Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: smart account init #2014

Merged
merged 30 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2ad3559
feat: add user operation related rpc methods
tomiir Feb 15, 2024
f4b4c7a
chore: add changeset versions for canary
tomiir Feb 15, 2024
2dc4939
chore: manually point to secure site prev
tomiir Feb 16, 2024
ceeff4d
chore: remove preemptive canary tag
tomiir Feb 16, 2024
1aec6bf
fix: rollback type changes
tomiir Feb 16, 2024
3845a99
feat: send usdc button
tomiir Feb 16, 2024
29a3ab9
Merge branch 'V4' into feat/smart-accounts
tomiir Feb 19, 2024
5af5c17
chore: reset secure-site url and vitalik address
tomiir Feb 19, 2024
d974ad5
fix: secure site url
tomiir Feb 20, 2024
8449bed
Merge branch 'V4' of github.com:WalletConnect/web3modal into feat/sma…
tomiir Feb 22, 2024
28876ec
chore: update secure site dev url
tomiir Feb 22, 2024
76ec887
chore: clean lab imports
tomiir Feb 22, 2024
c4bcb7b
fix: secure sdk url
tomiir Feb 22, 2024
605cc5b
feat: add rpc methods for sa enabled networks
tomiir Feb 28, 2024
387aa6a
feat: add initSmartAccount Handler
tomiir Feb 29, 2024
da8a5d0
feat: refactor flow to check for enabled networks and check sa deploy…
tomiir Feb 29, 2024
e8f2d04
feat: add upgrade to smart account screen
tomiir Feb 29, 2024
203dd72
feat: add smart account initialization to ethers
tomiir Feb 29, 2024
16cfe74
chore: refactor for code clarity
tomiir Mar 1, 2024
2cd4846
feat: add set preferred account handlers
tomiir Mar 1, 2024
24583bd
feat: serialize type in response and persist in storage
tomiir Mar 1, 2024
5c921d8
Merge branch 'V4' of github.com:WalletConnect/web3modal into feat/sma…
tomiir Mar 1, 2024
417ed09
chore: reset secure site url
tomiir Mar 1, 2024
796184b
chore: remove core usage on client side
tomiir Mar 1, 2024
0c59f84
chore: remove test logs
tomiir Mar 1, 2024
95b35e1
chore: canary version update
tomiir Mar 4, 2024
9fd8ef1
chore: exit pre mode
tomiir Mar 4, 2024
bd59e51
Merge branch 'V4' of github.com:WalletConnect/web3modal into feat/sma…
tomiir Mar 4, 2024
6d0cab2
feat: added enableSmartAccounts feature flag
tomiir Mar 4, 2024
129eb74
chore: bump version to 4.0.12
tomiir Mar 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions apps/gallery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# @apps/gallery

## 4.0.12

### Patch Changes

- [#2014](https://github.com/WalletConnect/web3modal/pull/2014) [`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0) Thanks [@tomiir](https://github.com/tomiir)! - Smart Account RPC handler canary

- Smart Account initialization and feature flag

- Updated dependencies [[`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0)]:
- @web3modal/ui@4.0.12
- @web3modal/common@4.0.12

## 4.0.12-0c59f84f.0

### Patch Changes

- Smart Account RPC handler canary

- Updated dependencies []:
- @web3modal/ui@4.0.12-0c59f84f.0
- @web3modal/common@4.0.12-0c59f84f.0

## 4.0.11

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions apps/gallery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/gallery",
"version": "4.0.11",
"version": "4.0.12",
"private": true,
"main": "index.js",
"scripts": {
Expand All @@ -9,8 +9,8 @@
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@web3modal/common": "4.0.11",
"@web3modal/ui": "4.0.11",
"@web3modal/common": "4.0.12",
"@web3modal/ui": "4.0.12",
"lit": "3.1.0",
"storybook": "7.6.7"
},
Expand Down
24 changes: 24 additions & 0 deletions apps/laboratory/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# @apps/laboratory

## 4.0.12

### Patch Changes

- [#2014](https://github.com/WalletConnect/web3modal/pull/2014) [`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0) Thanks [@tomiir](https://github.com/tomiir)! - Smart Account RPC handler canary

- Smart Account initialization and feature flag

- Updated dependencies [[`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0)]:
- @web3modal/ethers@4.0.12
- @web3modal/wagmi@4.0.12
- @web3modal/siwe@4.0.12

## 4.0.12-0c59f84f.0

### Patch Changes

- Smart Account RPC handler canary

- Updated dependencies []:
- @web3modal/ethers@4.0.12-0c59f84f.0
- @web3modal/wagmi@4.0.12-0c59f84f.0
- @web3modal/siwe@4.0.12-0c59f84f.0

## 4.0.11

### Patch Changes
Expand Down
8 changes: 4 additions & 4 deletions apps/laboratory/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/laboratory",
"version": "4.0.11",
"version": "4.0.12",
"private": true,
"scripts": {
"dev:laboratory": "next dev",
Expand All @@ -24,9 +24,9 @@
"@sentry/browser": "7.92.0",
"@sentry/react": "7.92.0",
"@tanstack/react-query": "5.17.19",
"@web3modal/ethers": "4.0.11",
"@web3modal/siwe": "4.0.11",
"@web3modal/wagmi": "4.0.11",
"@web3modal/ethers": "4.0.12",
"@web3modal/siwe": "4.0.12",
"@web3modal/wagmi": "4.0.12",
"framer-motion": "10.17.9",
"next": "14.0.4",
"next-auth": "4.24.5",
Expand Down
103 changes: 103 additions & 0 deletions apps/laboratory/src/components/Wagmi/WagmiSendUSDCTest.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { Button, useToast, Stack, Link, Text, Spacer, Input } from '@chakra-ui/react'
import { useAccount, useWriteContract } from 'wagmi'
import { useCallback, useState } from 'react'
import { sepolia } from 'wagmi/chains'

const minTokenAbi = [
{
inputs: [
{ internalType: 'address', name: 'to', type: 'address' },
{ internalType: 'uint256', name: 'value', type: 'uint256' }
],
name: 'transfer',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function'
},
{
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
name: 'balanceOf',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'decimals',
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
stateMutability: 'view',
type: 'function'
}
]

export function WagmiSendUSDCTest() {
const [isLoading, setLoading] = useState(false)
const [address, setAddress] = useState('')
const [amount, setAmount] = useState('')
const { status, chain } = useAccount()
const toast = useToast()

const { writeContract } = useWriteContract({
mutation: {
onSuccess: hash => {
setLoading(false)
toast({
title: 'Transaction Success',
description: hash,
status: 'success',
isClosable: true
})
},
onError: () => {
setLoading(false)
toast({
title: 'Error',
description: 'Failed to send transaction',
status: 'error',
isClosable: true
})
}
}
})

const onSendTransaction = useCallback(() => {
setLoading(true)
writeContract({
abi: minTokenAbi,
functionName: 'transfer',
args: [address, amount],
address: '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238'
})
}, [writeContract, address, amount])

return chain?.id === sepolia.id && status === 'connected' ? (
<Stack direction={['column', 'column', 'row']}>
<Button
data-test-id="sign-transaction-button"
onClick={onSendTransaction}
disabled={!writeContract}
isDisabled={isLoading}
>
Send USDC
</Button>

<Spacer />
<Input placeholder="0xf34ffa..." onChange={e => setAddress(e.target.value)} value={address} />
<Input
placeholder="Enter an amount"
onChange={e => setAmount(e.target.value)}
value={amount}
type="number"
/>
<Link isExternal href="https://faucet.circle.com">
<Button variant="outline" colorScheme="blue" isDisabled={isLoading}>
USDC Faucet
</Button>
</Link>
</Stack>
) : (
<Text fontSize="md" color="yellow">
Switch to Sepolia Ethereum Testnet to test this feature
</Text>
)
}
7 changes: 7 additions & 0 deletions apps/laboratory/src/components/Wagmi/WagmiTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { WagmiSignMessageTest } from './WagmiSignMessageTest'
import { WagmiSignTypedDataTest } from './WagmiSignTypedDataTest'
import { StackDivider, Card, CardHeader, Heading, CardBody, Box, Stack } from '@chakra-ui/react'
import { WagmiWriteContractTest } from './WagmiWriteContractTest'
import { WagmiSendUSDCTest } from './WagmiSendUSDCTest'

export function WagmiTests() {
return (
Expand Down Expand Up @@ -39,6 +40,12 @@ export function WagmiTests() {
</Heading>
<WagmiWriteContractTest />
</Box>
<Box>
<Heading size="xs" textTransform="uppercase" pb="2">
USDC Send
</Heading>
<WagmiSendUSDCTest />
</Box>
</Stack>
</CardBody>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { sepolia } from 'wagmi/chains'

const TEST_TX = {
to: vitalikEthAddress as Address,
value: parseGwei('0.0002')
value: parseGwei('0.3')
}
tomiir marked this conversation as resolved.
Show resolved Hide resolved

export function WagmiTransactionTest() {
Expand Down
20 changes: 20 additions & 0 deletions examples/html-ethers5/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @examples/html-ethers5

## 4.0.12

### Patch Changes

- [#2014](https://github.com/WalletConnect/web3modal/pull/2014) [`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0) Thanks [@tomiir](https://github.com/tomiir)! - Smart Account RPC handler canary

- Smart Account initialization and feature flag

- Updated dependencies [[`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0)]:
- @web3modal/ethers5@4.0.12

## 4.0.12-0c59f84f.0

### Patch Changes

- Smart Account RPC handler canary

- Updated dependencies []:
- @web3modal/ethers5@4.0.12-0c59f84f.0

## 4.0.11

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/html-ethers5/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@examples/html-ethers5",
"private": true,
"version": "4.0.11",
"version": "4.0.12",
"scripts": {
"dev:example": "vite --port 3011",
"build:examples": "vite build"
},
"dependencies": {
"@web3modal/ethers5": "4.0.11",
"@web3modal/ethers5": "4.0.12",
"ethers": "5.7.2"
},
"devDependencies": {
Expand Down
20 changes: 20 additions & 0 deletions examples/html-wagmi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @examples/html-wagmi

## 4.0.12

### Patch Changes

- [#2014](https://github.com/WalletConnect/web3modal/pull/2014) [`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0) Thanks [@tomiir](https://github.com/tomiir)! - Smart Account RPC handler canary

- Smart Account initialization and feature flag

- Updated dependencies [[`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0)]:
- @web3modal/wagmi@4.0.12

## 4.0.12-0c59f84f.0

### Patch Changes

- Smart Account RPC handler canary

- Updated dependencies []:
- @web3modal/wagmi@4.0.12-0c59f84f.0

## 4.0.11

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/html-wagmi/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@examples/html-wagmi",
"private": true,
"version": "4.0.11",
"version": "4.0.12",
"scripts": {
"dev:example": "vite --port 3001",
"build:examples": "vite build"
},
"dependencies": {
"@web3modal/wagmi": "4.0.11",
"@web3modal/wagmi": "4.0.12",
"@wagmi/connectors": "4.1.14",
"@wagmi/core": "2.6.5",
"react": "18.2.0",
Expand Down
20 changes: 20 additions & 0 deletions examples/next-wagmi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @examples/next-wagmi

## 4.0.12

### Patch Changes

- [#2014](https://github.com/WalletConnect/web3modal/pull/2014) [`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0) Thanks [@tomiir](https://github.com/tomiir)! - Smart Account RPC handler canary

- Smart Account initialization and feature flag

- Updated dependencies [[`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0)]:
- @web3modal/wagmi@4.0.12

## 4.0.12-0c59f84f.0

### Patch Changes

- Smart Account RPC handler canary

- Updated dependencies []:
- @web3modal/wagmi@4.0.12-0c59f84f.0

## 4.0.11

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/next-wagmi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@examples/next-wagmi",
"version": "4.0.11",
"version": "4.0.12",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -10,7 +10,7 @@
},
"dependencies": {
"@tanstack/react-query": "5.17.19",
"@web3modal/wagmi": "4.0.11",
"@web3modal/wagmi": "4.0.12",
"next": "14.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
20 changes: 20 additions & 0 deletions examples/react-ethers5/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @examples/react-ethers5

## 4.0.12

### Patch Changes

- [#2014](https://github.com/WalletConnect/web3modal/pull/2014) [`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0) Thanks [@tomiir](https://github.com/tomiir)! - Smart Account RPC handler canary

- Smart Account initialization and feature flag

- Updated dependencies [[`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0)]:
- @web3modal/ethers5@4.0.12

## 4.0.12-0c59f84f.0

### Patch Changes

- Smart Account RPC handler canary

- Updated dependencies []:
- @web3modal/ethers5@4.0.12-0c59f84f.0

## 4.0.11

### Patch Changes
Expand Down