@aa-sdk/core 4.0.0-alpha.1 → 4.0.0-alpha.10
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/ens/utils.d.ts +1 -1
- package/dist/cjs/ens/utils.js +3 -3
- package/dist/cjs/ens/utils.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 -6
- package/dist/cjs/index.js +38 -64
- 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 +4 -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 +44 -44
- package/dist/cjs/signer/local-account.js.map +1 -1
- package/dist/cjs/signer/wallet-client.d.ts +44 -44
- 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 +2 -4
- package/dist/cjs/utils/defaults.js +5 -45
- package/dist/cjs/utils/defaults.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +0 -3
- package/dist/cjs/utils/index.js +1 -25
- 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/ens/utils.d.ts +1 -1
- package/dist/esm/ens/utils.js +1 -1
- package/dist/esm/ens/utils.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 -6
- package/dist/esm/index.js +2 -4
- 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 +4 -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 +44 -44
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/wallet-client.d.ts +44 -44
- 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 +2 -4
- package/dist/esm/utils/defaults.js +1 -40
- package/dist/esm/utils/defaults.js.map +1 -1
- package/dist/esm/utils/index.d.ts +0 -3
- package/dist/esm/utils/index.js +0 -11
- 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/ens/utils.d.ts +1 -1
- package/dist/types/ens/utils.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 -6
- 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 +137 -45
- package/dist/types/signer/local-account.d.ts.map +1 -1
- package/dist/types/signer/wallet-client.d.ts +133 -44
- 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 +2 -12
- package/dist/types/utils/defaults.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +12 -22
- package/dist/types/utils/index.d.ts.map +1 -1
- 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/dist/types/version.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/account/smartContractAccount.ts +19 -13
- 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/ens/utils.ts +1 -2
- 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 -31
- package/src/logger.ts +88 -0
- package/src/middleware/actions.ts +6 -27
- package/src/middleware/defaults/gasEstimator.ts +9 -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 +3 -76
- package/src/utils/index.ts +12 -35
- 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/cjs/chains/index.d.ts +0 -20
- package/dist/cjs/chains/index.js +0 -169
- package/dist/cjs/chains/index.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/esm/chains/index.d.ts +0 -20
- package/dist/esm/chains/index.js +0 -166
- package/dist/esm/chains/index.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/dist/types/chains/index.d.ts +0 -21
- package/dist/types/chains/index.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
- package/src/chains/index.ts +0 -194
|
@@ -2,24 +2,24 @@ import type { BigNumberish, Multiplier } from "../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns the max bigint in a list of bigints
|
|
4
4
|
*
|
|
5
|
-
* @param args a list of bigints to get the max of
|
|
6
|
-
* @returns the max bigint in the list
|
|
5
|
+
* @param {bigint[]} args a list of bigints to get the max of
|
|
6
|
+
* @returns {bigint} the max bigint in the list
|
|
7
7
|
*/
|
|
8
8
|
export declare const bigIntMax: (...args: bigint[]) => bigint;
|
|
9
9
|
/**
|
|
10
10
|
* Returns the min bigint in a list of bigints
|
|
11
11
|
*
|
|
12
|
-
* @param args a list of bigints to get the max of
|
|
13
|
-
* @returns the min bigint in the list
|
|
12
|
+
* @param {bigint[]} args a list of bigints to get the max of
|
|
13
|
+
* @returns {bigint} the min bigint in the list
|
|
14
14
|
*/
|
|
15
15
|
export declare const bigIntMin: (...args: bigint[]) => bigint;
|
|
16
16
|
/**
|
|
17
17
|
* Given a bigint and a min-max range, returns the min-max clamped bigint value
|
|
18
18
|
*
|
|
19
|
-
* @param value a bigint value to clamp
|
|
20
|
-
* @param lower lower bound min max tuple value
|
|
21
|
-
* @param upper upper bound min max tuple value
|
|
22
|
-
* @returns the clamped bigint value per given range
|
|
19
|
+
* @param {BigNumberish} value a bigint value to clamp
|
|
20
|
+
* @param {BigNumberish | undefined} lower lower bound min max tuple value
|
|
21
|
+
* @param {BigNumberish | undefined} upper upper bound min max tuple value
|
|
22
|
+
* @returns {bigint} the clamped bigint value per given range
|
|
23
23
|
*/
|
|
24
24
|
export declare const bigIntClamp: (value: BigNumberish, lower: BigNumberish | null | undefined, upper: BigNumberish | null | undefined) => bigint;
|
|
25
25
|
export declare enum RoundingMode {
|
|
@@ -30,10 +30,10 @@ export declare enum RoundingMode {
|
|
|
30
30
|
* Given a bigint and a number (which can be a float), returns the bigint value.
|
|
31
31
|
* Note: this function has loss and will round down to the nearest integer.
|
|
32
32
|
*
|
|
33
|
-
* @param base - the number to be multiplied
|
|
34
|
-
* @param multiplier - the amount to multiply by
|
|
35
|
-
* @param roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP
|
|
36
|
-
* @returns the bigint value of the multiplication with the number rounded by the rounding mode
|
|
33
|
+
* @param {BigNumberish} base - the number to be multiplied
|
|
34
|
+
* @param {number} multiplier - the amount to multiply by
|
|
35
|
+
* @param {RoundingMode} roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP
|
|
36
|
+
* @returns {bigint} the bigint value of the multiplication with the number rounded by the rounding mode
|
|
37
37
|
*/
|
|
38
38
|
export declare const bigIntMultiply: (base: BigNumberish, multiplier: Multiplier["multiplier"], roundingMode?: RoundingMode) => bigint;
|
|
39
39
|
/**
|
|
@@ -49,8 +49,8 @@ export declare const bigIntMultiply: (base: BigNumberish, multiplier: Multiplier
|
|
|
49
49
|
* });
|
|
50
50
|
* ```
|
|
51
51
|
*
|
|
52
|
-
* @param phrase -- any string value.
|
|
53
|
-
* @returns the bigint value of the hashed string
|
|
52
|
+
* @param {string} phrase -- any string value.
|
|
53
|
+
* @returns {bigint} the bigint value of the hashed string
|
|
54
54
|
*/
|
|
55
55
|
export declare const stringToIndex: (phrase: string) => bigint;
|
|
56
56
|
//# sourceMappingURL=bigint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGzD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,EAAE,KAAG,MAM7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,EAAE,KAAG,MAM7C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,UACf,YAAY,SACZ,YAAY,GAAG,IAAI,GAAG,SAAS,SAC/B,YAAY,GAAG,IAAI,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGzD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,EAAE,KAAG,MAM7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,EAAE,KAAG,MAM7C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,UACf,YAAY,SACZ,YAAY,GAAG,IAAI,GAAG,SAAS,SAC/B,YAAY,GAAG,IAAI,GAAG,SAAS,KACrC,MAkBF,CAAC;AAEF,oBAAY,YAAY;IACtB,UAAU,IAAI;IACd,QAAQ,IAAI;CACb;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACnB,YAAY,cACN,UAAU,CAAC,YAAY,CAAC,iBACtB,YAAY,WAiB3B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MACb,CAAC"}
|
|
@@ -6,11 +6,11 @@ type TakeBytesOpts = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Given a bytes string, returns a slice of the bytes
|
|
8
8
|
*
|
|
9
|
-
* @param bytes - the hex string representing bytes
|
|
10
|
-
* @param opts - optional parameters for slicing the bytes
|
|
11
|
-
* @param opts.offset - the offset in bytes to start slicing from
|
|
12
|
-
* @param opts.count - the number of bytes to slice
|
|
13
|
-
* @returns the sliced bytes
|
|
9
|
+
* @param {Hex} bytes - the hex string representing bytes
|
|
10
|
+
* @param {TakeBytesOpts} opts - optional parameters for slicing the bytes
|
|
11
|
+
* @param {number} opts.offset - the offset in bytes to start slicing from
|
|
12
|
+
* @param {number} opts.count - the number of bytes to slice
|
|
13
|
+
* @returns {Hex} the sliced bytes
|
|
14
14
|
*/
|
|
15
15
|
export declare const takeBytes: (bytes: Hex, opts?: TakeBytesOpts) => Hex;
|
|
16
16
|
export {};
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
3
|
-
import type { UserOperationFeeOptions } from "../types";
|
|
4
|
-
/**
|
|
5
|
-
* Utility method returning the default simple account factory address given a {@link Chain} object
|
|
6
|
-
*
|
|
7
|
-
* @param chain - a {@link Chain} object
|
|
8
|
-
* @param version - {@link EntryPointVersion} value that defaults to `defaultEntryPointVersion`
|
|
9
|
-
* @returns a {@link abi.Address} for the given chain
|
|
10
|
-
* @throws if the chain doesn't have an address currently deployed
|
|
11
|
-
*/
|
|
12
|
-
export declare const getDefaultSimpleAccountFactoryAddress: (chain: Chain, version?: EntryPointVersion) => Address;
|
|
1
|
+
import { type Chain } from "viem";
|
|
2
|
+
import type { UserOperationFeeOptions } from "../types.js";
|
|
13
3
|
export declare const minPriorityFeePerBidDefaults: Map<number, bigint>;
|
|
14
4
|
export declare const getDefaultUserOperationFeeOptions: (chain: Chain) => UserOperationFeeOptions;
|
|
15
5
|
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,4BAA4B,qBAIvC,CAAC;AAEH,eAAO,MAAM,iCAAiC,UACrC,KAAK,KACX,uBAOF,CAAC"}
|
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
import type { Chain } from "viem";
|
|
2
1
|
import type { PromiseOrValue } from "../types.js";
|
|
3
2
|
import type { RecordableKeys } from "./types.js";
|
|
4
|
-
export declare const AlchemyChainMap: Map<number, Chain>;
|
|
5
|
-
/**
|
|
6
|
-
* Utility method for converting a chainId to a {@link Chain} object
|
|
7
|
-
*
|
|
8
|
-
* @param chainId - the chainId to convert
|
|
9
|
-
* @returns a {@link Chain} object for the given chainId
|
|
10
|
-
* @throws if the chainId is not found
|
|
11
|
-
*/
|
|
12
|
-
export declare const getChain: (chainId: number) => Chain;
|
|
13
3
|
/**
|
|
14
4
|
* Utility function that allows for piping a series of async functions together
|
|
15
5
|
*
|
|
16
|
-
* @param fns - functions to pipe
|
|
17
|
-
* @returns result of the pipe
|
|
6
|
+
* @param {((s: S, o?: O, f?: F) => Promise<S>)[]} fns - functions to pipe
|
|
7
|
+
* @returns {S} result of the pipe
|
|
18
8
|
*/
|
|
19
9
|
export declare const asyncPipe: <S, O, F>(...fns: ((s: S, o?: O | undefined, f?: F | undefined) => Promise<S>)[]) => (s: S, o?: O | undefined, f?: F | undefined) => Promise<S>;
|
|
20
10
|
export type Deferrable<T> = {
|
|
21
11
|
[K in keyof T]: PromiseOrValue<T[K]>;
|
|
22
12
|
};
|
|
23
13
|
/**
|
|
24
|
-
* Await all of the properties of a
|
|
14
|
+
* Await all of the properties of a Deferrable object
|
|
25
15
|
*
|
|
26
|
-
* @param object - a
|
|
27
|
-
* @returns the object with its properties resolved
|
|
16
|
+
* @param {Deferrable<T>} object - a Deferrable object
|
|
17
|
+
* @returns {Promise<T>} the object with its properties resolved
|
|
28
18
|
*/
|
|
29
19
|
export declare function resolveProperties<T>(object: Deferrable<T>): Promise<T>;
|
|
30
20
|
/**
|
|
31
21
|
* Recursively converts all values in an object to hex strings
|
|
32
22
|
*
|
|
33
|
-
* @param obj - obj to deep hexlify
|
|
34
|
-
* @returns object with all of its values hexlified
|
|
23
|
+
* @param {any} obj - obj to deep hexlify
|
|
24
|
+
* @returns {any} object with all of its values hexlified
|
|
35
25
|
*/
|
|
36
26
|
export declare function deepHexlify(obj: any): any;
|
|
37
27
|
/**
|
|
@@ -73,17 +63,17 @@ export declare function pick(obj: Record<string, unknown>, keys: string | string
|
|
|
73
63
|
/**
|
|
74
64
|
* Utility method for checking if the passed in values are all equal (strictly)
|
|
75
65
|
*
|
|
76
|
-
* @param params - values to check
|
|
77
|
-
* @returns a boolean indicating if all values are the same
|
|
66
|
+
* @param {...any[]} params - values to check
|
|
67
|
+
* @returns {boolean} a boolean indicating if all values are the same
|
|
78
68
|
* @throws if no values are passed in
|
|
79
69
|
*/
|
|
80
70
|
export declare const allEqual: (...params: any[]) => boolean;
|
|
81
71
|
/**
|
|
82
72
|
* Utility method for checking the condition and return the value if condition holds true, undefined if not.
|
|
83
73
|
*
|
|
84
|
-
* @param condition - condition to check
|
|
85
|
-
* @param value - value to return when condition holds true
|
|
86
|
-
* @returns the value if condition holds true, undefined if not
|
|
74
|
+
* @param {Promise<boolean>} condition - condition to check
|
|
75
|
+
* @param {() => Promise<T>} value - value to return when condition holds true
|
|
76
|
+
* @returns {Promise<T | undefined>} the value if condition holds true, undefined if not
|
|
87
77
|
*/
|
|
88
78
|
export declare const conditionalReturn: <T>(condition: Promise<boolean>, value: () => Promise<T>) => Promise<T | undefined>;
|
|
89
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,iJAQnB,CAAC;AAGJ,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAc5E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAqBzC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAO5C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,MAIzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,cAAe,GAAG,EAAE,KAAG,OAK3C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,iBACjB,QAAQ,OAAO,CAAC,oDAEgD,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,QAAQ,2KAYM,CAAC;AAE5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,mBAAmB,YAAY,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type NoUndefined<T> = T extends undefined ? never : T;
|
|
9
9
|
/**
|
|
10
|
-
* @description Checks if
|
|
10
|
+
* @description Checks if T is `undefined`
|
|
11
11
|
* @param T - Type to check
|
|
12
12
|
* @example
|
|
13
13
|
* type Result = IsUndefined<undefined>
|
|
@@ -18,7 +18,7 @@ export type RequiredBy<TType, TKeys extends keyof TType> = Required<Pick<TType,
|
|
|
18
18
|
/**
|
|
19
19
|
* @description Combines members of an intersection into a readable type.
|
|
20
20
|
*
|
|
21
|
-
* @see
|
|
21
|
+
* @see https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg
|
|
22
22
|
* @example
|
|
23
23
|
* Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
|
|
24
24
|
* => { a: string, b: string, c: number, d: bigint }
|
|
@@ -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.10";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,mBAAmB,CAAC"}
|
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.10",
|
|
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",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"ts-node": "^10.9.1",
|
|
48
49
|
"typescript": "^5.0.4",
|
|
49
50
|
"typescript-template": "*",
|
|
50
|
-
"vitest": "^0.
|
|
51
|
+
"vitest": "^2.0.4"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
54
|
"abitype": "^0.8.3",
|
|
@@ -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": "e3446b95cdee38c248f336857b24f78a32694076"
|
|
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({
|
|
@@ -367,7 +374,6 @@ export async function toSmartContractAccount(
|
|
|
367
374
|
if (deploymentState === DeploymentState.DEPLOYED) {
|
|
368
375
|
return "0x";
|
|
369
376
|
}
|
|
370
|
-
|
|
371
377
|
const contractCode = await client.getBytecode({
|
|
372
378
|
address: accountAddress_,
|
|
373
379
|
});
|
|
@@ -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` 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,
|