permissionless 0.0.26 → 0.0.27
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 +6 -0
- package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/signerToSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/signerToSimpleSmartAccount.js.map +1 -1
- package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/_cjs/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_cjs/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
- package/_cjs/actions/public/getAccountNonce.js +2 -1
- package/_cjs/actions/public/getAccountNonce.js.map +1 -1
- package/_cjs/actions/public/getSenderAddress.js +2 -1
- package/_cjs/actions/public/getSenderAddress.js.map +1 -1
- package/_cjs/actions/smartAccount/deployContract.js +4 -3
- package/_cjs/actions/smartAccount/deployContract.js.map +1 -1
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
- package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -1
- package/_cjs/actions/smartAccount/sendTransactions.js.map +1 -1
- package/_cjs/actions/smartAccount/sendUserOperation.js +1 -2
- package/_cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/_cjs/actions/smartAccount/signTypedData.js.map +1 -1
- package/_cjs/actions/smartAccount.js.map +1 -1
- package/_cjs/clients/createSmartAccountClient.js.map +1 -1
- package/_cjs/clients/decorators/bundler.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/decorators/smartAccount.js +30 -28
- package/_cjs/clients/decorators/smartAccount.js.map +1 -1
- package/_cjs/utils/deepHexlify.js.map +1 -1
- package/_cjs/utils/observe.js.map +1 -1
- package/_cjs/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/signerToSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/signerToSimpleSmartAccount.js.map +1 -1
- package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_esm/actions/pimlico/validateSponsorshipPolicies.js +1 -1
- package/_esm/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
- package/_esm/actions/public/getAccountNonce.js +2 -1
- package/_esm/actions/public/getAccountNonce.js.map +1 -1
- package/_esm/actions/public/getSenderAddress.js +2 -1
- package/_esm/actions/public/getSenderAddress.js.map +1 -1
- package/_esm/actions/smartAccount/deployContract.js +5 -5
- package/_esm/actions/smartAccount/deployContract.js.map +1 -1
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
- package/_esm/actions/smartAccount/sendTransaction.js +1 -1
- package/_esm/actions/smartAccount/sendTransaction.js.map +1 -1
- package/_esm/actions/smartAccount/sendTransactions.js +1 -1
- package/_esm/actions/smartAccount/sendTransactions.js.map +1 -1
- package/_esm/actions/smartAccount/sendUserOperation.js +1 -2
- package/_esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/_esm/actions/smartAccount/signTypedData.js.map +1 -1
- package/_esm/actions/smartAccount.js.map +1 -1
- package/_esm/clients/createSmartAccountClient.js.map +1 -1
- package/_esm/clients/decorators/bundler.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js +1 -1
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/decorators/smartAccount.js +30 -28
- package/_esm/clients/decorators/smartAccount.js.map +1 -1
- package/_esm/utils/deepHexlify.js.map +1 -1
- package/_esm/utils/observe.js.map +1 -1
- package/_esm/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_types/accounts/types.d.ts +3 -3
- package/_types/accounts/types.d.ts.map +1 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts +2 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationByHash.d.ts +3 -2
- package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts +2 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/bundler/sendUserOperation.d.ts +2 -1
- package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/bundler/waitForUserOperationReceipt.d.ts +2 -1
- package/_types/actions/bundler/waitForUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +2 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationStatus.d.ts +2 -1
- package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +2 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
- package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts +5 -4
- package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts.map +1 -1
- package/_types/actions/pimlico.d.ts +2 -2
- package/_types/actions/pimlico.d.ts.map +1 -1
- package/_types/actions/public/getAccountNonce.d.ts +2 -1
- package/_types/actions/public/getAccountNonce.d.ts.map +1 -1
- package/_types/actions/public/getSenderAddress.d.ts +2 -1
- package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
- package/_types/actions/smartAccount/deployContract.d.ts +4 -3
- package/_types/actions/smartAccount/deployContract.d.ts.map +1 -1
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +2 -2
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendTransaction.d.ts +4 -3
- package/_types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendTransactions.d.ts +4 -4
- package/_types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendUserOperation.d.ts +3 -4
- package/_types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/smartAccount/writeContract.d.ts +3 -3
- package/_types/actions/smartAccount/writeContract.d.ts.map +1 -1
- package/_types/actions/smartAccount.d.ts +2 -2
- package/_types/actions/smartAccount.d.ts.map +1 -1
- package/_types/clients/createSmartAccountClient.d.ts +5 -3
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
- package/_types/clients/decorators/bundler.d.ts +6 -5
- package/_types/clients/decorators/bundler.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +7 -6
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/decorators/smartAccount.d.ts +8 -7
- package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
- package/accounts/types.ts +4 -3
- package/actions/bundler/estimateUserOperationGas.ts +3 -2
- package/actions/bundler/getUserOperationByHash.ts +4 -3
- package/actions/bundler/getUserOperationReceipt.ts +3 -2
- package/actions/bundler/sendUserOperation.ts +2 -1
- package/actions/bundler/waitForUserOperationReceipt.ts +3 -2
- package/actions/pimlico/getUserOperationGasPrice.ts +2 -1
- package/actions/pimlico/getUserOperationStatus.ts +3 -2
- package/actions/pimlico/sponsorUserOperation.ts +3 -2
- package/actions/pimlico/validateSponsorshipPolicies.ts +6 -5
- package/actions/pimlico.ts +2 -2
- package/actions/public/getAccountNonce.ts +4 -1
- package/actions/public/getSenderAddress.ts +4 -1
- package/actions/smartAccount/deployContract.ts +19 -15
- package/actions/smartAccount/prepareUserOperationRequest.ts +3 -2
- package/actions/smartAccount/sendTransaction.ts +6 -7
- package/actions/smartAccount/sendTransactions.ts +5 -5
- package/actions/smartAccount/sendUserOperation.ts +5 -12
- package/actions/smartAccount/writeContract.ts +3 -3
- package/actions/smartAccount.ts +0 -2
- package/clients/createSmartAccountClient.ts +10 -16
- package/clients/decorators/bundler.ts +12 -9
- package/clients/decorators/pimlico.ts +12 -9
- package/clients/decorators/smartAccount.ts +34 -25
- package/package.json +1 -1
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
type ContractFunctionArgs,
|
|
6
6
|
type ContractFunctionName,
|
|
7
7
|
type EncodeFunctionDataParameters,
|
|
8
|
+
type Hash,
|
|
8
9
|
type Transport,
|
|
9
10
|
type WriteContractParameters,
|
|
10
|
-
type WriteContractReturnType,
|
|
11
11
|
encodeFunctionData
|
|
12
12
|
} from "viem"
|
|
13
13
|
import { type SmartAccount } from "../../accounts/types.js"
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
*
|
|
34
34
|
* @param client - Client to use
|
|
35
35
|
* @param parameters - {@link WriteContractParameters}
|
|
36
|
-
* @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash).
|
|
36
|
+
* @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash).
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* import { createWalletClient, custom, parseAbi } from 'viem'
|
|
@@ -124,7 +124,7 @@ export async function writeContract<
|
|
|
124
124
|
TArgs,
|
|
125
125
|
TChainOverride
|
|
126
126
|
>
|
|
127
|
-
): Promise<
|
|
127
|
+
): Promise<Hash> {
|
|
128
128
|
const data = encodeFunctionData<TAbi, TFunctionName>({
|
|
129
129
|
abi,
|
|
130
130
|
args,
|
package/actions/smartAccount.ts
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
19
|
type SendUserOperationParameters,
|
|
20
|
-
type SendUserOperationReturnType,
|
|
21
20
|
sendUserOperation
|
|
22
21
|
} from "./smartAccount/sendUserOperation.js"
|
|
23
22
|
|
|
@@ -44,7 +43,6 @@ export {
|
|
|
44
43
|
sendTransaction,
|
|
45
44
|
sendUserOperation,
|
|
46
45
|
type SendUserOperationParameters,
|
|
47
|
-
type SendUserOperationReturnType,
|
|
48
46
|
signMessage,
|
|
49
47
|
signTypedData,
|
|
50
48
|
type SendTransactionWithPaymasterParameters,
|
|
@@ -2,7 +2,6 @@ import type {
|
|
|
2
2
|
Chain,
|
|
3
3
|
Client,
|
|
4
4
|
ClientConfig,
|
|
5
|
-
ParseAccount,
|
|
6
5
|
Transport,
|
|
7
6
|
WalletClientConfig
|
|
8
7
|
} from "viem"
|
|
@@ -38,20 +37,15 @@ export type SmartAccountClient<
|
|
|
38
37
|
export type SmartAccountClientConfig<
|
|
39
38
|
transport extends Transport = Transport,
|
|
40
39
|
chain extends Chain | undefined = Chain | undefined,
|
|
41
|
-
|
|
40
|
+
account extends SmartAccount | undefined = SmartAccount | undefined
|
|
42
41
|
> = Prettify<
|
|
43
42
|
Pick<
|
|
44
|
-
ClientConfig<transport, chain,
|
|
45
|
-
| "
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
| "pollingInterval"
|
|
51
|
-
| "transport"
|
|
52
|
-
>
|
|
53
|
-
> &
|
|
54
|
-
SponsorUserOperationMiddleware
|
|
43
|
+
ClientConfig<transport, chain, account>,
|
|
44
|
+
"cacheTime" | "chain" | "key" | "name" | "pollingInterval" | "transport"
|
|
45
|
+
> & {
|
|
46
|
+
account?: account
|
|
47
|
+
} & SponsorUserOperationMiddleware
|
|
48
|
+
>
|
|
55
49
|
|
|
56
50
|
/**
|
|
57
51
|
* Creates a EIP-4337 compliant Bundler Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
|
|
@@ -75,11 +69,11 @@ export type SmartAccountClientConfig<
|
|
|
75
69
|
|
|
76
70
|
export function createSmartAccountClient<
|
|
77
71
|
TTransport extends Transport,
|
|
78
|
-
TChain extends Chain | undefined =
|
|
79
|
-
TSmartAccount extends SmartAccount | undefined =
|
|
72
|
+
TChain extends Chain | undefined = undefined,
|
|
73
|
+
TSmartAccount extends SmartAccount | undefined = undefined
|
|
80
74
|
>(
|
|
81
75
|
parameters: SmartAccountClientConfig<TTransport, TChain, TSmartAccount>
|
|
82
|
-
): SmartAccountClient<TTransport, TChain,
|
|
76
|
+
): SmartAccountClient<TTransport, TChain, TSmartAccount>
|
|
83
77
|
|
|
84
78
|
export function createSmartAccountClient(
|
|
85
79
|
parameters: SmartAccountClientConfig
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type WaitForUserOperationReceiptParameters,
|
|
26
26
|
waitForUserOperationReceipt
|
|
27
27
|
} from "../../actions/bundler/waitForUserOperationReceipt.js"
|
|
28
|
+
import type { Prettify } from "../../types/index.js"
|
|
28
29
|
import type { BundlerClient } from "../createBundlerClient.js"
|
|
29
30
|
|
|
30
31
|
export type BundlerActions = {
|
|
@@ -53,7 +54,9 @@ export type BundlerActions = {
|
|
|
53
54
|
*
|
|
54
55
|
* // Return '0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34'
|
|
55
56
|
*/
|
|
56
|
-
sendUserOperation: (
|
|
57
|
+
sendUserOperation: (
|
|
58
|
+
args: Prettify<SendUserOperationParameters>
|
|
59
|
+
) => Promise<Hash>
|
|
57
60
|
/**
|
|
58
61
|
*
|
|
59
62
|
* Estimates preVerificationGas, verificationGasLimit and callGasLimit for user operation
|
|
@@ -80,8 +83,8 @@ export type BundlerActions = {
|
|
|
80
83
|
* // Return {preVerificationGas: 43492n, verificationGasLimit: 59436n, callGasLimit: 9000n}
|
|
81
84
|
*/
|
|
82
85
|
estimateUserOperationGas: (
|
|
83
|
-
args: EstimateUserOperationGasParameters
|
|
84
|
-
) => Promise<EstimateUserOperationGasReturnType
|
|
86
|
+
args: Prettify<EstimateUserOperationGasParameters>
|
|
87
|
+
) => Promise<Prettify<EstimateUserOperationGasReturnType>>
|
|
85
88
|
/**
|
|
86
89
|
*
|
|
87
90
|
* Returns the supported entrypoints by the bundler service
|
|
@@ -147,8 +150,8 @@ export type BundlerActions = {
|
|
|
147
150
|
*
|
|
148
151
|
*/
|
|
149
152
|
getUserOperationByHash: (
|
|
150
|
-
args: GetUserOperationByHashParameters
|
|
151
|
-
) => Promise<GetUserOperationByHashReturnType>
|
|
153
|
+
args: Prettify<GetUserOperationByHashParameters>
|
|
154
|
+
) => Promise<Prettify<GetUserOperationByHashReturnType> | null>
|
|
152
155
|
/**
|
|
153
156
|
*
|
|
154
157
|
* Returns the user operation receipt from userOpHash
|
|
@@ -171,8 +174,8 @@ export type BundlerActions = {
|
|
|
171
174
|
*
|
|
172
175
|
*/
|
|
173
176
|
getUserOperationReceipt: (
|
|
174
|
-
args: GetUserOperationReceiptParameters
|
|
175
|
-
) => Promise<GetUserOperationReceiptReturnType | null>
|
|
177
|
+
args: Prettify<GetUserOperationReceiptParameters>
|
|
178
|
+
) => Promise<Prettify<GetUserOperationReceiptReturnType> | null>
|
|
176
179
|
|
|
177
180
|
/**
|
|
178
181
|
* Waits for the User Operation to be included on a [Block](https://viem.sh/docs/glossary/terms.html#block) (one confirmation), and then returns the [User Operation Receipt](https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationReceipt).
|
|
@@ -196,8 +199,8 @@ export type BundlerActions = {
|
|
|
196
199
|
* })
|
|
197
200
|
*/
|
|
198
201
|
waitForUserOperationReceipt: (
|
|
199
|
-
args: WaitForUserOperationReceiptParameters
|
|
200
|
-
) => Promise<GetUserOperationReceiptReturnType
|
|
202
|
+
args: Prettify<WaitForUserOperationReceiptParameters>
|
|
203
|
+
) => Promise<Prettify<GetUserOperationReceiptReturnType>>
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
const bundlerActions = (client: Client): BundlerActions => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Client, Hash } from "viem"
|
|
2
2
|
import {
|
|
3
|
+
type ValidateSponsorshipPolicies,
|
|
3
4
|
type ValidateSponsorshipPoliciesParameters,
|
|
4
|
-
type ValidateSponsorshipPoliciesReturnType,
|
|
5
5
|
validateSponsorshipPolicies
|
|
6
6
|
} from "../../actions/pimlico.js"
|
|
7
7
|
import {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type SponsorUserOperationReturnType,
|
|
19
19
|
sponsorUserOperation
|
|
20
20
|
} from "../../actions/pimlico/sponsorUserOperation.js"
|
|
21
|
+
import type { Prettify } from "../../types/index.js"
|
|
21
22
|
import type {
|
|
22
23
|
PimlicoBundlerClient,
|
|
23
24
|
PimlicoPaymasterClient
|
|
@@ -43,7 +44,9 @@ export type PimlicoBundlerActions = {
|
|
|
43
44
|
*
|
|
44
45
|
* await bundlerClient.getUserOperationGasPrice()
|
|
45
46
|
*/
|
|
46
|
-
getUserOperationGasPrice: () => Promise<
|
|
47
|
+
getUserOperationGasPrice: () => Promise<
|
|
48
|
+
Prettify<GetUserOperationGasPriceReturnType>
|
|
49
|
+
>
|
|
47
50
|
/**
|
|
48
51
|
* Returns the status of the userOperation that is pending in the mempool.
|
|
49
52
|
*
|
|
@@ -64,8 +67,8 @@ export type PimlicoBundlerActions = {
|
|
|
64
67
|
* await bundlerClient.getUserOperationStatus({ hash: userOpHash })
|
|
65
68
|
*/
|
|
66
69
|
getUserOperationStatus: (
|
|
67
|
-
args: GetUserOperationStatusParameters
|
|
68
|
-
) => Promise<GetUserOperationStatusReturnType
|
|
70
|
+
args: Prettify<GetUserOperationStatusParameters>
|
|
71
|
+
) => Promise<Prettify<GetUserOperationStatusReturnType>>
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
export const pimlicoBundlerActions = (
|
|
@@ -102,12 +105,12 @@ export type PimlicoPaymasterClientActions = {
|
|
|
102
105
|
*
|
|
103
106
|
*/
|
|
104
107
|
sponsorUserOperation: (
|
|
105
|
-
args: PimlicoSponsorUserOperationParameters
|
|
106
|
-
) => Promise<SponsorUserOperationReturnType
|
|
108
|
+
args: Prettify<PimlicoSponsorUserOperationParameters>
|
|
109
|
+
) => Promise<Prettify<SponsorUserOperationReturnType>>
|
|
107
110
|
|
|
108
111
|
validateSponsorshipPolicies: (
|
|
109
|
-
args: ValidateSponsorshipPoliciesParameters
|
|
110
|
-
) => Promise<
|
|
112
|
+
args: Prettify<ValidateSponsorshipPoliciesParameters>
|
|
113
|
+
) => Promise<Prettify<ValidateSponsorshipPolicies>[]>
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
/**
|
|
@@ -115,7 +118,7 @@ export type PimlicoPaymasterClientActions = {
|
|
|
115
118
|
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/ValidateSponsorshipPolicies
|
|
116
119
|
*
|
|
117
120
|
* @param args {@link ValidateSponsorshipPoliciesParameters} UserOperation you want to sponsor & entryPoint.
|
|
118
|
-
* @returns valid sponsorship policies, see {@link
|
|
121
|
+
* @returns valid sponsorship policies, see {@link ValidateSponsorshipPolicies}
|
|
119
122
|
*
|
|
120
123
|
* @example
|
|
121
124
|
* import { createClient } from "viem"
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
ContractFunctionArgs,
|
|
6
6
|
ContractFunctionName,
|
|
7
7
|
DeployContractParameters,
|
|
8
|
+
Hash,
|
|
8
9
|
SendTransactionParameters,
|
|
9
10
|
Transport,
|
|
10
11
|
TypedData,
|
|
@@ -30,7 +31,6 @@ import {
|
|
|
30
31
|
} from "../../actions/smartAccount/sendTransaction.js"
|
|
31
32
|
import {
|
|
32
33
|
type SendUserOperationParameters,
|
|
33
|
-
type SendUserOperationReturnType,
|
|
34
34
|
sendUserOperation
|
|
35
35
|
} from "../../actions/smartAccount/sendUserOperation.js"
|
|
36
36
|
import { signMessage } from "../../actions/smartAccount/signMessage.js"
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
type WriteContractWithPaymasterParameters,
|
|
40
40
|
writeContract
|
|
41
41
|
} from "../../actions/smartAccount/writeContract.js"
|
|
42
|
+
import type { Prettify } from "../../types/index.js"
|
|
42
43
|
|
|
43
44
|
export type SmartAccountActions<
|
|
44
45
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -279,11 +280,13 @@ export type SmartAccountActions<
|
|
|
279
280
|
const TAbi extends Abi | readonly unknown[],
|
|
280
281
|
TChainOverride extends Chain | undefined = undefined
|
|
281
282
|
>(
|
|
282
|
-
args:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
args: Prettify<
|
|
284
|
+
DeployContractParameters<
|
|
285
|
+
TAbi,
|
|
286
|
+
TChain,
|
|
287
|
+
TSmartAccount,
|
|
288
|
+
TChainOverride
|
|
289
|
+
>
|
|
287
290
|
>
|
|
288
291
|
) => ReturnType<typeof deployContract<TChain, TSmartAccount>>
|
|
289
292
|
/**
|
|
@@ -366,19 +369,23 @@ export type SmartAccountActions<
|
|
|
366
369
|
>
|
|
367
370
|
>
|
|
368
371
|
prepareUserOperationRequest: <TTransport extends Transport>(
|
|
369
|
-
args:
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
args: Prettify<
|
|
373
|
+
Parameters<
|
|
374
|
+
typeof prepareUserOperationRequest<
|
|
375
|
+
TTransport,
|
|
376
|
+
TChain,
|
|
377
|
+
TSmartAccount
|
|
378
|
+
>
|
|
379
|
+
>[1]
|
|
380
|
+
>
|
|
381
|
+
) => Promise<Prettify<PrepareUserOperationRequestReturnType>>
|
|
377
382
|
sendUserOperation: <TTransport extends Transport>(
|
|
378
|
-
args:
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
383
|
+
args: Prettify<
|
|
384
|
+
Parameters<
|
|
385
|
+
typeof sendUserOperation<TTransport, TChain, TSmartAccount>
|
|
386
|
+
>[1]
|
|
387
|
+
>
|
|
388
|
+
) => Promise<Hash>
|
|
382
389
|
/**
|
|
383
390
|
* Creates, signs, and sends a new transaction to the network.
|
|
384
391
|
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
@@ -429,13 +436,14 @@ export type SmartAccountActions<
|
|
|
429
436
|
* }])
|
|
430
437
|
*/
|
|
431
438
|
sendTransactions: (
|
|
432
|
-
args: SendTransactionsWithPaymasterParameters<TSmartAccount
|
|
439
|
+
args: Prettify<SendTransactionsWithPaymasterParameters<TSmartAccount>>
|
|
433
440
|
) => ReturnType<typeof sendTransactions<TChain, TSmartAccount>>
|
|
434
441
|
}
|
|
435
442
|
|
|
436
|
-
export
|
|
437
|
-
|
|
438
|
-
|
|
443
|
+
export function smartAccountActions({
|
|
444
|
+
sponsorUserOperation
|
|
445
|
+
}: SponsorUserOperationMiddleware) {
|
|
446
|
+
return <
|
|
439
447
|
TTransport extends Transport,
|
|
440
448
|
TChain extends Chain | undefined = Chain | undefined,
|
|
441
449
|
TSmartAccount extends SmartAccount | undefined =
|
|
@@ -458,17 +466,17 @@ export const smartAccountActions =
|
|
|
458
466
|
sendTransaction(client, {
|
|
459
467
|
...args,
|
|
460
468
|
sponsorUserOperation
|
|
461
|
-
} as SendTransactionWithPaymasterParameters),
|
|
469
|
+
} as SendTransactionWithPaymasterParameters<TChain, TSmartAccount>),
|
|
462
470
|
sendTransactions: (args) =>
|
|
463
471
|
sendTransactions(client, {
|
|
464
472
|
...args,
|
|
465
473
|
sponsorUserOperation
|
|
466
|
-
} as SendTransactionsWithPaymasterParameters),
|
|
474
|
+
} as SendTransactionsWithPaymasterParameters<TSmartAccount>),
|
|
467
475
|
sendUserOperation: (args) =>
|
|
468
476
|
sendUserOperation(client, {
|
|
469
477
|
...args,
|
|
470
478
|
sponsorUserOperation
|
|
471
|
-
} as SendUserOperationParameters),
|
|
479
|
+
} as SendUserOperationParameters<TSmartAccount>),
|
|
472
480
|
signMessage: (args) => signMessage(client, args),
|
|
473
481
|
signTypedData: (args) => signTypedData(client, args),
|
|
474
482
|
writeContract: (args) =>
|
|
@@ -477,3 +485,4 @@ export const smartAccountActions =
|
|
|
477
485
|
sponsorUserOperation
|
|
478
486
|
} as WriteContractWithPaymasterParameters<TChain, TSmartAccount>)
|
|
479
487
|
})
|
|
488
|
+
}
|