thirdweb 5.48.2 → 5.48.3-nightly-b661ce7b2fd58e7ff01faf47cf8fb3bb232841ec-20240827000337
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/exports/wallets/smart.js +4 -2
- package/dist/cjs/exports/wallets/smart.js.map +1 -1
- package/dist/cjs/extensions/erc1155/drops/write/claimTo.js.map +1 -1
- package/dist/cjs/extensions/erc4337/__generated__/IEntryPoint_v07/events/PostOpRevertReason.js +32 -0
- package/dist/cjs/extensions/erc4337/__generated__/IEntryPoint_v07/events/PostOpRevertReason.js.map +1 -0
- package/dist/cjs/extensions/erc4337/__generated__/IEntryPoint_v07/read/getUserOpHash.js +153 -0
- package/dist/cjs/extensions/erc4337/__generated__/IEntryPoint_v07/read/getUserOpHash.js.map +1 -0
- package/dist/cjs/extensions/prebuilts/__generated__/VoteERC20/write/initialize.js +184 -0
- package/dist/cjs/extensions/prebuilts/__generated__/VoteERC20/write/initialize.js.map +1 -0
- package/dist/cjs/extensions/prebuilts/deploy-vote.js +122 -0
- package/dist/cjs/extensions/prebuilts/deploy-vote.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/smart/index.js +13 -2
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js +11 -2
- package/dist/cjs/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/constants.js +27 -13
- package/dist/cjs/wallets/smart/lib/constants.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/packUserOp.js +75 -0
- package/dist/cjs/wallets/smart/lib/packUserOp.js.map +1 -0
- package/dist/cjs/wallets/smart/lib/paymaster.js +11 -1
- package/dist/cjs/wallets/smart/lib/paymaster.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/userop.js +201 -66
- package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/utils.js +1 -1
- package/dist/cjs/wallets/smart/lib/utils.js.map +1 -1
- package/dist/cjs/wallets/smart/smart-wallet.js +2 -1
- package/dist/cjs/wallets/smart/smart-wallet.js.map +1 -1
- package/dist/cjs/wallets/smart/types.js.map +1 -1
- package/dist/esm/exports/wallets/smart.js +1 -1
- package/dist/esm/exports/wallets/smart.js.map +1 -1
- package/dist/esm/extensions/erc1155/drops/write/claimTo.js.map +1 -1
- package/dist/esm/extensions/erc4337/__generated__/IEntryPoint_v07/events/PostOpRevertReason.js +29 -0
- package/dist/esm/extensions/erc4337/__generated__/IEntryPoint_v07/events/PostOpRevertReason.js.map +1 -0
- package/dist/esm/extensions/erc4337/__generated__/IEntryPoint_v07/read/getUserOpHash.js +145 -0
- package/dist/esm/extensions/erc4337/__generated__/IEntryPoint_v07/read/getUserOpHash.js.map +1 -0
- package/dist/esm/extensions/prebuilts/__generated__/VoteERC20/write/initialize.js +177 -0
- package/dist/esm/extensions/prebuilts/__generated__/VoteERC20/write/initialize.js.map +1 -0
- package/dist/esm/extensions/prebuilts/deploy-vote.js +119 -0
- package/dist/esm/extensions/prebuilts/deploy-vote.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/smart/index.js +14 -3
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js +12 -3
- package/dist/esm/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/esm/wallets/smart/lib/constants.js +23 -10
- package/dist/esm/wallets/smart/lib/constants.js.map +1 -1
- package/dist/esm/wallets/smart/lib/packUserOp.js +65 -0
- package/dist/esm/wallets/smart/lib/packUserOp.js.map +1 -0
- package/dist/esm/wallets/smart/lib/paymaster.js +12 -2
- package/dist/esm/wallets/smart/lib/paymaster.js.map +1 -1
- package/dist/esm/wallets/smart/lib/userop.js +202 -67
- package/dist/esm/wallets/smart/lib/userop.js.map +1 -1
- package/dist/esm/wallets/smart/lib/utils.js +1 -1
- package/dist/esm/wallets/smart/lib/utils.js.map +1 -1
- package/dist/esm/wallets/smart/smart-wallet.js +3 -2
- package/dist/esm/wallets/smart/smart-wallet.js.map +1 -1
- package/dist/esm/wallets/smart/types.js.map +1 -1
- package/dist/types/exports/wallets/smart.d.ts +2 -2
- package/dist/types/exports/wallets/smart.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/drops/write/claimTo.d.ts +2 -3
- package/dist/types/extensions/erc1155/drops/write/claimTo.d.ts.map +1 -1
- package/dist/types/extensions/erc4337/__generated__/IEntryPoint_v07/events/PostOpRevertReason.d.ts +57 -0
- package/dist/types/extensions/erc4337/__generated__/IEntryPoint_v07/events/PostOpRevertReason.d.ts.map +1 -0
- package/dist/types/extensions/erc4337/__generated__/IEntryPoint_v07/read/getUserOpHash.d.ts +123 -0
- package/dist/types/extensions/erc4337/__generated__/IEntryPoint_v07/read/getUserOpHash.d.ts.map +1 -0
- package/dist/types/extensions/prebuilts/__generated__/VoteERC20/write/initialize.d.ts +129 -0
- package/dist/types/extensions/prebuilts/__generated__/VoteERC20/write/initialize.d.ts.map +1 -0
- package/dist/types/extensions/prebuilts/deploy-vote.d.ts +82 -0
- package/dist/types/extensions/prebuilts/deploy-vote.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/smart/index.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/bundler.d.ts +3 -3
- package/dist/types/wallets/smart/lib/bundler.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/constants.d.ts +6 -6
- package/dist/types/wallets/smart/lib/constants.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/packUserOp.d.ts +16 -0
- package/dist/types/wallets/smart/lib/packUserOp.d.ts.map +1 -0
- package/dist/types/wallets/smart/lib/paymaster.d.ts +3 -3
- package/dist/types/wallets/smart/lib/paymaster.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/userop.d.ts +6 -4
- package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/utils.d.ts +2 -2
- package/dist/types/wallets/smart/lib/utils.d.ts.map +1 -1
- package/dist/types/wallets/smart/smart-wallet.d.ts.map +1 -1
- package/dist/types/wallets/smart/types.d.ts +62 -9
- package/dist/types/wallets/smart/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/wallets/smart.ts +4 -2
- package/src/extensions/erc1155/drops/write/claimTo.ts +2 -3
- package/src/extensions/erc4337/__generated__/IEntryPoint_v07/events/PostOpRevertReason.ts +49 -0
- package/src/extensions/erc4337/__generated__/IEntryPoint_v07/read/getUserOpHash.ts +181 -0
- package/src/extensions/prebuilts/__generated__/VoteERC20/write/initialize.ts +230 -0
- package/src/extensions/prebuilts/deploy-vote.test.ts +73 -0
- package/src/extensions/prebuilts/deploy-vote.ts +213 -0
- package/src/extensions/vote/read/proposalExists.test.ts +123 -0
- package/src/version.ts +1 -1
- package/src/wallets/smart/index.ts +21 -5
- package/src/wallets/smart/lib/bundler.ts +21 -5
- package/src/wallets/smart/lib/constants.ts +29 -10
- package/src/wallets/smart/lib/packUserOp.ts +79 -0
- package/src/wallets/smart/lib/paymaster.ts +22 -5
- package/src/wallets/smart/lib/userop.ts +292 -85
- package/src/wallets/smart/lib/utils.ts +11 -4
- package/src/wallets/smart/smart-wallet-integration-v07.test.ts +206 -0
- package/src/wallets/smart/smart-wallet-integration.test.ts +1 -1
- package/src/wallets/smart/smart-wallet-zksync.test.ts +1 -2
- package/src/wallets/smart/smart-wallet.ts +4 -2
- package/src/wallets/smart/types.ts +73 -9
@@ -1,15 +1,15 @@
|
|
1
1
|
import type { Chain } from "../../../chains/types.js";
|
2
2
|
export declare const DEBUG = false;
|
3
3
|
export declare const DUMMY_SIGNATURE = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
4
|
-
export declare const
|
4
|
+
export declare const DEFAULT_ACCOUNT_FACTORY_V0_6 = "0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00";
|
5
|
+
export declare const DEFAULT_ACCOUNT_FACTORY_V0_7 = "0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb";
|
5
6
|
export declare const ENTRYPOINT_ADDRESS_v0_6 = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
|
7
|
+
export declare const ENTRYPOINT_ADDRESS_v0_7 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
6
8
|
export declare const MANAGED_ACCOUNT_GAS_BUFFER = 50000n;
|
9
|
+
export declare const getDefaultAccountFactory: (entryPointAddress?: string) => "0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00" | "0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb";
|
7
10
|
/**
|
8
11
|
* @internal
|
9
12
|
*/
|
10
|
-
export declare const getDefaultBundlerUrl: (chain: Chain) => string;
|
11
|
-
|
12
|
-
* @internal
|
13
|
-
*/
|
14
|
-
export declare const getDefaultPaymasterUrl: (chain: Chain) => string;
|
13
|
+
export declare const getDefaultBundlerUrl: (chain: Chain, version: "v1" | "v2") => string;
|
14
|
+
export declare const getEntryPointVersion: (address: string) => "v0.6" | "v0.7";
|
15
15
|
//# sourceMappingURL=constants.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAKtD,eAAO,MAAM,KAAK,QAAQ,CAAC;AAE3B,eAAO,MAAM,eAAe,yIAC4G,CAAC;AAEzI,eAAO,MAAM,4BAA4B,+CACK,CAAC;AAC/C,eAAO,MAAM,4BAA4B,+CACK,CAAC;AAE/C,eAAO,MAAM,uBAAuB,+CACU,CAAC;AAC/C,eAAO,MAAM,uBAAuB,+CACU,CAAC;AAE/C,eAAO,MAAM,0BAA0B,SAAS,CAAC;AAKjD,eAAO,MAAM,wBAAwB,uBAAwB,MAAM,gGAQlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,UAAW,KAAK,WAAW,IAAI,GAAG,IAAI,WAMtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,MAAM,GAAG,MAS/D,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { type Hex } from "viem";
|
2
|
+
import type { PackedUserOperation, UserOperationV07 } from "../types.js";
|
3
|
+
export declare function getInitCode(unpackedUserOperation: UserOperationV07): `0x${string}`;
|
4
|
+
export declare function getAccountGasLimits(unpackedUserOperation: UserOperationV07): Hex;
|
5
|
+
export declare function unpackAccountGasLimits(accountGasLimits: Hex): {
|
6
|
+
verificationGasLimit: bigint;
|
7
|
+
callGasLimit: bigint;
|
8
|
+
};
|
9
|
+
export declare function getGasLimits(unpackedUserOperation: UserOperationV07): Hex;
|
10
|
+
export declare function unpackGasLimits(gasLimits: Hex): {
|
11
|
+
maxPriorityFeePerGas: bigint;
|
12
|
+
maxFeePerGas: bigint;
|
13
|
+
};
|
14
|
+
export declare function getPaymasterAndData(unpackedUserOperation: UserOperationV07): `0x${string}`;
|
15
|
+
export declare const getPackedUserOperation: (userOperation: UserOperationV07) => PackedUserOperation;
|
16
|
+
//# sourceMappingURL=packUserOp.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"packUserOp.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/packUserOp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAA6B,MAAM,MAAM,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEzE,wBAAgB,WAAW,CAAC,qBAAqB,EAAE,gBAAgB,iBAOlE;AAED,wBAAgB,mBAAmB,CAAC,qBAAqB,EAAE,gBAAgB,GAMnE,GAAG,CACV;AAED,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,GAAG;;;EAK3D;AAED,wBAAgB,YAAY,CAAC,qBAAqB,EAAE,gBAAgB,GAM5D,GAAG,CACV;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,GAAG;;;EAK7C;AAED,wBAAgB,mBAAmB,CAAC,qBAAqB,EAAE,gBAAgB,iBAkB1E;AAED,eAAO,MAAM,sBAAsB,kBAClB,gBAAgB,KAC9B,mBAYF,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Chain } from "../../../chains/types.js";
|
2
2
|
import type { ThirdwebClient } from "../../../client/client.js";
|
3
|
-
import type { PaymasterResult,
|
3
|
+
import type { PaymasterResult, UserOperationV06, UserOperationV07 } from "../types.js";
|
4
4
|
/**
|
5
5
|
* Get paymaster and data details for a user operation.
|
6
6
|
* @param args - The userOp and options
|
@@ -20,10 +20,10 @@ import type { PaymasterResult, UserOperation } from "../types.js";
|
|
20
20
|
* @walletUtils
|
21
21
|
*/
|
22
22
|
export declare function getPaymasterAndData(args: {
|
23
|
-
userOp:
|
23
|
+
userOp: UserOperationV06 | UserOperationV07;
|
24
24
|
client: ThirdwebClient;
|
25
25
|
chain: Chain;
|
26
26
|
entrypointAddress?: string;
|
27
|
-
paymasterOverride?: (userOp:
|
27
|
+
paymasterOverride?: (userOp: UserOperationV06 | UserOperationV07) => Promise<PaymasterResult>;
|
28
28
|
}): Promise<PaymasterResult>;
|
29
29
|
//# sourceMappingURL=paymaster.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"paymaster.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/paymaster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"paymaster.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/paymaster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AASrB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IAC5C,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAClB,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,KACxC,OAAO,CAAC,eAAe,CAAC,CAAC;CAC/B,GAAG,OAAO,CAAC,eAAe,CAAC,CA4E3B"}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import type { Chain } from "../../../chains/types.js";
|
2
|
+
import type { ThirdwebClient } from "../../../client/client.js";
|
2
3
|
import { type ThirdwebContract } from "../../../contract/contract.js";
|
3
4
|
import type { PreparedTransaction } from "../../../transaction/prepare-transaction.js";
|
4
5
|
import type { TransactionReceipt } from "../../../transaction/types.js";
|
5
6
|
import type { Hex } from "../../../utils/encoding/hex.js";
|
6
7
|
import type { Account } from "../../interfaces/wallet.js";
|
7
|
-
import type { BundlerOptions, SmartWalletOptions,
|
8
|
+
import type { BundlerOptions, SmartWalletOptions, UserOperationV06, UserOperationV07 } from "../types.js";
|
8
9
|
/**
|
9
10
|
* Wait for the user operation to be mined.
|
10
11
|
* @param args - The options and user operation hash
|
@@ -55,7 +56,7 @@ export declare function createUnsignedUserOp(args: {
|
|
55
56
|
adminAddress: string;
|
56
57
|
sponsorGas: boolean;
|
57
58
|
overrides?: SmartWalletOptions["overrides"];
|
58
|
-
}): Promise<
|
59
|
+
}): Promise<UserOperationV06 | UserOperationV07>;
|
59
60
|
/**
|
60
61
|
* Sign a user operation.
|
61
62
|
* @param userOp - The UserOperation to sign (with signature field ignored)
|
@@ -75,9 +76,10 @@ export declare function createUnsignedUserOp(args: {
|
|
75
76
|
* @walletUtils
|
76
77
|
*/
|
77
78
|
export declare function signUserOp(args: {
|
78
|
-
|
79
|
+
client: ThirdwebClient;
|
80
|
+
userOp: UserOperationV06 | UserOperationV07;
|
79
81
|
chain: Chain;
|
80
82
|
entrypointAddress?: string;
|
81
83
|
adminAccount: Account;
|
82
|
-
}): Promise<
|
84
|
+
}): Promise<UserOperationV06 | UserOperationV07>;
|
83
85
|
//# sourceMappingURL=userop.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAI1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAkBrB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,GAAG;IACrB,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,OAAO,CAAC,kBAAkB,CAAC,CAY7B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,WAAW,EAAE,mBAAmB,CAAC;IACjC,eAAe,EAAE,gBAAgB,CAAC;IAClC,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;CAC7C,GAAG,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAwE/C;AA2SD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CA0C/C"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Chain } from "../../../chains/types.js";
|
2
|
-
import type {
|
2
|
+
import type { UserOperationV06, UserOperationV06Hexed, UserOperationV07, UserOperationV07Hexed } from "../types.js";
|
3
3
|
export declare const generateRandomUint192: () => bigint;
|
4
4
|
/**
|
5
5
|
* @internal
|
@@ -8,6 +8,6 @@ export declare const randomNonce: () => bigint;
|
|
8
8
|
/**
|
9
9
|
* @internal
|
10
10
|
*/
|
11
|
-
export declare function hexlifyUserOp(userOp:
|
11
|
+
export declare function hexlifyUserOp(userOp: UserOperationV06 | UserOperationV07): UserOperationV06Hexed | UserOperationV07Hexed;
|
12
12
|
export declare function isNativeAAChain(chain: Chain): boolean;
|
13
13
|
//# sourceMappingURL=utils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,qBAAqB,QAAO,MAexC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,cAIvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,GAC1C,qBAAqB,GAAG,qBAAqB,CAQ/C;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,WAO3C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"smart-wallet.d.ts","sourceRoot":"","sources":["../../../../src/wallets/smart/smart-wallet.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAW,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAC1C,MAAM,CAAC,OAAO,CAAC,
|
1
|
+
{"version":3,"file":"smart-wallet.d.ts","sourceRoot":"","sources":["../../../../src/wallets/smart/smart-wallet.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAW,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAC1C,MAAM,CAAC,OAAO,CAAC,CAiGjB"}
|
@@ -19,7 +19,7 @@ export type SmartWalletOptions = Prettify<{
|
|
19
19
|
address: string;
|
20
20
|
token: string;
|
21
21
|
};
|
22
|
-
paymaster?: (userOp:
|
22
|
+
paymaster?: (userOp: UserOperationV06 | UserOperationV07) => Promise<PaymasterResult>;
|
23
23
|
predictAddress?: (factoryContract: ThirdwebContract) => Promise<string>;
|
24
24
|
createAccount?: (factoryContract: ThirdwebContract) => PreparedTransaction;
|
25
25
|
execute?: (accountContract: ThirdwebContract, transaction: SendTransactionOption) => PreparedTransaction;
|
@@ -53,20 +53,48 @@ export type SmartWalletConnectionOptions = {
|
|
53
53
|
client: ThirdwebClient;
|
54
54
|
chain?: Chain;
|
55
55
|
};
|
56
|
-
export type
|
56
|
+
export type UserOperationV06 = {
|
57
57
|
sender: Address;
|
58
58
|
nonce: bigint;
|
59
|
-
initCode: Hex
|
60
|
-
callData: Hex
|
59
|
+
initCode: Hex;
|
60
|
+
callData: Hex;
|
61
61
|
callGasLimit: bigint;
|
62
62
|
verificationGasLimit: bigint;
|
63
63
|
preVerificationGas: bigint;
|
64
64
|
maxFeePerGas: bigint;
|
65
65
|
maxPriorityFeePerGas: bigint;
|
66
|
-
paymasterAndData: Hex
|
67
|
-
signature: Hex
|
66
|
+
paymasterAndData: Hex;
|
67
|
+
signature: Hex;
|
68
|
+
};
|
69
|
+
export type UserOperationV07 = {
|
70
|
+
sender: string;
|
71
|
+
nonce: bigint;
|
72
|
+
factory: string | undefined;
|
73
|
+
factoryData: Hex;
|
74
|
+
callData: Hex;
|
75
|
+
callGasLimit: bigint;
|
76
|
+
verificationGasLimit: bigint;
|
77
|
+
preVerificationGas: bigint;
|
78
|
+
maxFeePerGas: bigint;
|
79
|
+
maxPriorityFeePerGas: bigint;
|
80
|
+
paymaster: string | undefined;
|
81
|
+
paymasterData: Hex;
|
82
|
+
paymasterVerificationGasLimit: bigint;
|
83
|
+
paymasterPostOpGasLimit: bigint;
|
84
|
+
signature: Hex;
|
85
|
+
};
|
86
|
+
export type PackedUserOperation = {
|
87
|
+
sender: string;
|
88
|
+
nonce: bigint;
|
89
|
+
initCode: Hex;
|
90
|
+
callData: Hex;
|
91
|
+
accountGasLimits: Hex;
|
92
|
+
preVerificationGas: bigint;
|
93
|
+
gasFees: Hex;
|
94
|
+
paymasterAndData: Hex;
|
95
|
+
signature: Hex;
|
68
96
|
};
|
69
|
-
export type
|
97
|
+
export type UserOperationV06Hexed = {
|
70
98
|
sender: Address;
|
71
99
|
nonce: Hex;
|
72
100
|
initCode: Hex;
|
@@ -79,17 +107,42 @@ export type UserOperationHexed = {
|
|
79
107
|
paymasterAndData: Hex;
|
80
108
|
signature: Hex;
|
81
109
|
};
|
110
|
+
export type UserOperationV07Hexed = {
|
111
|
+
sender: Hex;
|
112
|
+
nonce: Hex;
|
113
|
+
factory: Hex;
|
114
|
+
factoryData: Hex;
|
115
|
+
callData: Hex;
|
116
|
+
callGasLimit: Hex;
|
117
|
+
verificationGasLimit: Hex;
|
118
|
+
preVerificationGas: Hex;
|
119
|
+
maxFeePerGas: Hex;
|
120
|
+
maxPriorityFeePerGas: Hex;
|
121
|
+
paymaster: Hex;
|
122
|
+
paymasterVerificationGasLimit: Hex;
|
123
|
+
paymasterPostOpGasLimit: Hex;
|
124
|
+
paymasterData: Hex;
|
125
|
+
signature: Hex;
|
126
|
+
};
|
82
127
|
export type PaymasterResult = {
|
83
|
-
paymasterAndData: string;
|
84
128
|
preVerificationGas?: bigint;
|
85
129
|
verificationGasLimit?: bigint;
|
86
130
|
callGasLimit?: bigint;
|
87
|
-
}
|
131
|
+
} & ({
|
132
|
+
paymasterAndData: string;
|
133
|
+
} | {
|
134
|
+
paymaster: string;
|
135
|
+
paymasterData: string;
|
136
|
+
paymasterVerificationGasLimit?: bigint;
|
137
|
+
paymasterPostOpGasLimit?: bigint;
|
138
|
+
});
|
88
139
|
export type EstimationResult = {
|
89
140
|
preVerificationGas: bigint;
|
90
141
|
verificationGas: bigint;
|
91
142
|
verificationGasLimit: bigint;
|
92
143
|
callGasLimit: bigint;
|
144
|
+
paymasterVerificationGasLimit?: bigint;
|
145
|
+
paymasterPostOpGasLimit?: bigint;
|
93
146
|
};
|
94
147
|
export type GasPriceResult = {
|
95
148
|
maxFeePerGas: bigint;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallets/smart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EAAE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AAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,gBAAgB,EAAE,oBAAoB,wBA2CvC"}
|
package/package.json
CHANGED
@@ -21,11 +21,13 @@ export { getPaymasterAndData } from "../../wallets/smart/lib/paymaster.js";
|
|
21
21
|
export type {
|
22
22
|
SmartWalletConnectionOptions,
|
23
23
|
SmartWalletOptions,
|
24
|
-
UserOperation,
|
24
|
+
UserOperationV06 as UserOperation,
|
25
25
|
PaymasterResult,
|
26
26
|
} from "../../wallets/smart/types.js";
|
27
27
|
|
28
28
|
export {
|
29
29
|
ENTRYPOINT_ADDRESS_v0_6,
|
30
|
-
|
30
|
+
ENTRYPOINT_ADDRESS_v0_7,
|
31
|
+
DEFAULT_ACCOUNT_FACTORY_V0_6,
|
32
|
+
DEFAULT_ACCOUNT_FACTORY_V0_7,
|
31
33
|
} from "../../wallets/smart/lib/constants.js";
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { Address } from "abitype";
|
2
1
|
import type { BaseTransactionOptions } from "../../../../transaction/types.js";
|
3
2
|
import { getClaimParams } from "../../../../utils/extensions/drops/get-claim-params.js";
|
4
3
|
import { claim } from "../../__generated__/IDrop1155/write/claim.js";
|
@@ -7,10 +6,10 @@ import { claim } from "../../__generated__/IDrop1155/write/claim.js";
|
|
7
6
|
* @extension ERC1155
|
8
7
|
*/
|
9
8
|
export type ClaimToParams = {
|
10
|
-
to:
|
9
|
+
to: string;
|
11
10
|
tokenId: bigint;
|
12
11
|
quantity: bigint;
|
13
|
-
from?:
|
12
|
+
from?: string;
|
14
13
|
};
|
15
14
|
|
16
15
|
/**
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { prepareEvent } from "../../../../../event/prepare-event.js";
|
2
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Represents the filters for the "PostOpRevertReason" event.
|
6
|
+
*/
|
7
|
+
export type PostOpRevertReasonEventFilters = Partial<{
|
8
|
+
userOpHash: AbiParameterToPrimitiveType<{
|
9
|
+
type: "bytes32";
|
10
|
+
name: "userOpHash";
|
11
|
+
indexed: true;
|
12
|
+
}>;
|
13
|
+
sender: AbiParameterToPrimitiveType<{
|
14
|
+
type: "address";
|
15
|
+
name: "sender";
|
16
|
+
indexed: true;
|
17
|
+
}>;
|
18
|
+
}>;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Creates an event object for the PostOpRevertReason event.
|
22
|
+
* @param filters - Optional filters to apply to the event.
|
23
|
+
* @returns The prepared event object.
|
24
|
+
* @extension ERC4337
|
25
|
+
* @example
|
26
|
+
* ```ts
|
27
|
+
* import { getContractEvents } from "thirdweb";
|
28
|
+
* import { postOpRevertReasonEvent } from "thirdweb/extensions/erc4337";
|
29
|
+
*
|
30
|
+
* const events = await getContractEvents({
|
31
|
+
* contract,
|
32
|
+
* events: [
|
33
|
+
* postOpRevertReasonEvent({
|
34
|
+
* userOpHash: ...,
|
35
|
+
* sender: ...,
|
36
|
+
* })
|
37
|
+
* ],
|
38
|
+
* });
|
39
|
+
* ```
|
40
|
+
*/
|
41
|
+
export function postOpRevertReasonEvent(
|
42
|
+
filters: PostOpRevertReasonEventFilters = {},
|
43
|
+
) {
|
44
|
+
return prepareEvent({
|
45
|
+
signature:
|
46
|
+
"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)",
|
47
|
+
filters,
|
48
|
+
});
|
49
|
+
}
|
@@ -0,0 +1,181 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
import { readContract } from "../../../../../transaction/read-contract.js";
|
3
|
+
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
4
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
5
|
+
import { decodeAbiParameters } from "viem";
|
6
|
+
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
7
|
+
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
8
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Represents the parameters for the "getUserOpHash" function.
|
12
|
+
*/
|
13
|
+
export type GetUserOpHashParams = {
|
14
|
+
userOp: AbiParameterToPrimitiveType<{
|
15
|
+
type: "tuple";
|
16
|
+
name: "userOp";
|
17
|
+
components: [
|
18
|
+
{ type: "address"; name: "sender" },
|
19
|
+
{ type: "uint256"; name: "nonce" },
|
20
|
+
{ type: "bytes"; name: "initCode" },
|
21
|
+
{ type: "bytes"; name: "callData" },
|
22
|
+
{ type: "bytes32"; name: "accountGasLimits" },
|
23
|
+
{ type: "uint256"; name: "preVerificationGas" },
|
24
|
+
{ type: "bytes32"; name: "gasFees" },
|
25
|
+
{ type: "bytes"; name: "paymasterAndData" },
|
26
|
+
{ type: "bytes"; name: "signature" },
|
27
|
+
];
|
28
|
+
}>;
|
29
|
+
};
|
30
|
+
|
31
|
+
export const FN_SELECTOR = "0x22cdde4c" as const;
|
32
|
+
const FN_INPUTS = [
|
33
|
+
{
|
34
|
+
type: "tuple",
|
35
|
+
name: "userOp",
|
36
|
+
components: [
|
37
|
+
{
|
38
|
+
type: "address",
|
39
|
+
name: "sender",
|
40
|
+
},
|
41
|
+
{
|
42
|
+
type: "uint256",
|
43
|
+
name: "nonce",
|
44
|
+
},
|
45
|
+
{
|
46
|
+
type: "bytes",
|
47
|
+
name: "initCode",
|
48
|
+
},
|
49
|
+
{
|
50
|
+
type: "bytes",
|
51
|
+
name: "callData",
|
52
|
+
},
|
53
|
+
{
|
54
|
+
type: "bytes32",
|
55
|
+
name: "accountGasLimits",
|
56
|
+
},
|
57
|
+
{
|
58
|
+
type: "uint256",
|
59
|
+
name: "preVerificationGas",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
type: "bytes32",
|
63
|
+
name: "gasFees",
|
64
|
+
},
|
65
|
+
{
|
66
|
+
type: "bytes",
|
67
|
+
name: "paymasterAndData",
|
68
|
+
},
|
69
|
+
{
|
70
|
+
type: "bytes",
|
71
|
+
name: "signature",
|
72
|
+
},
|
73
|
+
],
|
74
|
+
},
|
75
|
+
] as const;
|
76
|
+
const FN_OUTPUTS = [
|
77
|
+
{
|
78
|
+
type: "bytes32",
|
79
|
+
},
|
80
|
+
] as const;
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Checks if the `getUserOpHash` method is supported by the given contract.
|
84
|
+
* @param contract The ThirdwebContract.
|
85
|
+
* @returns A promise that resolves to a boolean indicating if the `getUserOpHash` method is supported.
|
86
|
+
* @extension ERC4337
|
87
|
+
* @example
|
88
|
+
* ```ts
|
89
|
+
* import { isGetUserOpHashSupported } from "thirdweb/extensions/erc4337";
|
90
|
+
*
|
91
|
+
* const supported = await isGetUserOpHashSupported(contract);
|
92
|
+
* ```
|
93
|
+
*/
|
94
|
+
export async function isGetUserOpHashSupported(
|
95
|
+
contract: ThirdwebContract<any>,
|
96
|
+
) {
|
97
|
+
return detectMethod({
|
98
|
+
contract,
|
99
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
100
|
+
});
|
101
|
+
}
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Encodes the parameters for the "getUserOpHash" function.
|
105
|
+
* @param options - The options for the getUserOpHash function.
|
106
|
+
* @returns The encoded ABI parameters.
|
107
|
+
* @extension ERC4337
|
108
|
+
* @example
|
109
|
+
* ```ts
|
110
|
+
* import { encodeGetUserOpHashParams } "thirdweb/extensions/erc4337";
|
111
|
+
* const result = encodeGetUserOpHashParams({
|
112
|
+
* userOp: ...,
|
113
|
+
* });
|
114
|
+
* ```
|
115
|
+
*/
|
116
|
+
export function encodeGetUserOpHashParams(options: GetUserOpHashParams) {
|
117
|
+
return encodeAbiParameters(FN_INPUTS, [options.userOp]);
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Encodes the "getUserOpHash" function into a Hex string with its parameters.
|
122
|
+
* @param options - The options for the getUserOpHash function.
|
123
|
+
* @returns The encoded hexadecimal string.
|
124
|
+
* @extension ERC4337
|
125
|
+
* @example
|
126
|
+
* ```ts
|
127
|
+
* import { encodeGetUserOpHash } "thirdweb/extensions/erc4337";
|
128
|
+
* const result = encodeGetUserOpHash({
|
129
|
+
* userOp: ...,
|
130
|
+
* });
|
131
|
+
* ```
|
132
|
+
*/
|
133
|
+
export function encodeGetUserOpHash(options: GetUserOpHashParams) {
|
134
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
135
|
+
// we can do this because we know the specific formats of the values
|
136
|
+
return (FN_SELECTOR +
|
137
|
+
encodeGetUserOpHashParams(options).slice(
|
138
|
+
2,
|
139
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Decodes the result of the getUserOpHash function call.
|
144
|
+
* @param result - The hexadecimal result to decode.
|
145
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
146
|
+
* @extension ERC4337
|
147
|
+
* @example
|
148
|
+
* ```ts
|
149
|
+
* import { decodeGetUserOpHashResult } from "thirdweb/extensions/erc4337";
|
150
|
+
* const result = decodeGetUserOpHashResult("...");
|
151
|
+
* ```
|
152
|
+
*/
|
153
|
+
export function decodeGetUserOpHashResult(result: Hex) {
|
154
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Calls the "getUserOpHash" function on the contract.
|
159
|
+
* @param options - The options for the getUserOpHash function.
|
160
|
+
* @returns The parsed result of the function call.
|
161
|
+
* @extension ERC4337
|
162
|
+
* @example
|
163
|
+
* ```ts
|
164
|
+
* import { getUserOpHash } from "thirdweb/extensions/erc4337";
|
165
|
+
*
|
166
|
+
* const result = await getUserOpHash({
|
167
|
+
* contract,
|
168
|
+
* userOp: ...,
|
169
|
+
* });
|
170
|
+
*
|
171
|
+
* ```
|
172
|
+
*/
|
173
|
+
export async function getUserOpHash(
|
174
|
+
options: BaseTransactionOptions<GetUserOpHashParams>,
|
175
|
+
) {
|
176
|
+
return readContract({
|
177
|
+
contract: options.contract,
|
178
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
179
|
+
params: [options.userOp],
|
180
|
+
});
|
181
|
+
}
|