permissionless 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js +9 -5
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/toKernelSmartAccount.js +4 -0
- package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/light/toLightSmartAccount.js +9 -5
- package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_cjs/accounts/safe/signUserOperation.js +3 -0
- package/_cjs/accounts/safe/signUserOperation.js.map +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js +4 -3
- package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/toSimpleSmartAccount.js +15 -10
- package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/utils/decodeCallData.js +7 -5
- package/_cjs/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
- package/_cjs/accounts/trust/utils/decodeCallData.js +7 -5
- package/_cjs/accounts/trust/utils/decodeCallData.js.map +1 -1
- package/_cjs/actions/{erc7579.js → erc7579/index.js} +9 -9
- package/_cjs/actions/erc7579/index.js.map +1 -0
- package/_cjs/actions/{etherspot.js → etherspot/index.js} +2 -2
- package/_cjs/actions/etherspot/index.js.map +1 -0
- package/_cjs/actions/{passkeyServer.js → passkeyServer/index.js} +4 -4
- package/_cjs/actions/passkeyServer/index.js.map +1 -0
- package/_cjs/actions/pimlico/estimateErc20PaymasterCost.js +7 -3
- package/_cjs/actions/pimlico/estimateErc20PaymasterCost.js.map +1 -1
- package/_cjs/actions/{pimlico.js → pimlico/index.js} +8 -8
- package/_cjs/actions/pimlico/index.js.map +1 -0
- package/_cjs/actions/{smartAccount.js → smartAccount/index.js} +5 -5
- package/_cjs/actions/smartAccount/index.js.map +1 -0
- package/_cjs/clients/createSmartAccountClient.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js +4 -4
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/{passkeyServer.js → passkeyServer/index.js} +2 -2
- package/_cjs/clients/passkeyServer/index.js.map +1 -0
- package/_cjs/clients/{pimlico.js → pimlico/index.js} +2 -2
- package/_cjs/clients/pimlico/index.js.map +1 -0
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +6 -5
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js +9 -5
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/toKernelSmartAccount.js +4 -0
- package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/light/toLightSmartAccount.js +9 -5
- package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_esm/accounts/safe/signUserOperation.js +3 -0
- package/_esm/accounts/safe/signUserOperation.js.map +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js +4 -3
- package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/toSimpleSmartAccount.js +15 -10
- package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/utils/decodeCallData.js +7 -5
- package/_esm/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
- package/_esm/accounts/trust/utils/decodeCallData.js +7 -5
- package/_esm/accounts/trust/utils/decodeCallData.js.map +1 -1
- package/_esm/actions/{erc7579.js → erc7579/index.js} +9 -9
- package/_esm/actions/erc7579/index.js.map +1 -0
- package/_esm/actions/etherspot/index.js +2 -0
- package/_esm/actions/etherspot/index.js.map +1 -0
- package/_esm/actions/passkeyServer/index.js +4 -0
- package/_esm/actions/passkeyServer/index.js.map +1 -0
- package/_esm/actions/pimlico/estimateErc20PaymasterCost.js +7 -3
- package/_esm/actions/pimlico/estimateErc20PaymasterCost.js.map +1 -1
- package/_esm/actions/pimlico/index.js +8 -0
- package/_esm/actions/pimlico/index.js.map +1 -0
- package/_esm/actions/smartAccount/index.js +5 -0
- package/_esm/actions/smartAccount/index.js.map +1 -0
- package/_esm/clients/createSmartAccountClient.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js +1 -1
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/{passkeyServer.js → passkeyServer/index.js} +2 -2
- package/_esm/clients/passkeyServer/index.js.map +1 -0
- package/_esm/clients/{pimlico.js → pimlico/index.js} +2 -2
- package/_esm/clients/pimlico/index.js.map +1 -0
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +5 -4
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
- package/_types/accounts/safe/signUserOperation.d.ts.map +1 -1
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/utils/decodeCallData.d.ts.map +1 -1
- package/_types/accounts/trust/utils/decodeCallData.d.ts.map +1 -1
- package/_types/actions/{erc7579.d.ts → erc7579/index.d.ts} +11 -11
- package/_types/actions/erc7579/index.d.ts.map +1 -0
- package/_types/actions/etherspot/index.d.ts +2 -0
- package/_types/actions/etherspot/index.d.ts.map +1 -0
- package/_types/actions/passkeyServer/index.d.ts +4 -0
- package/_types/actions/passkeyServer/index.d.ts.map +1 -0
- package/_types/actions/pimlico/estimateErc20PaymasterCost.d.ts.map +1 -1
- package/_types/actions/pimlico/index.d.ts +8 -0
- package/_types/actions/pimlico/index.d.ts.map +1 -0
- package/_types/actions/smartAccount/index.d.ts +5 -0
- package/_types/actions/smartAccount/index.d.ts.map +1 -0
- package/_types/clients/createSmartAccountClient.d.ts +9 -1
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +1 -1
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/{passkeyServer.d.ts → passkeyServer/index.d.ts} +8 -4
- package/_types/clients/passkeyServer/index.d.ts.map +1 -0
- package/_types/clients/pimlico/index.d.ts +21 -0
- package/_types/clients/pimlico/index.d.ts.map +1 -0
- package/_types/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.d.ts.map +1 -1
- package/accounts/biconomy/package.json +6 -0
- package/accounts/biconomy/toBiconomySmartAccount.ts +13 -5
- package/accounts/etherspot/package.json +6 -0
- package/accounts/kernel/package.json +6 -0
- package/accounts/kernel/toKernelSmartAccount.ts +7 -0
- package/accounts/light/package.json +6 -0
- package/accounts/light/toLightSmartAccount.ts +13 -5
- package/accounts/nexus/package.json +6 -0
- package/accounts/package.json +6 -0
- package/accounts/safe/package.json +6 -0
- package/accounts/safe/signUserOperation.ts +4 -0
- package/accounts/safe/toSafeSmartAccount.ts +5 -3
- package/accounts/simple/package.json +6 -0
- package/accounts/simple/toSimpleSmartAccount.ts +21 -10
- package/accounts/thirdweb/package.json +6 -0
- package/accounts/thirdweb/utils/decodeCallData.ts +9 -5
- package/accounts/trust/package.json +6 -0
- package/accounts/trust/utils/decodeCallData.ts +9 -5
- package/actions/{erc7579.ts → erc7579/index.ts} +10 -16
- package/actions/erc7579/package.json +6 -0
- package/actions/{etherspot.ts → etherspot/index.ts} +1 -1
- package/actions/etherspot/package.json +6 -0
- package/actions/{passkeyServer.ts → passkeyServer/index.ts} +3 -3
- package/actions/passkeyServer/package.json +6 -0
- package/actions/pimlico/estimateErc20PaymasterCost.ts +9 -3
- package/actions/{pimlico.ts → pimlico/index.ts} +7 -7
- package/actions/pimlico/package.json +6 -0
- package/actions/smartAccount/index.ts +7 -0
- package/actions/smartAccount/package.json +6 -0
- package/clients/createSmartAccountClient.ts +45 -20
- package/clients/decorators/pimlico.ts +10 -10
- package/clients/package.json +6 -0
- package/clients/{passkeyServer.ts → passkeyServer/index.ts} +15 -13
- package/clients/passkeyServer/package.json +6 -0
- package/clients/{pimlico.ts → pimlico/index.ts} +50 -23
- package/clients/pimlico/package.json +6 -0
- package/errors/package.json +6 -0
- package/experimental/pimlico/package.json +6 -0
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +6 -4
- package/package.json +34 -29
- package/utils/package.json +6 -0
- package/_cjs/actions/erc7579.js.map +0 -1
- package/_cjs/actions/etherspot.js.map +0 -1
- package/_cjs/actions/passkeyServer.js.map +0 -1
- package/_cjs/actions/pimlico.js.map +0 -1
- package/_cjs/actions/smartAccount.js.map +0 -1
- package/_cjs/clients/passkeyServer.js.map +0 -1
- package/_cjs/clients/pimlico.js.map +0 -1
- package/_esm/actions/erc7579.js.map +0 -1
- package/_esm/actions/etherspot.js +0 -2
- package/_esm/actions/etherspot.js.map +0 -1
- package/_esm/actions/passkeyServer.js +0 -4
- package/_esm/actions/passkeyServer.js.map +0 -1
- package/_esm/actions/pimlico.js +0 -8
- package/_esm/actions/pimlico.js.map +0 -1
- package/_esm/actions/smartAccount.js +0 -5
- package/_esm/actions/smartAccount.js.map +0 -1
- package/_esm/clients/passkeyServer.js.map +0 -1
- package/_esm/clients/pimlico.js.map +0 -1
- package/_types/actions/erc7579.d.ts.map +0 -1
- package/_types/actions/etherspot.d.ts +0 -2
- package/_types/actions/etherspot.d.ts.map +0 -1
- package/_types/actions/passkeyServer.d.ts +0 -4
- package/_types/actions/passkeyServer.d.ts.map +0 -1
- package/_types/actions/pimlico.d.ts +0 -8
- package/_types/actions/pimlico.d.ts.map +0 -1
- package/_types/actions/smartAccount.d.ts +0 -5
- package/_types/actions/smartAccount.d.ts.map +0 -1
- package/_types/clients/passkeyServer.d.ts.map +0 -1
- package/_types/clients/pimlico.d.ts +0 -13
- package/_types/clients/pimlico.d.ts.map +0 -1
- package/accounts/decodeCalls.test.ts +0 -505
- package/accounts/safe/signUserOperation.test.ts +0 -275
- package/actions/erc7579/accountId.test.ts +0 -39
- package/actions/erc7579/installModule.test.ts +0 -214
- package/actions/erc7579/installModules.test.ts +0 -235
- package/actions/erc7579/isModuleInstalled.test.ts +0 -72
- package/actions/erc7579/supportsExecutionMode.test.ts +0 -108
- package/actions/erc7579/supportsModule.test.ts +0 -35
- package/actions/erc7579/uninstallModule.test.ts +0 -128
- package/actions/erc7579/uninstallModules.test.ts +0 -117
- package/actions/pimlico/getTokenQuotes.test.ts +0 -90
- package/actions/pimlico/getUserOperationGasPrice.test.ts +0 -82
- package/actions/pimlico/getUserOperationStatus.test.ts +0 -223
- package/actions/pimlico/sponsorUserOperation.test.ts +0 -236
- package/actions/pimlico/validateSponsorshipPolicies.test.ts +0 -153
- package/actions/public/getAccountNonce.test.ts +0 -96
- package/actions/public/getSenderAddress.test.ts +0 -154
- package/actions/smartAccount/getCallsStatus.test.ts +0 -253
- package/actions/smartAccount/sendCalls.test.ts +0 -569
- package/actions/smartAccount/sendTransaction.test.ts +0 -414
- package/actions/smartAccount/signMessage.test.ts +0 -217
- package/actions/smartAccount/signTypedData.test.ts +0 -226
- package/actions/smartAccount.ts +0 -7
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +0 -574
- package/types/package.json +0 -6
- package/utils/decodeNonce.test.ts +0 -40
- package/utils/deepHexlify.test.ts +0 -57
- package/utils/encode7579Calls.test.ts +0 -69
- package/utils/encodeNonce.test.ts +0 -38
- package/utils/erc20AllowanceOverride.test.ts +0 -59
- package/utils/erc20BalanceOverride.test.ts +0 -57
- package/utils/getAddressFromInitCodeOrPaymasterAndData.test.ts +0 -31
- package/utils/getPackedUserOperation.test.ts +0 -204
- package/utils/getRequiredPrefund.test.ts +0 -90
- package/vitest.config.ts +0 -41
|
@@ -1,569 +0,0 @@
|
|
|
1
|
-
import { type Hex, zeroAddress } from "viem"
|
|
2
|
-
import { waitForUserOperationReceipt } from "viem/account-abstraction"
|
|
3
|
-
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
4
|
-
import { describe, expect } from "vitest"
|
|
5
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
6
|
-
import {
|
|
7
|
-
getCoreSmartAccounts,
|
|
8
|
-
getPublicClient
|
|
9
|
-
} from "../../../permissionless-test/src/utils"
|
|
10
|
-
import { sendCalls } from "./sendCalls"
|
|
11
|
-
|
|
12
|
-
describe.each(getCoreSmartAccounts())(
|
|
13
|
-
"sendCalls $name",
|
|
14
|
-
({
|
|
15
|
-
getSmartAccountClient,
|
|
16
|
-
supportsEntryPointV06,
|
|
17
|
-
supportsEntryPointV07,
|
|
18
|
-
supportsEntryPointV08,
|
|
19
|
-
isEip7702Compliant
|
|
20
|
-
}) => {
|
|
21
|
-
const privateKey = generatePrivateKey()
|
|
22
|
-
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
23
|
-
"sendCalls_v06",
|
|
24
|
-
async ({ rpc }) => {
|
|
25
|
-
const { anvilRpc } = rpc
|
|
26
|
-
|
|
27
|
-
const smartClient = await getSmartAccountClient({
|
|
28
|
-
entryPoint: {
|
|
29
|
-
version: "0.6"
|
|
30
|
-
},
|
|
31
|
-
...rpc
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const { id: userOpHash } = await sendCalls(smartClient, {
|
|
35
|
-
calls: [
|
|
36
|
-
{
|
|
37
|
-
to: zeroAddress,
|
|
38
|
-
data: "0x",
|
|
39
|
-
value: 0n
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
expect(userOpHash).toBeTruthy()
|
|
45
|
-
expect(userOpHash).toMatch(/^0x[a-fA-F0-9]{64}$/)
|
|
46
|
-
|
|
47
|
-
const receipt = await waitForUserOperationReceipt(smartClient, {
|
|
48
|
-
hash: userOpHash as Hex
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
expect(receipt).toBeTruthy()
|
|
52
|
-
expect(receipt.success).toBe(true)
|
|
53
|
-
|
|
54
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
55
|
-
|
|
56
|
-
const txReceipt = await publicClient.getTransactionReceipt({
|
|
57
|
-
hash: receipt.receipt.transactionHash
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
expect(txReceipt).toBeTruthy()
|
|
61
|
-
expect(txReceipt.status).toBe("success")
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
66
|
-
"sendCalls_v06 with multiple calls",
|
|
67
|
-
async ({ rpc }) => {
|
|
68
|
-
const { anvilRpc } = rpc
|
|
69
|
-
|
|
70
|
-
const smartClient = await getSmartAccountClient({
|
|
71
|
-
entryPoint: {
|
|
72
|
-
version: "0.6"
|
|
73
|
-
},
|
|
74
|
-
...rpc
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
const { id: userOpHash } = await sendCalls(smartClient, {
|
|
78
|
-
calls: [
|
|
79
|
-
{
|
|
80
|
-
to: zeroAddress,
|
|
81
|
-
data: "0x",
|
|
82
|
-
value: 0n
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
to: zeroAddress,
|
|
86
|
-
data: "0x1234",
|
|
87
|
-
value: 0n
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
to: zeroAddress,
|
|
91
|
-
data: "0x5678",
|
|
92
|
-
value: 0n
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
expect(userOpHash).toBeTruthy()
|
|
98
|
-
expect(userOpHash).toMatch(/^0x[a-fA-F0-9]{64}$/)
|
|
99
|
-
|
|
100
|
-
const receipt = await waitForUserOperationReceipt(smartClient, {
|
|
101
|
-
hash: userOpHash as Hex
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
expect(receipt).toBeTruthy()
|
|
105
|
-
expect(receipt.success).toBe(true)
|
|
106
|
-
|
|
107
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
108
|
-
|
|
109
|
-
const txReceipt = await publicClient.getTransactionReceipt({
|
|
110
|
-
hash: receipt.receipt.transactionHash
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
expect(txReceipt).toBeTruthy()
|
|
114
|
-
expect(txReceipt.status).toBe("success")
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
testWithRpc.skipIf(!supportsEntryPointV07)(
|
|
119
|
-
"sendCalls_v07",
|
|
120
|
-
async ({ rpc }) => {
|
|
121
|
-
const { anvilRpc } = rpc
|
|
122
|
-
|
|
123
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
124
|
-
|
|
125
|
-
const smartClient = await getSmartAccountClient({
|
|
126
|
-
entryPoint: {
|
|
127
|
-
version: "0.7"
|
|
128
|
-
},
|
|
129
|
-
privateKey,
|
|
130
|
-
...rpc
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
134
|
-
|
|
135
|
-
const { id: userOpHash } = await sendCalls(smartClient, {
|
|
136
|
-
calls: [
|
|
137
|
-
{
|
|
138
|
-
to: zeroAddress,
|
|
139
|
-
data: "0x",
|
|
140
|
-
value: 0n
|
|
141
|
-
}
|
|
142
|
-
],
|
|
143
|
-
authorization: isEip7702Compliant
|
|
144
|
-
? await privateKeyAccount.signAuthorization({
|
|
145
|
-
address: (smartClient.account as any)
|
|
146
|
-
.implementation,
|
|
147
|
-
chainId: smartClient.chain.id,
|
|
148
|
-
nonce: await publicClient.getTransactionCount({
|
|
149
|
-
address: smartClient.account.address
|
|
150
|
-
})
|
|
151
|
-
})
|
|
152
|
-
: undefined
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
expect(userOpHash).toBeTruthy()
|
|
156
|
-
expect(userOpHash).toMatch(/^0x[a-fA-F0-9]{64}$/)
|
|
157
|
-
|
|
158
|
-
const receipt = await waitForUserOperationReceipt(smartClient, {
|
|
159
|
-
hash: userOpHash as Hex
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
expect(receipt).toBeTruthy()
|
|
163
|
-
expect(receipt.success).toBe(true)
|
|
164
|
-
|
|
165
|
-
const txReceipt = await publicClient.getTransactionReceipt({
|
|
166
|
-
hash: receipt.receipt.transactionHash
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
expect(txReceipt).toBeTruthy()
|
|
170
|
-
expect(txReceipt.status).toBe("success")
|
|
171
|
-
|
|
172
|
-
// Second transaction after deployment
|
|
173
|
-
const { id: userOpHash2 } = await sendCalls(smartClient, {
|
|
174
|
-
calls: [
|
|
175
|
-
{
|
|
176
|
-
to: zeroAddress,
|
|
177
|
-
data: "0x",
|
|
178
|
-
value: 0n
|
|
179
|
-
}
|
|
180
|
-
]
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
expect(userOpHash2).toBeTruthy()
|
|
184
|
-
expect(userOpHash2).toMatch(/^0x[a-fA-F0-9]{64}$/)
|
|
185
|
-
|
|
186
|
-
const receipt2 = await waitForUserOperationReceipt(
|
|
187
|
-
smartClient,
|
|
188
|
-
{
|
|
189
|
-
hash: userOpHash2 as Hex
|
|
190
|
-
}
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
expect(receipt2).toBeTruthy()
|
|
194
|
-
expect(receipt2.success).toBe(true)
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
testWithRpc.skipIf(!supportsEntryPointV08)(
|
|
199
|
-
"sendCalls_v08",
|
|
200
|
-
async ({ rpc }) => {
|
|
201
|
-
const { anvilRpc } = rpc
|
|
202
|
-
|
|
203
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
204
|
-
|
|
205
|
-
const smartClient = await getSmartAccountClient({
|
|
206
|
-
entryPoint: {
|
|
207
|
-
version: "0.8"
|
|
208
|
-
},
|
|
209
|
-
privateKey,
|
|
210
|
-
...rpc
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
214
|
-
|
|
215
|
-
const authorization = isEip7702Compliant
|
|
216
|
-
? await privateKeyAccount.signAuthorization({
|
|
217
|
-
address: (smartClient.account as any).implementation,
|
|
218
|
-
chainId: smartClient.chain.id,
|
|
219
|
-
nonce: await publicClient.getTransactionCount({
|
|
220
|
-
address: smartClient.account.address
|
|
221
|
-
})
|
|
222
|
-
})
|
|
223
|
-
: undefined
|
|
224
|
-
|
|
225
|
-
const { id: userOpHash } = await sendCalls(smartClient, {
|
|
226
|
-
calls: [
|
|
227
|
-
{
|
|
228
|
-
to: zeroAddress,
|
|
229
|
-
data: "0x",
|
|
230
|
-
value: 0n
|
|
231
|
-
}
|
|
232
|
-
],
|
|
233
|
-
authorization
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
expect(userOpHash).toBeTruthy()
|
|
237
|
-
expect(userOpHash).toMatch(/^0x[a-fA-F0-9]{64}$/)
|
|
238
|
-
|
|
239
|
-
const receipt = await waitForUserOperationReceipt(smartClient, {
|
|
240
|
-
hash: userOpHash as Hex
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
expect(receipt).toBeTruthy()
|
|
244
|
-
expect(receipt.success).toBe(true)
|
|
245
|
-
|
|
246
|
-
const txReceipt = await publicClient.getTransactionReceipt({
|
|
247
|
-
hash: receipt.receipt.transactionHash
|
|
248
|
-
})
|
|
249
|
-
|
|
250
|
-
expect(txReceipt).toBeTruthy()
|
|
251
|
-
expect(txReceipt.status).toBe("success")
|
|
252
|
-
|
|
253
|
-
// Second transaction after deployment
|
|
254
|
-
const { id: userOpHash2 } = await sendCalls(smartClient, {
|
|
255
|
-
calls: [
|
|
256
|
-
{
|
|
257
|
-
to: zeroAddress,
|
|
258
|
-
data: "0x",
|
|
259
|
-
value: 0n
|
|
260
|
-
}
|
|
261
|
-
]
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
expect(userOpHash2).toBeTruthy()
|
|
265
|
-
expect(userOpHash2).toMatch(/^0x[a-fA-F0-9]{64}$/)
|
|
266
|
-
|
|
267
|
-
const receipt2 = await waitForUserOperationReceipt(
|
|
268
|
-
smartClient,
|
|
269
|
-
{
|
|
270
|
-
hash: userOpHash2 as Hex
|
|
271
|
-
}
|
|
272
|
-
)
|
|
273
|
-
|
|
274
|
-
expect(receipt2).toBeTruthy()
|
|
275
|
-
expect(receipt2.success).toBe(true)
|
|
276
|
-
}
|
|
277
|
-
)
|
|
278
|
-
|
|
279
|
-
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
280
|
-
"sendCalls_v06 post deployment",
|
|
281
|
-
async ({ rpc }) => {
|
|
282
|
-
const { anvilRpc } = rpc
|
|
283
|
-
|
|
284
|
-
await (async () => {
|
|
285
|
-
const smartClient = await getSmartAccountClient({
|
|
286
|
-
entryPoint: {
|
|
287
|
-
version: "0.6"
|
|
288
|
-
},
|
|
289
|
-
privateKey,
|
|
290
|
-
...rpc
|
|
291
|
-
})
|
|
292
|
-
|
|
293
|
-
const { id: userOpHash } = await sendCalls(smartClient, {
|
|
294
|
-
calls: [
|
|
295
|
-
{
|
|
296
|
-
to: zeroAddress,
|
|
297
|
-
data: "0x",
|
|
298
|
-
value: 0n
|
|
299
|
-
}
|
|
300
|
-
]
|
|
301
|
-
})
|
|
302
|
-
|
|
303
|
-
expect(userOpHash).toBeTruthy()
|
|
304
|
-
|
|
305
|
-
const receipt = await waitForUserOperationReceipt(
|
|
306
|
-
smartClient,
|
|
307
|
-
{
|
|
308
|
-
hash: userOpHash as Hex
|
|
309
|
-
}
|
|
310
|
-
)
|
|
311
|
-
|
|
312
|
-
expect(receipt).toBeTruthy()
|
|
313
|
-
expect(receipt.success).toBe(true)
|
|
314
|
-
|
|
315
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
316
|
-
|
|
317
|
-
const txReceipt = await publicClient.getTransactionReceipt({
|
|
318
|
-
hash: receipt.receipt.transactionHash
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
expect(txReceipt).toBeTruthy()
|
|
322
|
-
expect(txReceipt.status).toBe("success")
|
|
323
|
-
})()
|
|
324
|
-
|
|
325
|
-
const smartClient = await getSmartAccountClient({
|
|
326
|
-
entryPoint: {
|
|
327
|
-
version: "0.6"
|
|
328
|
-
},
|
|
329
|
-
privateKey,
|
|
330
|
-
...rpc
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
// Second transaction after deployment
|
|
334
|
-
const { id: userOpHash2 } = await sendCalls(smartClient, {
|
|
335
|
-
calls: [
|
|
336
|
-
{
|
|
337
|
-
to: zeroAddress,
|
|
338
|
-
data: "0x",
|
|
339
|
-
value: 0n
|
|
340
|
-
}
|
|
341
|
-
]
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
expect(userOpHash2).toBeTruthy()
|
|
345
|
-
|
|
346
|
-
const receipt2 = await waitForUserOperationReceipt(
|
|
347
|
-
smartClient,
|
|
348
|
-
{
|
|
349
|
-
hash: userOpHash2 as Hex
|
|
350
|
-
}
|
|
351
|
-
)
|
|
352
|
-
|
|
353
|
-
expect(receipt2).toBeTruthy()
|
|
354
|
-
expect(receipt2.success).toBe(true)
|
|
355
|
-
|
|
356
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
357
|
-
|
|
358
|
-
const txReceipt2 = await publicClient.getTransactionReceipt({
|
|
359
|
-
hash: receipt2.receipt.transactionHash
|
|
360
|
-
})
|
|
361
|
-
|
|
362
|
-
expect(txReceipt2).toBeTruthy()
|
|
363
|
-
expect(txReceipt2.status).toBe("success")
|
|
364
|
-
}
|
|
365
|
-
)
|
|
366
|
-
|
|
367
|
-
testWithRpc.skipIf(!supportsEntryPointV07)(
|
|
368
|
-
"sendCalls_v07 post deployment",
|
|
369
|
-
async ({ rpc }) => {
|
|
370
|
-
const { anvilRpc } = rpc
|
|
371
|
-
|
|
372
|
-
await (async () => {
|
|
373
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
374
|
-
|
|
375
|
-
const smartClient = await getSmartAccountClient({
|
|
376
|
-
entryPoint: {
|
|
377
|
-
version: "0.7"
|
|
378
|
-
},
|
|
379
|
-
privateKey,
|
|
380
|
-
...rpc
|
|
381
|
-
})
|
|
382
|
-
|
|
383
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
384
|
-
|
|
385
|
-
const authorization = isEip7702Compliant
|
|
386
|
-
? await privateKeyAccount.signAuthorization({
|
|
387
|
-
address: (smartClient.account as any)
|
|
388
|
-
.implementation,
|
|
389
|
-
chainId: smartClient.chain.id,
|
|
390
|
-
nonce: await publicClient.getTransactionCount({
|
|
391
|
-
address: smartClient.account.address
|
|
392
|
-
})
|
|
393
|
-
})
|
|
394
|
-
: undefined
|
|
395
|
-
|
|
396
|
-
const { id: userOpHash } = await sendCalls(smartClient, {
|
|
397
|
-
calls: [
|
|
398
|
-
{
|
|
399
|
-
to: zeroAddress,
|
|
400
|
-
data: "0x",
|
|
401
|
-
value: 0n
|
|
402
|
-
}
|
|
403
|
-
],
|
|
404
|
-
authorization
|
|
405
|
-
})
|
|
406
|
-
|
|
407
|
-
expect(userOpHash).toBeTruthy()
|
|
408
|
-
|
|
409
|
-
const receipt = await waitForUserOperationReceipt(
|
|
410
|
-
smartClient,
|
|
411
|
-
{
|
|
412
|
-
hash: userOpHash as Hex
|
|
413
|
-
}
|
|
414
|
-
)
|
|
415
|
-
|
|
416
|
-
expect(receipt).toBeTruthy()
|
|
417
|
-
expect(receipt.success).toBe(true)
|
|
418
|
-
|
|
419
|
-
const txReceipt = await publicClient.getTransactionReceipt({
|
|
420
|
-
hash: receipt.receipt.transactionHash
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
expect(txReceipt).toBeTruthy()
|
|
424
|
-
expect(txReceipt.status).toBe("success")
|
|
425
|
-
})()
|
|
426
|
-
|
|
427
|
-
const smartClient = await getSmartAccountClient({
|
|
428
|
-
entryPoint: {
|
|
429
|
-
version: "0.7"
|
|
430
|
-
},
|
|
431
|
-
privateKey,
|
|
432
|
-
...rpc
|
|
433
|
-
})
|
|
434
|
-
|
|
435
|
-
const { id: userOpHash2 } = await sendCalls(smartClient, {
|
|
436
|
-
calls: [
|
|
437
|
-
{
|
|
438
|
-
to: zeroAddress,
|
|
439
|
-
data: "0x",
|
|
440
|
-
value: 0n
|
|
441
|
-
}
|
|
442
|
-
]
|
|
443
|
-
})
|
|
444
|
-
|
|
445
|
-
expect(userOpHash2).toBeTruthy()
|
|
446
|
-
|
|
447
|
-
const receipt2 = await waitForUserOperationReceipt(
|
|
448
|
-
smartClient,
|
|
449
|
-
{
|
|
450
|
-
hash: userOpHash2 as Hex
|
|
451
|
-
}
|
|
452
|
-
)
|
|
453
|
-
|
|
454
|
-
expect(receipt2).toBeTruthy()
|
|
455
|
-
expect(receipt2.success).toBe(true)
|
|
456
|
-
|
|
457
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
458
|
-
|
|
459
|
-
const txReceipt2 = await publicClient.getTransactionReceipt({
|
|
460
|
-
hash: receipt2.receipt.transactionHash
|
|
461
|
-
})
|
|
462
|
-
|
|
463
|
-
expect(txReceipt2).toBeTruthy()
|
|
464
|
-
expect(txReceipt2.status).toBe("success")
|
|
465
|
-
}
|
|
466
|
-
)
|
|
467
|
-
|
|
468
|
-
testWithRpc.skipIf(!supportsEntryPointV08)(
|
|
469
|
-
"sendCalls_v08 post deployment",
|
|
470
|
-
async ({ rpc }) => {
|
|
471
|
-
const { anvilRpc } = rpc
|
|
472
|
-
|
|
473
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
474
|
-
|
|
475
|
-
await (async () => {
|
|
476
|
-
const smartClient = await getSmartAccountClient({
|
|
477
|
-
entryPoint: {
|
|
478
|
-
version: "0.8"
|
|
479
|
-
},
|
|
480
|
-
privateKey,
|
|
481
|
-
...rpc
|
|
482
|
-
})
|
|
483
|
-
|
|
484
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
485
|
-
|
|
486
|
-
const authorization = isEip7702Compliant
|
|
487
|
-
? await privateKeyAccount.signAuthorization({
|
|
488
|
-
address: (smartClient.account as any)
|
|
489
|
-
.implementation,
|
|
490
|
-
chainId: smartClient.chain.id,
|
|
491
|
-
nonce: await publicClient.getTransactionCount({
|
|
492
|
-
address: smartClient.account.address
|
|
493
|
-
})
|
|
494
|
-
})
|
|
495
|
-
: undefined
|
|
496
|
-
|
|
497
|
-
const { id: userOpHash } = await sendCalls(smartClient, {
|
|
498
|
-
calls: [
|
|
499
|
-
{
|
|
500
|
-
to: zeroAddress,
|
|
501
|
-
data: "0x",
|
|
502
|
-
value: 0n
|
|
503
|
-
}
|
|
504
|
-
],
|
|
505
|
-
authorization
|
|
506
|
-
})
|
|
507
|
-
|
|
508
|
-
expect(userOpHash).toBeTruthy()
|
|
509
|
-
|
|
510
|
-
const receipt = await waitForUserOperationReceipt(
|
|
511
|
-
smartClient,
|
|
512
|
-
{
|
|
513
|
-
hash: userOpHash as Hex
|
|
514
|
-
}
|
|
515
|
-
)
|
|
516
|
-
|
|
517
|
-
expect(receipt).toBeTruthy()
|
|
518
|
-
expect(receipt.success).toBe(true)
|
|
519
|
-
|
|
520
|
-
const txReceipt = await publicClient.getTransactionReceipt({
|
|
521
|
-
hash: receipt.receipt.transactionHash
|
|
522
|
-
})
|
|
523
|
-
|
|
524
|
-
expect(txReceipt).toBeTruthy()
|
|
525
|
-
expect(txReceipt.status).toBe("success")
|
|
526
|
-
})()
|
|
527
|
-
|
|
528
|
-
const smartClient = await getSmartAccountClient({
|
|
529
|
-
entryPoint: {
|
|
530
|
-
version: "0.8"
|
|
531
|
-
},
|
|
532
|
-
privateKey,
|
|
533
|
-
...rpc
|
|
534
|
-
})
|
|
535
|
-
|
|
536
|
-
const { id: userOpHash2 } = await sendCalls(smartClient, {
|
|
537
|
-
calls: [
|
|
538
|
-
{
|
|
539
|
-
to: zeroAddress,
|
|
540
|
-
data: "0x",
|
|
541
|
-
value: 0n
|
|
542
|
-
}
|
|
543
|
-
]
|
|
544
|
-
})
|
|
545
|
-
|
|
546
|
-
expect(userOpHash2).toBeTruthy()
|
|
547
|
-
|
|
548
|
-
const receipt2 = await waitForUserOperationReceipt(
|
|
549
|
-
smartClient,
|
|
550
|
-
{
|
|
551
|
-
hash: userOpHash2 as Hex
|
|
552
|
-
}
|
|
553
|
-
)
|
|
554
|
-
|
|
555
|
-
expect(receipt2).toBeTruthy()
|
|
556
|
-
expect(receipt2.success).toBe(true)
|
|
557
|
-
|
|
558
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
559
|
-
|
|
560
|
-
const txReceipt2 = await publicClient.getTransactionReceipt({
|
|
561
|
-
hash: receipt2.receipt.transactionHash
|
|
562
|
-
})
|
|
563
|
-
|
|
564
|
-
expect(txReceipt2).toBeTruthy()
|
|
565
|
-
expect(txReceipt2.status).toBe("success")
|
|
566
|
-
}
|
|
567
|
-
)
|
|
568
|
-
}
|
|
569
|
-
)
|