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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Client } from "viem";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ValidateSponsorshipPolicies, type ValidateSponsorshipPoliciesParameters } from "../../actions/pimlico.js";
|
|
3
3
|
import { type GetUserOperationGasPriceReturnType } from "../../actions/pimlico/getUserOperationGasPrice.js";
|
|
4
4
|
import { type GetUserOperationStatusParameters, type GetUserOperationStatusReturnType } from "../../actions/pimlico/getUserOperationStatus.js";
|
|
5
5
|
import { type PimlicoSponsorUserOperationParameters, type SponsorUserOperationReturnType } from "../../actions/pimlico/sponsorUserOperation.js";
|
|
6
|
+
import type { Prettify } from "../../types/index.js";
|
|
6
7
|
export type PimlicoBundlerActions = {
|
|
7
8
|
/**
|
|
8
9
|
* Returns the live gas prices that you can use to send a user operation.
|
|
@@ -23,7 +24,7 @@ export type PimlicoBundlerActions = {
|
|
|
23
24
|
*
|
|
24
25
|
* await bundlerClient.getUserOperationGasPrice()
|
|
25
26
|
*/
|
|
26
|
-
getUserOperationGasPrice: () => Promise<GetUserOperationGasPriceReturnType
|
|
27
|
+
getUserOperationGasPrice: () => Promise<Prettify<GetUserOperationGasPriceReturnType>>;
|
|
27
28
|
/**
|
|
28
29
|
* Returns the status of the userOperation that is pending in the mempool.
|
|
29
30
|
*
|
|
@@ -43,7 +44,7 @@ export type PimlicoBundlerActions = {
|
|
|
43
44
|
*
|
|
44
45
|
* await bundlerClient.getUserOperationStatus({ hash: userOpHash })
|
|
45
46
|
*/
|
|
46
|
-
getUserOperationStatus: (args: GetUserOperationStatusParameters) => Promise<GetUserOperationStatusReturnType
|
|
47
|
+
getUserOperationStatus: (args: Prettify<GetUserOperationStatusParameters>) => Promise<Prettify<GetUserOperationStatusReturnType>>;
|
|
47
48
|
};
|
|
48
49
|
export declare const pimlicoBundlerActions: (client: Client) => PimlicoBundlerActions;
|
|
49
50
|
export type PimlicoPaymasterClientActions = {
|
|
@@ -70,15 +71,15 @@ export type PimlicoPaymasterClientActions = {
|
|
|
70
71
|
* }})
|
|
71
72
|
*
|
|
72
73
|
*/
|
|
73
|
-
sponsorUserOperation: (args: PimlicoSponsorUserOperationParameters) => Promise<SponsorUserOperationReturnType
|
|
74
|
-
validateSponsorshipPolicies: (args: ValidateSponsorshipPoliciesParameters) => Promise<
|
|
74
|
+
sponsorUserOperation: (args: Prettify<PimlicoSponsorUserOperationParameters>) => Promise<Prettify<SponsorUserOperationReturnType>>;
|
|
75
|
+
validateSponsorshipPolicies: (args: Prettify<ValidateSponsorshipPoliciesParameters>) => Promise<Prettify<ValidateSponsorshipPolicies>[]>;
|
|
75
76
|
};
|
|
76
77
|
/**
|
|
77
78
|
* Returns valid sponsorship policies for a userOperation from the list of ids passed
|
|
78
79
|
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/ValidateSponsorshipPolicies
|
|
79
80
|
*
|
|
80
81
|
* @param args {@link ValidateSponsorshipPoliciesParameters} UserOperation you want to sponsor & entryPoint.
|
|
81
|
-
* @returns valid sponsorship policies, see {@link
|
|
82
|
+
* @returns valid sponsorship policies, see {@link ValidateSponsorshipPolicies}
|
|
82
83
|
*
|
|
83
84
|
* @example
|
|
84
85
|
* import { createClient } from "viem"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../../clients/decorators/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAQ,MAAM,MAAM,CAAA;AACxC,OAAO,EACH,KAAK,
|
|
1
|
+
{"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../../clients/decorators/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAQ,MAAM,MAAM,CAAA;AACxC,OAAO,EACH,KAAK,2BAA2B,EAChC,KAAK,qCAAqC,EAE7C,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,KAAK,kCAAkC,EAE1C,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,EAExC,MAAM,iDAAiD,CAAA;AACxD,OAAO,EACH,KAAK,qCAAqC,EAC1C,KAAK,8BAA8B,EAEtC,MAAM,+CAA+C,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAMpD,MAAM,MAAM,qBAAqB,GAAG;IAChC;;;;;;;;;;;;;;;;;;OAkBG;IACH,wBAAwB,EAAE,MAAM,OAAO,CACnC,QAAQ,CAAC,kCAAkC,CAAC,CAC/C,CAAA;IACD;;;;;;;;;;;;;;;;;;OAkBG;IACH,sBAAsB,EAAE,CACpB,IAAI,EAAE,QAAQ,CAAC,gCAAgC,CAAC,KAC/C,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC,CAAA;CAC3D,CAAA;AAED,eAAO,MAAM,qBAAqB,WACtB,MAAM,KACf,qBAKD,CAAA;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,oBAAoB,EAAE,CAClB,IAAI,EAAE,QAAQ,CAAC,qCAAqC,CAAC,KACpD,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,CAAA;IAEtD,2BAA2B,EAAE,CACzB,IAAI,EAAE,QAAQ,CAAC,qCAAqC,CAAC,KACpD,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAA;CACxD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,uBAAuB,WACxB,MAAM,KACf,6BAMD,CAAA;AAEF;;GAEG"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type { Abi, Chain, Client, ContractFunctionArgs, ContractFunctionName, DeployContractParameters, SendTransactionParameters, Transport, TypedData, WriteContractParameters } from "viem";
|
|
1
|
+
import type { Abi, Chain, Client, ContractFunctionArgs, ContractFunctionName, DeployContractParameters, Hash, SendTransactionParameters, Transport, TypedData, WriteContractParameters } from "viem";
|
|
2
2
|
import type { SmartAccount } from "../../accounts/types.js";
|
|
3
3
|
import { type SendTransactionsWithPaymasterParameters, sendTransactions } from "../../actions/smartAccount.js";
|
|
4
4
|
import { deployContract } from "../../actions/smartAccount/deployContract.js";
|
|
5
5
|
import { type PrepareUserOperationRequestReturnType, type SponsorUserOperationMiddleware, prepareUserOperationRequest } from "../../actions/smartAccount/prepareUserOperationRequest.js";
|
|
6
6
|
import { sendTransaction } from "../../actions/smartAccount/sendTransaction.js";
|
|
7
|
-
import {
|
|
7
|
+
import { sendUserOperation } from "../../actions/smartAccount/sendUserOperation.js";
|
|
8
8
|
import { signMessage } from "../../actions/smartAccount/signMessage.js";
|
|
9
9
|
import { signTypedData } from "../../actions/smartAccount/signTypedData.js";
|
|
10
10
|
import { writeContract } from "../../actions/smartAccount/writeContract.js";
|
|
11
|
+
import type { Prettify } from "../../types/index.js";
|
|
11
12
|
export type SmartAccountActions<TChain extends Chain | undefined = Chain | undefined, TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
12
13
|
/**
|
|
13
14
|
* Creates, signs, and sends a new transaction to the network.
|
|
@@ -222,7 +223,7 @@ export type SmartAccountActions<TChain extends Chain | undefined = Chain | undef
|
|
|
222
223
|
* bytecode: '0x608060405260405161083e38038061083e833981016040819052610...',
|
|
223
224
|
* })
|
|
224
225
|
*/
|
|
225
|
-
deployContract: <const TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined = undefined>(args: DeployContractParameters<TAbi, TChain, TSmartAccount, TChainOverride
|
|
226
|
+
deployContract: <const TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined = undefined>(args: Prettify<DeployContractParameters<TAbi, TChain, TSmartAccount, TChainOverride>>) => ReturnType<typeof deployContract<TChain, TSmartAccount>>;
|
|
226
227
|
/**
|
|
227
228
|
* Executes a write function on a contract.
|
|
228
229
|
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
@@ -272,8 +273,8 @@ export type SmartAccountActions<TChain extends Chain | undefined = Chain | undef
|
|
|
272
273
|
* const hash = await client.writeContract(request)
|
|
273
274
|
*/
|
|
274
275
|
writeContract: <const TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "nonpayable" | "payable"> = ContractFunctionName<TAbi, "nonpayable" | "payable">, TArgs extends ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName> = ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>, TChainOverride extends Chain | undefined = undefined>(args: WriteContractParameters<TAbi, TFunctionName, TArgs, TChain, TSmartAccount, TChainOverride>) => ReturnType<typeof writeContract<TChain, TSmartAccount, TAbi, TFunctionName, TArgs, TChainOverride>>;
|
|
275
|
-
prepareUserOperationRequest: <TTransport extends Transport>(args: Parameters<typeof prepareUserOperationRequest<TTransport, TChain, TSmartAccount>>[1]) => Promise<PrepareUserOperationRequestReturnType
|
|
276
|
-
sendUserOperation: <TTransport extends Transport>(args: Parameters<typeof sendUserOperation<TTransport, TChain, TSmartAccount>>[1]) => Promise<
|
|
276
|
+
prepareUserOperationRequest: <TTransport extends Transport>(args: Prettify<Parameters<typeof prepareUserOperationRequest<TTransport, TChain, TSmartAccount>>[1]>) => Promise<Prettify<PrepareUserOperationRequestReturnType>>;
|
|
277
|
+
sendUserOperation: <TTransport extends Transport>(args: Prettify<Parameters<typeof sendUserOperation<TTransport, TChain, TSmartAccount>>[1]>) => Promise<Hash>;
|
|
277
278
|
/**
|
|
278
279
|
* Creates, signs, and sends a new transaction to the network.
|
|
279
280
|
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
@@ -323,7 +324,7 @@ export type SmartAccountActions<TChain extends Chain | undefined = Chain | undef
|
|
|
323
324
|
* value: 10000000000000000n
|
|
324
325
|
* }])
|
|
325
326
|
*/
|
|
326
|
-
sendTransactions: (args: SendTransactionsWithPaymasterParameters<TSmartAccount
|
|
327
|
+
sendTransactions: (args: Prettify<SendTransactionsWithPaymasterParameters<TSmartAccount>>) => ReturnType<typeof sendTransactions<TChain, TSmartAccount>>;
|
|
327
328
|
};
|
|
328
|
-
export declare
|
|
329
|
+
export declare function smartAccountActions({ sponsorUserOperation }: SponsorUserOperationMiddleware): <TTransport extends Transport, TChain extends Chain | undefined = Chain | undefined, TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined>(client: Client<TTransport, TChain, TSmartAccount>) => SmartAccountActions<TChain, TSmartAccount>;
|
|
329
330
|
//# sourceMappingURL=smartAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartAccount.d.ts","sourceRoot":"","sources":["../../../clients/decorators/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,GAAG,EACH,KAAK,EACL,MAAM,EACN,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,SAAS,EACT,SAAS,EACT,uBAAuB,EAC1B,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EACH,KAAK,uCAAuC,EAC5C,gBAAgB,EACnB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAEH,cAAc,EACjB,MAAM,8CAA8C,CAAA;AACrD,OAAO,EACH,KAAK,qCAAqC,EAC1C,KAAK,8BAA8B,EACnC,2BAA2B,EAC9B,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAEH,eAAe,EAClB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAEH,
|
|
1
|
+
{"version":3,"file":"smartAccount.d.ts","sourceRoot":"","sources":["../../../clients/decorators/smartAccount.ts"],"names":[],"mappings":"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"}
|
package/accounts/types.ts
CHANGED
|
@@ -28,7 +28,8 @@ export class SignTransactionNotSupportedBySmartAccount extends BaseError {
|
|
|
28
28
|
export type SmartAccount<
|
|
29
29
|
Name extends string = string,
|
|
30
30
|
transport extends Transport = Transport,
|
|
31
|
-
chain extends Chain | undefined = Chain | undefined
|
|
31
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
32
|
+
TAbi extends Abi | readonly unknown[] = Abi
|
|
32
33
|
> = LocalAccount<Name> & {
|
|
33
34
|
client: Client<transport, chain>
|
|
34
35
|
entryPoint: Address
|
|
@@ -48,7 +49,7 @@ export type SmartAccount<
|
|
|
48
49
|
}[]
|
|
49
50
|
) => Promise<Hex>
|
|
50
51
|
getDummySignature(userOperation: UserOperation): Promise<Hex>
|
|
51
|
-
encodeDeployCallData:
|
|
52
|
+
encodeDeployCallData: ({
|
|
52
53
|
abi,
|
|
53
54
|
args,
|
|
54
55
|
bytecode
|
|
@@ -57,6 +58,6 @@ export type SmartAccount<
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export type SmartAccountSigner<
|
|
60
|
-
TSource extends string,
|
|
61
|
+
TSource extends string = string,
|
|
61
62
|
TAddress extends Address = Address
|
|
62
63
|
> = Omit<LocalAccount<TSource, TAddress>, "signTransaction">
|
|
@@ -2,6 +2,7 @@ import type { Account, Address, Chain, Client, Transport } from "viem"
|
|
|
2
2
|
import type { PartialBy } from "viem/types/utils"
|
|
3
3
|
import type { BundlerClient } from "../../clients/createBundlerClient.js"
|
|
4
4
|
import type { BundlerRpcSchema } from "../../types/bundler.js"
|
|
5
|
+
import type { Prettify } from "../../types/index.js"
|
|
5
6
|
import type { UserOperation } from "../../types/userOperation.js"
|
|
6
7
|
import type { UserOperationWithBigIntAsHex } from "../../types/userOperation.js"
|
|
7
8
|
import { deepHexlify } from "../../utils/deepHexlify.js"
|
|
@@ -53,8 +54,8 @@ export const estimateUserOperationGas = async <
|
|
|
53
54
|
TAccount extends Account | undefined = Account | undefined
|
|
54
55
|
>(
|
|
55
56
|
client: Client<TTransport, TChain, TAccount, BundlerRpcSchema>,
|
|
56
|
-
args: EstimateUserOperationGasParameters
|
|
57
|
-
): Promise<EstimateUserOperationGasReturnType
|
|
57
|
+
args: Prettify<EstimateUserOperationGasParameters>
|
|
58
|
+
): Promise<Prettify<EstimateUserOperationGasReturnType>> => {
|
|
58
59
|
const { userOperation, entryPoint } = args
|
|
59
60
|
|
|
60
61
|
const response = await client.request({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Account, Address, Chain, Client, Hash, Transport } from "viem"
|
|
2
2
|
import type { BundlerClient } from "../../clients/createBundlerClient.js"
|
|
3
3
|
import type { BundlerRpcSchema } from "../../types/bundler.js"
|
|
4
|
+
import type { Prettify } from "../../types/index.js"
|
|
4
5
|
import type { UserOperation } from "../../types/userOperation.js"
|
|
5
6
|
|
|
6
7
|
export type GetUserOperationByHashParameters = {
|
|
@@ -13,7 +14,7 @@ export type GetUserOperationByHashReturnType = {
|
|
|
13
14
|
transactionHash: Hash
|
|
14
15
|
blockHash: Hash
|
|
15
16
|
blockNumber: bigint
|
|
16
|
-
}
|
|
17
|
+
}
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Returns the user operation from userOpHash
|
|
@@ -43,8 +44,8 @@ export const getUserOperationByHash = async <
|
|
|
43
44
|
TAccount extends Account | undefined = Account | undefined
|
|
44
45
|
>(
|
|
45
46
|
client: Client<TTransport, TChain, TAccount, BundlerRpcSchema>,
|
|
46
|
-
{ hash }: GetUserOperationByHashParameters
|
|
47
|
-
): Promise<GetUserOperationByHashReturnType> => {
|
|
47
|
+
{ hash }: Prettify<GetUserOperationByHashParameters>
|
|
48
|
+
): Promise<Prettify<GetUserOperationByHashReturnType> | null> => {
|
|
48
49
|
const params: [Hash] = [hash]
|
|
49
50
|
|
|
50
51
|
const response = await client.request({
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
} from "viem"
|
|
10
10
|
import type { BundlerClient } from "../../clients/createBundlerClient.js"
|
|
11
11
|
import type { BundlerRpcSchema } from "../../types/bundler.js"
|
|
12
|
+
import type { Prettify } from "../../types/index.js"
|
|
12
13
|
import type { TStatus } from "../../types/userOperation.js"
|
|
13
14
|
import { transactionReceiptStatus } from "../../utils/deepHexlify.js"
|
|
14
15
|
|
|
@@ -77,8 +78,8 @@ export const getUserOperationReceipt = async <
|
|
|
77
78
|
TAccount extends Account | undefined = Account | undefined
|
|
78
79
|
>(
|
|
79
80
|
client: Client<TTransport, TChain, TAccount, BundlerRpcSchema>,
|
|
80
|
-
{ hash }: GetUserOperationReceiptParameters
|
|
81
|
-
): Promise<GetUserOperationReceiptReturnType | null> => {
|
|
81
|
+
{ hash }: Prettify<GetUserOperationReceiptParameters>
|
|
82
|
+
): Promise<Prettify<GetUserOperationReceiptReturnType> | null> => {
|
|
82
83
|
const params: [Hash] = [hash]
|
|
83
84
|
|
|
84
85
|
const response = await client.request({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Account, Address, Chain, Client, Hash, Transport } from "viem"
|
|
2
2
|
import type { BundlerClient } from "../../clients/createBundlerClient.js"
|
|
3
3
|
import type { BundlerRpcSchema } from "../../types/bundler.js"
|
|
4
|
+
import type { Prettify } from "../../types/index.js"
|
|
4
5
|
import type {
|
|
5
6
|
UserOperation,
|
|
6
7
|
UserOperationWithBigIntAsHex
|
|
@@ -43,7 +44,7 @@ export const sendUserOperation = async <
|
|
|
43
44
|
TAccount extends Account | undefined = Account | undefined
|
|
44
45
|
>(
|
|
45
46
|
client: Client<TTransport, TChain, TAccount, BundlerRpcSchema>,
|
|
46
|
-
args: SendUserOperationParameters
|
|
47
|
+
args: Prettify<SendUserOperationParameters>
|
|
47
48
|
): Promise<Hash> => {
|
|
48
49
|
const { userOperation, entryPoint } = args
|
|
49
50
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type Transport,
|
|
8
8
|
stringify
|
|
9
9
|
} from "viem"
|
|
10
|
+
import type { Prettify } from "../../types/index.js"
|
|
10
11
|
import { getAction } from "../../utils/getAction.js"
|
|
11
12
|
import { observe } from "../../utils/observe.js"
|
|
12
13
|
import {
|
|
@@ -66,8 +67,8 @@ export const waitForUserOperationReceipt = <
|
|
|
66
67
|
hash,
|
|
67
68
|
pollingInterval = bundlerClient.pollingInterval,
|
|
68
69
|
timeout
|
|
69
|
-
}: WaitForUserOperationReceiptParameters
|
|
70
|
-
): Promise<GetUserOperationReceiptReturnType
|
|
70
|
+
}: Prettify<WaitForUserOperationReceiptParameters>
|
|
71
|
+
): Promise<Prettify<GetUserOperationReceiptReturnType>> => {
|
|
71
72
|
const observerId = stringify([
|
|
72
73
|
"waitForUserOperationReceipt",
|
|
73
74
|
bundlerClient.uid,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Account, Chain, Client, Transport } from "viem"
|
|
2
|
+
import type { Prettify } from "../../types/index.js"
|
|
2
3
|
import type { PimlicoBundlerRpcSchema } from "../../types/pimlico.js"
|
|
3
4
|
|
|
4
5
|
export type GetUserOperationGasPriceReturnType = {
|
|
@@ -43,7 +44,7 @@ export const getUserOperationGasPrice = async <
|
|
|
43
44
|
TAccount extends Account | undefined = Account | undefined
|
|
44
45
|
>(
|
|
45
46
|
client: Client<TTransport, TChain, TAccount, PimlicoBundlerRpcSchema>
|
|
46
|
-
): Promise<GetUserOperationGasPriceReturnType
|
|
47
|
+
): Promise<Prettify<GetUserOperationGasPriceReturnType>> => {
|
|
47
48
|
const gasPrices = await client.request({
|
|
48
49
|
method: "pimlico_getUserOperationGasPrice",
|
|
49
50
|
params: []
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Account, Chain, Client, Hash, Transport } from "viem"
|
|
2
2
|
import type { PimlicoBundlerClient } from "../../clients/pimlico.js"
|
|
3
|
+
import type { Prettify } from "../../types/index.js"
|
|
3
4
|
import type {
|
|
4
5
|
PimlicoBundlerRpcSchema,
|
|
5
6
|
PimlicoUserOperationStatus
|
|
@@ -39,8 +40,8 @@ export const getUserOperationStatus = async <
|
|
|
39
40
|
TAccount extends Account | undefined = Account | undefined
|
|
40
41
|
>(
|
|
41
42
|
client: Client<TTransport, TChain, TAccount, PimlicoBundlerRpcSchema>,
|
|
42
|
-
{ hash }: GetUserOperationStatusParameters
|
|
43
|
-
): Promise<GetUserOperationStatusReturnType
|
|
43
|
+
{ hash }: Prettify<GetUserOperationStatusParameters>
|
|
44
|
+
): Promise<Prettify<GetUserOperationStatusReturnType>> => {
|
|
44
45
|
return client.request({
|
|
45
46
|
method: "pimlico_getUserOperationStatus",
|
|
46
47
|
params: [hash]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Account, Address, Chain, Client, Transport } from "viem"
|
|
2
2
|
import type { PartialBy } from "viem/types/utils"
|
|
3
|
+
import type { Prettify } from "../../types/index.js"
|
|
3
4
|
import type { PimlicoPaymasterRpcSchema } from "../../types/pimlico.js"
|
|
4
5
|
import type {
|
|
5
6
|
UserOperation,
|
|
@@ -52,8 +53,8 @@ export const sponsorUserOperation = async <
|
|
|
52
53
|
TAccount extends Account | undefined = Account | undefined
|
|
53
54
|
>(
|
|
54
55
|
client: Client<TTransport, TChain, TAccount, PimlicoPaymasterRpcSchema>,
|
|
55
|
-
args: PimlicoSponsorUserOperationParameters
|
|
56
|
-
): Promise<SponsorUserOperationReturnType
|
|
56
|
+
args: Prettify<PimlicoSponsorUserOperationParameters>
|
|
57
|
+
): Promise<Prettify<SponsorUserOperationReturnType>> => {
|
|
57
58
|
const response = await client.request({
|
|
58
59
|
method: "pm_sponsorUserOperation",
|
|
59
60
|
params: args.sponsorshipPolicyId
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Account, Address, Chain, Client, Transport } from "viem"
|
|
2
|
+
import type { Prettify } from "../../types/index.js"
|
|
2
3
|
import type { PimlicoPaymasterRpcSchema } from "../../types/pimlico.js"
|
|
3
4
|
import type {
|
|
4
5
|
UserOperation,
|
|
@@ -12,7 +13,7 @@ export type ValidateSponsorshipPoliciesParameters = {
|
|
|
12
13
|
sponsorshipPolicyIds: string[]
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export type
|
|
16
|
+
export type ValidateSponsorshipPolicies = {
|
|
16
17
|
sponsorshipPolicyId: string
|
|
17
18
|
data: {
|
|
18
19
|
name: string | null
|
|
@@ -20,7 +21,7 @@ export type ValidateSponsorshipPoliciesReturnType = {
|
|
|
20
21
|
icon: string | null
|
|
21
22
|
description: string | null
|
|
22
23
|
}
|
|
23
|
-
}
|
|
24
|
+
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Returns valid sponsorship policies for a userOperation from the list of ids passed
|
|
@@ -28,7 +29,7 @@ export type ValidateSponsorshipPoliciesReturnType = {
|
|
|
28
29
|
*
|
|
29
30
|
* @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
|
|
30
31
|
* @param args {@link ValidateSponsorshipPoliciesParameters} UserOperation you want to sponsor & entryPoint.
|
|
31
|
-
* @returns valid sponsorship policies, see {@link
|
|
32
|
+
* @returns valid sponsorship policies, see {@link ValidateSponsorshipPolicies}
|
|
32
33
|
*
|
|
33
34
|
* @example
|
|
34
35
|
* import { createClient } from "viem"
|
|
@@ -63,8 +64,8 @@ export const validateSponsorshipPolicies = async <
|
|
|
63
64
|
TAccount extends Account | undefined = Account | undefined
|
|
64
65
|
>(
|
|
65
66
|
client: Client<TTransport, TChain, TAccount, PimlicoPaymasterRpcSchema>,
|
|
66
|
-
args: ValidateSponsorshipPoliciesParameters
|
|
67
|
-
): Promise<
|
|
67
|
+
args: Prettify<ValidateSponsorshipPoliciesParameters>
|
|
68
|
+
): Promise<Prettify<ValidateSponsorshipPolicies>[]> => {
|
|
68
69
|
return await client.request({
|
|
69
70
|
method: "pm_validateSponsorshipPolicies",
|
|
70
71
|
params: [
|
package/actions/pimlico.ts
CHANGED
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
} from "../clients/decorators/pimlico.js"
|
|
24
24
|
|
|
25
25
|
import {
|
|
26
|
+
type ValidateSponsorshipPolicies,
|
|
26
27
|
type ValidateSponsorshipPoliciesParameters,
|
|
27
|
-
type ValidateSponsorshipPoliciesReturnType,
|
|
28
28
|
validateSponsorshipPolicies
|
|
29
29
|
} from "./pimlico/validateSponsorshipPolicies.js"
|
|
30
30
|
|
|
@@ -37,7 +37,7 @@ export type {
|
|
|
37
37
|
PimlicoBundlerActions,
|
|
38
38
|
PimlicoPaymasterClientActions,
|
|
39
39
|
ValidateSponsorshipPoliciesParameters,
|
|
40
|
-
|
|
40
|
+
ValidateSponsorshipPolicies
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address, Chain, Client, Transport } from "viem"
|
|
2
2
|
import { readContract } from "viem/actions"
|
|
3
|
+
import type { Prettify } from "../../types/index.js"
|
|
3
4
|
import { getAction } from "../../utils/getAction.js"
|
|
4
5
|
|
|
5
6
|
export type GetAccountNonceParams = {
|
|
@@ -39,8 +40,10 @@ export const getAccountNonce = async <
|
|
|
39
40
|
TChain extends Chain | undefined = Chain | undefined
|
|
40
41
|
>(
|
|
41
42
|
client: Client<TTransport, TChain>,
|
|
42
|
-
|
|
43
|
+
args: Prettify<GetAccountNonceParams>
|
|
43
44
|
): Promise<bigint> => {
|
|
45
|
+
const { sender, entryPoint, key = BigInt(0) } = args
|
|
46
|
+
|
|
44
47
|
return await getAction(
|
|
45
48
|
client,
|
|
46
49
|
readContract
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "viem"
|
|
11
11
|
|
|
12
12
|
import { simulateContract } from "viem/actions"
|
|
13
|
+
import type { Prettify } from "../../types/index.js"
|
|
13
14
|
import { getAction } from "../../utils/getAction.js"
|
|
14
15
|
|
|
15
16
|
export type GetSenderAddressParams = { initCode: Hex; entryPoint: Address }
|
|
@@ -62,8 +63,10 @@ export const getSenderAddress = async <
|
|
|
62
63
|
TChain extends Chain | undefined = Chain | undefined
|
|
63
64
|
>(
|
|
64
65
|
client: Client<TTransport, TChain>,
|
|
65
|
-
|
|
66
|
+
args: Prettify<GetSenderAddressParams>
|
|
66
67
|
): Promise<Address> => {
|
|
68
|
+
const { initCode, entryPoint } = args
|
|
69
|
+
|
|
67
70
|
try {
|
|
68
71
|
await getAction(
|
|
69
72
|
client,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type {
|
|
2
|
+
Abi,
|
|
3
|
+
Chain,
|
|
4
|
+
Client,
|
|
5
|
+
DeployContractParameters,
|
|
6
|
+
EncodeDeployDataParameters,
|
|
7
|
+
Hash,
|
|
8
|
+
Transport
|
|
8
9
|
} from "viem"
|
|
9
10
|
import type { SmartAccount } from "../../accounts/types.js"
|
|
11
|
+
import type { Prettify } from "../../types/index.js"
|
|
10
12
|
import { getAction } from "../../utils/getAction.js"
|
|
11
13
|
import { parseAccount } from "../../utils/index.js"
|
|
12
14
|
import { AccountOrClientNotFoundError } from "../../utils/signUserOperationHashWithECDSA.js"
|
|
@@ -31,7 +33,7 @@ export type DeployContractParametersWithPaymaster<
|
|
|
31
33
|
*
|
|
32
34
|
* @param client - Client to use
|
|
33
35
|
* @param parameters - {@link DeployContractParameters}
|
|
34
|
-
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
|
36
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
|
35
37
|
*
|
|
36
38
|
* @example
|
|
37
39
|
* import { createWalletClient, http } from 'viem'
|
|
@@ -55,14 +57,16 @@ export async function deployContract<
|
|
|
55
57
|
TAccount extends SmartAccount | undefined
|
|
56
58
|
>(
|
|
57
59
|
client: Client<Transport, TChain, TAccount>,
|
|
58
|
-
|
|
60
|
+
args: Prettify<DeployContractParametersWithPaymaster>
|
|
61
|
+
): Promise<Hash> {
|
|
62
|
+
const {
|
|
59
63
|
abi,
|
|
60
|
-
args,
|
|
64
|
+
args: constructorArgs,
|
|
61
65
|
bytecode,
|
|
62
66
|
sponsorUserOperation,
|
|
63
67
|
...request
|
|
64
|
-
}
|
|
65
|
-
|
|
68
|
+
} = args
|
|
69
|
+
|
|
66
70
|
const { account: account_ = client.account } = request
|
|
67
71
|
|
|
68
72
|
if (!account_) {
|
|
@@ -84,9 +88,9 @@ export async function deployContract<
|
|
|
84
88
|
maxPriorityFeePerGas: request.maxPriorityFeePerGas || 0n,
|
|
85
89
|
callData: await account.encodeDeployCallData({
|
|
86
90
|
abi,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
91
|
+
bytecode,
|
|
92
|
+
args: constructorArgs
|
|
93
|
+
} as EncodeDeployDataParameters)
|
|
90
94
|
},
|
|
91
95
|
account: account,
|
|
92
96
|
sponsorUserOperation
|
|
@@ -4,6 +4,7 @@ import type { SmartAccount } from "../../accounts/types.js"
|
|
|
4
4
|
import type {
|
|
5
5
|
GetAccountParameter,
|
|
6
6
|
PartialBy,
|
|
7
|
+
Prettify,
|
|
7
8
|
UserOperation
|
|
8
9
|
} from "../../types/index.js"
|
|
9
10
|
import { getAction } from "../../utils/getAction.js"
|
|
@@ -47,8 +48,8 @@ export async function prepareUserOperationRequest<
|
|
|
47
48
|
TAccount extends SmartAccount | undefined = SmartAccount | undefined
|
|
48
49
|
>(
|
|
49
50
|
client: Client<TTransport, TChain, TAccount>,
|
|
50
|
-
args: PrepareUserOperationRequestParameters<TAccount
|
|
51
|
-
): Promise<PrepareUserOperationRequestReturnType
|
|
51
|
+
args: Prettify<PrepareUserOperationRequestParameters<TAccount>>
|
|
52
|
+
): Promise<Prettify<PrepareUserOperationRequestReturnType>> {
|
|
52
53
|
const {
|
|
53
54
|
account: account_ = client.account,
|
|
54
55
|
userOperation: partialUserOperation,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
Chain,
|
|
3
3
|
Client,
|
|
4
|
+
Hash,
|
|
4
5
|
SendTransactionParameters,
|
|
5
|
-
SendTransactionReturnType,
|
|
6
6
|
Transport
|
|
7
7
|
} from "viem"
|
|
8
8
|
import { type SmartAccount } from "../../accounts/types.js"
|
|
9
|
+
import type { Prettify } from "../../types/index.js"
|
|
9
10
|
import { getAction } from "../../utils/getAction.js"
|
|
10
11
|
import {
|
|
11
12
|
AccountOrClientNotFoundError,
|
|
@@ -34,7 +35,7 @@ export type SendTransactionWithPaymasterParameters<
|
|
|
34
35
|
*
|
|
35
36
|
* @param client - Client to use
|
|
36
37
|
* @param parameters - {@link SendTransactionParameters}
|
|
37
|
-
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
|
38
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
|
38
39
|
*
|
|
39
40
|
* @example
|
|
40
41
|
* import { createWalletClient, custom } from 'viem'
|
|
@@ -74,12 +75,10 @@ export async function sendTransaction<
|
|
|
74
75
|
TChainOverride extends Chain | undefined
|
|
75
76
|
>(
|
|
76
77
|
client: Client<Transport, TChain, TAccount>,
|
|
77
|
-
args:
|
|
78
|
-
TChain,
|
|
79
|
-
TAccount,
|
|
80
|
-
TChainOverride
|
|
78
|
+
args: Prettify<
|
|
79
|
+
SendTransactionWithPaymasterParameters<TChain, TAccount, TChainOverride>
|
|
81
80
|
>
|
|
82
|
-
): Promise<
|
|
81
|
+
): Promise<Hash> {
|
|
83
82
|
const {
|
|
84
83
|
account: account_ = client.account,
|
|
85
84
|
data,
|
|
@@ -2,13 +2,13 @@ import type {
|
|
|
2
2
|
Address,
|
|
3
3
|
Chain,
|
|
4
4
|
Client,
|
|
5
|
+
Hash,
|
|
5
6
|
Hex,
|
|
6
7
|
SendTransactionParameters,
|
|
7
|
-
SendTransactionReturnType,
|
|
8
8
|
Transport
|
|
9
9
|
} from "viem"
|
|
10
10
|
import { type SmartAccount } from "../../accounts/types.js"
|
|
11
|
-
import type { GetAccountParameter } from "../../types/index.js"
|
|
11
|
+
import type { GetAccountParameter, Prettify } from "../../types/index.js"
|
|
12
12
|
import { getAction } from "../../utils/getAction.js"
|
|
13
13
|
import {
|
|
14
14
|
AccountOrClientNotFoundError,
|
|
@@ -35,7 +35,7 @@ export type SendTransactionsWithPaymasterParameters<
|
|
|
35
35
|
*
|
|
36
36
|
* @param client - Client to use
|
|
37
37
|
* @param parameters - {@link SendTransactionParameters}
|
|
38
|
-
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
|
38
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* import { createWalletClient, custom } from 'viem'
|
|
@@ -80,8 +80,8 @@ export async function sendTransactions<
|
|
|
80
80
|
TAccount extends SmartAccount | undefined
|
|
81
81
|
>(
|
|
82
82
|
client: Client<Transport, TChain, TAccount>,
|
|
83
|
-
args: SendTransactionsWithPaymasterParameters<TAccount
|
|
84
|
-
): Promise<
|
|
83
|
+
args: Prettify<SendTransactionsWithPaymasterParameters<TAccount>>
|
|
84
|
+
): Promise<Hash> {
|
|
85
85
|
const {
|
|
86
86
|
account: account_ = client.account,
|
|
87
87
|
transactions,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { Chain, Client,
|
|
1
|
+
import type { Chain, Client, Hash, Transport } from "viem"
|
|
2
2
|
import type { SmartAccount } from "../../accounts/types.js"
|
|
3
3
|
import type {
|
|
4
4
|
GetAccountParameter,
|
|
5
5
|
PartialBy,
|
|
6
|
+
Prettify,
|
|
6
7
|
UserOperation
|
|
7
8
|
} from "../../types/index.js"
|
|
8
9
|
import { getAction } from "../../utils/getAction.js"
|
|
@@ -35,16 +36,14 @@ export type SendUserOperationParameters<
|
|
|
35
36
|
} & GetAccountParameter<TAccount> &
|
|
36
37
|
SponsorUserOperationMiddleware
|
|
37
38
|
|
|
38
|
-
export type SendUserOperationReturnType = Hex
|
|
39
|
-
|
|
40
39
|
export async function sendUserOperation<
|
|
41
40
|
TTransport extends Transport = Transport,
|
|
42
41
|
TChain extends Chain | undefined = Chain | undefined,
|
|
43
42
|
TAccount extends SmartAccount | undefined = SmartAccount | undefined
|
|
44
43
|
>(
|
|
45
44
|
client: Client<TTransport, TChain, TAccount>,
|
|
46
|
-
args: SendUserOperationParameters<TAccount
|
|
47
|
-
): Promise<
|
|
45
|
+
args: Prettify<SendUserOperationParameters<TAccount>>
|
|
46
|
+
): Promise<Hash> {
|
|
48
47
|
const { account: account_ = client.account } = args
|
|
49
48
|
if (!account_) throw new AccountOrClientNotFoundError()
|
|
50
49
|
|
|
@@ -57,14 +56,8 @@ export async function sendUserOperation<
|
|
|
57
56
|
|
|
58
57
|
userOperation.signature = await account.signUserOperation(userOperation)
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
client,
|
|
62
|
-
sendUserOperationBundler,
|
|
63
|
-
"sendUserOperation"
|
|
64
|
-
)({
|
|
59
|
+
return sendUserOperationBundler(client, {
|
|
65
60
|
userOperation: userOperation,
|
|
66
61
|
entryPoint: account.entryPoint
|
|
67
62
|
})
|
|
68
|
-
|
|
69
|
-
return userOpHash
|
|
70
63
|
}
|