permissionless 0.0.18 → 0.0.20
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/signerToBiconomySmartAccount.js +1 -1
- package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/index.js +3 -1
- package/_cjs/accounts/index.js.map +1 -1
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js +1 -1
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/signerToSafeSmartAccount.js +1 -1
- package/_cjs/accounts/signerToSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/signerToSimpleSmartAccount.js +1 -1
- package/_cjs/accounts/signerToSimpleSmartAccount.js.map +1 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js +3 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js +7 -11
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
- package/_cjs/actions/smartAccount.js +3 -1
- package/_cjs/actions/smartAccount.js.map +1 -1
- package/_cjs/actions/stackup/sponsorUserOperation.js +3 -1
- package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -1
- package/_cjs/clients/decorators/smartAccount.js +5 -0
- package/_cjs/clients/decorators/smartAccount.js.map +1 -1
- package/_cjs/utils/index.js +6 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js +1 -1
- package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/index.js +2 -1
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js +1 -1
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/signerToSafeSmartAccount.js +1 -1
- package/_esm/accounts/signerToSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/signerToSimpleSmartAccount.js +1 -1
- package/_esm/accounts/signerToSimpleSmartAccount.js.map +1 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js +4 -2
- package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js +7 -11
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
- package/_esm/actions/smartAccount.js +2 -1
- package/_esm/actions/smartAccount.js.map +1 -1
- package/_esm/actions/stackup/sponsorUserOperation.js +3 -1
- package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -1
- package/_esm/clients/decorators/smartAccount.js +5 -0
- package/_esm/clients/decorators/smartAccount.js.map +1 -1
- package/_esm/utils/index.js +3 -1
- package/_esm/utils/index.js.map +1 -1
- package/_types/accounts/index.d.ts +2 -1
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/accounts/types.d.ts +2 -2
- package/_types/accounts/types.d.ts.map +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +5 -10
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
- package/_types/actions/pimlico.d.ts +2 -2
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +2 -7
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -1
- package/_types/actions/smartAccount.d.ts +2 -1
- package/_types/actions/smartAccount.d.ts.map +1 -1
- package/_types/actions/stackup/sponsorUserOperation.d.ts +2 -7
- package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -1
- package/_types/clients/createSmartAccountClient.d.ts +1 -0
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +3 -3
- package/_types/clients/decorators/smartAccount.d.ts +2 -0
- package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
- package/_types/utils/index.d.ts +4 -2
- package/_types/utils/index.d.ts.map +1 -1
- package/_types/utils/signUserOperationHashWithECDSA.d.ts +2 -2
- package/accounts/biconomy/signerToBiconomySmartAccount.ts +1 -1
- package/accounts/index.ts +3 -0
- package/accounts/kernel/signerToEcdsaKernelSmartAccount.ts +1 -1
- package/accounts/signerToSafeSmartAccount.ts +1 -1
- package/accounts/signerToSimpleSmartAccount.ts +1 -1
- package/accounts/types.ts +2 -2
- package/actions/pimlico/sponsorUserOperation.ts +9 -11
- package/actions/pimlico.ts +2 -2
- package/actions/smartAccount/prepareUserOperationRequest.ts +10 -23
- package/actions/smartAccount.ts +8 -1
- package/actions/stackup/sponsorUserOperation.ts +6 -8
- package/clients/decorators/pimlico.ts +4 -4
- package/clients/decorators/smartAccount.ts +15 -0
- package/package.json +1 -1
- package/utils/index.ts +7 -0
- package/utils/signUserOperationHashWithECDSA.ts +2 -2
- package/utils/deepHexlify.test.ts +0 -35
package/accounts/types.ts
CHANGED
|
@@ -48,13 +48,13 @@ export type SmartAccount<
|
|
|
48
48
|
data: Hex
|
|
49
49
|
}[]
|
|
50
50
|
) => Promise<Hex>
|
|
51
|
-
getDummySignature(): Promise<Hex>
|
|
51
|
+
getDummySignature(userOperation: UserOperation): Promise<Hex>
|
|
52
52
|
encodeDeployCallData: <TAbi extends Abi | readonly unknown[] = Abi>({
|
|
53
53
|
abi,
|
|
54
54
|
args,
|
|
55
55
|
bytecode
|
|
56
56
|
}: { abi: TAbi; bytecode: Hex } & GetConstructorArgs<TAbi>) => Promise<Hex>
|
|
57
|
-
signUserOperation: (
|
|
57
|
+
signUserOperation: (userOperation: UserOperation) => Promise<Hex>
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export type SmartAccountSigner<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Account, Address, Chain, Client,
|
|
1
|
+
import type { Account, Address, Chain, Client, Transport } from "viem"
|
|
2
2
|
import type { PartialBy } from "viem/types/utils"
|
|
3
3
|
import type { PimlicoPaymasterRpcSchema } from "../../types/pimlico.js"
|
|
4
4
|
import type {
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from "../../types/userOperation.js"
|
|
8
8
|
import { deepHexlify } from "../../utils/deepHexlify.js"
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type PimlicoSponsorUserOperationParameters = {
|
|
11
11
|
userOperation: PartialBy<
|
|
12
12
|
UserOperation,
|
|
13
13
|
| "callGasLimit"
|
|
@@ -19,12 +19,7 @@ export type PimlocoSponsorUserOperationParameters = {
|
|
|
19
19
|
sponsorshipPolicyId?: string
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export type SponsorUserOperationReturnType =
|
|
23
|
-
paymasterAndData: Hex
|
|
24
|
-
preVerificationGas: bigint
|
|
25
|
-
verificationGasLimit: bigint
|
|
26
|
-
callGasLimit: bigint
|
|
27
|
-
}
|
|
22
|
+
export type SponsorUserOperationReturnType = UserOperation
|
|
28
23
|
|
|
29
24
|
/**
|
|
30
25
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
@@ -32,7 +27,7 @@ export type SponsorUserOperationReturnType = {
|
|
|
32
27
|
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
|
|
33
28
|
*
|
|
34
29
|
* @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
|
|
35
|
-
* @param args {@link
|
|
30
|
+
* @param args {@link PimlicoSponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
|
|
36
31
|
* @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
|
|
37
32
|
*
|
|
38
33
|
*
|
|
@@ -57,7 +52,7 @@ export const sponsorUserOperation = async <
|
|
|
57
52
|
TAccount extends Account | undefined = Account | undefined
|
|
58
53
|
>(
|
|
59
54
|
client: Client<TTransport, TChain, TAccount, PimlicoPaymasterRpcSchema>,
|
|
60
|
-
args:
|
|
55
|
+
args: PimlicoSponsorUserOperationParameters
|
|
61
56
|
): Promise<SponsorUserOperationReturnType> => {
|
|
62
57
|
const response = await client.request({
|
|
63
58
|
method: "pm_sponsorUserOperation",
|
|
@@ -79,10 +74,13 @@ export const sponsorUserOperation = async <
|
|
|
79
74
|
]
|
|
80
75
|
})
|
|
81
76
|
|
|
82
|
-
|
|
77
|
+
const userOperation: UserOperation = {
|
|
78
|
+
...args.userOperation,
|
|
83
79
|
paymasterAndData: response.paymasterAndData,
|
|
84
80
|
preVerificationGas: BigInt(response.preVerificationGas),
|
|
85
81
|
verificationGasLimit: BigInt(response.verificationGasLimit),
|
|
86
82
|
callGasLimit: BigInt(response.callGasLimit)
|
|
87
83
|
}
|
|
84
|
+
|
|
85
|
+
return userOperation
|
|
88
86
|
}
|
package/actions/pimlico.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getUserOperationStatus
|
|
9
9
|
} from "./pimlico/getUserOperationStatus.js"
|
|
10
10
|
import {
|
|
11
|
-
type
|
|
11
|
+
type PimlicoSponsorUserOperationParameters,
|
|
12
12
|
type SponsorUserOperationReturnType,
|
|
13
13
|
sponsorUserOperation
|
|
14
14
|
} from "./pimlico/sponsorUserOperation.js"
|
|
@@ -32,7 +32,7 @@ export type {
|
|
|
32
32
|
GetUserOperationGasPriceReturnType,
|
|
33
33
|
GetUserOperationStatusParameters,
|
|
34
34
|
GetUserOperationStatusReturnType,
|
|
35
|
-
|
|
35
|
+
PimlicoSponsorUserOperationParameters,
|
|
36
36
|
SponsorUserOperationReturnType,
|
|
37
37
|
PimlicoBundlerActions,
|
|
38
38
|
PimlicoPaymasterClientActions,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address, Chain, Client,
|
|
1
|
+
import type { Address, Chain, Client, Transport } from "viem"
|
|
2
2
|
import { estimateFeesPerGas } from "viem/actions"
|
|
3
3
|
import type { SmartAccount } from "../../accounts/types.js"
|
|
4
4
|
import type {
|
|
@@ -17,12 +17,7 @@ export type SponsorUserOperationMiddleware = {
|
|
|
17
17
|
sponsorUserOperation?: (args: {
|
|
18
18
|
userOperation: UserOperation
|
|
19
19
|
entryPoint: Address
|
|
20
|
-
}) => Promise<
|
|
21
|
-
paymasterAndData: Hex
|
|
22
|
-
preVerificationGas: bigint
|
|
23
|
-
verificationGasLimit: bigint
|
|
24
|
-
callGasLimit: bigint
|
|
25
|
-
}>
|
|
20
|
+
}) => Promise<UserOperation>
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
export type PrepareUserOperationRequestParameters<
|
|
@@ -63,12 +58,11 @@ export async function prepareUserOperationRequest<
|
|
|
63
58
|
|
|
64
59
|
const account = parseAccount(account_) as SmartAccount
|
|
65
60
|
|
|
66
|
-
const [sender, nonce, initCode,
|
|
61
|
+
const [sender, nonce, initCode, callData, gasEstimation] =
|
|
67
62
|
await Promise.all([
|
|
68
63
|
partialUserOperation.sender || account.address,
|
|
69
64
|
partialUserOperation.nonce || account.getNonce(),
|
|
70
65
|
partialUserOperation.initCode || account.getInitCode(),
|
|
71
|
-
partialUserOperation.signature || account.getDummySignature(),
|
|
72
66
|
partialUserOperation.callData,
|
|
73
67
|
!partialUserOperation.maxFeePerGas ||
|
|
74
68
|
!partialUserOperation.maxPriorityFeePerGas
|
|
@@ -76,13 +70,13 @@ export async function prepareUserOperationRequest<
|
|
|
76
70
|
: undefined
|
|
77
71
|
])
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
let userOperation: UserOperation = {
|
|
80
74
|
sender,
|
|
81
75
|
nonce,
|
|
82
76
|
initCode,
|
|
83
|
-
signature,
|
|
84
77
|
callData,
|
|
85
78
|
paymasterAndData: "0x",
|
|
79
|
+
signature: partialUserOperation.signature || "0x",
|
|
86
80
|
maxFeePerGas:
|
|
87
81
|
partialUserOperation.maxFeePerGas ||
|
|
88
82
|
gasEstimation?.maxFeePerGas ||
|
|
@@ -96,22 +90,15 @@ export async function prepareUserOperationRequest<
|
|
|
96
90
|
preVerificationGas: partialUserOperation.preVerificationGas || 0n
|
|
97
91
|
}
|
|
98
92
|
|
|
93
|
+
if (userOperation.signature === "0x") {
|
|
94
|
+
userOperation.signature = await account.getDummySignature(userOperation)
|
|
95
|
+
}
|
|
96
|
+
|
|
99
97
|
if (sponsorUserOperation) {
|
|
100
|
-
|
|
101
|
-
callGasLimit,
|
|
102
|
-
verificationGasLimit,
|
|
103
|
-
preVerificationGas,
|
|
104
|
-
paymasterAndData
|
|
105
|
-
} = await sponsorUserOperation({
|
|
98
|
+
userOperation = await sponsorUserOperation({
|
|
106
99
|
userOperation,
|
|
107
100
|
entryPoint: account.entryPoint
|
|
108
101
|
})
|
|
109
|
-
userOperation.paymasterAndData = paymasterAndData
|
|
110
|
-
userOperation.callGasLimit = userOperation.callGasLimit || callGasLimit
|
|
111
|
-
userOperation.verificationGasLimit =
|
|
112
|
-
userOperation.verificationGasLimit || verificationGasLimit
|
|
113
|
-
userOperation.preVerificationGas =
|
|
114
|
-
userOperation.preVerificationGas || preVerificationGas
|
|
115
102
|
} else if (
|
|
116
103
|
!userOperation.callGasLimit ||
|
|
117
104
|
!userOperation.verificationGasLimit ||
|
package/actions/smartAccount.ts
CHANGED
|
@@ -30,6 +30,11 @@ import {
|
|
|
30
30
|
sendTransactions
|
|
31
31
|
} from "./smartAccount/sendTransactions.js"
|
|
32
32
|
|
|
33
|
+
import {
|
|
34
|
+
type WriteContractWithPaymasterParameters,
|
|
35
|
+
writeContract
|
|
36
|
+
} from "./smartAccount/writeContract.js"
|
|
37
|
+
|
|
33
38
|
export {
|
|
34
39
|
deployContract,
|
|
35
40
|
type DeployContractParametersWithPaymaster,
|
|
@@ -45,5 +50,7 @@ export {
|
|
|
45
50
|
type SendTransactionWithPaymasterParameters,
|
|
46
51
|
type SponsorUserOperationMiddleware,
|
|
47
52
|
sendTransactions,
|
|
48
|
-
type SendTransactionsWithPaymasterParameters
|
|
53
|
+
type SendTransactionsWithPaymasterParameters,
|
|
54
|
+
type WriteContractWithPaymasterParameters,
|
|
55
|
+
writeContract
|
|
49
56
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address
|
|
1
|
+
import type { Address } from "viem"
|
|
2
2
|
import type { PartialBy } from "viem/types/utils"
|
|
3
3
|
import { type StackupPaymasterClient } from "../../clients/stackup.js"
|
|
4
4
|
import type { StackupPaymasterContext } from "../../types/stackup.js"
|
|
@@ -20,12 +20,7 @@ export type SponsorUserOperationParameters = {
|
|
|
20
20
|
context: StackupPaymasterContext
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export type SponsorUserOperationReturnType =
|
|
24
|
-
paymasterAndData: Hex
|
|
25
|
-
preVerificationGas: bigint
|
|
26
|
-
verificationGasLimit: bigint
|
|
27
|
-
callGasLimit: bigint
|
|
28
|
-
}
|
|
23
|
+
export type SponsorUserOperationReturnType = UserOperation
|
|
29
24
|
|
|
30
25
|
/**
|
|
31
26
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
@@ -65,10 +60,13 @@ export const sponsorUserOperation = async (
|
|
|
65
60
|
]
|
|
66
61
|
})
|
|
67
62
|
|
|
68
|
-
|
|
63
|
+
const userOperation: UserOperation = {
|
|
64
|
+
...args.userOperation,
|
|
69
65
|
paymasterAndData: response.paymasterAndData,
|
|
70
66
|
preVerificationGas: BigInt(response.preVerificationGas),
|
|
71
67
|
verificationGasLimit: BigInt(response.verificationGasLimit),
|
|
72
68
|
callGasLimit: BigInt(response.callGasLimit)
|
|
73
69
|
}
|
|
70
|
+
|
|
71
|
+
return userOperation
|
|
74
72
|
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
getUserOperationStatus
|
|
15
15
|
} from "../../actions/pimlico/getUserOperationStatus.js"
|
|
16
16
|
import {
|
|
17
|
-
type
|
|
17
|
+
type PimlicoSponsorUserOperationParameters,
|
|
18
18
|
type SponsorUserOperationReturnType,
|
|
19
19
|
sponsorUserOperation
|
|
20
20
|
} from "../../actions/pimlico/sponsorUserOperation.js"
|
|
@@ -83,7 +83,7 @@ export type PimlicoPaymasterClientActions = {
|
|
|
83
83
|
*
|
|
84
84
|
* https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
|
|
85
85
|
*
|
|
86
|
-
* @param args {@link
|
|
86
|
+
* @param args {@link PimlicoSponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
|
|
87
87
|
* @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
|
|
88
88
|
*
|
|
89
89
|
* @example
|
|
@@ -102,7 +102,7 @@ export type PimlicoPaymasterClientActions = {
|
|
|
102
102
|
*
|
|
103
103
|
*/
|
|
104
104
|
sponsorUserOperation: (
|
|
105
|
-
args:
|
|
105
|
+
args: PimlicoSponsorUserOperationParameters
|
|
106
106
|
) => Promise<SponsorUserOperationReturnType>
|
|
107
107
|
|
|
108
108
|
validateSponsorshipPolicies: (
|
|
@@ -148,7 +148,7 @@ export type PimlicoPaymasterClientActions = {
|
|
|
148
148
|
export const pimlicoPaymasterActions = (
|
|
149
149
|
client: Client
|
|
150
150
|
): PimlicoPaymasterClientActions => ({
|
|
151
|
-
sponsorUserOperation: async (args:
|
|
151
|
+
sponsorUserOperation: async (args: PimlicoSponsorUserOperationParameters) =>
|
|
152
152
|
sponsorUserOperation(client as PimlicoPaymasterClient, args),
|
|
153
153
|
validateSponsorshipPolicies: async (
|
|
154
154
|
args: ValidateSponsorshipPoliciesParameters
|
|
@@ -26,6 +26,11 @@ import {
|
|
|
26
26
|
type SendTransactionWithPaymasterParameters,
|
|
27
27
|
sendTransaction
|
|
28
28
|
} from "../../actions/smartAccount/sendTransaction.js"
|
|
29
|
+
import {
|
|
30
|
+
type SendUserOperationParameters,
|
|
31
|
+
type SendUserOperationReturnType,
|
|
32
|
+
sendUserOperation
|
|
33
|
+
} from "../../actions/smartAccount/sendUserOperation.js"
|
|
29
34
|
import { signMessage } from "../../actions/smartAccount/signMessage.js"
|
|
30
35
|
import { signTypedData } from "../../actions/smartAccount/signTypedData.js"
|
|
31
36
|
import {
|
|
@@ -359,6 +364,11 @@ export type SmartAccountActions<
|
|
|
359
364
|
>
|
|
360
365
|
>[1]
|
|
361
366
|
) => Promise<PrepareUserOperationRequestReturnType>
|
|
367
|
+
sendUserOperation: <TTransport extends Transport>(
|
|
368
|
+
args: Parameters<
|
|
369
|
+
typeof sendUserOperation<TTransport, TChain, TSmartAccount>
|
|
370
|
+
>[1]
|
|
371
|
+
) => Promise<SendUserOperationReturnType>
|
|
362
372
|
/**
|
|
363
373
|
* Creates, signs, and sends a new transaction to the network.
|
|
364
374
|
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
@@ -441,6 +451,11 @@ export const smartAccountActions =
|
|
|
441
451
|
...args,
|
|
442
452
|
sponsorUserOperation
|
|
443
453
|
} as SendTransactionsWithPaymasterParameters),
|
|
454
|
+
sendUserOperation: (args) =>
|
|
455
|
+
sendUserOperation(client, {
|
|
456
|
+
...args,
|
|
457
|
+
sponsorUserOperation
|
|
458
|
+
} as SendUserOperationParameters),
|
|
444
459
|
signMessage: (args) => signMessage(client, args),
|
|
445
460
|
signTypedData: (args) => signTypedData(client, args),
|
|
446
461
|
writeContract: (args) =>
|
package/package.json
CHANGED
package/utils/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Account, Address } from "viem"
|
|
2
|
+
import { deepHexlify, transactionReceiptStatus } from "./deepHexlify.js"
|
|
3
|
+
import { getAction } from "./getAction.js"
|
|
2
4
|
import {
|
|
3
5
|
type GetRequiredPrefundReturnType,
|
|
4
6
|
getRequiredPrefund
|
|
@@ -9,6 +11,7 @@ import {
|
|
|
9
11
|
} from "./getUserOperationHash.js"
|
|
10
12
|
import {
|
|
11
13
|
AccountOrClientNotFoundError,
|
|
14
|
+
type SignUserOperationHashWithECDSAParams,
|
|
12
15
|
signUserOperationHashWithECDSA
|
|
13
16
|
} from "./signUserOperationHashWithECDSA.js"
|
|
14
17
|
import { walletClientToCustomSigner } from "./walletClientToCustomSigner.js"
|
|
@@ -20,11 +23,15 @@ export function parseAccount(account: Address | Account): Account {
|
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export {
|
|
26
|
+
transactionReceiptStatus,
|
|
27
|
+
deepHexlify,
|
|
28
|
+
getAction,
|
|
23
29
|
getUserOperationHash,
|
|
24
30
|
getRequiredPrefund,
|
|
25
31
|
walletClientToCustomSigner,
|
|
26
32
|
type GetRequiredPrefundReturnType,
|
|
27
33
|
type GetUserOperationHashParams,
|
|
28
34
|
signUserOperationHashWithECDSA,
|
|
35
|
+
type SignUserOperationHashWithECDSAParams,
|
|
29
36
|
AccountOrClientNotFoundError
|
|
30
37
|
}
|
|
@@ -13,7 +13,7 @@ import type { UserOperation } from "../types/userOperation.js"
|
|
|
13
13
|
import { getUserOperationHash } from "./getUserOperationHash.js"
|
|
14
14
|
import { parseAccount } from "./index.js"
|
|
15
15
|
|
|
16
|
-
export type
|
|
16
|
+
export type SignUserOperationHashWithECDSAParams<
|
|
17
17
|
TTransport extends Transport = Transport,
|
|
18
18
|
TChain extends Chain | undefined = Chain | undefined,
|
|
19
19
|
TAccount extends Account | undefined = Account | undefined
|
|
@@ -83,7 +83,7 @@ export const signUserOperationHashWithECDSA = async <
|
|
|
83
83
|
userOperation,
|
|
84
84
|
chainId,
|
|
85
85
|
entryPoint
|
|
86
|
-
}:
|
|
86
|
+
}: SignUserOperationHashWithECDSAParams<
|
|
87
87
|
TTransport,
|
|
88
88
|
TChain,
|
|
89
89
|
TAccount
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { beforeAll, expect, test } from "bun:test"
|
|
2
|
-
import dotenv from "dotenv"
|
|
3
|
-
import { deepHexlify } from "./deepHexlify.js"
|
|
4
|
-
|
|
5
|
-
dotenv.config()
|
|
6
|
-
|
|
7
|
-
beforeAll(() => {
|
|
8
|
-
if (!process.env.STACKUP_API_KEY)
|
|
9
|
-
throw new Error("STACKUP_API_KEY environment variable not set")
|
|
10
|
-
if (!process.env.FACTORY_ADDRESS)
|
|
11
|
-
throw new Error("FACTORY_ADDRESS environment variable not set")
|
|
12
|
-
if (!process.env.TEST_PRIVATE_KEY)
|
|
13
|
-
throw new Error("TEST_PRIVATE_KEY environment variable not set")
|
|
14
|
-
if (!process.env.RPC_URL)
|
|
15
|
-
throw new Error("RPC_URL environment variable not set")
|
|
16
|
-
if (!process.env.ENTRYPOINT_ADDRESS)
|
|
17
|
-
throw new Error("ENTRYPOINT_ADDRESS environment variable not set")
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
test("Test deep Hexlify", async () => {
|
|
21
|
-
expect(deepHexlify("abcd")).toBe("abcd")
|
|
22
|
-
expect(deepHexlify(null)).toBe(null)
|
|
23
|
-
expect(deepHexlify(true)).toBe(true)
|
|
24
|
-
expect(deepHexlify(false)).toBe(false)
|
|
25
|
-
expect(deepHexlify(1n)).toBe("0x1")
|
|
26
|
-
expect(
|
|
27
|
-
deepHexlify({
|
|
28
|
-
name: "Garvit",
|
|
29
|
-
balance: 1n
|
|
30
|
-
})
|
|
31
|
-
).toEqual({
|
|
32
|
-
name: "Garvit",
|
|
33
|
-
balance: "0x1"
|
|
34
|
-
})
|
|
35
|
-
})
|