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,414 +0,0 @@
|
|
|
1
|
-
import { zeroAddress } from "viem"
|
|
2
|
-
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
|
-
import { describe, expect } from "vitest"
|
|
4
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
|
-
import {
|
|
6
|
-
getCoreSmartAccounts,
|
|
7
|
-
getPublicClient
|
|
8
|
-
} from "../../../permissionless-test/src/utils"
|
|
9
|
-
import { sendTransaction } from "./sendTransaction"
|
|
10
|
-
|
|
11
|
-
describe.each(getCoreSmartAccounts())(
|
|
12
|
-
"sendTransaction $name",
|
|
13
|
-
({
|
|
14
|
-
getSmartAccountClient,
|
|
15
|
-
supportsEntryPointV06,
|
|
16
|
-
supportsEntryPointV07,
|
|
17
|
-
supportsEntryPointV08,
|
|
18
|
-
isEip7702Compliant
|
|
19
|
-
}) => {
|
|
20
|
-
const privateKey = generatePrivateKey()
|
|
21
|
-
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
22
|
-
"sendTransaction_v06",
|
|
23
|
-
async ({ rpc }) => {
|
|
24
|
-
const { anvilRpc } = rpc
|
|
25
|
-
|
|
26
|
-
const smartClient = await getSmartAccountClient({
|
|
27
|
-
entryPoint: {
|
|
28
|
-
version: "0.6"
|
|
29
|
-
},
|
|
30
|
-
...rpc
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const transactionHash = await sendTransaction(smartClient, {
|
|
34
|
-
to: zeroAddress,
|
|
35
|
-
data: "0x",
|
|
36
|
-
value: 0n
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
expect(transactionHash).toBeTruthy()
|
|
40
|
-
|
|
41
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
42
|
-
|
|
43
|
-
const receipt = await publicClient.getTransactionReceipt({
|
|
44
|
-
hash: transactionHash
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
expect(receipt).toBeTruthy()
|
|
48
|
-
expect(receipt.transactionHash).toBe(transactionHash)
|
|
49
|
-
expect(receipt.status).toBe("success")
|
|
50
|
-
|
|
51
|
-
// -- second transaction after deployment
|
|
52
|
-
|
|
53
|
-
const transactionHash2 = await sendTransaction(smartClient, {
|
|
54
|
-
to: zeroAddress,
|
|
55
|
-
data: "0x",
|
|
56
|
-
value: 0n
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
expect(transactionHash2).toBeTruthy()
|
|
60
|
-
|
|
61
|
-
const receipt2 = await publicClient.getTransactionReceipt({
|
|
62
|
-
hash: transactionHash2
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
expect(receipt2).toBeTruthy()
|
|
66
|
-
expect(receipt2.transactionHash).toBe(transactionHash2)
|
|
67
|
-
expect(receipt2.status).toBe("success")
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
testWithRpc.skipIf(!supportsEntryPointV07)(
|
|
72
|
-
"sendTransaction_v07",
|
|
73
|
-
async ({ rpc }) => {
|
|
74
|
-
const { anvilRpc } = rpc
|
|
75
|
-
|
|
76
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
77
|
-
|
|
78
|
-
const smartClient = await getSmartAccountClient({
|
|
79
|
-
entryPoint: {
|
|
80
|
-
version: "0.7"
|
|
81
|
-
},
|
|
82
|
-
privateKey, // anvil private key
|
|
83
|
-
...rpc
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
87
|
-
|
|
88
|
-
const transactionHash = await sendTransaction(smartClient, {
|
|
89
|
-
to: zeroAddress,
|
|
90
|
-
data: "0x",
|
|
91
|
-
value: 0n,
|
|
92
|
-
authorization: isEip7702Compliant
|
|
93
|
-
? await privateKeyAccount.signAuthorization({
|
|
94
|
-
address: (smartClient.account as any)
|
|
95
|
-
.implementation,
|
|
96
|
-
chainId: smartClient.chain.id,
|
|
97
|
-
nonce: await publicClient.getTransactionCount({
|
|
98
|
-
address: smartClient.account.address
|
|
99
|
-
})
|
|
100
|
-
})
|
|
101
|
-
: undefined
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
expect(transactionHash).toBeTruthy()
|
|
105
|
-
|
|
106
|
-
const receipt = await publicClient.getTransactionReceipt({
|
|
107
|
-
hash: transactionHash
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
expect(receipt).toBeTruthy()
|
|
111
|
-
expect(receipt.transactionHash).toBe(transactionHash)
|
|
112
|
-
expect(receipt.status).toBe("success")
|
|
113
|
-
|
|
114
|
-
const transactionHash2 = await sendTransaction(smartClient, {
|
|
115
|
-
to: zeroAddress,
|
|
116
|
-
data: "0x",
|
|
117
|
-
value: 0n
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
// -- second transaction after deployment
|
|
121
|
-
|
|
122
|
-
expect(transactionHash2).toBeTruthy()
|
|
123
|
-
|
|
124
|
-
const receipt2 = await publicClient.getTransactionReceipt({
|
|
125
|
-
hash: transactionHash2
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
expect(receipt2).toBeTruthy()
|
|
129
|
-
expect(receipt2.transactionHash).toBe(transactionHash2)
|
|
130
|
-
expect(receipt2.status).toBe("success")
|
|
131
|
-
}
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
testWithRpc.skipIf(!supportsEntryPointV08)(
|
|
135
|
-
"sendTransaction_v08",
|
|
136
|
-
async ({ rpc }) => {
|
|
137
|
-
const { anvilRpc } = rpc
|
|
138
|
-
|
|
139
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
140
|
-
|
|
141
|
-
const smartClient = await getSmartAccountClient({
|
|
142
|
-
entryPoint: {
|
|
143
|
-
version: "0.8"
|
|
144
|
-
},
|
|
145
|
-
privateKey, // anvil private key
|
|
146
|
-
...rpc
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
150
|
-
|
|
151
|
-
const authorization = isEip7702Compliant
|
|
152
|
-
? await privateKeyAccount.signAuthorization({
|
|
153
|
-
address: (smartClient.account as any).implementation,
|
|
154
|
-
chainId: smartClient.chain.id,
|
|
155
|
-
nonce: await publicClient.getTransactionCount({
|
|
156
|
-
address: smartClient.account.address
|
|
157
|
-
})
|
|
158
|
-
})
|
|
159
|
-
: undefined
|
|
160
|
-
|
|
161
|
-
const transactionHash = await sendTransaction(smartClient, {
|
|
162
|
-
to: zeroAddress,
|
|
163
|
-
data: "0x",
|
|
164
|
-
value: 0n,
|
|
165
|
-
authorization
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
expect(transactionHash).toBeTruthy()
|
|
169
|
-
|
|
170
|
-
const receipt = await publicClient.getTransactionReceipt({
|
|
171
|
-
hash: transactionHash
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
expect(receipt).toBeTruthy()
|
|
175
|
-
expect(receipt.transactionHash).toBe(transactionHash)
|
|
176
|
-
expect(receipt.status).toBe("success")
|
|
177
|
-
|
|
178
|
-
const transactionHash2 = await sendTransaction(smartClient, {
|
|
179
|
-
to: zeroAddress,
|
|
180
|
-
data: "0x",
|
|
181
|
-
value: 0n
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
// -- second transaction after deployment
|
|
185
|
-
|
|
186
|
-
expect(transactionHash2).toBeTruthy()
|
|
187
|
-
|
|
188
|
-
const receipt2 = await publicClient.getTransactionReceipt({
|
|
189
|
-
hash: transactionHash2
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
expect(receipt2).toBeTruthy()
|
|
193
|
-
expect(receipt2.transactionHash).toBe(transactionHash2)
|
|
194
|
-
expect(receipt2.status).toBe("success")
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
199
|
-
"sendTransaction_v06 post deployment",
|
|
200
|
-
async ({ rpc }) => {
|
|
201
|
-
const { anvilRpc } = rpc
|
|
202
|
-
|
|
203
|
-
await (async () => {
|
|
204
|
-
const smartClient = await getSmartAccountClient({
|
|
205
|
-
entryPoint: {
|
|
206
|
-
version: "0.6"
|
|
207
|
-
},
|
|
208
|
-
privateKey, // anvil private key
|
|
209
|
-
...rpc
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
const transactionHash = await sendTransaction(smartClient, {
|
|
213
|
-
to: zeroAddress,
|
|
214
|
-
data: "0x",
|
|
215
|
-
value: 0n
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
expect(transactionHash).toBeTruthy()
|
|
219
|
-
|
|
220
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
221
|
-
|
|
222
|
-
const receipt = await publicClient.getTransactionReceipt({
|
|
223
|
-
hash: transactionHash
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
expect(receipt).toBeTruthy()
|
|
227
|
-
expect(receipt.transactionHash).toBe(transactionHash)
|
|
228
|
-
expect(receipt.status).toBe("success")
|
|
229
|
-
})()
|
|
230
|
-
|
|
231
|
-
const smartClient = await getSmartAccountClient({
|
|
232
|
-
entryPoint: {
|
|
233
|
-
version: "0.6"
|
|
234
|
-
},
|
|
235
|
-
privateKey, // anvil private key
|
|
236
|
-
...rpc
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
240
|
-
|
|
241
|
-
// -- second transaction after deployment
|
|
242
|
-
const transactionHash2 = await sendTransaction(smartClient, {
|
|
243
|
-
to: zeroAddress,
|
|
244
|
-
data: "0x",
|
|
245
|
-
value: 0n
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
expect(transactionHash2).toBeTruthy()
|
|
249
|
-
|
|
250
|
-
const receipt2 = await publicClient.getTransactionReceipt({
|
|
251
|
-
hash: transactionHash2
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
expect(receipt2).toBeTruthy()
|
|
255
|
-
expect(receipt2.transactionHash).toBe(transactionHash2)
|
|
256
|
-
expect(receipt2.status).toBe("success")
|
|
257
|
-
}
|
|
258
|
-
)
|
|
259
|
-
|
|
260
|
-
testWithRpc.skipIf(!supportsEntryPointV07)(
|
|
261
|
-
"sendTransaction_v07 post deployment",
|
|
262
|
-
async ({ rpc }) => {
|
|
263
|
-
const { anvilRpc } = rpc
|
|
264
|
-
|
|
265
|
-
await (async () => {
|
|
266
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
267
|
-
|
|
268
|
-
const smartClient = await getSmartAccountClient({
|
|
269
|
-
entryPoint: {
|
|
270
|
-
version: "0.7"
|
|
271
|
-
},
|
|
272
|
-
privateKey, // anvil private key
|
|
273
|
-
...rpc
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
277
|
-
|
|
278
|
-
const authorization = isEip7702Compliant
|
|
279
|
-
? await privateKeyAccount.signAuthorization({
|
|
280
|
-
address: (smartClient.account as any)
|
|
281
|
-
.implementation,
|
|
282
|
-
chainId: smartClient.chain.id,
|
|
283
|
-
nonce: await publicClient.getTransactionCount({
|
|
284
|
-
address: smartClient.account.address
|
|
285
|
-
})
|
|
286
|
-
})
|
|
287
|
-
: undefined
|
|
288
|
-
|
|
289
|
-
const transactionHash = await sendTransaction(smartClient, {
|
|
290
|
-
to: zeroAddress,
|
|
291
|
-
data: "0x",
|
|
292
|
-
value: 0n,
|
|
293
|
-
authorization
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
expect(transactionHash).toBeTruthy()
|
|
297
|
-
|
|
298
|
-
const receipt = await publicClient.getTransactionReceipt({
|
|
299
|
-
hash: transactionHash
|
|
300
|
-
})
|
|
301
|
-
|
|
302
|
-
expect(receipt).toBeTruthy()
|
|
303
|
-
expect(receipt.transactionHash).toBe(transactionHash)
|
|
304
|
-
expect(receipt.status).toBe("success")
|
|
305
|
-
})()
|
|
306
|
-
|
|
307
|
-
const smartClient = await getSmartAccountClient({
|
|
308
|
-
entryPoint: {
|
|
309
|
-
version: "0.7"
|
|
310
|
-
},
|
|
311
|
-
privateKey, // anvil private key
|
|
312
|
-
...rpc
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
316
|
-
|
|
317
|
-
const transactionHash2 = await sendTransaction(smartClient, {
|
|
318
|
-
to: zeroAddress,
|
|
319
|
-
data: "0x",
|
|
320
|
-
value: 0n
|
|
321
|
-
})
|
|
322
|
-
|
|
323
|
-
// -- second transaction after deployment
|
|
324
|
-
|
|
325
|
-
expect(transactionHash2).toBeTruthy()
|
|
326
|
-
|
|
327
|
-
const receipt2 = await publicClient.getTransactionReceipt({
|
|
328
|
-
hash: transactionHash2
|
|
329
|
-
})
|
|
330
|
-
|
|
331
|
-
expect(receipt2).toBeTruthy()
|
|
332
|
-
expect(receipt2.transactionHash).toBe(transactionHash2)
|
|
333
|
-
expect(receipt2.status).toBe("success")
|
|
334
|
-
}
|
|
335
|
-
)
|
|
336
|
-
|
|
337
|
-
testWithRpc.skipIf(!supportsEntryPointV08)(
|
|
338
|
-
"sendTransaction_v08 post deployment",
|
|
339
|
-
async ({ rpc }) => {
|
|
340
|
-
const { anvilRpc } = rpc
|
|
341
|
-
|
|
342
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
343
|
-
|
|
344
|
-
await (async () => {
|
|
345
|
-
const smartClient = await getSmartAccountClient({
|
|
346
|
-
entryPoint: {
|
|
347
|
-
version: "0.8"
|
|
348
|
-
},
|
|
349
|
-
privateKey, // anvil private key
|
|
350
|
-
...rpc
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
354
|
-
|
|
355
|
-
const authorization = isEip7702Compliant
|
|
356
|
-
? await privateKeyAccount.signAuthorization({
|
|
357
|
-
address: (smartClient.account as any)
|
|
358
|
-
.implementation,
|
|
359
|
-
chainId: smartClient.chain.id,
|
|
360
|
-
nonce: await publicClient.getTransactionCount({
|
|
361
|
-
address: smartClient.account.address
|
|
362
|
-
})
|
|
363
|
-
})
|
|
364
|
-
: undefined
|
|
365
|
-
|
|
366
|
-
const transactionHash = await sendTransaction(smartClient, {
|
|
367
|
-
to: zeroAddress,
|
|
368
|
-
data: "0x",
|
|
369
|
-
value: 0n,
|
|
370
|
-
authorization
|
|
371
|
-
})
|
|
372
|
-
|
|
373
|
-
expect(transactionHash).toBeTruthy()
|
|
374
|
-
|
|
375
|
-
const receipt = await publicClient.getTransactionReceipt({
|
|
376
|
-
hash: transactionHash
|
|
377
|
-
})
|
|
378
|
-
|
|
379
|
-
expect(receipt).toBeTruthy()
|
|
380
|
-
expect(receipt.transactionHash).toBe(transactionHash)
|
|
381
|
-
expect(receipt.status).toBe("success")
|
|
382
|
-
})()
|
|
383
|
-
|
|
384
|
-
const smartClient = await getSmartAccountClient({
|
|
385
|
-
entryPoint: {
|
|
386
|
-
version: "0.8"
|
|
387
|
-
},
|
|
388
|
-
privateKey, // anvil private key
|
|
389
|
-
...rpc
|
|
390
|
-
})
|
|
391
|
-
|
|
392
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
393
|
-
|
|
394
|
-
const transactionHash2 = await sendTransaction(smartClient, {
|
|
395
|
-
to: zeroAddress,
|
|
396
|
-
data: "0x",
|
|
397
|
-
value: 0n
|
|
398
|
-
})
|
|
399
|
-
|
|
400
|
-
// -- second transaction after deployment
|
|
401
|
-
|
|
402
|
-
expect(transactionHash2).toBeTruthy()
|
|
403
|
-
|
|
404
|
-
const receipt2 = await publicClient.getTransactionReceipt({
|
|
405
|
-
hash: transactionHash2
|
|
406
|
-
})
|
|
407
|
-
|
|
408
|
-
expect(receipt2).toBeTruthy()
|
|
409
|
-
expect(receipt2.transactionHash).toBe(transactionHash2)
|
|
410
|
-
expect(receipt2.status).toBe("success")
|
|
411
|
-
}
|
|
412
|
-
)
|
|
413
|
-
}
|
|
414
|
-
)
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { zeroAddress } from "viem"
|
|
2
|
-
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
|
-
import { describe, expect } from "vitest"
|
|
4
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
|
-
import {
|
|
6
|
-
getCoreSmartAccounts,
|
|
7
|
-
getPublicClient
|
|
8
|
-
} from "../../../permissionless-test/src/utils"
|
|
9
|
-
import { signMessage } from "./signMessage"
|
|
10
|
-
|
|
11
|
-
describe.each(getCoreSmartAccounts())(
|
|
12
|
-
"signMessage $name",
|
|
13
|
-
({
|
|
14
|
-
getSmartAccountClient,
|
|
15
|
-
isEip1271Compliant,
|
|
16
|
-
supportsEntryPointV06,
|
|
17
|
-
supportsEntryPointV07,
|
|
18
|
-
supportsEntryPointV08,
|
|
19
|
-
isEip7702Compliant,
|
|
20
|
-
name
|
|
21
|
-
}) => {
|
|
22
|
-
const privateKey = generatePrivateKey()
|
|
23
|
-
testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV06)(
|
|
24
|
-
"not isEip1271Compliant_v06",
|
|
25
|
-
async ({ rpc }) => {
|
|
26
|
-
const smartClient = await getSmartAccountClient({
|
|
27
|
-
entryPoint: {
|
|
28
|
-
version: "0.6"
|
|
29
|
-
},
|
|
30
|
-
...rpc
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
await expect(async () =>
|
|
34
|
-
signMessage(smartClient, {
|
|
35
|
-
message: "slowly and steadily burning the private keys"
|
|
36
|
-
})
|
|
37
|
-
).rejects.toThrow()
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV06)(
|
|
42
|
-
"isEip1271Compliant_v06",
|
|
43
|
-
async ({ rpc }) => {
|
|
44
|
-
const { anvilRpc } = rpc
|
|
45
|
-
|
|
46
|
-
const smartClient = await getSmartAccountClient({
|
|
47
|
-
entryPoint: {
|
|
48
|
-
version: "0.6"
|
|
49
|
-
},
|
|
50
|
-
...rpc
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
if (!smartClient.account) {
|
|
54
|
-
throw new Error("Account not found")
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (name.includes("Safe 7579")) {
|
|
58
|
-
// Due to 7579 launchpad, we can't verify the signature before deploying the account.
|
|
59
|
-
await smartClient.sendTransaction({
|
|
60
|
-
calls: [{ to: zeroAddress, value: 0n }]
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const signature = await signMessage(smartClient, {
|
|
65
|
-
message: "slowly and steadily burning the private keys",
|
|
66
|
-
account: smartClient.account
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
70
|
-
|
|
71
|
-
const isVerified = await publicClient.verifyMessage({
|
|
72
|
-
address: smartClient.account.address,
|
|
73
|
-
message: "slowly and steadily burning the private keys",
|
|
74
|
-
signature
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
expect(isVerified).toBeTruthy()
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV07)(
|
|
82
|
-
"not isEip1271Compliant_v07",
|
|
83
|
-
async ({ rpc }) => {
|
|
84
|
-
const smartClient = await getSmartAccountClient({
|
|
85
|
-
entryPoint: {
|
|
86
|
-
version: "0.7"
|
|
87
|
-
},
|
|
88
|
-
...rpc
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
await expect(async () =>
|
|
92
|
-
signMessage(smartClient, {
|
|
93
|
-
message: "slowly and steadily burning the private keys"
|
|
94
|
-
})
|
|
95
|
-
).rejects.toThrow()
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV07)(
|
|
100
|
-
"isEip1271Compliant_v07",
|
|
101
|
-
async ({ rpc }) => {
|
|
102
|
-
const { anvilRpc } = rpc
|
|
103
|
-
|
|
104
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
105
|
-
|
|
106
|
-
const smartClient = await getSmartAccountClient({
|
|
107
|
-
entryPoint: {
|
|
108
|
-
version: "0.7"
|
|
109
|
-
},
|
|
110
|
-
privateKey, // anvil private key
|
|
111
|
-
...rpc
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
if (name === "LightAccount 2.0.0") {
|
|
115
|
-
// LightAccount 2.0.0 doesn't support EIP-1271
|
|
116
|
-
return
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
name.includes("Safe 7579") ||
|
|
121
|
-
name.includes("Kernel 0.3.3 + EIP-7702")
|
|
122
|
-
) {
|
|
123
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
124
|
-
|
|
125
|
-
// Due to 7579 launchpad, we can't verify the signature before deploying the account.
|
|
126
|
-
await smartClient.sendTransaction({
|
|
127
|
-
calls: [{ to: zeroAddress, value: 0n }],
|
|
128
|
-
authorization: isEip7702Compliant
|
|
129
|
-
? await privateKeyAccount.signAuthorization({
|
|
130
|
-
address: (smartClient.account as any)
|
|
131
|
-
.implementation,
|
|
132
|
-
chainId: smartClient.chain.id,
|
|
133
|
-
nonce: await publicClient.getTransactionCount(
|
|
134
|
-
{
|
|
135
|
-
address: smartClient.account.address
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
})
|
|
139
|
-
: undefined
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const signature = await signMessage(smartClient, {
|
|
144
|
-
message: "slowly and steadily burning the private keys"
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
148
|
-
|
|
149
|
-
const isVerified = await publicClient.verifyMessage({
|
|
150
|
-
address: smartClient.account.address,
|
|
151
|
-
message: "slowly and steadily burning the private keys",
|
|
152
|
-
signature
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
expect(isVerified).toBeTruthy()
|
|
156
|
-
}
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV08)(
|
|
160
|
-
"not isEip1271Compliant_v08",
|
|
161
|
-
async ({ rpc }) => {
|
|
162
|
-
const smartClient = await getSmartAccountClient({
|
|
163
|
-
entryPoint: {
|
|
164
|
-
version: "0.8"
|
|
165
|
-
},
|
|
166
|
-
...rpc
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
await expect(async () =>
|
|
170
|
-
signMessage(smartClient, {
|
|
171
|
-
message: "slowly and steadily burning the private keys"
|
|
172
|
-
})
|
|
173
|
-
).rejects.toThrow()
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV08)(
|
|
178
|
-
"isEip1271Compliant_v08",
|
|
179
|
-
async ({ rpc }) => {
|
|
180
|
-
const { anvilRpc } = rpc
|
|
181
|
-
|
|
182
|
-
const smartClient = await getSmartAccountClient({
|
|
183
|
-
entryPoint: {
|
|
184
|
-
version: "0.8"
|
|
185
|
-
},
|
|
186
|
-
...rpc
|
|
187
|
-
})
|
|
188
|
-
|
|
189
|
-
if (name === "LightAccount 2.0.0") {
|
|
190
|
-
// LightAccount 2.0.0 doesn't support EIP-1271
|
|
191
|
-
return
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (name.includes("Safe 7579")) {
|
|
195
|
-
// Due to 7579 launchpad, we can't verify the signature before deploying the account.
|
|
196
|
-
await smartClient.sendTransaction({
|
|
197
|
-
calls: [{ to: zeroAddress, value: 0n }]
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const signature = await signMessage(smartClient, {
|
|
202
|
-
message: "slowly and steadily burning the private keys"
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
const publicClient = getPublicClient(anvilRpc)
|
|
206
|
-
|
|
207
|
-
const isVerified = await publicClient.verifyMessage({
|
|
208
|
-
address: smartClient.account.address,
|
|
209
|
-
message: "slowly and steadily burning the private keys",
|
|
210
|
-
signature
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
expect(isVerified).toBeTruthy()
|
|
214
|
-
}
|
|
215
|
-
)
|
|
216
|
-
}
|
|
217
|
-
)
|