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,117 +0,0 @@
|
|
|
1
|
-
import { encodeAbiParameters, encodePacked, isHash, 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 { uninstallModules } from "./uninstallModules"
|
|
7
|
-
|
|
8
|
-
describe.each(getCoreSmartAccounts())(
|
|
9
|
-
"uninstallModules $name",
|
|
10
|
-
({ getErc7579SmartAccountClient, name }) => {
|
|
11
|
-
testWithRpc.skipIf(!getErc7579SmartAccountClient)(
|
|
12
|
-
"uninstallModules",
|
|
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
|
-
type: "executor",
|
|
37
|
-
address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
38
|
-
context: name.startsWith("Kernel 7579")
|
|
39
|
-
? encodePacked(
|
|
40
|
-
["address", "bytes"],
|
|
41
|
-
[
|
|
42
|
-
zeroAddress,
|
|
43
|
-
encodeAbiParameters(
|
|
44
|
-
[{ type: "bytes" }, { type: "bytes" }],
|
|
45
|
-
[moduleData, "0x"]
|
|
46
|
-
)
|
|
47
|
-
]
|
|
48
|
-
)
|
|
49
|
-
: moduleData
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
await smartClient.waitForUserOperationReceipt({
|
|
53
|
-
hash: opHash,
|
|
54
|
-
timeout: 100000
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const uninstallModulesUserOpHash = await uninstallModules(
|
|
58
|
-
smartClient,
|
|
59
|
-
{
|
|
60
|
-
account: smartClient.account,
|
|
61
|
-
modules: [
|
|
62
|
-
{
|
|
63
|
-
type: "executor",
|
|
64
|
-
address:
|
|
65
|
-
"0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
66
|
-
context: name.startsWith("Kernel 7579")
|
|
67
|
-
? "0x"
|
|
68
|
-
: encodeAbiParameters(
|
|
69
|
-
[
|
|
70
|
-
{
|
|
71
|
-
name: "prev",
|
|
72
|
-
type: "address"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "moduleInitData",
|
|
76
|
-
type: "bytes"
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
[
|
|
80
|
-
"0x0000000000000000000000000000000000000001",
|
|
81
|
-
"0x"
|
|
82
|
-
]
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
expect(isHash(uninstallModulesUserOpHash)).toBe(true)
|
|
90
|
-
|
|
91
|
-
const userOperationReceiptUninstallModules =
|
|
92
|
-
await smartClient.waitForUserOperationReceipt({
|
|
93
|
-
hash: uninstallModulesUserOpHash,
|
|
94
|
-
timeout: 100000
|
|
95
|
-
})
|
|
96
|
-
expect(userOperationReceiptUninstallModules).not.toBeNull()
|
|
97
|
-
expect(userOperationReceiptUninstallModules?.userOpHash).toBe(
|
|
98
|
-
uninstallModulesUserOpHash
|
|
99
|
-
)
|
|
100
|
-
expect(
|
|
101
|
-
userOperationReceiptUninstallModules?.receipt
|
|
102
|
-
.transactionHash
|
|
103
|
-
).toBeTruthy()
|
|
104
|
-
|
|
105
|
-
const receiptUninstallModules =
|
|
106
|
-
await smartClient.getUserOperationReceipt({
|
|
107
|
-
hash: uninstallModulesUserOpHash
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
expect(receiptUninstallModules?.receipt.transactionHash).toBe(
|
|
111
|
-
userOperationReceiptUninstallModules?.receipt
|
|
112
|
-
.transactionHash
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
)
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { getAddress, isAddress } from "viem"
|
|
2
|
-
import { entryPoint07Address } from "viem/account-abstraction"
|
|
3
|
-
import { foundry } from "viem/chains"
|
|
4
|
-
import { describe, expect } from "vitest"
|
|
5
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
6
|
-
import { getPimlicoClient } from "../../../permissionless-test/src/utils"
|
|
7
|
-
import { getTokenQuotes } from "./getTokenQuotes"
|
|
8
|
-
|
|
9
|
-
describe("getTokenQuotes", () => {
|
|
10
|
-
testWithRpc("getTokenQuotes v0.6", async ({ rpc }) => {
|
|
11
|
-
const pimlicoBundlerClient = getPimlicoClient({
|
|
12
|
-
entryPointVersion: "0.6",
|
|
13
|
-
altoRpc: rpc.paymasterRpc
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
const token = getAddress("0xffffffffffffffffffffffffffffffffffffffff")
|
|
17
|
-
|
|
18
|
-
const quotes = await getTokenQuotes(pimlicoBundlerClient, {
|
|
19
|
-
tokens: [token],
|
|
20
|
-
entryPointAddress: entryPoint07Address,
|
|
21
|
-
chain: foundry
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
expect(quotes).toBeTruthy()
|
|
25
|
-
expect(Array.isArray(quotes)).toBe(true)
|
|
26
|
-
expect(quotes[0].token).toBeTruthy()
|
|
27
|
-
expect(isAddress(quotes[0].token))
|
|
28
|
-
expect(quotes[0].token).toEqual(token)
|
|
29
|
-
expect(quotes[0].paymaster).toBeTruthy()
|
|
30
|
-
expect(isAddress(quotes[0].paymaster))
|
|
31
|
-
expect(quotes[0].exchangeRate).toBeTruthy()
|
|
32
|
-
expect(quotes[0].exchangeRate).toBeGreaterThan(0n)
|
|
33
|
-
expect(quotes[0].postOpGas).toBeTruthy()
|
|
34
|
-
expect(quotes[0].postOpGas).toBeGreaterThan(0n)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
testWithRpc("getTokenQuotes v0.7", async ({ rpc }) => {
|
|
38
|
-
const pimlicoBundlerClient = getPimlicoClient({
|
|
39
|
-
entryPointVersion: "0.7",
|
|
40
|
-
altoRpc: rpc.paymasterRpc
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const token = getAddress("0xffffffffffffffffffffffffffffffffffffffff")
|
|
44
|
-
|
|
45
|
-
const quotes = await getTokenQuotes(pimlicoBundlerClient, {
|
|
46
|
-
tokens: [token],
|
|
47
|
-
entryPointAddress: entryPoint07Address,
|
|
48
|
-
chain: foundry
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
expect(quotes).toBeTruthy()
|
|
52
|
-
expect(Array.isArray(quotes)).toBe(true)
|
|
53
|
-
expect(quotes[0].token).toBeTruthy()
|
|
54
|
-
expect(isAddress(quotes[0].token))
|
|
55
|
-
expect(quotes[0].token).toEqual(token)
|
|
56
|
-
expect(quotes[0].paymaster).toBeTruthy()
|
|
57
|
-
expect(isAddress(quotes[0].paymaster))
|
|
58
|
-
expect(quotes[0].exchangeRate).toBeTruthy()
|
|
59
|
-
expect(quotes[0].exchangeRate).toBeGreaterThan(0n)
|
|
60
|
-
expect(quotes[0].postOpGas).toBeTruthy()
|
|
61
|
-
expect(quotes[0].postOpGas).toBeGreaterThan(0n)
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
testWithRpc("getTokenQuotes v0.8", async ({ rpc }) => {
|
|
65
|
-
const pimlicoBundlerClient = getPimlicoClient({
|
|
66
|
-
entryPointVersion: "0.8",
|
|
67
|
-
altoRpc: rpc.paymasterRpc
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
const token = getAddress("0xffffffffffffffffffffffffffffffffffffffff")
|
|
71
|
-
|
|
72
|
-
const quotes = await getTokenQuotes(pimlicoBundlerClient, {
|
|
73
|
-
tokens: [token],
|
|
74
|
-
entryPointAddress: entryPoint07Address,
|
|
75
|
-
chain: foundry
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
expect(quotes).toBeTruthy()
|
|
79
|
-
expect(Array.isArray(quotes)).toBe(true)
|
|
80
|
-
expect(quotes[0].token).toBeTruthy()
|
|
81
|
-
expect(isAddress(quotes[0].token))
|
|
82
|
-
expect(quotes[0].token).toEqual(token)
|
|
83
|
-
expect(quotes[0].paymaster).toBeTruthy()
|
|
84
|
-
expect(isAddress(quotes[0].paymaster))
|
|
85
|
-
expect(quotes[0].exchangeRate).toBeTruthy()
|
|
86
|
-
expect(quotes[0].exchangeRate).toBeGreaterThan(0n)
|
|
87
|
-
expect(quotes[0].postOpGas).toBeTruthy()
|
|
88
|
-
expect(quotes[0].postOpGas).toBeGreaterThan(0n)
|
|
89
|
-
})
|
|
90
|
-
})
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { describe, expect } from "vitest"
|
|
2
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
3
|
-
import { getPimlicoClient } from "../../../permissionless-test/src/utils"
|
|
4
|
-
import { getUserOperationGasPrice } from "./getUserOperationGasPrice"
|
|
5
|
-
|
|
6
|
-
describe("getUserOperationGasPrice", () => {
|
|
7
|
-
testWithRpc("getUserOperationGasPrice", async ({ rpc }) => {
|
|
8
|
-
const pimlicoBundlerClient = getPimlicoClient({
|
|
9
|
-
entryPointVersion: "0.6",
|
|
10
|
-
altoRpc: rpc.altoRpc
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const gasPrice = await getUserOperationGasPrice(pimlicoBundlerClient)
|
|
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
|
-
|
|
65
|
-
expect(gasPrice).toBeTruthy()
|
|
66
|
-
expect(gasPrice.slow).toBeTruthy()
|
|
67
|
-
expect(gasPrice.standard).toBeTruthy()
|
|
68
|
-
expect(gasPrice.fast).toBeTruthy()
|
|
69
|
-
expect(typeof gasPrice.slow.maxFeePerGas).toBe("bigint")
|
|
70
|
-
expect(gasPrice.slow.maxFeePerGas).toBeGreaterThan(0n)
|
|
71
|
-
expect(typeof gasPrice.slow.maxPriorityFeePerGas).toBe("bigint")
|
|
72
|
-
expect(gasPrice.slow.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
73
|
-
expect(typeof gasPrice.standard.maxFeePerGas).toBe("bigint")
|
|
74
|
-
expect(gasPrice.standard.maxFeePerGas).toBeGreaterThan(0n)
|
|
75
|
-
expect(typeof gasPrice.standard.maxPriorityFeePerGas).toBe("bigint")
|
|
76
|
-
expect(gasPrice.standard.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
77
|
-
expect(typeof gasPrice.fast.maxFeePerGas).toBe("bigint")
|
|
78
|
-
expect(gasPrice.fast.maxFeePerGas).toBeGreaterThan(0n)
|
|
79
|
-
expect(typeof gasPrice.fast.maxPriorityFeePerGas).toBe("bigint")
|
|
80
|
-
expect(gasPrice.fast.maxPriorityFeePerGas).toBeGreaterThan(0n)
|
|
81
|
-
})
|
|
82
|
-
})
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { isHash, zeroAddress } from "viem"
|
|
2
|
-
import { describe, expect } from "vitest"
|
|
3
|
-
import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
|
|
4
|
-
import {
|
|
5
|
-
getBundlerClient,
|
|
6
|
-
getPimlicoClient,
|
|
7
|
-
getSimpleAccountClient
|
|
8
|
-
} from "../../../permissionless-test/src/utils"
|
|
9
|
-
import { getUserOperationStatus } from "./getUserOperationStatus"
|
|
10
|
-
|
|
11
|
-
describe("getUserOperationStatus", () => {
|
|
12
|
-
testWithRpc("getUserOperationStatus_V06", async ({ rpc }) => {
|
|
13
|
-
const { altoRpc } = rpc
|
|
14
|
-
|
|
15
|
-
const bundlerClient = getPimlicoClient({
|
|
16
|
-
entryPointVersion: "0.6",
|
|
17
|
-
altoRpc: altoRpc
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const simpleAccountClient = getBundlerClient({
|
|
21
|
-
account: await getSimpleAccountClient({
|
|
22
|
-
...rpc,
|
|
23
|
-
entryPoint: {
|
|
24
|
-
version: "0.6"
|
|
25
|
-
}
|
|
26
|
-
}),
|
|
27
|
-
entryPoint: {
|
|
28
|
-
version: "0.6"
|
|
29
|
-
},
|
|
30
|
-
...rpc
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const opHash = await simpleAccountClient.sendUserOperation({
|
|
34
|
-
calls: [
|
|
35
|
-
{
|
|
36
|
-
to: zeroAddress,
|
|
37
|
-
data: "0x",
|
|
38
|
-
value: 0n
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
expect(isHash(opHash)).toBe(true)
|
|
44
|
-
|
|
45
|
-
const userOperationReceipt =
|
|
46
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
47
|
-
hash: opHash,
|
|
48
|
-
timeout: 100000
|
|
49
|
-
})
|
|
50
|
-
expect(userOperationReceipt).not.toBeNull()
|
|
51
|
-
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
52
|
-
expect(userOperationReceipt?.receipt.transactionHash).toBeTruthy()
|
|
53
|
-
|
|
54
|
-
const receipt = await bundlerClient.getUserOperationReceipt({
|
|
55
|
-
hash: opHash
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
expect(receipt?.receipt.transactionHash).toBe(
|
|
59
|
-
userOperationReceipt?.receipt.transactionHash
|
|
60
|
-
)
|
|
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, {
|
|
72
|
-
hash: opHash
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
expect(userOperationStatus).not.toBeNull()
|
|
76
|
-
expect(userOperationStatus).not.toBeUndefined()
|
|
77
|
-
expect(userOperationStatus.status).toBe("included")
|
|
78
|
-
expect(userOperationStatus.transactionHash).toBe(
|
|
79
|
-
userOperationReceipt?.receipt.transactionHash
|
|
80
|
-
)
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
testWithRpc("getUserOperationStatus_V07", async ({ rpc }) => {
|
|
84
|
-
const { altoRpc } = rpc
|
|
85
|
-
|
|
86
|
-
const bundlerClient = getPimlicoClient({
|
|
87
|
-
entryPointVersion: "0.7",
|
|
88
|
-
altoRpc: altoRpc
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
const simpleAccountClient = getBundlerClient({
|
|
92
|
-
account: await getSimpleAccountClient({
|
|
93
|
-
...rpc,
|
|
94
|
-
entryPoint: {
|
|
95
|
-
version: "0.7"
|
|
96
|
-
}
|
|
97
|
-
}),
|
|
98
|
-
entryPoint: {
|
|
99
|
-
version: "0.7"
|
|
100
|
-
},
|
|
101
|
-
...rpc
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
const opHash = await simpleAccountClient.sendUserOperation({
|
|
105
|
-
calls: [
|
|
106
|
-
{
|
|
107
|
-
to: zeroAddress,
|
|
108
|
-
data: "0x",
|
|
109
|
-
value: 0n
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
expect(isHash(opHash)).toBe(true)
|
|
115
|
-
|
|
116
|
-
const userOperationReceipt =
|
|
117
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
118
|
-
hash: opHash,
|
|
119
|
-
timeout: 100000
|
|
120
|
-
})
|
|
121
|
-
expect(userOperationReceipt).not.toBeNull()
|
|
122
|
-
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
123
|
-
expect(userOperationReceipt?.receipt.transactionHash).toBeTruthy()
|
|
124
|
-
|
|
125
|
-
const receipt = await bundlerClient.getUserOperationReceipt({
|
|
126
|
-
hash: opHash
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
expect(receipt?.receipt.transactionHash).toBe(
|
|
130
|
-
userOperationReceipt?.receipt.transactionHash
|
|
131
|
-
)
|
|
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, {
|
|
143
|
-
hash: opHash
|
|
144
|
-
})
|
|
145
|
-
}
|
|
146
|
-
expect(userOperationStatus).not.toBeNull()
|
|
147
|
-
expect(userOperationStatus).not.toBeUndefined()
|
|
148
|
-
expect(userOperationStatus.status).toBe("included")
|
|
149
|
-
expect(userOperationStatus.transactionHash).toBe(
|
|
150
|
-
userOperationReceipt?.receipt.transactionHash
|
|
151
|
-
)
|
|
152
|
-
})
|
|
153
|
-
testWithRpc("getUserOperationStatus_V08", async ({ rpc }) => {
|
|
154
|
-
const { altoRpc } = rpc
|
|
155
|
-
|
|
156
|
-
const bundlerClient = getPimlicoClient({
|
|
157
|
-
entryPointVersion: "0.8",
|
|
158
|
-
altoRpc: altoRpc
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
const simpleAccountClient = getBundlerClient({
|
|
162
|
-
account: await getSimpleAccountClient({
|
|
163
|
-
...rpc,
|
|
164
|
-
entryPoint: {
|
|
165
|
-
version: "0.8"
|
|
166
|
-
}
|
|
167
|
-
}),
|
|
168
|
-
entryPoint: {
|
|
169
|
-
version: "0.8"
|
|
170
|
-
},
|
|
171
|
-
...rpc
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
const opHash = await simpleAccountClient.sendUserOperation({
|
|
175
|
-
calls: [
|
|
176
|
-
{
|
|
177
|
-
to: zeroAddress,
|
|
178
|
-
data: "0x",
|
|
179
|
-
value: 0n
|
|
180
|
-
}
|
|
181
|
-
]
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
expect(isHash(opHash)).toBe(true)
|
|
185
|
-
|
|
186
|
-
const userOperationReceipt =
|
|
187
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
188
|
-
hash: opHash,
|
|
189
|
-
timeout: 100000
|
|
190
|
-
})
|
|
191
|
-
expect(userOperationReceipt).not.toBeNull()
|
|
192
|
-
expect(userOperationReceipt?.userOpHash).toBe(opHash)
|
|
193
|
-
expect(userOperationReceipt?.receipt.transactionHash).toBeTruthy()
|
|
194
|
-
|
|
195
|
-
const receipt = await bundlerClient.getUserOperationReceipt({
|
|
196
|
-
hash: opHash
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
expect(receipt?.receipt.transactionHash).toBe(
|
|
200
|
-
userOperationReceipt?.receipt.transactionHash
|
|
201
|
-
)
|
|
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, {
|
|
213
|
-
hash: opHash
|
|
214
|
-
})
|
|
215
|
-
}
|
|
216
|
-
expect(userOperationStatus).not.toBeNull()
|
|
217
|
-
expect(userOperationStatus).not.toBeUndefined()
|
|
218
|
-
expect(userOperationStatus.status).toBe("included")
|
|
219
|
-
expect(userOperationStatus.transactionHash).toBe(
|
|
220
|
-
userOperationReceipt?.receipt.transactionHash
|
|
221
|
-
)
|
|
222
|
-
})
|
|
223
|
-
})
|