permissionless 0.3.4 → 0.3.6
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/index.js +8 -0
- package/_cjs/accounts/biconomy/index.js.map +1 -0
- 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 +6 -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/nexus/index.js +8 -0
- package/_cjs/accounts/nexus/index.js.map +1 -0
- package/_cjs/accounts/safe/toSafeSmartAccount.js +24 -4
- 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/thirdweb/index.js +8 -0
- package/_cjs/accounts/thirdweb/index.js.map +1 -0
- package/_cjs/accounts/trust/index.js +8 -0
- package/_cjs/accounts/trust/index.js.map +1 -0
- package/_esm/accounts/biconomy/index.js +5 -0
- package/_esm/accounts/biconomy/index.js.map +1 -0
- 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 +6 -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/nexus/index.js +5 -0
- package/_esm/accounts/nexus/index.js.map +1 -0
- package/_esm/accounts/safe/toSafeSmartAccount.js +24 -4
- 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/thirdweb/index.js +5 -0
- package/_esm/accounts/thirdweb/index.js.map +1 -0
- package/_esm/accounts/trust/index.js +5 -0
- package/_esm/accounts/trust/index.js.map +1 -0
- package/_types/accounts/biconomy/index.d.ts +6 -0
- package/_types/accounts/biconomy/index.d.ts.map +1 -0
- 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/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/nexus/index.d.ts +6 -0
- package/_types/accounts/nexus/index.d.ts.map +1 -0
- package/_types/accounts/safe/toSafeSmartAccount.d.ts +9 -0
- 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/thirdweb/index.d.ts +6 -0
- package/_types/accounts/thirdweb/index.d.ts.map +1 -0
- package/_types/accounts/trust/index.d.ts +6 -0
- package/_types/accounts/trust/index.d.ts.map +1 -0
- package/accounts/biconomy/index.ts +11 -0
- package/accounts/etherspot/index.ts +11 -0
- package/accounts/kernel/index.ts +33 -0
- package/accounts/kernel/toKernelSmartAccount.ts +6 -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/nexus/index.ts +11 -0
- package/accounts/safe/toSafeSmartAccount.ts +38 -1
- package/accounts/simple/index.ts +18 -0
- package/accounts/thirdweb/index.ts +11 -0
- package/accounts/trust/index.ts +11 -0
- package/actions/erc7579/installModule.test.ts +4 -6
- package/actions/erc7579/installModules.test.ts +4 -6
- package/actions/erc7579/uninstallModule.test.ts +2 -3
- package/actions/pimlico/getUserOperationStatus.test.ts +40 -16
- package/actions/smartAccount/getCallsStatus.test.ts +2 -4
- package/actions/smartAccount/sendCalls.test.ts +2 -4
- package/actions/smartAccount/sendTransaction.test.ts +2 -4
- package/actions/smartAccount/signMessage.test.ts +2 -4
- package/actions/smartAccount/signTypedData.test.ts +2 -4
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +76 -25
- package/package.json +41 -1
- package/vitest.config.ts +11 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeAbiParameters, encodePacked, isHash, zeroAddress } from "viem"
|
|
2
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
2
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
3
|
import { describe, expect } from "vitest"
|
|
4
4
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
5
|
import {
|
|
@@ -19,8 +19,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
19
19
|
throw new Error("getErc7579SmartAccountClient not defined")
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const privateKey =
|
|
23
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
22
|
+
const privateKey = generatePrivateKey()
|
|
24
23
|
|
|
25
24
|
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
26
25
|
|
|
@@ -104,14 +103,13 @@ describe.each(getCoreSmartAccounts())(
|
|
|
104
103
|
}
|
|
105
104
|
)
|
|
106
105
|
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
107
|
-
"installModule",
|
|
106
|
+
"installModule post deployment",
|
|
108
107
|
async ({ rpc }) => {
|
|
109
108
|
if (!getErc7579SmartAccountClient) {
|
|
110
109
|
throw new Error("getErc7579SmartAccountClient not defined")
|
|
111
110
|
}
|
|
112
111
|
|
|
113
|
-
const privateKey =
|
|
114
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
112
|
+
const privateKey = generatePrivateKey()
|
|
115
113
|
|
|
116
114
|
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
117
115
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeAbiParameters, encodePacked, isHash, zeroAddress } from "viem"
|
|
2
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
2
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
3
|
import { describe, expect } from "vitest"
|
|
4
4
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
5
|
import {
|
|
@@ -19,8 +19,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
19
19
|
throw new Error("getErc7579SmartAccountClient not defined")
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const privateKey =
|
|
23
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
22
|
+
const privateKey = generatePrivateKey()
|
|
24
23
|
|
|
25
24
|
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
26
25
|
|
|
@@ -118,14 +117,13 @@ describe.each(getCoreSmartAccounts())(
|
|
|
118
117
|
}
|
|
119
118
|
)
|
|
120
119
|
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
121
|
-
"installModules",
|
|
120
|
+
"installModules post deployment",
|
|
122
121
|
async ({ rpc }) => {
|
|
123
122
|
if (!getErc7579SmartAccountClient) {
|
|
124
123
|
throw new Error("getErc7579SmartAccountClient not defined")
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
const privateKey =
|
|
128
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
126
|
+
const privateKey = generatePrivateKey()
|
|
129
127
|
|
|
130
128
|
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
131
129
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeAbiParameters, encodePacked, isHash, zeroAddress } from "viem"
|
|
2
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
2
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
3
|
import { describe, expect } from "vitest"
|
|
4
4
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
5
|
import {
|
|
@@ -19,8 +19,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
19
19
|
throw new Error("getErc7579SmartAccountClient not defined")
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const privateKey =
|
|
23
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
22
|
+
const privateKey = generatePrivateKey()
|
|
24
23
|
|
|
25
24
|
const privateKeyAccount = privateKeyToAccount(privateKey)
|
|
26
25
|
|
|
@@ -58,12 +58,20 @@ describe("getUserOperationStatus", () => {
|
|
|
58
58
|
expect(receipt?.receipt.transactionHash).toBe(
|
|
59
59
|
userOperationReceipt?.receipt.transactionHash
|
|
60
60
|
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
let userOperationStatus = await getUserOperationStatus(bundlerClient, {
|
|
62
|
+
hash: opHash
|
|
63
|
+
})
|
|
64
|
+
// Poll until alto's internal status catches up
|
|
65
|
+
for (
|
|
66
|
+
let i = 0;
|
|
67
|
+
i < 20 && userOperationStatus.status !== "included";
|
|
68
|
+
i++
|
|
69
|
+
) {
|
|
70
|
+
await new Promise((r) => setTimeout(r, 100))
|
|
71
|
+
userOperationStatus = await getUserOperationStatus(bundlerClient, {
|
|
64
72
|
hash: opHash
|
|
65
|
-
}
|
|
66
|
-
|
|
73
|
+
})
|
|
74
|
+
}
|
|
67
75
|
expect(userOperationStatus).not.toBeNull()
|
|
68
76
|
expect(userOperationStatus).not.toBeUndefined()
|
|
69
77
|
expect(userOperationStatus.status).toBe("included")
|
|
@@ -121,12 +129,20 @@ describe("getUserOperationStatus", () => {
|
|
|
121
129
|
expect(receipt?.receipt.transactionHash).toBe(
|
|
122
130
|
userOperationReceipt?.receipt.transactionHash
|
|
123
131
|
)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
132
|
+
let userOperationStatus = await getUserOperationStatus(bundlerClient, {
|
|
133
|
+
hash: opHash
|
|
134
|
+
})
|
|
135
|
+
// Poll until alto's internal status catches up
|
|
136
|
+
for (
|
|
137
|
+
let i = 0;
|
|
138
|
+
i < 20 && userOperationStatus.status !== "included";
|
|
139
|
+
i++
|
|
140
|
+
) {
|
|
141
|
+
await new Promise((r) => setTimeout(r, 100))
|
|
142
|
+
userOperationStatus = await getUserOperationStatus(bundlerClient, {
|
|
127
143
|
hash: opHash
|
|
128
|
-
}
|
|
129
|
-
|
|
144
|
+
})
|
|
145
|
+
}
|
|
130
146
|
expect(userOperationStatus).not.toBeNull()
|
|
131
147
|
expect(userOperationStatus).not.toBeUndefined()
|
|
132
148
|
expect(userOperationStatus.status).toBe("included")
|
|
@@ -134,7 +150,7 @@ describe("getUserOperationStatus", () => {
|
|
|
134
150
|
userOperationReceipt?.receipt.transactionHash
|
|
135
151
|
)
|
|
136
152
|
})
|
|
137
|
-
testWithRpc("
|
|
153
|
+
testWithRpc("getUserOperationStatus_V08", async ({ rpc }) => {
|
|
138
154
|
const { altoRpc } = rpc
|
|
139
155
|
|
|
140
156
|
const bundlerClient = getPimlicoClient({
|
|
@@ -183,12 +199,20 @@ describe("getUserOperationStatus", () => {
|
|
|
183
199
|
expect(receipt?.receipt.transactionHash).toBe(
|
|
184
200
|
userOperationReceipt?.receipt.transactionHash
|
|
185
201
|
)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
202
|
+
let userOperationStatus = await getUserOperationStatus(bundlerClient, {
|
|
203
|
+
hash: opHash
|
|
204
|
+
})
|
|
205
|
+
// Poll until alto's internal status catches up
|
|
206
|
+
for (
|
|
207
|
+
let i = 0;
|
|
208
|
+
i < 20 && userOperationStatus.status !== "included";
|
|
209
|
+
i++
|
|
210
|
+
) {
|
|
211
|
+
await new Promise((r) => setTimeout(r, 100))
|
|
212
|
+
userOperationStatus = await getUserOperationStatus(bundlerClient, {
|
|
189
213
|
hash: opHash
|
|
190
|
-
}
|
|
191
|
-
|
|
214
|
+
})
|
|
215
|
+
}
|
|
192
216
|
expect(userOperationStatus).not.toBeNull()
|
|
193
217
|
expect(userOperationStatus).not.toBeUndefined()
|
|
194
218
|
expect(userOperationStatus.status).toBe("included")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Hex, zeroAddress } from "viem"
|
|
2
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
2
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
3
|
import { describe, expect } from "vitest"
|
|
4
4
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
5
|
import {
|
|
@@ -9,9 +9,6 @@ import {
|
|
|
9
9
|
import { getCallsStatus } from "./getCallsStatus"
|
|
10
10
|
import { sendCalls } from "./sendCalls"
|
|
11
11
|
|
|
12
|
-
const privateKey =
|
|
13
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
14
|
-
|
|
15
12
|
describe.each(getCoreSmartAccounts())(
|
|
16
13
|
"getCallsStatus $name",
|
|
17
14
|
({
|
|
@@ -21,6 +18,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
21
18
|
supportsEntryPointV08,
|
|
22
19
|
isEip7702Compliant
|
|
23
20
|
}) => {
|
|
21
|
+
const privateKey = generatePrivateKey()
|
|
24
22
|
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
25
23
|
"getCallsStatus_v06",
|
|
26
24
|
async ({ rpc }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Hex, zeroAddress } from "viem"
|
|
2
2
|
import { waitForUserOperationReceipt } from "viem/account-abstraction"
|
|
3
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
3
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
4
4
|
import { describe, expect } from "vitest"
|
|
5
5
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
6
6
|
import {
|
|
@@ -9,9 +9,6 @@ import {
|
|
|
9
9
|
} from "../../../permissionless-test/src/utils"
|
|
10
10
|
import { sendCalls } from "./sendCalls"
|
|
11
11
|
|
|
12
|
-
const privateKey =
|
|
13
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
14
|
-
|
|
15
12
|
describe.each(getCoreSmartAccounts())(
|
|
16
13
|
"sendCalls $name",
|
|
17
14
|
({
|
|
@@ -21,6 +18,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
21
18
|
supportsEntryPointV08,
|
|
22
19
|
isEip7702Compliant
|
|
23
20
|
}) => {
|
|
21
|
+
const privateKey = generatePrivateKey()
|
|
24
22
|
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
25
23
|
"sendCalls_v06",
|
|
26
24
|
async ({ rpc }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { zeroAddress } from "viem"
|
|
2
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
2
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
3
|
import { describe, expect } from "vitest"
|
|
4
4
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
5
|
import {
|
|
@@ -8,9 +8,6 @@ import {
|
|
|
8
8
|
} from "../../../permissionless-test/src/utils"
|
|
9
9
|
import { sendTransaction } from "./sendTransaction"
|
|
10
10
|
|
|
11
|
-
const privateKey =
|
|
12
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
13
|
-
|
|
14
11
|
describe.each(getCoreSmartAccounts())(
|
|
15
12
|
"sendTransaction $name",
|
|
16
13
|
({
|
|
@@ -20,6 +17,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
20
17
|
supportsEntryPointV08,
|
|
21
18
|
isEip7702Compliant
|
|
22
19
|
}) => {
|
|
20
|
+
const privateKey = generatePrivateKey()
|
|
23
21
|
testWithRpc.skipIf(!supportsEntryPointV06)(
|
|
24
22
|
"sendTransaction_v06",
|
|
25
23
|
async ({ rpc }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { zeroAddress } from "viem"
|
|
2
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
2
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
3
|
import { describe, expect } from "vitest"
|
|
4
4
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
5
|
import {
|
|
@@ -8,9 +8,6 @@ import {
|
|
|
8
8
|
} from "../../../permissionless-test/src/utils"
|
|
9
9
|
import { signMessage } from "./signMessage"
|
|
10
10
|
|
|
11
|
-
const privateKey =
|
|
12
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
13
|
-
|
|
14
11
|
describe.each(getCoreSmartAccounts())(
|
|
15
12
|
"signMessage $name",
|
|
16
13
|
({
|
|
@@ -22,6 +19,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
22
19
|
isEip7702Compliant,
|
|
23
20
|
name
|
|
24
21
|
}) => {
|
|
22
|
+
const privateKey = generatePrivateKey()
|
|
25
23
|
testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV06)(
|
|
26
24
|
"not isEip1271Compliant_v06",
|
|
27
25
|
async ({ rpc }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAddress, zeroAddress } from "viem"
|
|
2
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
2
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
3
3
|
import { describe, expect } from "vitest"
|
|
4
4
|
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
5
5
|
import {
|
|
@@ -8,9 +8,6 @@ import {
|
|
|
8
8
|
} from "../../../permissionless-test/src/utils"
|
|
9
9
|
import { signTypedData } from "./signTypedData"
|
|
10
10
|
|
|
11
|
-
const privateKey =
|
|
12
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
13
|
-
|
|
14
11
|
const typedData = {
|
|
15
12
|
domain: {
|
|
16
13
|
name: "Ether Mail",
|
|
@@ -56,6 +53,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
56
53
|
isEip7702Compliant,
|
|
57
54
|
name
|
|
58
55
|
}) => {
|
|
56
|
+
const privateKey = generatePrivateKey()
|
|
59
57
|
testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV06)(
|
|
60
58
|
"not isEip1271Compliant_v06",
|
|
61
59
|
async ({ rpc }) => {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
entryPoint07Address,
|
|
5
5
|
entryPoint08Address
|
|
6
6
|
} from "viem/account-abstraction"
|
|
7
|
-
import { privateKeyToAccount } from "viem/accounts"
|
|
7
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
|
|
8
8
|
import { foundry } from "viem/chains"
|
|
9
9
|
import { describe, expect } from "vitest"
|
|
10
10
|
import {
|
|
@@ -12,7 +12,10 @@ import {
|
|
|
12
12
|
sudoMintTokens,
|
|
13
13
|
tokenBalanceOf
|
|
14
14
|
} from "../../../../mock-paymaster/helpers/erc20-utils"
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
createAutoBundleTransport,
|
|
17
|
+
testWithRpc
|
|
18
|
+
} from "../../../../permissionless-test/src/testWithRpc"
|
|
16
19
|
import {
|
|
17
20
|
getCoreSmartAccounts,
|
|
18
21
|
getPublicClient
|
|
@@ -21,9 +24,6 @@ import { createSmartAccountClient } from "../../../clients/createSmartAccountCli
|
|
|
21
24
|
import { createPimlicoClient } from "../../../clients/pimlico"
|
|
22
25
|
import { prepareUserOperationForErc20Paymaster } from "./prepareUserOperationForErc20Paymaster"
|
|
23
26
|
|
|
24
|
-
const privateKey =
|
|
25
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
|
|
26
|
-
|
|
27
27
|
describe.each(getCoreSmartAccounts())(
|
|
28
28
|
"prepareUserOperationForErc20Paymaster $name",
|
|
29
29
|
({
|
|
@@ -34,6 +34,7 @@ describe.each(getCoreSmartAccounts())(
|
|
|
34
34
|
isEip7702Compliant,
|
|
35
35
|
name
|
|
36
36
|
}) => {
|
|
37
|
+
const privateKey = generatePrivateKey()
|
|
37
38
|
testWithRpc.skipIf(!supportsEntryPointV06 || name === "Kernel 0.2.1")(
|
|
38
39
|
"prepareUserOperationForErc20Paymaster_v06",
|
|
39
40
|
async ({ rpc }) => {
|
|
@@ -69,20 +70,30 @@ describe.each(getCoreSmartAccounts())(
|
|
|
69
70
|
prepareUserOperation:
|
|
70
71
|
prepareUserOperationForErc20Paymaster(pimlicoClient)
|
|
71
72
|
},
|
|
72
|
-
bundlerTransport:
|
|
73
|
+
bundlerTransport: createAutoBundleTransport(
|
|
74
|
+
rpc.altoRpc,
|
|
75
|
+
rpc.anvilRpc
|
|
76
|
+
)
|
|
73
77
|
})
|
|
74
78
|
|
|
75
|
-
const INITIAL_TOKEN_BALANCE = parseEther("100")
|
|
76
79
|
const INTIAL_ETH_BALANCE = await publicClient.getBalance({
|
|
77
80
|
address: smartAccountClient.account.address
|
|
78
81
|
})
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
const PRE_MINT_TOKEN_BALANCE = await tokenBalanceOf(
|
|
84
|
+
smartAccountClient.account.address,
|
|
85
|
+
rpc.anvilRpc
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
await sudoMintTokens({
|
|
89
|
+
amount: parseEther("100"),
|
|
82
90
|
to: smartAccountClient.account.address,
|
|
83
91
|
anvilRpc
|
|
84
92
|
})
|
|
85
93
|
|
|
94
|
+
const INITIAL_TOKEN_BALANCE =
|
|
95
|
+
PRE_MINT_TOKEN_BALANCE + parseEther("100")
|
|
96
|
+
|
|
86
97
|
const opHash = await smartAccountClient.sendUserOperation({
|
|
87
98
|
calls: [
|
|
88
99
|
{
|
|
@@ -155,20 +166,30 @@ describe.each(getCoreSmartAccounts())(
|
|
|
155
166
|
prepareUserOperation:
|
|
156
167
|
prepareUserOperationForErc20Paymaster(pimlicoClient)
|
|
157
168
|
},
|
|
158
|
-
bundlerTransport:
|
|
169
|
+
bundlerTransport: createAutoBundleTransport(
|
|
170
|
+
rpc.altoRpc,
|
|
171
|
+
rpc.anvilRpc
|
|
172
|
+
)
|
|
159
173
|
})
|
|
160
174
|
|
|
161
|
-
const INITIAL_TOKEN_BALANCE = parseEther("100")
|
|
162
175
|
const INTIAL_ETH_BALANCE = await publicClient.getBalance({
|
|
163
176
|
address: smartAccountClient.account.address
|
|
164
177
|
})
|
|
165
178
|
|
|
166
|
-
|
|
167
|
-
|
|
179
|
+
const PRE_MINT_TOKEN_BALANCE = await tokenBalanceOf(
|
|
180
|
+
smartAccountClient.account.address,
|
|
181
|
+
rpc.anvilRpc
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
await sudoMintTokens({
|
|
185
|
+
amount: parseEther("100"),
|
|
168
186
|
to: smartAccountClient.account.address,
|
|
169
187
|
anvilRpc
|
|
170
188
|
})
|
|
171
189
|
|
|
190
|
+
const INITIAL_TOKEN_BALANCE =
|
|
191
|
+
PRE_MINT_TOKEN_BALANCE + parseEther("100")
|
|
192
|
+
|
|
172
193
|
const authorization = isEip7702Compliant
|
|
173
194
|
? await privateKeyAccount.signAuthorization({
|
|
174
195
|
address: (smartAccountClient.account as any)
|
|
@@ -253,20 +274,30 @@ describe.each(getCoreSmartAccounts())(
|
|
|
253
274
|
prepareUserOperation:
|
|
254
275
|
prepareUserOperationForErc20Paymaster(pimlicoClient)
|
|
255
276
|
},
|
|
256
|
-
bundlerTransport:
|
|
277
|
+
bundlerTransport: createAutoBundleTransport(
|
|
278
|
+
rpc.altoRpc,
|
|
279
|
+
rpc.anvilRpc
|
|
280
|
+
)
|
|
257
281
|
})
|
|
258
282
|
|
|
259
|
-
const INITIAL_TOKEN_BALANCE = parseEther("100")
|
|
260
283
|
const INTIAL_ETH_BALANCE = await publicClient.getBalance({
|
|
261
284
|
address: smartAccountClient.account.address
|
|
262
285
|
})
|
|
263
286
|
|
|
264
|
-
|
|
265
|
-
|
|
287
|
+
const PRE_MINT_TOKEN_BALANCE = await tokenBalanceOf(
|
|
288
|
+
smartAccountClient.account.address,
|
|
289
|
+
rpc.anvilRpc
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
await sudoMintTokens({
|
|
293
|
+
amount: parseEther("100"),
|
|
266
294
|
to: smartAccountClient.account.address,
|
|
267
295
|
anvilRpc
|
|
268
296
|
})
|
|
269
297
|
|
|
298
|
+
const INITIAL_TOKEN_BALANCE =
|
|
299
|
+
PRE_MINT_TOKEN_BALANCE + parseEther("100")
|
|
300
|
+
|
|
270
301
|
const authorization = isEip7702Compliant
|
|
271
302
|
? await privateKeyAccount.signAuthorization({
|
|
272
303
|
address: (smartAccountClient.account as any)
|
|
@@ -356,20 +387,30 @@ describe.each(getCoreSmartAccounts())(
|
|
|
356
387
|
}
|
|
357
388
|
)
|
|
358
389
|
},
|
|
359
|
-
bundlerTransport:
|
|
390
|
+
bundlerTransport: createAutoBundleTransport(
|
|
391
|
+
rpc.altoRpc,
|
|
392
|
+
rpc.anvilRpc
|
|
393
|
+
)
|
|
360
394
|
})
|
|
361
395
|
|
|
362
|
-
const INITIAL_TOKEN_BALANCE = parseEther("100")
|
|
363
396
|
const INTIAL_ETH_BALANCE = await publicClient.getBalance({
|
|
364
397
|
address: smartAccountClient.account.address
|
|
365
398
|
})
|
|
366
399
|
|
|
367
|
-
|
|
368
|
-
|
|
400
|
+
const PRE_MINT_TOKEN_BALANCE = await tokenBalanceOf(
|
|
401
|
+
smartAccountClient.account.address,
|
|
402
|
+
rpc.anvilRpc
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
await sudoMintTokens({
|
|
406
|
+
amount: parseEther("100"),
|
|
369
407
|
to: smartAccountClient.account.address,
|
|
370
408
|
anvilRpc
|
|
371
409
|
})
|
|
372
410
|
|
|
411
|
+
const INITIAL_TOKEN_BALANCE =
|
|
412
|
+
PRE_MINT_TOKEN_BALANCE + parseEther("100")
|
|
413
|
+
|
|
373
414
|
const authorization = isEip7702Compliant
|
|
374
415
|
? await privateKeyAccount.signAuthorization({
|
|
375
416
|
address: (smartAccountClient.account as any)
|
|
@@ -459,20 +500,30 @@ describe.each(getCoreSmartAccounts())(
|
|
|
459
500
|
}
|
|
460
501
|
)
|
|
461
502
|
},
|
|
462
|
-
bundlerTransport:
|
|
503
|
+
bundlerTransport: createAutoBundleTransport(
|
|
504
|
+
rpc.altoRpc,
|
|
505
|
+
rpc.anvilRpc
|
|
506
|
+
)
|
|
463
507
|
})
|
|
464
508
|
|
|
465
|
-
const INITIAL_TOKEN_BALANCE = parseEther("100")
|
|
466
509
|
const INTIAL_ETH_BALANCE = await publicClient.getBalance({
|
|
467
510
|
address: smartAccountClient.account.address
|
|
468
511
|
})
|
|
469
512
|
|
|
470
|
-
|
|
471
|
-
|
|
513
|
+
const PRE_MINT_TOKEN_BALANCE = await tokenBalanceOf(
|
|
514
|
+
smartAccountClient.account.address,
|
|
515
|
+
rpc.anvilRpc
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
await sudoMintTokens({
|
|
519
|
+
amount: parseEther("100"),
|
|
472
520
|
to: smartAccountClient.account.address,
|
|
473
521
|
anvilRpc
|
|
474
522
|
})
|
|
475
523
|
|
|
524
|
+
const INITIAL_TOKEN_BALANCE =
|
|
525
|
+
PRE_MINT_TOKEN_BALANCE + parseEther("100")
|
|
526
|
+
|
|
476
527
|
const authorization = isEip7702Compliant
|
|
477
528
|
? await privateKeyAccount.signAuthorization({
|
|
478
529
|
address: (smartAccountClient.account as any)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "permissionless",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"author": "Pimlico",
|
|
5
5
|
"homepage": "https://docs.pimlico.io/permissionless",
|
|
6
6
|
"repository": "github:pimlicolabs/permissionless.js",
|
|
@@ -30,11 +30,51 @@
|
|
|
30
30
|
"import": "./_esm/accounts/index.js",
|
|
31
31
|
"default": "./_cjs/accounts/index.js"
|
|
32
32
|
},
|
|
33
|
+
"./accounts/biconomy": {
|
|
34
|
+
"types": "./_types/accounts/biconomy/index.d.ts",
|
|
35
|
+
"import": "./_esm/accounts/biconomy/index.js",
|
|
36
|
+
"default": "./_cjs/accounts/biconomy/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./accounts/etherspot": {
|
|
39
|
+
"types": "./_types/accounts/etherspot/index.d.ts",
|
|
40
|
+
"import": "./_esm/accounts/etherspot/index.js",
|
|
41
|
+
"default": "./_cjs/accounts/etherspot/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./accounts/kernel": {
|
|
44
|
+
"types": "./_types/accounts/kernel/index.d.ts",
|
|
45
|
+
"import": "./_esm/accounts/kernel/index.js",
|
|
46
|
+
"default": "./_cjs/accounts/kernel/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./accounts/light": {
|
|
49
|
+
"types": "./_types/accounts/light/index.d.ts",
|
|
50
|
+
"import": "./_esm/accounts/light/index.js",
|
|
51
|
+
"default": "./_cjs/accounts/light/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./accounts/nexus": {
|
|
54
|
+
"types": "./_types/accounts/nexus/index.d.ts",
|
|
55
|
+
"import": "./_esm/accounts/nexus/index.js",
|
|
56
|
+
"default": "./_cjs/accounts/nexus/index.js"
|
|
57
|
+
},
|
|
33
58
|
"./accounts/safe": {
|
|
34
59
|
"types": "./_types/accounts/safe/index.d.ts",
|
|
35
60
|
"import": "./_esm/accounts/safe/index.js",
|
|
36
61
|
"default": "./_cjs/accounts/safe/index.js"
|
|
37
62
|
},
|
|
63
|
+
"./accounts/simple": {
|
|
64
|
+
"types": "./_types/accounts/simple/index.d.ts",
|
|
65
|
+
"import": "./_esm/accounts/simple/index.js",
|
|
66
|
+
"default": "./_cjs/accounts/simple/index.js"
|
|
67
|
+
},
|
|
68
|
+
"./accounts/thirdweb": {
|
|
69
|
+
"types": "./_types/accounts/thirdweb/index.d.ts",
|
|
70
|
+
"import": "./_esm/accounts/thirdweb/index.js",
|
|
71
|
+
"default": "./_cjs/accounts/thirdweb/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./accounts/trust": {
|
|
74
|
+
"types": "./_types/accounts/trust/index.d.ts",
|
|
75
|
+
"import": "./_esm/accounts/trust/index.js",
|
|
76
|
+
"default": "./_cjs/accounts/trust/index.js"
|
|
77
|
+
},
|
|
38
78
|
"./actions": {
|
|
39
79
|
"types": "./_types/actions/index.d.ts",
|
|
40
80
|
"import": "./_esm/actions/index.js",
|
package/vitest.config.ts
CHANGED
|
@@ -3,6 +3,14 @@ import { loadEnv } from "vite"
|
|
|
3
3
|
import { defineConfig } from "vitest/config"
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
+
resolve: {
|
|
7
|
+
alias: {
|
|
8
|
+
"@pimlico/mock-paymaster": join(
|
|
9
|
+
__dirname,
|
|
10
|
+
"../mock-paymaster/index.ts"
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
},
|
|
6
14
|
test: {
|
|
7
15
|
coverage: {
|
|
8
16
|
all: true,
|
|
@@ -15,7 +23,9 @@ export default defineConfig({
|
|
|
15
23
|
"**/permissionless-test/**",
|
|
16
24
|
"**/_cjs/**",
|
|
17
25
|
"**/_esm/**",
|
|
18
|
-
"**/_types/**"
|
|
26
|
+
"**/_types/**",
|
|
27
|
+
"**/permissionless/accounts/index.ts",
|
|
28
|
+
"**/permissionless/accounts/*/index.ts"
|
|
19
29
|
]
|
|
20
30
|
},
|
|
21
31
|
sequence: {
|