permissionless 0.2.45 → 0.2.47
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 +12 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/etherspot/toEtherspotSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/toSimpleSmartAccount.js +208 -178
- package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_cjs/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/pimlico.js.map +1 -1
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_cjs/utils/getEstimationCallData.js +13 -0
- package/_cjs/utils/getEstimationCallData.js.map +1 -1
- package/_cjs/utils/getRequiredPrefund.js.map +1 -1
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/etherspot/toEtherspotSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/toSimpleSmartAccount.js +211 -179
- package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_esm/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/pimlico.js.map +1 -1
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_esm/utils/getEstimationCallData.js +13 -0
- package/_esm/utils/getEstimationCallData.js.map +1 -1
- package/_esm/utils/getRequiredPrefund.js.map +1 -1
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts +2 -2
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/etherspot/toEtherspotSmartAccount.d.ts +2 -2
- package/_types/accounts/etherspot/toEtherspotSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts +2 -2
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/light/toLightSmartAccount.d.ts +2 -2
- package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts +2 -2
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -1
- package/_types/accounts/safe/toSafeSmartAccount.d.ts +2 -2
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts +2303 -7
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts +2 -2
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts.map +1 -1
- package/_types/accounts/trust/toTrustSmartAccount.d.ts +2 -2
- package/_types/accounts/trust/toTrustSmartAccount.d.ts.map +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +4 -4
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +3 -2
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/pimlico.d.ts +4 -4
- package/_types/clients/pimlico.d.ts.map +1 -1
- package/_types/types/pimlico.d.ts +3 -3
- package/_types/types/pimlico.d.ts.map +1 -1
- package/_types/utils/getEstimationCallData.d.ts +3 -3
- package/_types/utils/getEstimationCallData.d.ts.map +1 -1
- package/_types/utils/getRequiredPrefund.d.ts +3 -3
- package/_types/utils/getRequiredPrefund.d.ts.map +1 -1
- package/accounts/biconomy/toBiconomySmartAccount.ts +6 -1
- package/accounts/decodeCalls.test.ts +161 -0
- package/accounts/etherspot/toEtherspotSmartAccount.ts +6 -1
- package/accounts/kernel/toKernelSmartAccount.ts +6 -1
- package/accounts/light/toLightSmartAccount.ts +6 -1
- package/accounts/nexus/toNexusSmartAccount.ts +6 -1
- package/accounts/safe/toSafeSmartAccount.ts +7 -2
- package/accounts/simple/toSimpleSmartAccount.ts +243 -197
- package/accounts/thirdweb/toThirdwebSmartAccount.ts +6 -1
- package/accounts/trust/toTrustSmartAccount.ts +6 -1
- package/actions/pimlico/getTokenQuotes.test.ts +55 -1
- package/actions/pimlico/getUserOperationGasPrice.test.ts +50 -0
- package/actions/pimlico/getUserOperationStatus.test.ts +62 -0
- package/actions/pimlico/sponsorUserOperation.test.ts +51 -0
- package/actions/pimlico/sponsorUserOperation.ts +4 -4
- package/actions/pimlico/validateSponsorshipPolicies.test.ts +98 -2
- package/actions/public/getAccountNonce.test.ts +27 -0
- package/actions/public/getSenderAddress.test.ts +37 -1
- package/actions/smartAccount/sendTransaction.test.ts +121 -1
- package/actions/smartAccount/signMessage.test.ts +59 -0
- package/actions/smartAccount/signTypedData.test.ts +54 -0
- package/clients/decorators/pimlico.ts +3 -2
- package/clients/pimlico.ts +4 -3
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +208 -43
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +1 -1
- package/package.json +2 -2
- package/types/pimlico.ts +12 -2
- package/utils/getEstimationCallData.ts +25 -7
- package/utils/getRequiredPrefund.ts +6 -4
|
@@ -12,6 +12,56 @@ describe("getUserOperationGasPrice", () => {
|
|
|
12
12
|
|
|
13
13
|
const gasPrice = await getUserOperationGasPrice(pimlicoBundlerClient)
|
|
14
14
|
|
|
15
|
+
expect(gasPrice).toBeTruthy()
|
|
16
|
+
expect(gasPrice.slow).toBeTruthy()
|
|
17
|
+
expect(gasPrice.standard).toBeTruthy()
|
|
18
|
+
expect(gasPrice.fast).toBeTruthy()
|
|
19
|
+
expect(typeof gasPrice.slow.maxFeePerGas).toBe("bigint")
|
|
20
|
+
expect(gasPrice.slow.maxFeePerGas).toBeGreaterThan(0n)
|
|
21
|
+
expect(typeof gasPrice.slow.maxPriorityFeePerGas).toBe("bigint")
|
|
22
|
+
expect(gasPrice.slow.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
23
|
+
expect(typeof gasPrice.standard.maxFeePerGas).toBe("bigint")
|
|
24
|
+
expect(gasPrice.standard.maxFeePerGas).toBeGreaterThan(0n)
|
|
25
|
+
expect(typeof gasPrice.standard.maxPriorityFeePerGas).toBe("bigint")
|
|
26
|
+
expect(gasPrice.standard.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
27
|
+
expect(typeof gasPrice.fast.maxFeePerGas).toBe("bigint")
|
|
28
|
+
expect(gasPrice.fast.maxFeePerGas).toBeGreaterThan(0n)
|
|
29
|
+
expect(typeof gasPrice.fast.maxPriorityFeePerGas).toBe("bigint")
|
|
30
|
+
expect(gasPrice.fast.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
31
|
+
})
|
|
32
|
+
testWithRpc("getUserOperationGasPrice", async ({ rpc }) => {
|
|
33
|
+
const pimlicoBundlerClient = getPimlicoClient({
|
|
34
|
+
entryPointVersion: "0.7",
|
|
35
|
+
altoRpc: rpc.altoRpc
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const gasPrice = await getUserOperationGasPrice(pimlicoBundlerClient)
|
|
39
|
+
|
|
40
|
+
expect(gasPrice).toBeTruthy()
|
|
41
|
+
expect(gasPrice.slow).toBeTruthy()
|
|
42
|
+
expect(gasPrice.standard).toBeTruthy()
|
|
43
|
+
expect(gasPrice.fast).toBeTruthy()
|
|
44
|
+
expect(typeof gasPrice.slow.maxFeePerGas).toBe("bigint")
|
|
45
|
+
expect(gasPrice.slow.maxFeePerGas).toBeGreaterThan(0n)
|
|
46
|
+
expect(typeof gasPrice.slow.maxPriorityFeePerGas).toBe("bigint")
|
|
47
|
+
expect(gasPrice.slow.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
48
|
+
expect(typeof gasPrice.standard.maxFeePerGas).toBe("bigint")
|
|
49
|
+
expect(gasPrice.standard.maxFeePerGas).toBeGreaterThan(0n)
|
|
50
|
+
expect(typeof gasPrice.standard.maxPriorityFeePerGas).toBe("bigint")
|
|
51
|
+
expect(gasPrice.standard.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
52
|
+
expect(typeof gasPrice.fast.maxFeePerGas).toBe("bigint")
|
|
53
|
+
expect(gasPrice.fast.maxFeePerGas).toBeGreaterThan(0n)
|
|
54
|
+
expect(typeof gasPrice.fast.maxPriorityFeePerGas).toBe("bigint")
|
|
55
|
+
expect(gasPrice.fast.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
56
|
+
})
|
|
57
|
+
testWithRpc("getUserOperationGasPrice", async ({ rpc }) => {
|
|
58
|
+
const pimlicoBundlerClient = getPimlicoClient({
|
|
59
|
+
entryPointVersion: "0.8",
|
|
60
|
+
altoRpc: rpc.altoRpc
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const gasPrice = await getUserOperationGasPrice(pimlicoBundlerClient)
|
|
64
|
+
|
|
15
65
|
expect(gasPrice).toBeTruthy()
|
|
16
66
|
expect(gasPrice.slow).toBeTruthy()
|
|
17
67
|
expect(gasPrice.standard).toBeTruthy()
|
|
@@ -119,6 +119,68 @@ describe("getUserOperationStatus", () => {
|
|
|
119
119
|
hash: opHash
|
|
120
120
|
})
|
|
121
121
|
|
|
122
|
+
expect(receipt?.receipt.transactionHash).toBe(
|
|
123
|
+
userOperationReceipt?.receipt.transactionHash
|
|
124
|
+
)
|
|
125
|
+
const userOperationStatus = await getUserOperationStatus(
|
|
126
|
+
bundlerClient,
|
|
127
|
+
{
|
|
128
|
+
hash: opHash
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
expect(userOperationStatus).not.toBeNull()
|
|
132
|
+
expect(userOperationStatus).not.toBeUndefined()
|
|
133
|
+
expect(userOperationStatus.status).toBe("included")
|
|
134
|
+
expect(userOperationStatus.transactionHash).toBe(
|
|
135
|
+
userOperationReceipt?.receipt.transactionHash
|
|
136
|
+
)
|
|
137
|
+
})
|
|
138
|
+
testWithRpc("getUserOperationStatus_V07", async ({ rpc }) => {
|
|
139
|
+
const { altoRpc } = rpc
|
|
140
|
+
|
|
141
|
+
const bundlerClient = getPimlicoClient({
|
|
142
|
+
entryPointVersion: "0.8",
|
|
143
|
+
altoRpc: altoRpc
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
const simpleAccountClient = getBundlerClient({
|
|
147
|
+
account: await getSimpleAccountClient({
|
|
148
|
+
...rpc,
|
|
149
|
+
entryPoint: {
|
|
150
|
+
version: "0.8"
|
|
151
|
+
}
|
|
152
|
+
}),
|
|
153
|
+
entryPoint: {
|
|
154
|
+
version: "0.8"
|
|
155
|
+
},
|
|
156
|
+
...rpc
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
const opHash = await simpleAccountClient.sendUserOperation({
|
|
160
|
+
calls: [
|
|
161
|
+
{
|
|
162
|
+
to: zeroAddress,
|
|
163
|
+
data: "0x",
|
|
164
|
+
value: 0n
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
expect(isHash(opHash)).toBe(true)
|
|
170
|
+
|
|
171
|
+
const userOperationReceipt =
|
|
172
|
+
await bundlerClient.waitForUserOperationReceipt({
|
|
173
|
+
hash: opHash,
|
|
174
|
+
timeout: 100000
|
|
175
|
+
})
|
|
176
|
+
expect(userOperationReceipt).not.toBeNull()
|
|
177
|
+
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
178
|
+
expect(userOperationReceipt?.receipt.transactionHash).toBeTruthy()
|
|
179
|
+
|
|
180
|
+
const receipt = await bundlerClient.getUserOperationReceipt({
|
|
181
|
+
hash: opHash
|
|
182
|
+
})
|
|
183
|
+
|
|
122
184
|
expect(receipt?.receipt.transactionHash).toBe(
|
|
123
185
|
userOperationReceipt?.receipt.transactionHash
|
|
124
186
|
)
|
|
@@ -110,4 +110,55 @@ describe("sponsorUserOperation", () => {
|
|
|
110
110
|
userOperationReceipt?.receipt.transactionHash
|
|
111
111
|
)
|
|
112
112
|
})
|
|
113
|
+
|
|
114
|
+
testWithRpc("sponsorUserOperation_V08", async ({ rpc }) => {
|
|
115
|
+
const { altoRpc } = rpc
|
|
116
|
+
|
|
117
|
+
const bundlerClient = getPimlicoClient({
|
|
118
|
+
entryPointVersion: "0.8",
|
|
119
|
+
altoRpc: altoRpc
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const simpleAccountClient = getBundlerClient({
|
|
123
|
+
account: await getSimpleAccountClient({
|
|
124
|
+
...rpc,
|
|
125
|
+
entryPoint: {
|
|
126
|
+
version: "0.8"
|
|
127
|
+
}
|
|
128
|
+
}),
|
|
129
|
+
entryPoint: {
|
|
130
|
+
version: "0.8"
|
|
131
|
+
},
|
|
132
|
+
...rpc
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
const opHash = await simpleAccountClient.sendUserOperation({
|
|
136
|
+
calls: [
|
|
137
|
+
{
|
|
138
|
+
to: zeroAddress,
|
|
139
|
+
data: "0x",
|
|
140
|
+
value: 0n
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
expect(isHash(opHash)).toBe(true)
|
|
146
|
+
|
|
147
|
+
const userOperationReceipt =
|
|
148
|
+
await bundlerClient.waitForUserOperationReceipt({
|
|
149
|
+
hash: opHash,
|
|
150
|
+
timeout: 100000
|
|
151
|
+
})
|
|
152
|
+
expect(userOperationReceipt).not.toBeNull()
|
|
153
|
+
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
154
|
+
expect(userOperationReceipt?.receipt.transactionHash).toBeTruthy()
|
|
155
|
+
|
|
156
|
+
const receipt = await bundlerClient.getUserOperationReceipt({
|
|
157
|
+
hash: opHash
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
expect(receipt?.receipt.transactionHash).toBe(
|
|
161
|
+
userOperationReceipt?.receipt.transactionHash
|
|
162
|
+
)
|
|
163
|
+
})
|
|
113
164
|
})
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
PartialBy,
|
|
9
9
|
Transport
|
|
10
10
|
} from "viem"
|
|
11
|
-
import type { UserOperation } from "viem/account-abstraction"
|
|
11
|
+
import type { EntryPointVersion, UserOperation } from "viem/account-abstraction"
|
|
12
12
|
import type { PimlicoRpcSchema } from "../../types/pimlico.js"
|
|
13
13
|
import { deepHexlify } from "../../utils/deepHexlify.js"
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ type PaymasterContext = {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export type PimlicoSponsorUserOperationParameters<
|
|
23
|
-
entryPointVersion extends
|
|
23
|
+
entryPointVersion extends EntryPointVersion
|
|
24
24
|
> = {
|
|
25
25
|
userOperation: OneOf<
|
|
26
26
|
| (entryPointVersion extends "0.6"
|
|
@@ -51,7 +51,7 @@ export type PimlicoSponsorUserOperationParameters<
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export type SponsorUserOperationReturnType<
|
|
54
|
-
entryPointVersion extends
|
|
54
|
+
entryPointVersion extends EntryPointVersion = "0.7"
|
|
55
55
|
> = OneOf<
|
|
56
56
|
| (entryPointVersion extends "0.6"
|
|
57
57
|
? {
|
|
@@ -75,7 +75,7 @@ export type SponsorUserOperationReturnType<
|
|
|
75
75
|
>
|
|
76
76
|
|
|
77
77
|
export const sponsorUserOperation = async <
|
|
78
|
-
entryPointVersion extends
|
|
78
|
+
entryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
79
79
|
>(
|
|
80
80
|
client: Client<
|
|
81
81
|
Transport,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
entryPoint06Address,
|
|
3
|
+
entryPoint07Address,
|
|
4
|
+
entryPoint08Address
|
|
5
|
+
} from "viem/account-abstraction"
|
|
2
6
|
import { describe, expect } from "vitest"
|
|
3
7
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
4
8
|
import {
|
|
@@ -9,7 +13,7 @@ import {
|
|
|
9
13
|
import { validateSponsorshipPolicies } from "./validateSponsorshipPolicies"
|
|
10
14
|
|
|
11
15
|
describe("validateSponsorshipPolicies", () => {
|
|
12
|
-
testWithRpc("Validating sponsorship policies", async ({ rpc }) => {
|
|
16
|
+
testWithRpc("Validating sponsorship policies V06", async ({ rpc }) => {
|
|
13
17
|
const { paymasterRpc } = rpc
|
|
14
18
|
|
|
15
19
|
const simpleAccountClient = getBundlerClient({
|
|
@@ -54,4 +58,96 @@ describe("validateSponsorshipPolicies", () => {
|
|
|
54
58
|
expect(Array.isArray(policies)).toBe(true)
|
|
55
59
|
expect(policies.length).toBe(1)
|
|
56
60
|
})
|
|
61
|
+
|
|
62
|
+
testWithRpc("Validating sponsorship policies V07", async ({ rpc }) => {
|
|
63
|
+
const { paymasterRpc } = rpc
|
|
64
|
+
|
|
65
|
+
const simpleAccountClient = getBundlerClient({
|
|
66
|
+
account: await getSimpleAccountClient({
|
|
67
|
+
...rpc,
|
|
68
|
+
entryPoint: {
|
|
69
|
+
version: "0.7"
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
entryPoint: {
|
|
73
|
+
version: "0.7"
|
|
74
|
+
},
|
|
75
|
+
...rpc
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const userOperation = await simpleAccountClient.prepareUserOperation({
|
|
79
|
+
calls: [
|
|
80
|
+
{
|
|
81
|
+
to: "0x5af0d9827e0c53e4799bb226655a1de152a425a5",
|
|
82
|
+
data: "0x",
|
|
83
|
+
value: 0n
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
const pimlicoPaymasterClient = getPimlicoClient({
|
|
89
|
+
entryPointVersion: "0.7",
|
|
90
|
+
altoRpc: paymasterRpc
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const policies = await validateSponsorshipPolicies(
|
|
94
|
+
pimlicoPaymasterClient,
|
|
95
|
+
{
|
|
96
|
+
entryPointAddress: entryPoint07Address,
|
|
97
|
+
userOperation: userOperation,
|
|
98
|
+
sponsorshipPolicyIds: ["sp_crazy_kangaroo"]
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
expect(policies).toBeTruthy()
|
|
103
|
+
expect(policies.length).toBeGreaterThan(0)
|
|
104
|
+
expect(Array.isArray(policies)).toBe(true)
|
|
105
|
+
expect(policies.length).toBe(1)
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
testWithRpc("Validating sponsorship policies V08", async ({ rpc }) => {
|
|
109
|
+
const { paymasterRpc } = rpc
|
|
110
|
+
|
|
111
|
+
const simpleAccountClient = getBundlerClient({
|
|
112
|
+
account: await getSimpleAccountClient({
|
|
113
|
+
...rpc,
|
|
114
|
+
entryPoint: {
|
|
115
|
+
version: "0.8"
|
|
116
|
+
}
|
|
117
|
+
}),
|
|
118
|
+
entryPoint: {
|
|
119
|
+
version: "0.8"
|
|
120
|
+
},
|
|
121
|
+
...rpc
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const userOperation = await simpleAccountClient.prepareUserOperation({
|
|
125
|
+
calls: [
|
|
126
|
+
{
|
|
127
|
+
to: "0x5af0d9827e0c53e4799bb226655a1de152a425a5",
|
|
128
|
+
data: "0x",
|
|
129
|
+
value: 0n
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
const pimlicoPaymasterClient = getPimlicoClient({
|
|
135
|
+
entryPointVersion: "0.8",
|
|
136
|
+
altoRpc: paymasterRpc
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
const policies = await validateSponsorshipPolicies(
|
|
140
|
+
pimlicoPaymasterClient,
|
|
141
|
+
{
|
|
142
|
+
entryPointAddress: entryPoint08Address,
|
|
143
|
+
userOperation: userOperation,
|
|
144
|
+
sponsorshipPolicyIds: ["sp_crazy_kangaroo"]
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
expect(policies).toBeTruthy()
|
|
149
|
+
expect(policies.length).toBeGreaterThan(0)
|
|
150
|
+
expect(Array.isArray(policies)).toBe(true)
|
|
151
|
+
expect(policies.length).toBe(1)
|
|
152
|
+
})
|
|
57
153
|
})
|
|
@@ -65,6 +65,33 @@ describe("getAccountNonce", () => {
|
|
|
65
65
|
address: simpleAccountClient.account.address
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
+
expect(nonce).toBe(0n)
|
|
69
|
+
})
|
|
70
|
+
testWithRpc("getAccountNonce_V08", async ({ rpc }) => {
|
|
71
|
+
const { anvilRpc } = rpc
|
|
72
|
+
|
|
73
|
+
const client = createPublicClient({
|
|
74
|
+
transport: http(anvilRpc)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const simpleAccountClient = getBundlerClient({
|
|
78
|
+
account: await getSimpleAccountClient({
|
|
79
|
+
...rpc,
|
|
80
|
+
entryPoint: {
|
|
81
|
+
version: "0.8"
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
entryPoint: {
|
|
85
|
+
version: "0.8"
|
|
86
|
+
},
|
|
87
|
+
...rpc
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const nonce = await getAccountNonce(client, {
|
|
91
|
+
entryPointAddress: entryPoint07Address,
|
|
92
|
+
address: simpleAccountClient.account.address
|
|
93
|
+
})
|
|
94
|
+
|
|
68
95
|
expect(nonce).toBe(0n)
|
|
69
96
|
})
|
|
70
97
|
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { http, concatHex, createPublicClient } from "viem"
|
|
2
2
|
import {
|
|
3
3
|
entryPoint06Address,
|
|
4
|
-
entryPoint07Address
|
|
4
|
+
entryPoint07Address,
|
|
5
|
+
entryPoint08Address
|
|
5
6
|
} from "viem/account-abstraction"
|
|
6
7
|
import { describe, expect } from "vitest"
|
|
7
8
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
@@ -113,6 +114,41 @@ describe("getSenderAddress", () => {
|
|
|
113
114
|
factoryData
|
|
114
115
|
})
|
|
115
116
|
|
|
117
|
+
expect(address).toBe(simpleAccountClient.account.address)
|
|
118
|
+
})
|
|
119
|
+
testWithRpc("getSenderAddress_V08", async ({ rpc }) => {
|
|
120
|
+
const { anvilRpc, altoRpc } = rpc
|
|
121
|
+
|
|
122
|
+
const client = createPublicClient({
|
|
123
|
+
transport: http(anvilRpc)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const simpleAccountClient = getBundlerClient({
|
|
127
|
+
account: await getSimpleAccountClient({
|
|
128
|
+
...rpc,
|
|
129
|
+
entryPoint: {
|
|
130
|
+
version: "0.8"
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
entryPoint: {
|
|
134
|
+
version: "0.8"
|
|
135
|
+
},
|
|
136
|
+
...rpc
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
const { factory, factoryData } =
|
|
140
|
+
await simpleAccountClient.account.getFactoryArgs()
|
|
141
|
+
|
|
142
|
+
if (!factory || !factoryData) {
|
|
143
|
+
throw new Error("Factory or factoryData not found")
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const address = await getSenderAddress(client, {
|
|
147
|
+
entryPointAddress: entryPoint08Address,
|
|
148
|
+
factory,
|
|
149
|
+
factoryData
|
|
150
|
+
})
|
|
151
|
+
|
|
116
152
|
expect(address).toBe(simpleAccountClient.account.address)
|
|
117
153
|
})
|
|
118
154
|
})
|
|
@@ -13,7 +13,8 @@ describe.each(getCoreSmartAccounts())(
|
|
|
13
13
|
({
|
|
14
14
|
getSmartAccountClient,
|
|
15
15
|
supportsEntryPointV06,
|
|
16
|
-
supportsEntryPointV07
|
|
16
|
+
supportsEntryPointV07,
|
|
17
|
+
supportsEntryPointV08
|
|
17
18
|
}) => {
|
|
18
19
|
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
19
20
|
"sendTransaction_v06",
|
|
@@ -117,6 +118,58 @@ describe.each(getCoreSmartAccounts())(
|
|
|
117
118
|
}
|
|
118
119
|
)
|
|
119
120
|
|
|
121
|
+
testWithRpc.skipIf(!supportsEntryPointV08)(
|
|
122
|
+
"sendTransaction_v08",
|
|
123
|
+
async ({ rpc }) => {
|
|
124
|
+
const { anvilRpc } = rpc
|
|
125
|
+
|
|
126
|
+
const smartClient = await getSmartAccountClient({
|
|
127
|
+
entryPoint: {
|
|
128
|
+
version: "0.8"
|
|
129
|
+
},
|
|
130
|
+
privateKey:
|
|
131
|
+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", // anvil private key
|
|
132
|
+
...rpc
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
const transactionHash = await sendTransaction(smartClient, {
|
|
136
|
+
to: zeroAddress,
|
|
137
|
+
data: "0x",
|
|
138
|
+
value: 0n
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
expect(transactionHash).toBeTruthy()
|
|
142
|
+
|
|
143
|
+
const publicClient = getPublicClient(anvilRpc)
|
|
144
|
+
|
|
145
|
+
const receipt = await publicClient.getTransactionReceipt({
|
|
146
|
+
hash: transactionHash
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
expect(receipt).toBeTruthy()
|
|
150
|
+
expect(receipt.transactionHash).toBe(transactionHash)
|
|
151
|
+
expect(receipt.status).toBe("success")
|
|
152
|
+
|
|
153
|
+
const transactionHash2 = await sendTransaction(smartClient, {
|
|
154
|
+
to: zeroAddress,
|
|
155
|
+
data: "0x",
|
|
156
|
+
value: 0n
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
// -- second transaction after deployment
|
|
160
|
+
|
|
161
|
+
expect(transactionHash2).toBeTruthy()
|
|
162
|
+
|
|
163
|
+
const receipt2 = await publicClient.getTransactionReceipt({
|
|
164
|
+
hash: transactionHash2
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
expect(receipt2).toBeTruthy()
|
|
168
|
+
expect(receipt2.transactionHash).toBe(transactionHash2)
|
|
169
|
+
expect(receipt2.status).toBe("success")
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
|
|
120
173
|
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
121
174
|
"sendTransaction_v06 post deployment",
|
|
122
175
|
async ({ rpc }) => {
|
|
@@ -191,6 +244,8 @@ describe.each(getCoreSmartAccounts())(
|
|
|
191
244
|
entryPoint: {
|
|
192
245
|
version: "0.7"
|
|
193
246
|
},
|
|
247
|
+
privateKey:
|
|
248
|
+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", // anvil private key
|
|
194
249
|
...rpc
|
|
195
250
|
})
|
|
196
251
|
|
|
@@ -243,5 +298,70 @@ describe.each(getCoreSmartAccounts())(
|
|
|
243
298
|
expect(receipt2.status).toBe("success")
|
|
244
299
|
}
|
|
245
300
|
)
|
|
301
|
+
|
|
302
|
+
testWithRpc.skipIf(!supportsEntryPointV08)(
|
|
303
|
+
"sendTransaction_v08 post deployment",
|
|
304
|
+
async ({ rpc }) => {
|
|
305
|
+
const { anvilRpc } = rpc
|
|
306
|
+
|
|
307
|
+
await (async () => {
|
|
308
|
+
const smartClient = await getSmartAccountClient({
|
|
309
|
+
entryPoint: {
|
|
310
|
+
version: "0.8"
|
|
311
|
+
},
|
|
312
|
+
privateKey:
|
|
313
|
+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", // anvil private key
|
|
314
|
+
...rpc
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
const transactionHash = await sendTransaction(smartClient, {
|
|
318
|
+
to: zeroAddress,
|
|
319
|
+
data: "0x",
|
|
320
|
+
value: 0n
|
|
321
|
+
})
|
|
322
|
+
|
|
323
|
+
expect(transactionHash).toBeTruthy()
|
|
324
|
+
|
|
325
|
+
const publicClient = getPublicClient(anvilRpc)
|
|
326
|
+
|
|
327
|
+
const receipt = await publicClient.getTransactionReceipt({
|
|
328
|
+
hash: transactionHash
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
expect(receipt).toBeTruthy()
|
|
332
|
+
expect(receipt.transactionHash).toBe(transactionHash)
|
|
333
|
+
expect(receipt.status).toBe("success")
|
|
334
|
+
})()
|
|
335
|
+
|
|
336
|
+
const smartClient = await getSmartAccountClient({
|
|
337
|
+
entryPoint: {
|
|
338
|
+
version: "0.8"
|
|
339
|
+
},
|
|
340
|
+
privateKey:
|
|
341
|
+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", // anvil private key
|
|
342
|
+
...rpc
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
const publicClient = getPublicClient(anvilRpc)
|
|
346
|
+
|
|
347
|
+
const transactionHash2 = await sendTransaction(smartClient, {
|
|
348
|
+
to: zeroAddress,
|
|
349
|
+
data: "0x",
|
|
350
|
+
value: 0n
|
|
351
|
+
})
|
|
352
|
+
|
|
353
|
+
// -- second transaction after deployment
|
|
354
|
+
|
|
355
|
+
expect(transactionHash2).toBeTruthy()
|
|
356
|
+
|
|
357
|
+
const receipt2 = await publicClient.getTransactionReceipt({
|
|
358
|
+
hash: transactionHash2
|
|
359
|
+
})
|
|
360
|
+
|
|
361
|
+
expect(receipt2).toBeTruthy()
|
|
362
|
+
expect(receipt2.transactionHash).toBe(transactionHash2)
|
|
363
|
+
expect(receipt2.status).toBe("success")
|
|
364
|
+
}
|
|
365
|
+
)
|
|
246
366
|
}
|
|
247
367
|
)
|
|
@@ -14,6 +14,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
14
14
|
isEip1271Compliant,
|
|
15
15
|
supportsEntryPointV06,
|
|
16
16
|
supportsEntryPointV07,
|
|
17
|
+
supportsEntryPointV08,
|
|
17
18
|
name
|
|
18
19
|
}) => {
|
|
19
20
|
testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV06)(
|
|
@@ -131,5 +132,63 @@ describe.each(getCoreSmartAccounts())(
|
|
|
131
132
|
expect(isVerified).toBeTruthy()
|
|
132
133
|
}
|
|
133
134
|
)
|
|
135
|
+
|
|
136
|
+
testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV08)(
|
|
137
|
+
"not isEip1271Compliant_v08",
|
|
138
|
+
async ({ rpc }) => {
|
|
139
|
+
const smartClient = await getSmartAccountClient({
|
|
140
|
+
entryPoint: {
|
|
141
|
+
version: "0.8"
|
|
142
|
+
},
|
|
143
|
+
...rpc
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
await expect(async () =>
|
|
147
|
+
signMessage(smartClient, {
|
|
148
|
+
message: "slowly and steadily burning the private keys"
|
|
149
|
+
})
|
|
150
|
+
).rejects.toThrow()
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV08)(
|
|
155
|
+
"isEip1271Compliant_v08",
|
|
156
|
+
async ({ rpc }) => {
|
|
157
|
+
const { anvilRpc } = rpc
|
|
158
|
+
|
|
159
|
+
const smartClient = await getSmartAccountClient({
|
|
160
|
+
entryPoint: {
|
|
161
|
+
version: "0.8"
|
|
162
|
+
},
|
|
163
|
+
...rpc
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
if (name === "LightAccount 2.0.0") {
|
|
167
|
+
// LightAccount 2.0.0 doesn't support EIP-1271
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (name.includes("Safe 7579")) {
|
|
172
|
+
// Due to 7579 launchpad, we can't verify the signature before deploying the account.
|
|
173
|
+
await smartClient.sendTransaction({
|
|
174
|
+
calls: [{ to: zeroAddress, value: 0n }]
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const signature = await signMessage(smartClient, {
|
|
179
|
+
message: "slowly and steadily burning the private keys"
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
const publicClient = getPublicClient(anvilRpc)
|
|
183
|
+
|
|
184
|
+
const isVerified = await publicClient.verifyMessage({
|
|
185
|
+
address: smartClient.account.address,
|
|
186
|
+
message: "slowly and steadily burning the private keys",
|
|
187
|
+
signature
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
expect(isVerified).toBeTruthy()
|
|
191
|
+
}
|
|
192
|
+
)
|
|
134
193
|
}
|
|
135
194
|
)
|