@aa-sdk/core 4.0.0-alpha.4 → 4.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/account/smartContractAccount.d.ts +9 -3
- package/dist/cjs/account/smartContractAccount.js +11 -6
- package/dist/cjs/account/smartContractAccount.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/cjs/client/bundlerClient.js.map +1 -1
- package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
- package/dist/cjs/client/isSmartAccountClient.js.map +1 -1
- package/dist/cjs/client/types.d.ts +2 -7
- package/dist/cjs/client/types.js.map +1 -1
- package/dist/cjs/errors/account.js.map +1 -1
- package/dist/cjs/errors/client.js.map +1 -1
- package/dist/cjs/errors/entrypoint.js.map +1 -1
- package/dist/cjs/errors/signer.js.map +1 -1
- package/dist/cjs/errors/transaction.js.map +1 -1
- package/dist/cjs/errors/useroperation.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -5
- package/dist/cjs/index.js +6 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger.js.map +1 -1
- package/dist/cjs/middleware/actions.js +2 -18
- package/dist/cjs/middleware/actions.js.map +1 -1
- package/dist/cjs/middleware/defaults/gasEstimator.js +3 -2
- package/dist/cjs/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/cjs/middleware/erc7677middleware.d.ts +40 -0
- package/dist/cjs/middleware/erc7677middleware.js +77 -0
- package/dist/cjs/middleware/erc7677middleware.js.map +1 -0
- package/dist/cjs/middleware/noopMiddleware.d.ts +2 -1
- package/dist/cjs/middleware/noopMiddleware.js.map +1 -1
- package/dist/cjs/middleware/types.d.ts +3 -2
- package/dist/cjs/middleware/types.js.map +1 -1
- package/dist/cjs/signer/local-account.d.ts +46 -46
- package/dist/cjs/signer/local-account.js.map +1 -1
- package/dist/cjs/signer/wallet-client.d.ts +46 -46
- package/dist/cjs/signer/wallet-client.js.map +1 -1
- package/dist/cjs/transport/split.js.map +1 -1
- package/dist/cjs/utils/bigint.js.map +1 -1
- package/dist/cjs/utils/bytes.js.map +1 -1
- package/dist/cjs/utils/defaults.d.ts +1 -3
- package/dist/cjs/utils/defaults.js +1 -41
- package/dist/cjs/utils/defaults.js.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/types.js.map +1 -1
- package/dist/cjs/utils/userop.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/account/smartContractAccount.d.ts +9 -3
- package/dist/esm/account/smartContractAccount.js +6 -1
- package/dist/esm/account/smartContractAccount.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/esm/client/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
- package/dist/esm/client/isSmartAccountClient.js.map +1 -1
- package/dist/esm/client/types.d.ts +2 -7
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/errors/account.js.map +1 -1
- package/dist/esm/errors/client.js.map +1 -1
- package/dist/esm/errors/entrypoint.js.map +1 -1
- package/dist/esm/errors/signer.js.map +1 -1
- package/dist/esm/errors/transaction.js.map +1 -1
- package/dist/esm/errors/useroperation.js.map +1 -1
- package/dist/esm/index.d.ts +3 -5
- package/dist/esm/index.js +2 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/middleware/actions.js +3 -18
- package/dist/esm/middleware/actions.js.map +1 -1
- package/dist/esm/middleware/defaults/gasEstimator.js +3 -2
- package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/esm/middleware/erc7677middleware.d.ts +40 -0
- package/dist/esm/middleware/erc7677middleware.js +73 -0
- package/dist/esm/middleware/erc7677middleware.js.map +1 -0
- package/dist/esm/middleware/noopMiddleware.d.ts +2 -1
- package/dist/esm/middleware/noopMiddleware.js.map +1 -1
- package/dist/esm/middleware/types.d.ts +3 -2
- package/dist/esm/middleware/types.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +46 -46
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/wallet-client.d.ts +46 -46
- package/dist/esm/signer/wallet-client.js.map +1 -1
- package/dist/esm/transport/split.js.map +1 -1
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/bytes.js.map +1 -1
- package/dist/esm/utils/defaults.d.ts +1 -3
- package/dist/esm/utils/defaults.js +1 -40
- package/dist/esm/utils/defaults.js.map +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/types.js.map +1 -1
- package/dist/esm/utils/userop.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/account/smartContractAccount.d.ts +17 -11
- package/dist/types/account/smartContractAccount.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +33 -33
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts +43 -59
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +18 -18
- package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts +3 -3
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts +3 -4
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -14
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts +0 -7
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts +17 -3
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
- package/dist/types/client/bundlerClient.d.ts +2 -2
- package/dist/types/client/decorators/bundlerClient.d.ts +8 -8
- package/dist/types/client/isSmartAccountClient.d.ts +4 -4
- package/dist/types/client/types.d.ts +2 -7
- package/dist/types/client/types.d.ts.map +1 -1
- package/dist/types/errors/account.d.ts +53 -4
- package/dist/types/errors/account.d.ts.map +1 -1
- package/dist/types/errors/client.d.ts +15 -0
- package/dist/types/errors/client.d.ts.map +1 -1
- package/dist/types/errors/entrypoint.d.ts +12 -0
- package/dist/types/errors/entrypoint.d.ts.map +1 -1
- package/dist/types/errors/signer.d.ts +5 -0
- package/dist/types/errors/signer.d.ts.map +1 -1
- package/dist/types/errors/transaction.d.ts +8 -1
- package/dist/types/errors/transaction.d.ts.map +1 -1
- package/dist/types/errors/useroperation.d.ts +5 -5
- package/dist/types/errors/useroperation.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logger.d.ts +88 -0
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/middleware/actions.d.ts +3 -3
- package/dist/types/middleware/actions.d.ts.map +1 -1
- package/dist/types/middleware/defaults/gasEstimator.d.ts +2 -2
- package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -1
- package/dist/types/middleware/erc7677middleware.d.ts +62 -0
- package/dist/types/middleware/erc7677middleware.d.ts.map +1 -0
- package/dist/types/middleware/noopMiddleware.d.ts +4 -4
- package/dist/types/middleware/noopMiddleware.d.ts.map +1 -1
- package/dist/types/middleware/types.d.ts +3 -2
- package/dist/types/middleware/types.d.ts.map +1 -1
- package/dist/types/signer/local-account.d.ts +139 -47
- package/dist/types/signer/local-account.d.ts.map +1 -1
- package/dist/types/signer/wallet-client.d.ts +135 -46
- package/dist/types/signer/wallet-client.d.ts.map +1 -1
- package/dist/types/transport/split.d.ts +2 -2
- package/dist/types/utils/bigint.d.ts +14 -14
- package/dist/types/utils/bigint.d.ts.map +1 -1
- package/dist/types/utils/bytes.d.ts +5 -5
- package/dist/types/utils/defaults.d.ts +1 -11
- package/dist/types/utils/defaults.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +12 -12
- package/dist/types/utils/types.d.ts +2 -2
- package/dist/types/utils/userop.d.ts +33 -33
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -2
- package/src/account/smartContractAccount.ts +19 -12
- package/src/actions/smartAccount/buildUserOperationFromTx.ts +35 -35
- package/src/actions/smartAccount/buildUserOperationFromTxs.ts +44 -60
- package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +19 -19
- package/src/actions/smartAccount/estimateUserOperationGas.ts +3 -3
- package/src/actions/smartAccount/internal/initUserOperation.ts +3 -4
- package/src/actions/smartAccount/internal/runMiddlewareStack.ts +0 -22
- package/src/actions/smartAccount/internal/sendUserOperation.ts +0 -7
- package/src/actions/smartAccount/sendUserOperation.ts +17 -3
- package/src/client/bundlerClient.ts +2 -2
- package/src/client/decorators/bundlerClient.ts +8 -8
- package/src/client/isSmartAccountClient.ts +4 -4
- package/src/client/types.ts +2 -15
- package/src/errors/account.ts +64 -4
- package/src/errors/client.ts +18 -0
- package/src/errors/entrypoint.ts +12 -0
- package/src/errors/signer.ts +6 -0
- package/src/errors/transaction.ts +10 -1
- package/src/errors/useroperation.ts +5 -6
- package/src/index.ts +2 -8
- package/src/logger.ts +88 -0
- package/src/middleware/actions.ts +6 -27
- package/src/middleware/defaults/gasEstimator.ts +8 -5
- package/src/middleware/erc7677middleware.ts +201 -0
- package/src/middleware/noopMiddleware.ts +6 -4
- package/src/middleware/types.ts +16 -7
- package/src/signer/local-account.ts +94 -2
- package/src/signer/wallet-client.ts +89 -0
- package/src/transport/split.ts +2 -2
- package/src/utils/bigint.ts +15 -15
- package/src/utils/bytes.ts +5 -5
- package/src/utils/defaults.ts +2 -74
- package/src/utils/index.ts +12 -12
- package/src/utils/types.ts +2 -2
- package/src/utils/userop.ts +33 -33
- package/src/version.ts +1 -1
- package/dist/cjs/account/base.d.ts +0 -49
- package/dist/cjs/account/base.js +0 -257
- package/dist/cjs/account/base.js.map +0 -1
- package/dist/cjs/account/schema.d.ts +0 -100
- package/dist/cjs/account/schema.js +0 -43
- package/dist/cjs/account/schema.js.map +0 -1
- package/dist/cjs/account/simple.d.ts +0 -14
- package/dist/cjs/account/simple.js +0 -119
- package/dist/cjs/account/simple.js.map +0 -1
- package/dist/cjs/account/types.d.ts +0 -30
- package/dist/cjs/account/types.js +0 -3
- package/dist/cjs/account/types.js.map +0 -1
- package/dist/esm/account/base.d.ts +0 -49
- package/dist/esm/account/base.js +0 -253
- package/dist/esm/account/base.js.map +0 -1
- package/dist/esm/account/schema.d.ts +0 -100
- package/dist/esm/account/schema.js +0 -35
- package/dist/esm/account/schema.js.map +0 -1
- package/dist/esm/account/simple.d.ts +0 -14
- package/dist/esm/account/simple.js +0 -115
- package/dist/esm/account/simple.js.map +0 -1
- package/dist/esm/account/types.d.ts +0 -30
- package/dist/esm/account/types.js +0 -2
- package/dist/esm/account/types.js.map +0 -1
- package/dist/types/account/base.d.ts +0 -128
- package/dist/types/account/base.d.ts.map +0 -1
- package/dist/types/account/schema.d.ts +0 -101
- package/dist/types/account/schema.d.ts.map +0 -1
- package/dist/types/account/simple.d.ts +0 -15
- package/dist/types/account/simple.d.ts.map +0 -1
- package/dist/types/account/types.d.ts +0 -144
- package/dist/types/account/types.d.ts.map +0 -1
- package/src/account/base.ts +0 -415
- package/src/account/schema.ts +0 -51
- package/src/account/simple.ts +0 -221
- package/src/account/types.ts +0 -184
|
@@ -2,53 +2,53 @@ import { type Hex } from "viem";
|
|
|
2
2
|
import type { EntryPointVersion } from "../entrypoint/types";
|
|
3
3
|
import type { BigNumberish, Multiplier, UserOperationFeeOptionsField, UserOperationOverrides, UserOperationRequest, UserOperationStruct } from "../types";
|
|
4
4
|
/**
|
|
5
|
-
* Utility method for asserting a
|
|
5
|
+
* Utility method for asserting a UserOperationStruct has valid fields for the given entry point version
|
|
6
6
|
*
|
|
7
|
-
* @param request a
|
|
8
|
-
* @returns a type guard that asserts the
|
|
7
|
+
* @param {UserOperationStruct} request a UserOperationStruct to validate
|
|
8
|
+
* @returns {boolean} a type guard that asserts the UserOperationRequest is valid
|
|
9
9
|
*/
|
|
10
10
|
export declare function isValidRequest<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): request is UserOperationRequest<TEntryPointVersion>;
|
|
11
11
|
/**
|
|
12
|
-
* Utility method for asserting a
|
|
12
|
+
* Utility method for asserting a UserOperationRequest has valid fields for the paymaster data
|
|
13
13
|
*
|
|
14
|
-
* @param request a
|
|
15
|
-
* @returns a type guard that asserts the
|
|
14
|
+
* @param {UserOperationRequest} request a UserOperationRequest to validate
|
|
15
|
+
* @returns {boolean} a type guard that asserts the UserOperationRequest is a UserOperationRequest
|
|
16
16
|
*/
|
|
17
17
|
export declare function isValidPaymasterAndData<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): boolean;
|
|
18
18
|
/**
|
|
19
|
-
* Utility method for asserting a
|
|
19
|
+
* Utility method for asserting a UserOperationStruct has valid fields for the paymaster data
|
|
20
20
|
*
|
|
21
|
-
* @param request a
|
|
22
|
-
* @returns a type guard that asserts the
|
|
21
|
+
* @param {UserOperationRequest} request a UserOperationRequest to validate
|
|
22
|
+
* @returns {boolean} a type guard that asserts the UserOperationStruct is a UserOperationRequest
|
|
23
23
|
*/
|
|
24
24
|
export declare function isValidFactoryAndData<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): boolean;
|
|
25
25
|
/**
|
|
26
|
-
* Utility method for applying a
|
|
26
|
+
* Utility method for applying a UserOperationOverrides field value
|
|
27
27
|
* over the current value set for the field
|
|
28
28
|
*
|
|
29
|
-
* @param value the current value of the field
|
|
30
|
-
* @param override the override value to apply
|
|
31
|
-
* @returns the new value of the field after applying the override
|
|
29
|
+
* @param {BigNumberish} value the current value of the field
|
|
30
|
+
* @param {BigNumberish | Multiplier} override the override value to apply
|
|
31
|
+
* @returns {BigNumberish} the new value of the field after applying the override
|
|
32
32
|
*/
|
|
33
33
|
export declare function applyUserOpOverride<TValue extends BigNumberish | undefined>(value: TValue, override?: BigNumberish | Multiplier): TValue | BigNumberish;
|
|
34
34
|
/**
|
|
35
|
-
* Utility method for applying a
|
|
35
|
+
* Utility method for applying a UserOperationFeeOptionsField value
|
|
36
36
|
* over the current value set for the field
|
|
37
37
|
*
|
|
38
|
-
* @param value the current value of the field
|
|
39
|
-
* @param feeOption the
|
|
40
|
-
* @returns the new value of the field after applying the
|
|
38
|
+
* @param {BigNumberish} value the current value of the field
|
|
39
|
+
* @param {UserOperationFeeOptionsField} feeOption the override value to apply
|
|
40
|
+
* @returns {BigNumberish} the new value of the field after applying the override
|
|
41
41
|
*/
|
|
42
42
|
export declare function applyUserOpFeeOption<TValue extends BigNumberish | undefined>(value: TValue, feeOption?: UserOperationFeeOptionsField): TValue | BigNumberish;
|
|
43
43
|
/**
|
|
44
|
-
* Utility method for applying a
|
|
45
|
-
* a
|
|
44
|
+
* Utility method for applying a UserOperationOverrides field value and
|
|
45
|
+
* a UserOperationFeeOptionsField value over the current value set for the field,
|
|
46
46
|
* with the override taking precedence over the fee option
|
|
47
47
|
*
|
|
48
|
-
* @param value the current value of the field
|
|
49
|
-
* @param [override] the override value to apply
|
|
50
|
-
* @param [feeOption] the fee option field value to apply
|
|
51
|
-
* @returns the new value of the field after applying the override or fee option
|
|
48
|
+
* @param {BigNumberish} value the current value of the field
|
|
49
|
+
* @param {BigNumberish | Multiplier} [override] the override value to apply
|
|
50
|
+
* @param {UserOperationFeeOptionsField} [feeOption] the fee option field value to apply
|
|
51
|
+
* @returns {BigNumberish} the new value of the field after applying the override or fee option
|
|
52
52
|
*/
|
|
53
53
|
export declare function applyUserOpOverrideOrFeeOption<TValue extends BigNumberish | undefined>(value: TValue, override?: BigNumberish | Multiplier, feeOption?: UserOperationFeeOptionsField): TValue | BigNumberish;
|
|
54
54
|
/**
|
|
@@ -57,8 +57,8 @@ export declare function applyUserOpOverrideOrFeeOption<TValue extends BigNumberi
|
|
|
57
57
|
* either because the UserOp is paying for its own gas, or passing a specific paymaster
|
|
58
58
|
*
|
|
59
59
|
* @template EntryPointVersion TEntryPointVersion
|
|
60
|
-
* @param overrides the user operation overrides to check
|
|
61
|
-
* @returns whether the paymaster middleware should be bypassed
|
|
60
|
+
* @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the user operation overrides to check
|
|
61
|
+
* @returns {boolean} whether the paymaster middleware should be bypassed
|
|
62
62
|
*/
|
|
63
63
|
export declare const bypassPaymasterAndData: <TEntryPointVersion extends keyof import("../entrypoint/types").EntryPointRegistryBase<unknown> = keyof import("../entrypoint/types").EntryPointRegistryBase<unknown>>(overrides: Partial<{
|
|
64
64
|
callGasLimit: {
|
|
@@ -85,8 +85,8 @@ export declare const bypassPaymasterAndData: <TEntryPointVersion extends keyof i
|
|
|
85
85
|
* pay for its own gas
|
|
86
86
|
*
|
|
87
87
|
* @template EntryPointVersion TEntryPointVersion
|
|
88
|
-
* @param overrides the user operation overrides to check
|
|
89
|
-
* @returns whether the paymaster middleware should be bypassed
|
|
88
|
+
* @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the user operation overrides to check
|
|
89
|
+
* @returns {boolean} whether the paymaster middleware should be bypassed
|
|
90
90
|
*/
|
|
91
91
|
export declare const bypassPaymasterAndDataEmptyHex: <TEntryPointVersion extends keyof import("../entrypoint/types").EntryPointRegistryBase<unknown> = keyof import("../entrypoint/types").EntryPointRegistryBase<unknown>>(overrides: Partial<{
|
|
92
92
|
callGasLimit: {
|
|
@@ -110,20 +110,20 @@ export declare const bypassPaymasterAndDataEmptyHex: <TEntryPointVersion extends
|
|
|
110
110
|
/**
|
|
111
111
|
* Utility method for parsing the paymaster address and paymasterData from the paymasterAndData hex string
|
|
112
112
|
*
|
|
113
|
-
* @param paymasterAndData the paymaster and data hex string to parse.
|
|
113
|
+
* @param {Hex} paymasterAndData the paymaster and data hex string to parse.
|
|
114
114
|
* The hex string refers to the paymasterAndData field of entrypoint v0.6 user operation request
|
|
115
|
-
* @returns the parsed paymaster and paymasterData fields of entrypoint v0.7 user operation request paymaster and paymasterData field
|
|
115
|
+
* @returns {{ paymaster: Hex; paymasterData: Hex}} the parsed paymaster and paymasterData fields of entrypoint v0.7 user operation request paymaster and paymasterData field
|
|
116
116
|
*/
|
|
117
117
|
export declare const parsePaymasterAndData: (paymasterAndData: Hex) => Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData">;
|
|
118
118
|
/**
|
|
119
119
|
* Utility method for converting the object containing the paymaster address and paymaster data
|
|
120
120
|
* to the paymaster and data concatenated hex string
|
|
121
121
|
*
|
|
122
|
-
* @param paymasterAndData the object containing the picked paymaster and paymasterData fields of
|
|
122
|
+
* @param {{ paymaster: Hex; paymasterData: Hex}} paymasterAndData the object containing the picked paymaster and paymasterData fields of
|
|
123
123
|
* entrypoint v0.7 user operation request
|
|
124
|
-
* @param paymasterAndData.paymaster the paymaster address
|
|
125
|
-
* @param paymasterAndData.paymasterData the paymaster data
|
|
126
|
-
* @returns the paymasterAndData hex value of entrypoint v0.6 user operation request paymasterAndData field
|
|
124
|
+
* @param {Hex} paymasterAndData.paymaster the paymaster address
|
|
125
|
+
* @param {Hex} paymasterAndData.paymasterData the paymaster data
|
|
126
|
+
* @returns {Hex} the paymasterAndData hex value of entrypoint v0.6 user operation request paymasterAndData field
|
|
127
127
|
*/
|
|
128
128
|
export declare const concatPaymasterAndData: ({ paymaster, paymasterData, }: Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData">) => Hex;
|
|
129
129
|
//# sourceMappingURL=userop.d.ts.map
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0-alpha.
|
|
1
|
+
export declare const VERSION = "4.0.0-alpha.6";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aa-sdk/core",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.6",
|
|
5
5
|
"description": "viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts",
|
|
6
6
|
"author": "Alchemy",
|
|
7
7
|
"type": "module",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
|
|
38
38
|
"build:esm": "tsc --project tsconfig.build.json --module es2020 --outDir ./dist/esm --removeComments && echo > ./dist/esm/package.json '{\"type\":\"module\"}'",
|
|
39
39
|
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
|
|
40
|
+
"docs:gen": "npx ak-docgen generate --in ./src/index.ts --out ../../site/pages/reference/aa-sdk/core",
|
|
40
41
|
"clean": "rm -rf ./dist",
|
|
41
42
|
"test": "vitest",
|
|
42
43
|
"test:run": "vitest run",
|
|
@@ -66,5 +67,5 @@
|
|
|
66
67
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
67
68
|
},
|
|
68
69
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "2c35ec701f526c77ea5e00e2e6f147156c7ac0e4"
|
|
70
71
|
}
|
|
@@ -34,7 +34,6 @@ import type { SmartAccountSigner } from "../signer/types.js";
|
|
|
34
34
|
import { wrapSignatureWith6492 } from "../signer/utils.js";
|
|
35
35
|
import type { NullAddress } from "../types.js";
|
|
36
36
|
import type { IsUndefined } from "../utils/types.js";
|
|
37
|
-
import { DeploymentState } from "./base.js";
|
|
38
37
|
|
|
39
38
|
export type AccountOp = {
|
|
40
39
|
target: Address;
|
|
@@ -42,6 +41,12 @@ export type AccountOp = {
|
|
|
42
41
|
data: Hex | "0x";
|
|
43
42
|
};
|
|
44
43
|
|
|
44
|
+
export enum DeploymentState {
|
|
45
|
+
UNDEFINED = "0x0",
|
|
46
|
+
NOT_DEPLOYED = "0x1",
|
|
47
|
+
DEPLOYED = "0x2",
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
export type GetEntryPointFromAccount<
|
|
46
51
|
TAccount extends SmartContractAccount | undefined,
|
|
47
52
|
TAccountOverride extends SmartContractAccount = SmartContractAccount
|
|
@@ -174,6 +179,13 @@ export const parseFactoryAddressFromAccountInitCode = (
|
|
|
174
179
|
return [factoryAddress, factoryCalldata];
|
|
175
180
|
};
|
|
176
181
|
|
|
182
|
+
export type GetAccountAddressParams = {
|
|
183
|
+
client: PublicClient;
|
|
184
|
+
entryPoint: EntryPointDef;
|
|
185
|
+
accountAddress?: Address;
|
|
186
|
+
getAccountInitCode: () => Promise<Hex>;
|
|
187
|
+
};
|
|
188
|
+
|
|
177
189
|
/**
|
|
178
190
|
* Retrieves the account address. Uses a provided `accountAddress` if available; otherwise, it computes the address using the entry point contract and the initial code.
|
|
179
191
|
*
|
|
@@ -188,11 +200,11 @@ export const parseFactoryAddressFromAccountInitCode = (
|
|
|
188
200
|
* });
|
|
189
201
|
* ```
|
|
190
202
|
*
|
|
191
|
-
* @param {
|
|
192
|
-
* @param {PublicClient}
|
|
193
|
-
* @param {EntryPointDef}
|
|
194
|
-
* @param {Address}
|
|
195
|
-
* @param {
|
|
203
|
+
* @param {GetAccountAddressParams} params The configuration object
|
|
204
|
+
* @param {PublicClient} params.client A public client instance to interact with the blockchain
|
|
205
|
+
* @param {EntryPointDef} params.entryPoint The entry point definition which includes the address and ABI
|
|
206
|
+
* @param {Address} params.accountAddress Optional existing account address
|
|
207
|
+
* @param {() => Promise<Hex>} params.getAccountInitCode A function that returns a Promise resolving to a Hex string representing the initial code of the account
|
|
196
208
|
* @returns {Promise<Address>} A promise that resolves to the account address
|
|
197
209
|
*/
|
|
198
210
|
export const getAccountAddress = async ({
|
|
@@ -200,12 +212,7 @@ export const getAccountAddress = async ({
|
|
|
200
212
|
entryPoint,
|
|
201
213
|
accountAddress,
|
|
202
214
|
getAccountInitCode,
|
|
203
|
-
}: {
|
|
204
|
-
client: PublicClient;
|
|
205
|
-
entryPoint: EntryPointDef;
|
|
206
|
-
accountAddress?: Address;
|
|
207
|
-
getAccountInitCode: () => Promise<Hex>;
|
|
208
|
-
}) => {
|
|
215
|
+
}: GetAccountAddressParams) => {
|
|
209
216
|
if (accountAddress) return accountAddress;
|
|
210
217
|
|
|
211
218
|
const entryPointContract = getContract({
|
|
@@ -20,43 +20,43 @@ import { buildUserOperation } from "./buildUserOperation.js";
|
|
|
20
20
|
import type { UserOperationContext } from "./types.js";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Performs
|
|
24
|
-
*
|
|
23
|
+
* Performs `buildUserOperationFromTx` in batch and builds into a single, yet to be signed `UserOperation` (UO) struct. The output user operation struct will be filled with all gas fields (and paymaster data if a paymaster is used) based on the transactions data (`to`, `data`, `value`, `maxFeePerGas`, `maxPriorityFeePerGas`) computed using the configured [`ClientMiddlewares`](/packages/aa-core/smart-account-client/middleware/index) on the `SmartAccountClient`
|
|
24
|
+
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```ts
|
|
27
|
-
import type { RpcTransactionRequest } from "viem";
|
|
28
|
-
import { smartAccountClient } from "./smartAccountClient";
|
|
29
|
-
// [!code focus:99]
|
|
30
|
-
// buildUserOperationFromTx converts a traditional Ethereum transaction and returns
|
|
31
|
-
// the unsigned user operation struct after constructing the user operation struct
|
|
32
|
-
// through the middleware pipeline
|
|
33
|
-
const tx: RpcTransactionRequest = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
const uoStruct = await smartAccountClient.buildUserOperationFromTx(tx);
|
|
43
|
-
|
|
44
|
-
// signUserOperation signs the above unsigned user operation struct built
|
|
45
|
-
// using the account connected to the smart account client
|
|
46
|
-
const request = await smartAccountClient.signUserOperation({ uoStruct });
|
|
47
|
-
|
|
48
|
-
// You can use the BundlerAction `sendRawUserOperation` (packages/core/src/actions/bundler/sendRawUserOperation.ts)
|
|
49
|
-
// to send the signed user operation request to the bundler, requesting the bundler to send the signed uo to the
|
|
50
|
-
// EntryPoint contract pointed at by the entryPoint address parameter
|
|
51
|
-
const entryPointAddress = client.account.getEntryPoint().address;
|
|
52
|
-
const uoHash = await smartAccountClient.sendRawUserOperation({ request, entryPoint: entryPointAddress });
|
|
53
|
-
```
|
|
54
|
-
*
|
|
55
|
-
* @param client the smart account client to use for RPC requests
|
|
56
|
-
* @param args
|
|
57
|
-
* @param overrides optional
|
|
58
|
-
* @param context if the smart account client requires additinoal context for building UOs
|
|
59
|
-
* @returns a Promise containing the built user operation
|
|
27
|
+
* import type { RpcTransactionRequest } from "viem";
|
|
28
|
+
* import { smartAccountClient } from "./smartAccountClient";
|
|
29
|
+
* // [!code focus:99]
|
|
30
|
+
* // buildUserOperationFromTx converts a traditional Ethereum transaction and returns
|
|
31
|
+
* // the unsigned user operation struct after constructing the user operation struct
|
|
32
|
+
* // through the middleware pipeline
|
|
33
|
+
* const tx: RpcTransactionRequest = {
|
|
34
|
+
* from, // ignored
|
|
35
|
+
* to,
|
|
36
|
+
* data: encodeFunctionData({
|
|
37
|
+
* abi: ContractABI.abi,
|
|
38
|
+
* functionName: "func",
|
|
39
|
+
* args: [arg1, arg2, ...],
|
|
40
|
+
* }),
|
|
41
|
+
* };
|
|
42
|
+
* const uoStruct = await smartAccountClient.buildUserOperationFromTx(tx);
|
|
43
|
+
*
|
|
44
|
+
* // signUserOperation signs the above unsigned user operation struct built
|
|
45
|
+
* // using the account connected to the smart account client
|
|
46
|
+
* const request = await smartAccountClient.signUserOperation({ uoStruct });
|
|
47
|
+
*
|
|
48
|
+
* // You can use the BundlerAction `sendRawUserOperation` (packages/core/src/actions/bundler/sendRawUserOperation.ts)
|
|
49
|
+
* // to send the signed user operation request to the bundler, requesting the bundler to send the signed uo to the
|
|
50
|
+
* // EntryPoint contract pointed at by the entryPoint address parameter
|
|
51
|
+
* const entryPointAddress = client.account.getEntryPoint().address;
|
|
52
|
+
* const uoHash = await smartAccountClient.sendRawUserOperation({ request, entryPoint: entryPointAddress });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param {Client<Transport, TChain, TAccount>} client the smart account client to use for RPC requests
|
|
56
|
+
* @param {SendTransactionParameters} args the send tx parameters
|
|
57
|
+
* @param {UserOperationOverrides} overrides optional overrides to use for any of the fields
|
|
58
|
+
* @param {TContext} context if the smart account client requires additinoal context for building UOs
|
|
59
|
+
* @returns {Promise<UserOperationStruct<TEntryPointVersion>>} a Promise containing the built user operation
|
|
60
60
|
*/
|
|
61
61
|
export async function buildUserOperationFromTx<
|
|
62
62
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -17,74 +17,58 @@ import type {
|
|
|
17
17
|
} from "./types";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Performs
|
|
20
|
+
* Performs `buildUserOperationFromTx` in batch and builds into a single,
|
|
21
21
|
* yet to be signed `UserOperation` (UO) struct. The output user operation struct
|
|
22
22
|
* will be filled with all gas fields (and paymaster data if a paymaster is used)
|
|
23
23
|
* based on the transactions data (`to`, `data`, `value`, `maxFeePerGas`,
|
|
24
|
-
* `maxPriorityFeePerGas`) computed using the configured
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* `maxPriorityFeePerGas`) computed using the configured ClientMiddlewares on the SmartAccountClient.
|
|
25
|
+
*
|
|
27
26
|
* @example
|
|
28
27
|
* ```ts
|
|
29
28
|
* import type { RpcTransactionRequest } from "viem";
|
|
30
|
-
import { smartAccountClient } from "./smartAccountClient";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// signUserOperation signs the above unsigned user operation struct built
|
|
70
|
-
// using the account connected to the smart account client
|
|
71
|
-
const request = await smartAccountClient.signUserOperation({ uoStruct });
|
|
72
|
-
|
|
73
|
-
// You can use the BundlerAction `sendRawUserOperation` (packages/core/src/actions/bundler/sendRawUserOperation.ts)
|
|
74
|
-
// to send the signed user operation request to the bundler, requesting the bundler to send the signed uo to the
|
|
75
|
-
// EntryPoint contract pointed at by the entryPoint address parameter
|
|
76
|
-
const entryPointAddress = client.account.getEntryPoint().address;
|
|
77
|
-
const uoHash = await smartAccountClient.sendRawUserOperation({
|
|
78
|
-
request,
|
|
79
|
-
entryPoint: entryPointAddress,
|
|
80
|
-
});
|
|
29
|
+
* import { smartAccountClient } from "./smartAccountClient";
|
|
30
|
+
*
|
|
31
|
+
* const requests: RpcTransactionRequest[] = [
|
|
32
|
+
* {
|
|
33
|
+
* from, // ignored
|
|
34
|
+
* to,
|
|
35
|
+
* data: encodeFunctionData({
|
|
36
|
+
* abi: ContractABI.abi,
|
|
37
|
+
* functionName: "func",
|
|
38
|
+
* args: [arg1, arg2, ...],
|
|
39
|
+
* }),
|
|
40
|
+
* },
|
|
41
|
+
* {
|
|
42
|
+
* from, // ignored
|
|
43
|
+
* to,
|
|
44
|
+
* data: encodeFunctionData({
|
|
45
|
+
* abi: ContractABI.abi,
|
|
46
|
+
* functionName: "func",
|
|
47
|
+
* args: [arg1, arg2, ...],
|
|
48
|
+
* }),
|
|
49
|
+
* },
|
|
50
|
+
* ];
|
|
51
|
+
* const uoStruct = await smartAccountClient.buildUserOperationFromTxs({
|
|
52
|
+
* requests,
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // signUserOperation signs the above unsigned user operation struct built
|
|
56
|
+
* // using the account connected to the smart account client
|
|
57
|
+
* const request = await smartAccountClient.signUserOperation({ uoStruct });
|
|
58
|
+
*
|
|
59
|
+
* // You can use the BundlerAction `sendRawUserOperation` (packages/core/src/actions/bundler/sendRawUserOperation.ts)
|
|
60
|
+
* // to send the signed user operation request to the bundler, requesting the bundler to send the signed uo to the
|
|
61
|
+
* // EntryPoint contract pointed at by the entryPoint address parameter
|
|
62
|
+
* const entryPointAddress = client.account.getEntryPoint().address;
|
|
63
|
+
* const uoHash = await smartAccountClient.sendRawUserOperation({
|
|
64
|
+
* request,
|
|
65
|
+
* entryPoint: entryPointAddress,
|
|
66
|
+
* });
|
|
81
67
|
* ```
|
|
82
68
|
*
|
|
83
|
-
* @param client the smart account client to use to make RPC calls
|
|
84
|
-
* @param
|
|
85
|
-
*
|
|
86
|
-
* optionally a flag to enable signing of the UO via the underlying middleware
|
|
87
|
-
* @returns a Promise containing the built user operation
|
|
69
|
+
* @param {Client<TTransport, TChain, TAccount>} client the smart account client to use to make RPC calls
|
|
70
|
+
* @param {BuildTransactionParameters} args an object containing the requests to build as well as, the account if not hoisted, the context, the overrides, and optionally a flag to enable signing of the UO via the underlying middleware
|
|
71
|
+
* @returns {Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>} a Promise containing the built user operation
|
|
88
72
|
*/
|
|
89
73
|
export async function buildUserOperationFromTxs<
|
|
90
74
|
TTransport extends Transport = Transport,
|
|
@@ -12,31 +12,31 @@ import type {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* This function verifies the eligibility of the connected account for gas sponsorship concerning the upcoming `UserOperation` (UO) that is intended to be sent.
|
|
15
|
-
* Internally, this method invokes
|
|
15
|
+
* Internally, this method invokes `buildUserOperation`, which navigates through the middleware pipeline, including the `PaymasterMiddleware`. Its purpose is to construct the UO struct meant for transmission to the bundler. Following the construction of the UO struct, this function verifies if the resulting structure contains a non-empty `paymasterAndData` field.
|
|
16
16
|
* You can utilize this method before sending the user operation to confirm its eligibility for gas sponsorship. Depending on the outcome, it allows you to tailor the user experience accordingly, based on eligibility.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```ts
|
|
20
20
|
* import { smartAccountClient } from "./smartAccountClient";
|
|
21
|
-
// [!code focus:99]
|
|
22
|
-
const eligible = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
console.log(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
21
|
+
* // [!code focus:99]
|
|
22
|
+
* const eligible = await smartAccountClient.checkGasSponsorshipEligibility({
|
|
23
|
+
* uo: {
|
|
24
|
+
* data: "0xCalldata",
|
|
25
|
+
* target: "0xTarget",
|
|
26
|
+
* value: 0n,
|
|
27
|
+
* },
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* console.log(
|
|
31
|
+
* `User Operation is ${
|
|
32
|
+
* eligible ? "eligible" : "ineligible"
|
|
33
|
+
* } for gas sponsorship.`
|
|
34
|
+
* );
|
|
35
35
|
* ```
|
|
36
|
-
*
|
|
37
|
-
* @param client the smart account client to use for making RPC calls
|
|
38
|
-
* @param
|
|
39
|
-
* @returns a Promise containing a boolean indicating if the account is elgibile for sponsorship
|
|
36
|
+
*
|
|
37
|
+
* @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for making RPC calls
|
|
38
|
+
* @param {SendUserOperationParameters} args containing the user operation, account, context, and overrides
|
|
39
|
+
* @returns {Promise<boolean>} a Promise containing a boolean indicating if the account is elgibile for sponsorship
|
|
40
40
|
*/
|
|
41
41
|
export function checkGasSponsorshipEligibility<
|
|
42
42
|
TTransport extends Transport = Transport,
|
|
@@ -23,9 +23,9 @@ import type {
|
|
|
23
23
|
* @template {SmartContractAccount | undefined} TAccount
|
|
24
24
|
* @template {UserOperationContext | undefined} TContext
|
|
25
25
|
* @template {GetEntryPointFromAccount<TAccount>} TEntryPointVersion
|
|
26
|
-
* @param client smart account client
|
|
27
|
-
* @param args send user operation parameters
|
|
28
|
-
* @returns user operation gas estimate response
|
|
26
|
+
* @param {Client<TTransport, TChain, TAccount>} client smart account client
|
|
27
|
+
* @param {SendUserOperationParameters<TAccount, TContext>} args send user operation parameters
|
|
28
|
+
* @returns {Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>}user operation gas estimate response
|
|
29
29
|
*/
|
|
30
30
|
export async function estimateUserOperationGas<
|
|
31
31
|
TTransport extends Transport = Transport,
|
|
@@ -18,15 +18,14 @@ import type {
|
|
|
18
18
|
* Description internal action function of SmartAccountClient for initializing
|
|
19
19
|
* a user operation for the sender account
|
|
20
20
|
*
|
|
21
|
-
* @async
|
|
22
21
|
* @template {Transport} TTransport
|
|
23
22
|
* @template {Chain | undefined} TChain
|
|
24
23
|
* @template {SmartContractAccount | undefined} TAccount
|
|
25
24
|
* @template {UserOperationContext | undefined} TContext
|
|
26
25
|
* @template {GetEntryPointFromAccount} TEntryPointVersion
|
|
27
|
-
* @param client smart account client
|
|
28
|
-
* @param args send user operation parameters
|
|
29
|
-
* @returns initialized user operation struct
|
|
26
|
+
* @param {BaseSmartAccountClient<TTransport, TChain, TAccount>} client smart account client
|
|
27
|
+
* @param {SendUserOperationParameters<TAccount, TContext, TEntryPointVersion> | BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>} args send user operation parameters
|
|
28
|
+
* @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} initialized user operation struct
|
|
30
29
|
*/
|
|
31
30
|
export async function _initUserOperation<
|
|
32
31
|
TTransport extends Transport = Transport,
|
|
@@ -19,14 +19,6 @@ import {
|
|
|
19
19
|
} from "../../../utils/index.js";
|
|
20
20
|
import type { UserOperationContext } from "../types";
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Utility method for running a sequence of async functions as a pipeline
|
|
24
|
-
*
|
|
25
|
-
* @template S
|
|
26
|
-
* @template Opts
|
|
27
|
-
* @param fns async functions to run in a pipeline sequence
|
|
28
|
-
* @returns a function that runs the async functions in a pipeline sequence
|
|
29
|
-
*/
|
|
30
22
|
const asyncPipe =
|
|
31
23
|
<S, Opts>(...fns: ((s: S, opts: Opts) => Promise<S>)[]) =>
|
|
32
24
|
async (s: S, opts: Opts) => {
|
|
@@ -37,20 +29,6 @@ const asyncPipe =
|
|
|
37
29
|
return result;
|
|
38
30
|
};
|
|
39
31
|
|
|
40
|
-
/**
|
|
41
|
-
* Internal method of {@link SmartAccountClient} running the middleware stack for a user operation
|
|
42
|
-
*
|
|
43
|
-
* @async
|
|
44
|
-
* @template TTransport
|
|
45
|
-
* @template TChain
|
|
46
|
-
* @template TAccount
|
|
47
|
-
* @template TContext the {@link UserOperationContext} passed to the middleware
|
|
48
|
-
* @template TEntryPointVersion
|
|
49
|
-
* @param client the smart account client instance that runs the middleware pipeline with
|
|
50
|
-
* @param args the Deferrable {@link UserOperationStruct} to run the middleware pipeline on
|
|
51
|
-
*
|
|
52
|
-
* @returns the resolved {@link UserOperationStruct} after running the middleware pipeline
|
|
53
|
-
*/
|
|
54
32
|
export async function _runMiddlewareStack<
|
|
55
33
|
TTransport extends Transport = Transport,
|
|
56
34
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -15,13 +15,6 @@ import type {
|
|
|
15
15
|
import { signUserOperation } from "../signUserOperation.js";
|
|
16
16
|
import type { GetContextParameter, UserOperationContext } from "../types";
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Used internally to send a user operation that has **already** been signed
|
|
20
|
-
*
|
|
21
|
-
* @param client a base smart account client instance with middleware configured
|
|
22
|
-
* @param args user operation struct, overrides, account, and context to be used in sending
|
|
23
|
-
* @returns A Promise containing the send user operation result {@link SendUserOperationResult}
|
|
24
|
-
*/
|
|
25
18
|
export async function _sendUserOperation<
|
|
26
19
|
TTransport extends Transport = Transport,
|
|
27
20
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -17,9 +17,23 @@ import type {
|
|
|
17
17
|
/**
|
|
18
18
|
* Sends a user operation or batch of user operations using the connected account. Before executing, sendUserOperation will run the user operation through the middleware pipeline.
|
|
19
19
|
*
|
|
20
|
-
* @
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { createSmartAccountClient, toSmartContractAccount } from "@aa-sdk/core";
|
|
23
|
+
*
|
|
24
|
+
* const account = await toSmartContractAccount(...);
|
|
25
|
+
* const result = await createSmartAccountClient(...).sendUserOperation({
|
|
26
|
+
* uo: {
|
|
27
|
+
* target: "0x...",
|
|
28
|
+
* data: "0x...", // or "0x",
|
|
29
|
+
* value: 0n, // optional
|
|
30
|
+
* }
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests
|
|
35
|
+
* @param {SendUserOperationParameters<TAccount, TContext>} args contains the UO or batch to send, context, overrides, and account if not hoisted on the client
|
|
36
|
+
* @returns {Promise<SendUserOperationResult<TEntryPointVersion>>} a Promise containing the result of the user operation
|
|
23
37
|
*/
|
|
24
38
|
export async function sendUserOperation<
|
|
25
39
|
TTransport extends Transport = Transport,
|
|
@@ -58,8 +58,8 @@ export const createBundlerClientFromExisting: <
|
|
|
58
58
|
/**
|
|
59
59
|
* Creates a PublicClient with methods for calling Bundler RPC methods
|
|
60
60
|
*
|
|
61
|
-
* @param args - configuration for the client
|
|
62
|
-
* @returns a PublicClient with methods for calling Bundler RPC methods
|
|
61
|
+
* @param {PublicClientConfig<TTransport, Chain> & { type?: string }} args - configuration for the client
|
|
62
|
+
* @returns {BundlerClient<TTransport>} a PublicClient with methods for calling Bundler RPC methods
|
|
63
63
|
*/
|
|
64
64
|
export function createBundlerClient<TTransport extends Transport>(
|
|
65
65
|
args: PublicClientConfig<TTransport, Chain> & { type?: string }
|