permissionless 0.3.5 → 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 +13 -0
- package/_cjs/accounts/biconomy/index.js +8 -0
- package/_cjs/accounts/biconomy/index.js.map +1 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js +9 -5
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/etherspot/index.js +8 -0
- package/_cjs/accounts/etherspot/index.js.map +1 -0
- package/_cjs/accounts/kernel/index.js +18 -0
- package/_cjs/accounts/kernel/index.js.map +1 -0
- package/_cjs/accounts/kernel/toKernelSmartAccount.js +10 -6
- package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/signMessage.js +9 -7
- package/_cjs/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_cjs/accounts/kernel/utils/signTypedData.js +7 -6
- package/_cjs/accounts/kernel/utils/signTypedData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/wrapMessageHash.js +3 -3
- package/_cjs/accounts/kernel/utils/wrapMessageHash.js.map +1 -1
- package/_cjs/accounts/light/index.js +8 -0
- package/_cjs/accounts/light/index.js.map +1 -0
- package/_cjs/accounts/light/toLightSmartAccount.js +9 -5
- package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_cjs/accounts/nexus/index.js +8 -0
- package/_cjs/accounts/nexus/index.js.map +1 -0
- 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/index.js +10 -0
- package/_cjs/accounts/simple/index.js.map +1 -0
- package/_cjs/accounts/simple/toSimpleSmartAccount.js +15 -10
- package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/index.js +8 -0
- package/_cjs/accounts/thirdweb/index.js.map +1 -0
- package/_cjs/accounts/thirdweb/utils/decodeCallData.js +7 -5
- package/_cjs/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
- package/_cjs/accounts/trust/index.js +8 -0
- package/_cjs/accounts/trust/index.js.map +1 -0
- 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/index.js +5 -0
- package/_esm/accounts/biconomy/index.js.map +1 -0
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js +9 -5
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/etherspot/index.js +5 -0
- package/_esm/accounts/etherspot/index.js.map +1 -0
- package/_esm/accounts/kernel/index.js +15 -0
- package/_esm/accounts/kernel/index.js.map +1 -0
- package/_esm/accounts/kernel/toKernelSmartAccount.js +10 -6
- package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/signMessage.js +9 -7
- package/_esm/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_esm/accounts/kernel/utils/signTypedData.js +7 -6
- package/_esm/accounts/kernel/utils/signTypedData.js.map +1 -1
- package/_esm/accounts/kernel/utils/wrapMessageHash.js +3 -3
- package/_esm/accounts/kernel/utils/wrapMessageHash.js.map +1 -1
- package/_esm/accounts/light/index.js +5 -0
- package/_esm/accounts/light/index.js.map +1 -0
- package/_esm/accounts/light/toLightSmartAccount.js +9 -5
- package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_esm/accounts/nexus/index.js +5 -0
- package/_esm/accounts/nexus/index.js.map +1 -0
- 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/index.js +7 -0
- package/_esm/accounts/simple/index.js.map +1 -0
- package/_esm/accounts/simple/toSimpleSmartAccount.js +15 -10
- package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/index.js +5 -0
- package/_esm/accounts/thirdweb/index.js.map +1 -0
- package/_esm/accounts/thirdweb/utils/decodeCallData.js +7 -5
- package/_esm/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
- package/_esm/accounts/trust/index.js +5 -0
- package/_esm/accounts/trust/index.js.map +1 -0
- 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/index.d.ts +6 -0
- package/_types/accounts/biconomy/index.d.ts.map +1 -0
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/etherspot/index.d.ts +6 -0
- package/_types/accounts/etherspot/index.d.ts.map +1 -0
- package/_types/accounts/kernel/index.d.ts +22 -0
- package/_types/accounts/kernel/index.d.ts.map +1 -0
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/signMessage.d.ts +4 -5
- package/_types/accounts/kernel/utils/signMessage.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/signTypedData.d.ts +4 -4
- package/_types/accounts/kernel/utils/signTypedData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts +8 -3
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts.map +1 -1
- package/_types/accounts/light/index.d.ts +6 -0
- package/_types/accounts/light/index.d.ts.map +1 -0
- package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
- package/_types/accounts/nexus/index.d.ts +6 -0
- package/_types/accounts/nexus/index.d.ts.map +1 -0
- package/_types/accounts/safe/signUserOperation.d.ts.map +1 -1
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/index.d.ts +9 -0
- package/_types/accounts/simple/index.d.ts.map +1 -0
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/index.d.ts +6 -0
- package/_types/accounts/thirdweb/index.d.ts.map +1 -0
- package/_types/accounts/thirdweb/utils/decodeCallData.d.ts.map +1 -1
- package/_types/accounts/trust/index.d.ts +6 -0
- package/_types/accounts/trust/index.d.ts.map +1 -0
- 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/index.ts +11 -0
- package/accounts/biconomy/package.json +6 -0
- package/accounts/biconomy/toBiconomySmartAccount.ts +13 -5
- package/accounts/etherspot/index.ts +11 -0
- package/accounts/etherspot/package.json +6 -0
- package/accounts/kernel/index.ts +33 -0
- package/accounts/kernel/package.json +6 -0
- package/accounts/kernel/toKernelSmartAccount.ts +13 -6
- package/accounts/kernel/utils/signMessage.ts +19 -15
- package/accounts/kernel/utils/signTypedData.ts +14 -11
- package/accounts/kernel/utils/wrapMessageHash.ts +11 -8
- package/accounts/light/index.ts +12 -0
- package/accounts/light/package.json +6 -0
- package/accounts/light/toLightSmartAccount.ts +13 -5
- package/accounts/nexus/index.ts +11 -0
- 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/index.ts +18 -0
- package/accounts/simple/package.json +6 -0
- package/accounts/simple/toSimpleSmartAccount.ts +21 -10
- package/accounts/thirdweb/index.ts +11 -0
- package/accounts/thirdweb/package.json +6 -0
- package/accounts/thirdweb/utils/decodeCallData.ts +9 -5
- package/accounts/trust/index.ts +11 -0
- 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 +74 -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 -216
- package/actions/erc7579/installModules.test.ts +0 -237
- 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 -129
- 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 -199
- 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 -255
- package/actions/smartAccount/sendCalls.test.ts +0 -571
- package/actions/smartAccount/sendTransaction.test.ts +0 -416
- package/actions/smartAccount/signMessage.test.ts +0 -219
- package/actions/smartAccount/signTypedData.test.ts +0 -228
- package/actions/smartAccount.ts +0 -7
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +0 -523
- 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 -31
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
entryPoint06Address,
|
|
3
|
-
entryPoint07Address
|
|
4
|
-
} from "viem/account-abstraction"
|
|
5
|
-
import {
|
|
6
|
-
generatePrivateKey,
|
|
7
|
-
privateKeyToAccount,
|
|
8
|
-
toAccount
|
|
9
|
-
} from "viem/accounts"
|
|
10
|
-
import { foundry } from "viem/chains"
|
|
11
|
-
import { describe, expect } from "vitest"
|
|
12
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
13
|
-
import {
|
|
14
|
-
getBundlerClient,
|
|
15
|
-
getSafeClient
|
|
16
|
-
} from "../../../permissionless-test/src/utils"
|
|
17
|
-
import { signUserOperation } from "./signUserOperation"
|
|
18
|
-
|
|
19
|
-
describe("signUserOperation", () => {
|
|
20
|
-
testWithRpc("signUserOperation_V06", async ({ rpc }) => {
|
|
21
|
-
const owners = [
|
|
22
|
-
privateKeyToAccount(generatePrivateKey()),
|
|
23
|
-
privateKeyToAccount(generatePrivateKey()),
|
|
24
|
-
privateKeyToAccount(generatePrivateKey())
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
const safeAccountClient = getBundlerClient({
|
|
28
|
-
account: await getSafeClient({
|
|
29
|
-
...rpc,
|
|
30
|
-
entryPoint: {
|
|
31
|
-
version: "0.6"
|
|
32
|
-
},
|
|
33
|
-
owners: owners.map((owner) => toAccount(owner.address))
|
|
34
|
-
}),
|
|
35
|
-
entryPoint: {
|
|
36
|
-
version: "0.6"
|
|
37
|
-
},
|
|
38
|
-
...rpc
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const unSignedUserOperation =
|
|
42
|
-
await safeAccountClient.prepareUserOperation({
|
|
43
|
-
calls: [
|
|
44
|
-
{
|
|
45
|
-
to: safeAccountClient.account.address,
|
|
46
|
-
data: "0x"
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
let partialSignatures = await signUserOperation({
|
|
52
|
-
version: "1.4.1",
|
|
53
|
-
entryPoint: {
|
|
54
|
-
address: entryPoint06Address,
|
|
55
|
-
version: "0.6"
|
|
56
|
-
},
|
|
57
|
-
chainId: foundry.id,
|
|
58
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
59
|
-
account: owners[0],
|
|
60
|
-
...unSignedUserOperation
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
partialSignatures = await signUserOperation({
|
|
64
|
-
version: "1.4.1",
|
|
65
|
-
entryPoint: {
|
|
66
|
-
address: entryPoint06Address,
|
|
67
|
-
version: "0.6"
|
|
68
|
-
},
|
|
69
|
-
chainId: foundry.id,
|
|
70
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
71
|
-
account: owners[1],
|
|
72
|
-
signatures: partialSignatures,
|
|
73
|
-
...unSignedUserOperation
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
const finalSignature = await signUserOperation({
|
|
77
|
-
version: "1.4.1",
|
|
78
|
-
entryPoint: {
|
|
79
|
-
address: entryPoint06Address,
|
|
80
|
-
version: "0.6"
|
|
81
|
-
},
|
|
82
|
-
chainId: foundry.id,
|
|
83
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
84
|
-
account: owners[2],
|
|
85
|
-
signatures: partialSignatures,
|
|
86
|
-
...unSignedUserOperation
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
const userOpHash = safeAccountClient.sendUserOperation({
|
|
90
|
-
...unSignedUserOperation,
|
|
91
|
-
signature: finalSignature
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
expect(userOpHash).toBeTruthy()
|
|
95
|
-
|
|
96
|
-
const receipt = await safeAccountClient.waitForUserOperationReceipt({
|
|
97
|
-
hash: await userOpHash
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
expect(receipt).toBeTruthy()
|
|
101
|
-
expect(receipt.success).toBeTruthy()
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
testWithRpc("signUserOperation_V07", async ({ rpc }) => {
|
|
105
|
-
const owners = [
|
|
106
|
-
privateKeyToAccount(generatePrivateKey()),
|
|
107
|
-
privateKeyToAccount(generatePrivateKey()),
|
|
108
|
-
privateKeyToAccount(generatePrivateKey())
|
|
109
|
-
]
|
|
110
|
-
|
|
111
|
-
const safeAccountClient = getBundlerClient({
|
|
112
|
-
account: await getSafeClient({
|
|
113
|
-
...rpc,
|
|
114
|
-
entryPoint: {
|
|
115
|
-
version: "0.7"
|
|
116
|
-
},
|
|
117
|
-
owners: owners.map((owner) => toAccount(owner.address))
|
|
118
|
-
}),
|
|
119
|
-
entryPoint: {
|
|
120
|
-
version: "0.7"
|
|
121
|
-
},
|
|
122
|
-
...rpc
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
const unSignedUserOperation =
|
|
126
|
-
await safeAccountClient.prepareUserOperation({
|
|
127
|
-
calls: [
|
|
128
|
-
{
|
|
129
|
-
to: safeAccountClient.account.address,
|
|
130
|
-
data: "0x"
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
let partialSignatures = await signUserOperation({
|
|
136
|
-
version: "1.4.1",
|
|
137
|
-
entryPoint: {
|
|
138
|
-
address: entryPoint07Address,
|
|
139
|
-
version: "0.7"
|
|
140
|
-
},
|
|
141
|
-
chainId: foundry.id,
|
|
142
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
143
|
-
account: owners[0],
|
|
144
|
-
...unSignedUserOperation
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
partialSignatures = await signUserOperation({
|
|
148
|
-
version: "1.4.1",
|
|
149
|
-
entryPoint: {
|
|
150
|
-
address: entryPoint07Address,
|
|
151
|
-
version: "0.7"
|
|
152
|
-
},
|
|
153
|
-
chainId: foundry.id,
|
|
154
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
155
|
-
account: owners[1],
|
|
156
|
-
signatures: partialSignatures,
|
|
157
|
-
...unSignedUserOperation
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
const finalSignature = await signUserOperation({
|
|
161
|
-
version: "1.4.1",
|
|
162
|
-
entryPoint: {
|
|
163
|
-
address: entryPoint07Address,
|
|
164
|
-
version: "0.7"
|
|
165
|
-
},
|
|
166
|
-
chainId: foundry.id,
|
|
167
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
168
|
-
account: owners[2],
|
|
169
|
-
signatures: partialSignatures,
|
|
170
|
-
...unSignedUserOperation
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
const userOpHash = safeAccountClient.sendUserOperation({
|
|
174
|
-
...unSignedUserOperation,
|
|
175
|
-
signature: finalSignature
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
expect(userOpHash).toBeTruthy()
|
|
179
|
-
|
|
180
|
-
const receipt = await safeAccountClient.waitForUserOperationReceipt({
|
|
181
|
-
hash: await userOpHash
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
expect(receipt).toBeTruthy()
|
|
185
|
-
expect(receipt.success).toBeTruthy()
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
testWithRpc("signUserOperation_V07 7579", async ({ rpc }) => {
|
|
189
|
-
const owners = [
|
|
190
|
-
privateKeyToAccount(generatePrivateKey()),
|
|
191
|
-
privateKeyToAccount(generatePrivateKey()),
|
|
192
|
-
privateKeyToAccount(generatePrivateKey())
|
|
193
|
-
]
|
|
194
|
-
|
|
195
|
-
const safeAccountClient = getBundlerClient({
|
|
196
|
-
account: await getSafeClient({
|
|
197
|
-
...rpc,
|
|
198
|
-
entryPoint: {
|
|
199
|
-
version: "0.7"
|
|
200
|
-
},
|
|
201
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
202
|
-
erc7579: true
|
|
203
|
-
}),
|
|
204
|
-
entryPoint: {
|
|
205
|
-
version: "0.7"
|
|
206
|
-
},
|
|
207
|
-
...rpc
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
const unSignedUserOperation =
|
|
211
|
-
await safeAccountClient.prepareUserOperation({
|
|
212
|
-
calls: [
|
|
213
|
-
{
|
|
214
|
-
to: safeAccountClient.account.address,
|
|
215
|
-
data: "0x"
|
|
216
|
-
}
|
|
217
|
-
]
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
let partialSignatures = await signUserOperation({
|
|
221
|
-
version: "1.4.1",
|
|
222
|
-
entryPoint: {
|
|
223
|
-
address: entryPoint07Address,
|
|
224
|
-
version: "0.7"
|
|
225
|
-
},
|
|
226
|
-
chainId: foundry.id,
|
|
227
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
228
|
-
account: owners[0],
|
|
229
|
-
safe4337ModuleAddress: "0x7579EE8307284F293B1927136486880611F20002",
|
|
230
|
-
...unSignedUserOperation
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
partialSignatures = await signUserOperation({
|
|
234
|
-
version: "1.4.1",
|
|
235
|
-
entryPoint: {
|
|
236
|
-
address: entryPoint07Address,
|
|
237
|
-
version: "0.7"
|
|
238
|
-
},
|
|
239
|
-
chainId: foundry.id,
|
|
240
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
241
|
-
account: owners[1],
|
|
242
|
-
signatures: partialSignatures,
|
|
243
|
-
safe4337ModuleAddress: "0x7579EE8307284F293B1927136486880611F20002",
|
|
244
|
-
...unSignedUserOperation
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
const finalSignature = await signUserOperation({
|
|
248
|
-
version: "1.4.1",
|
|
249
|
-
entryPoint: {
|
|
250
|
-
address: entryPoint07Address,
|
|
251
|
-
version: "0.7"
|
|
252
|
-
},
|
|
253
|
-
chainId: foundry.id,
|
|
254
|
-
owners: owners.map((owner) => toAccount(owner.address)),
|
|
255
|
-
account: owners[2],
|
|
256
|
-
signatures: partialSignatures,
|
|
257
|
-
safe4337ModuleAddress: "0x7579EE8307284F293B1927136486880611F20002",
|
|
258
|
-
...unSignedUserOperation
|
|
259
|
-
})
|
|
260
|
-
|
|
261
|
-
const userOpHash = safeAccountClient.sendUserOperation({
|
|
262
|
-
...unSignedUserOperation,
|
|
263
|
-
signature: finalSignature
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
expect(userOpHash).toBeTruthy()
|
|
267
|
-
|
|
268
|
-
const receipt = await safeAccountClient.waitForUserOperationReceipt({
|
|
269
|
-
hash: await userOpHash
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
expect(receipt).toBeTruthy()
|
|
273
|
-
expect(receipt.success).toBeTruthy()
|
|
274
|
-
})
|
|
275
|
-
})
|
|
@@ -1,39 +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 { accountId } from "./accountId"
|
|
6
|
-
|
|
7
|
-
describe.each(getCoreSmartAccounts())(
|
|
8
|
-
"accountId $name",
|
|
9
|
-
({ getErc7579SmartAccountClient }) => {
|
|
10
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
11
|
-
"accountId",
|
|
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 accountIdBeforeDeploy = await accountId(smartClient)
|
|
25
|
-
|
|
26
|
-
// deploy account
|
|
27
|
-
await smartClient.sendTransaction({
|
|
28
|
-
to: zeroAddress,
|
|
29
|
-
value: 0n,
|
|
30
|
-
data: "0x"
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const postDeployAccountId = await accountId(smartClient)
|
|
34
|
-
|
|
35
|
-
expect(accountIdBeforeDeploy).toBe(postDeployAccountId)
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
)
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { encodeAbiParameters, encodePacked, isHash, zeroAddress } from "viem"
|
|
2
|
-
import { 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 { installModule } from "./installModule"
|
|
11
|
-
|
|
12
|
-
describe.each(getCoreSmartAccounts())(
|
|
13
|
-
"installModule $name",
|
|
14
|
-
({ getErc7579SmartAccountClient, name, isEip7702Compliant }) => {
|
|
15
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
16
|
-
"installModule",
|
|
17
|
-
async ({ rpc }) => {
|
|
18
|
-
if (!getErc7579SmartAccountClient) {
|
|
19
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const privateKey =
|
|
23
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
24
|
-
|
|
25
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
26
|
-
|
|
27
|
-
const smartClientWithoutExtend =
|
|
28
|
-
await getErc7579SmartAccountClient({
|
|
29
|
-
entryPoint: {
|
|
30
|
-
version: "0.7"
|
|
31
|
-
},
|
|
32
|
-
privateKey,
|
|
33
|
-
...rpc
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const publicClient = getPublicClient(rpc.anvilRpc)
|
|
37
|
-
|
|
38
|
-
const smartClient = smartClientWithoutExtend.extend(
|
|
39
|
-
erc7579Actions()
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
const moduleData = encodePacked(
|
|
43
|
-
["address"],
|
|
44
|
-
[smartClient.account.address]
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
const opHash = await installModule(smartClient, {
|
|
48
|
-
account: smartClient.account,
|
|
49
|
-
type: "executor",
|
|
50
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
51
|
-
initData: name.startsWith("Kernel 7579")
|
|
52
|
-
? encodePacked(
|
|
53
|
-
["address", "bytes"],
|
|
54
|
-
[
|
|
55
|
-
zeroAddress,
|
|
56
|
-
encodeAbiParameters(
|
|
57
|
-
[{ type: "bytes" }, { type: "bytes" }],
|
|
58
|
-
[moduleData, "0x"]
|
|
59
|
-
)
|
|
60
|
-
]
|
|
61
|
-
)
|
|
62
|
-
: moduleData,
|
|
63
|
-
authorization: isEip7702Compliant
|
|
64
|
-
? await privateKeyAccount.signAuthorization({
|
|
65
|
-
address: (smartClient.account as any)
|
|
66
|
-
.implementation,
|
|
67
|
-
chainId: smartClient.chain.id,
|
|
68
|
-
nonce: await publicClient.getTransactionCount({
|
|
69
|
-
address: smartClient.account.address
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
: undefined
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
expect(isHash(opHash)).toBe(true)
|
|
76
|
-
|
|
77
|
-
const userOperationReceipt =
|
|
78
|
-
await smartClient.waitForUserOperationReceipt({
|
|
79
|
-
hash: opHash,
|
|
80
|
-
timeout: 100000
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
expect(userOperationReceipt).not.toBeNull()
|
|
84
|
-
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
85
|
-
expect(
|
|
86
|
-
userOperationReceipt?.receipt.transactionHash
|
|
87
|
-
).toBeTruthy()
|
|
88
|
-
|
|
89
|
-
const receipt = await smartClient.getUserOperationReceipt({
|
|
90
|
-
hash: opHash
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
expect(receipt?.receipt.transactionHash).toBe(
|
|
94
|
-
userOperationReceipt?.receipt.transactionHash
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
const isModuleInstalled = await smartClient.isModuleInstalled({
|
|
98
|
-
type: "executor",
|
|
99
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
100
|
-
context: "0x"
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
expect(isModuleInstalled).toBe(true)
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
107
|
-
"installModule",
|
|
108
|
-
async ({ rpc }) => {
|
|
109
|
-
if (!getErc7579SmartAccountClient) {
|
|
110
|
-
throw new Error("getErc7579SmartAccountClient not defined")
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const privateKey =
|
|
114
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
115
|
-
|
|
116
|
-
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
117
|
-
|
|
118
|
-
const smartClientWithoutExtend =
|
|
119
|
-
await getErc7579SmartAccountClient({
|
|
120
|
-
entryPoint: {
|
|
121
|
-
version: "0.7"
|
|
122
|
-
},
|
|
123
|
-
privateKey,
|
|
124
|
-
...rpc
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
const publicClient = getPublicClient(rpc.anvilRpc)
|
|
128
|
-
|
|
129
|
-
const smartClient = smartClientWithoutExtend.extend(
|
|
130
|
-
erc7579Actions()
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
const userOpHash = await smartClient.sendUserOperation({
|
|
134
|
-
calls: [
|
|
135
|
-
{
|
|
136
|
-
to: smartClient.account.address,
|
|
137
|
-
value: 0n,
|
|
138
|
-
data: "0x"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
to: smartClient.account.address,
|
|
142
|
-
value: 0n,
|
|
143
|
-
data: "0x"
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
authorization: isEip7702Compliant
|
|
147
|
-
? await privateKeyAccount.signAuthorization({
|
|
148
|
-
address: (smartClient.account as any)
|
|
149
|
-
.implementation,
|
|
150
|
-
chainId: smartClient.chain.id,
|
|
151
|
-
nonce: await publicClient.getTransactionCount({
|
|
152
|
-
address: smartClient.account.address
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
: undefined
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
await smartClient.waitForUserOperationReceipt({
|
|
159
|
-
hash: userOpHash
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
const moduleData = encodePacked(
|
|
163
|
-
["address"],
|
|
164
|
-
[smartClient.account.address]
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
const opHash = await installModule(smartClient, {
|
|
168
|
-
account: smartClient.account,
|
|
169
|
-
type: "executor",
|
|
170
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
171
|
-
context: name.startsWith("Kernel 7579")
|
|
172
|
-
? encodePacked(
|
|
173
|
-
["address", "bytes"],
|
|
174
|
-
[
|
|
175
|
-
zeroAddress,
|
|
176
|
-
encodeAbiParameters(
|
|
177
|
-
[{ type: "bytes" }, { type: "bytes" }],
|
|
178
|
-
[moduleData, "0x"]
|
|
179
|
-
)
|
|
180
|
-
]
|
|
181
|
-
)
|
|
182
|
-
: moduleData
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
expect(isHash(opHash)).toBe(true)
|
|
186
|
-
|
|
187
|
-
const userOperationReceipt =
|
|
188
|
-
await smartClient.waitForUserOperationReceipt({
|
|
189
|
-
hash: opHash,
|
|
190
|
-
timeout: 100000
|
|
191
|
-
})
|
|
192
|
-
expect(userOperationReceipt).not.toBeNull()
|
|
193
|
-
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
194
|
-
expect(
|
|
195
|
-
userOperationReceipt?.receipt.transactionHash
|
|
196
|
-
).toBeTruthy()
|
|
197
|
-
|
|
198
|
-
const receipt = await smartClient.getUserOperationReceipt({
|
|
199
|
-
hash: opHash
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
expect(receipt?.receipt.transactionHash).toBe(
|
|
203
|
-
userOperationReceipt?.receipt.transactionHash
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
const isModuleInstalled = await smartClient.isModuleInstalled({
|
|
207
|
-
type: "executor",
|
|
208
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
209
|
-
context: "0x"
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
expect(isModuleInstalled).toBe(true)
|
|
213
|
-
}
|
|
214
|
-
)
|
|
215
|
-
}
|
|
216
|
-
)
|