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,235 +0,0 @@
|
|
|
1
|
-
import { encodeAbiParameters, encodePacked, isHash, 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 { erc7579Actions } from "../erc7579"
|
|
10
|
-
import { installModules } from "./installModules"
|
|
11
|
-
|
|
12
|
-
describe.each(getCoreSmartAccounts())(
|
|
13
|
-
"installModules $name",
|
|
14
|
-
({ getErc7579SmartAccountClient, name, isEip7702Compliant }) => {
|
|
15
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
16
|
-
"installModules",
|
|
17
|
-
async ({ rpc }) => {
|
|
18
|
-
if (!getErc7579SmartAccountClient) {
|
|
19
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const privateKey = generatePrivateKey()
|
|
23
|
-
|
|
24
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
25
|
-
|
|
26
|
-
const smartClientWithoutExtend =
|
|
27
|
-
await getErc7579SmartAccountClient({
|
|
28
|
-
entryPoint: {
|
|
29
|
-
version: "0.7"
|
|
30
|
-
},
|
|
31
|
-
privateKey,
|
|
32
|
-
...rpc
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const publicClient = getPublicClient(rpc.anvilRpc)
|
|
36
|
-
|
|
37
|
-
const smartClient = smartClientWithoutExtend.extend(
|
|
38
|
-
erc7579Actions()
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
const moduleData = encodePacked(
|
|
42
|
-
["address"],
|
|
43
|
-
[smartClient.account.address]
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
const opHash = await installModules(smartClient, {
|
|
47
|
-
account: smartClient.account,
|
|
48
|
-
calls: [
|
|
49
|
-
{
|
|
50
|
-
to: smartClient.account.address,
|
|
51
|
-
value: 0n,
|
|
52
|
-
data: "0x"
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
authorization: isEip7702Compliant
|
|
56
|
-
? await privateKeyAccount.signAuthorization({
|
|
57
|
-
address: (smartClient.account as any)
|
|
58
|
-
.implementation,
|
|
59
|
-
chainId: smartClient.chain.id,
|
|
60
|
-
nonce: await publicClient.getTransactionCount({
|
|
61
|
-
address: smartClient.account.address
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
: undefined,
|
|
65
|
-
modules: [
|
|
66
|
-
{
|
|
67
|
-
type: "executor",
|
|
68
|
-
address:
|
|
69
|
-
"0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
70
|
-
context: name.startsWith("Kernel 7579")
|
|
71
|
-
? encodePacked(
|
|
72
|
-
["address", "bytes"],
|
|
73
|
-
[
|
|
74
|
-
zeroAddress,
|
|
75
|
-
encodeAbiParameters(
|
|
76
|
-
[
|
|
77
|
-
{ type: "bytes" },
|
|
78
|
-
{ type: "bytes" }
|
|
79
|
-
],
|
|
80
|
-
[moduleData, "0x"]
|
|
81
|
-
)
|
|
82
|
-
]
|
|
83
|
-
)
|
|
84
|
-
: moduleData
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
expect(isHash(opHash)).toBe(true)
|
|
90
|
-
|
|
91
|
-
const userOperationReceipt =
|
|
92
|
-
await smartClient.waitForUserOperationReceipt({
|
|
93
|
-
hash: opHash,
|
|
94
|
-
timeout: 100000
|
|
95
|
-
})
|
|
96
|
-
expect(userOperationReceipt).not.toBeNull()
|
|
97
|
-
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
98
|
-
expect(
|
|
99
|
-
userOperationReceipt?.receipt.transactionHash
|
|
100
|
-
).toBeTruthy()
|
|
101
|
-
|
|
102
|
-
const receipt = await smartClient.getUserOperationReceipt({
|
|
103
|
-
hash: opHash
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
expect(receipt?.receipt.transactionHash).toBe(
|
|
107
|
-
userOperationReceipt?.receipt.transactionHash
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
const isModuleInstalled = await smartClient.isModuleInstalled({
|
|
111
|
-
type: "executor",
|
|
112
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
113
|
-
context: "0x"
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
expect(isModuleInstalled).toBe(true)
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
120
|
-
"installModules post deployment",
|
|
121
|
-
async ({ rpc }) => {
|
|
122
|
-
if (!getErc7579SmartAccountClient) {
|
|
123
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const privateKey = generatePrivateKey()
|
|
127
|
-
|
|
128
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
129
|
-
|
|
130
|
-
const smartClientWithoutExtend =
|
|
131
|
-
await getErc7579SmartAccountClient({
|
|
132
|
-
entryPoint: {
|
|
133
|
-
version: "0.7"
|
|
134
|
-
},
|
|
135
|
-
privateKey,
|
|
136
|
-
...rpc
|
|
137
|
-
})
|
|
138
|
-
const publicClient = getPublicClient(rpc.anvilRpc)
|
|
139
|
-
|
|
140
|
-
const smartClient = smartClientWithoutExtend.extend(
|
|
141
|
-
erc7579Actions()
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
const userOpHash = await smartClient.sendUserOperation({
|
|
145
|
-
authorization: isEip7702Compliant
|
|
146
|
-
? await privateKeyAccount.signAuthorization({
|
|
147
|
-
address: (smartClient.account as any)
|
|
148
|
-
.implementation,
|
|
149
|
-
chainId: smartClient.chain.id,
|
|
150
|
-
nonce: await publicClient.getTransactionCount({
|
|
151
|
-
address: smartClient.account.address
|
|
152
|
-
})
|
|
153
|
-
})
|
|
154
|
-
: undefined,
|
|
155
|
-
calls: [
|
|
156
|
-
{
|
|
157
|
-
to: smartClient.account.address,
|
|
158
|
-
value: 0n,
|
|
159
|
-
data: "0x"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
to: smartClient.account.address,
|
|
163
|
-
value: 0n,
|
|
164
|
-
data: "0x"
|
|
165
|
-
}
|
|
166
|
-
]
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
await smartClient.waitForUserOperationReceipt({
|
|
170
|
-
hash: userOpHash
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
const moduleData = encodePacked(
|
|
174
|
-
["address"],
|
|
175
|
-
[smartClient.account.address]
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
const opHash = await installModules(smartClient, {
|
|
179
|
-
account: smartClient.account,
|
|
180
|
-
modules: [
|
|
181
|
-
{
|
|
182
|
-
type: "executor",
|
|
183
|
-
address:
|
|
184
|
-
"0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
185
|
-
context: name.startsWith("Kernel 7579")
|
|
186
|
-
? encodePacked(
|
|
187
|
-
["address", "bytes"],
|
|
188
|
-
[
|
|
189
|
-
zeroAddress,
|
|
190
|
-
encodeAbiParameters(
|
|
191
|
-
[
|
|
192
|
-
{ type: "bytes" },
|
|
193
|
-
{ type: "bytes" }
|
|
194
|
-
],
|
|
195
|
-
[moduleData, "0x"]
|
|
196
|
-
)
|
|
197
|
-
]
|
|
198
|
-
)
|
|
199
|
-
: moduleData
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
expect(isHash(opHash)).toBe(true)
|
|
205
|
-
|
|
206
|
-
const userOperationReceipt =
|
|
207
|
-
await smartClient.waitForUserOperationReceipt({
|
|
208
|
-
hash: opHash,
|
|
209
|
-
timeout: 100000
|
|
210
|
-
})
|
|
211
|
-
expect(userOperationReceipt).not.toBeNull()
|
|
212
|
-
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
213
|
-
expect(
|
|
214
|
-
userOperationReceipt?.receipt.transactionHash
|
|
215
|
-
).toBeTruthy()
|
|
216
|
-
|
|
217
|
-
const receipt = await smartClient.getUserOperationReceipt({
|
|
218
|
-
hash: opHash
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
expect(receipt?.receipt.transactionHash).toBe(
|
|
222
|
-
userOperationReceipt?.receipt.transactionHash
|
|
223
|
-
)
|
|
224
|
-
|
|
225
|
-
const isModuleInstalled = await smartClient.isModuleInstalled({
|
|
226
|
-
type: "executor",
|
|
227
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
228
|
-
context: "0x"
|
|
229
|
-
})
|
|
230
|
-
|
|
231
|
-
expect(isModuleInstalled).toBe(true)
|
|
232
|
-
}
|
|
233
|
-
)
|
|
234
|
-
}
|
|
235
|
-
)
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { encodeAbiParameters, encodePacked, zeroAddress } from "viem"
|
|
2
|
-
import { describe, expect } from "vitest"
|
|
3
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
4
|
-
import { getCoreSmartAccounts } from "../../../permissionless-test/src/utils"
|
|
5
|
-
import { erc7579Actions } from "../erc7579"
|
|
6
|
-
import { isModuleInstalled } from "./isModuleInstalled"
|
|
7
|
-
|
|
8
|
-
describe.each(getCoreSmartAccounts())(
|
|
9
|
-
"isModuleInstalled $name",
|
|
10
|
-
({ getErc7579SmartAccountClient, name }) => {
|
|
11
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
12
|
-
"isModuleInstalled",
|
|
13
|
-
async ({ rpc }) => {
|
|
14
|
-
if (!getErc7579SmartAccountClient) {
|
|
15
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const smartClientWithoutExtend =
|
|
19
|
-
await getErc7579SmartAccountClient({
|
|
20
|
-
entryPoint: {
|
|
21
|
-
version: "0.7"
|
|
22
|
-
},
|
|
23
|
-
...rpc
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
const smartClient = smartClientWithoutExtend.extend(
|
|
27
|
-
erc7579Actions()
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
const moduleData = encodePacked(
|
|
31
|
-
["address"],
|
|
32
|
-
[smartClient.account.address]
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
const opHash = await smartClient.installModule({
|
|
36
|
-
account: smartClient.account as any,
|
|
37
|
-
type: "executor",
|
|
38
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
39
|
-
context: name.startsWith("Kernel 7579")
|
|
40
|
-
? encodePacked(
|
|
41
|
-
["address", "bytes"],
|
|
42
|
-
[
|
|
43
|
-
zeroAddress,
|
|
44
|
-
encodeAbiParameters(
|
|
45
|
-
[{ type: "bytes" }, { type: "bytes" }],
|
|
46
|
-
[moduleData, "0x"]
|
|
47
|
-
)
|
|
48
|
-
]
|
|
49
|
-
)
|
|
50
|
-
: moduleData
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
await smartClient.waitForUserOperationReceipt({
|
|
54
|
-
hash: opHash,
|
|
55
|
-
timeout: 100000
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const isModuleInstalledResult = await isModuleInstalled(
|
|
59
|
-
smartClient,
|
|
60
|
-
{
|
|
61
|
-
account: smartClient.account,
|
|
62
|
-
type: "executor",
|
|
63
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
64
|
-
context: "0x"
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
expect(isModuleInstalledResult).toBe(true)
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
)
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { zeroAddress } from "viem"
|
|
2
|
-
import { describe, expect } from "vitest"
|
|
3
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
4
|
-
import { getCoreSmartAccounts } from "../../../permissionless-test/src/utils"
|
|
5
|
-
import { supportsExecutionMode } from "./supportsExecutionMode"
|
|
6
|
-
|
|
7
|
-
describe.each(getCoreSmartAccounts())(
|
|
8
|
-
"supportsExecutionMode $name",
|
|
9
|
-
({ getErc7579SmartAccountClient }) => {
|
|
10
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
11
|
-
"supportsExecutionMode",
|
|
12
|
-
async ({ rpc }) => {
|
|
13
|
-
if (!getErc7579SmartAccountClient) {
|
|
14
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const smartClient = await getErc7579SmartAccountClient({
|
|
18
|
-
entryPoint: {
|
|
19
|
-
version: "0.7"
|
|
20
|
-
},
|
|
21
|
-
...rpc
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const supportsExecutionModeBatchCallBeforeDeploy =
|
|
25
|
-
await supportsExecutionMode(smartClient, {
|
|
26
|
-
account: smartClient.account,
|
|
27
|
-
type: "batchcall",
|
|
28
|
-
revertOnError: false,
|
|
29
|
-
selector: "0x0",
|
|
30
|
-
context: "0x"
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
expect(supportsExecutionModeBatchCallBeforeDeploy).toBe(true)
|
|
34
|
-
|
|
35
|
-
// deploy account
|
|
36
|
-
await smartClient.sendTransaction({
|
|
37
|
-
to: zeroAddress,
|
|
38
|
-
value: 0n,
|
|
39
|
-
data: "0x"
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
const supportsExecutionModeBatchCallBeforeDeployPostDeploy =
|
|
43
|
-
await supportsExecutionMode(smartClient, {
|
|
44
|
-
account: smartClient.account,
|
|
45
|
-
type: "batchcall",
|
|
46
|
-
revertOnError: false,
|
|
47
|
-
selector: "0x0",
|
|
48
|
-
context: "0x"
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
expect(
|
|
52
|
-
supportsExecutionModeBatchCallBeforeDeployPostDeploy
|
|
53
|
-
).toBe(true)
|
|
54
|
-
|
|
55
|
-
expect(supportsExecutionModeBatchCallBeforeDeploy).toBe(
|
|
56
|
-
supportsExecutionModeBatchCallBeforeDeployPostDeploy
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
61
|
-
"supportsExecutionMode",
|
|
62
|
-
async ({ rpc }) => {
|
|
63
|
-
if (!getErc7579SmartAccountClient) {
|
|
64
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const smartClient = await getErc7579SmartAccountClient({
|
|
68
|
-
entryPoint: {
|
|
69
|
-
version: "0.7"
|
|
70
|
-
},
|
|
71
|
-
...rpc
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
const supportsExecutionModeBatchCallBeforeDeploy =
|
|
75
|
-
await supportsExecutionMode(smartClient, {
|
|
76
|
-
account: smartClient.account,
|
|
77
|
-
type: "delegatecall"
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
expect(supportsExecutionModeBatchCallBeforeDeploy).toBe(true)
|
|
81
|
-
|
|
82
|
-
// deploy account
|
|
83
|
-
await smartClient.sendTransaction({
|
|
84
|
-
to: zeroAddress,
|
|
85
|
-
value: 0n,
|
|
86
|
-
data: "0x"
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
const supportsExecutionModeBatchCallBeforeDeployPostDeploy =
|
|
90
|
-
await supportsExecutionMode(smartClient, {
|
|
91
|
-
account: smartClient.account,
|
|
92
|
-
type: "batchcall",
|
|
93
|
-
revertOnError: false,
|
|
94
|
-
selector: "0x0",
|
|
95
|
-
context: "0x"
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
expect(
|
|
99
|
-
supportsExecutionModeBatchCallBeforeDeployPostDeploy
|
|
100
|
-
).toBe(true)
|
|
101
|
-
|
|
102
|
-
expect(supportsExecutionModeBatchCallBeforeDeploy).toBe(
|
|
103
|
-
supportsExecutionModeBatchCallBeforeDeployPostDeploy
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
)
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { describe, expect } from "vitest"
|
|
2
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
3
|
-
import { getCoreSmartAccounts } from "../../../permissionless-test/src/utils"
|
|
4
|
-
import { supportsModule } from "./supportsModule"
|
|
5
|
-
|
|
6
|
-
describe.each(getCoreSmartAccounts())(
|
|
7
|
-
"supportsModule $name",
|
|
8
|
-
({ getErc7579SmartAccountClient }) => {
|
|
9
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
10
|
-
"supportsModule",
|
|
11
|
-
async ({ rpc }) => {
|
|
12
|
-
if (!getErc7579SmartAccountClient) {
|
|
13
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const smartClient = await getErc7579SmartAccountClient({
|
|
17
|
-
entryPoint: {
|
|
18
|
-
version: "0.7"
|
|
19
|
-
},
|
|
20
|
-
...rpc
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const supportsValidationModule = await supportsModule(
|
|
24
|
-
smartClient,
|
|
25
|
-
{
|
|
26
|
-
account: smartClient.account,
|
|
27
|
-
type: "validator"
|
|
28
|
-
}
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
expect(supportsValidationModule).toBe(true)
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
)
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { encodeAbiParameters, encodePacked, isHash, 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 { erc7579Actions } from "../erc7579"
|
|
10
|
-
import { uninstallModule } from "./uninstallModule"
|
|
11
|
-
|
|
12
|
-
describe.each(getCoreSmartAccounts())(
|
|
13
|
-
"uninstallModule $name",
|
|
14
|
-
({ getErc7579SmartAccountClient, name, isEip7702Compliant }) => {
|
|
15
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
16
|
-
"uninstallModule",
|
|
17
|
-
async ({ rpc }) => {
|
|
18
|
-
if (!getErc7579SmartAccountClient) {
|
|
19
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const privateKey = generatePrivateKey()
|
|
23
|
-
|
|
24
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
25
|
-
|
|
26
|
-
const smartClientWithoutExtend =
|
|
27
|
-
await getErc7579SmartAccountClient({
|
|
28
|
-
entryPoint: {
|
|
29
|
-
version: "0.7"
|
|
30
|
-
},
|
|
31
|
-
privateKey,
|
|
32
|
-
...rpc
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const publicClient = getPublicClient(rpc.anvilRpc)
|
|
36
|
-
|
|
37
|
-
const smartClient = smartClientWithoutExtend.extend(
|
|
38
|
-
erc7579Actions()
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
const moduleData = encodePacked(
|
|
42
|
-
["address"],
|
|
43
|
-
[smartClient.account.address]
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
const opHash = await smartClient.installModule({
|
|
47
|
-
type: "executor",
|
|
48
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
49
|
-
context: name.startsWith("Kernel 7579")
|
|
50
|
-
? encodePacked(
|
|
51
|
-
["address", "bytes"],
|
|
52
|
-
[
|
|
53
|
-
zeroAddress,
|
|
54
|
-
encodeAbiParameters(
|
|
55
|
-
[{ type: "bytes" }, { type: "bytes" }],
|
|
56
|
-
[moduleData, "0x"]
|
|
57
|
-
)
|
|
58
|
-
]
|
|
59
|
-
)
|
|
60
|
-
: moduleData,
|
|
61
|
-
authorization: isEip7702Compliant
|
|
62
|
-
? await privateKeyAccount.signAuthorization({
|
|
63
|
-
address: (smartClient.account as any)
|
|
64
|
-
.implementation,
|
|
65
|
-
chainId: smartClient.chain.id,
|
|
66
|
-
nonce: await publicClient.getTransactionCount({
|
|
67
|
-
address: smartClient.account.address
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
: undefined
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
await smartClient.waitForUserOperationReceipt({
|
|
74
|
-
hash: opHash,
|
|
75
|
-
timeout: 100000
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
const uninstallModuleUserOpHash = await uninstallModule(
|
|
79
|
-
smartClient,
|
|
80
|
-
{
|
|
81
|
-
account: smartClient.account,
|
|
82
|
-
type: "executor",
|
|
83
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
84
|
-
context: name.startsWith("Kernel 7579")
|
|
85
|
-
? "0x"
|
|
86
|
-
: encodeAbiParameters(
|
|
87
|
-
[
|
|
88
|
-
{ name: "prev", type: "address" },
|
|
89
|
-
{
|
|
90
|
-
name: "moduleInitData",
|
|
91
|
-
type: "bytes"
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
[
|
|
95
|
-
"0x0000000000000000000000000000000000000001",
|
|
96
|
-
"0x"
|
|
97
|
-
]
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
expect(isHash(uninstallModuleUserOpHash)).toBe(true)
|
|
103
|
-
|
|
104
|
-
const userOperationReceiptUninstallModule =
|
|
105
|
-
await smartClient.waitForUserOperationReceipt({
|
|
106
|
-
hash: uninstallModuleUserOpHash,
|
|
107
|
-
timeout: 100000
|
|
108
|
-
})
|
|
109
|
-
expect(userOperationReceiptUninstallModule).not.toBeNull()
|
|
110
|
-
expect(userOperationReceiptUninstallModule?.userOpHash).toBe(
|
|
111
|
-
uninstallModuleUserOpHash
|
|
112
|
-
)
|
|
113
|
-
expect(
|
|
114
|
-
userOperationReceiptUninstallModule?.receipt.transactionHash
|
|
115
|
-
).toBeTruthy()
|
|
116
|
-
|
|
117
|
-
const receiptUninstallModule =
|
|
118
|
-
await smartClient.getUserOperationReceipt({
|
|
119
|
-
hash: uninstallModuleUserOpHash
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
expect(receiptUninstallModule?.receipt.transactionHash).toBe(
|
|
123
|
-
userOperationReceiptUninstallModule?.receipt.transactionHash
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
)
|