thirdweb 5.34.0-nightly-325416ea19905901f30e795cbf93cb8a085be02f-20240708203622 → 5.34.0-nightly-3f0291def5ac8b5006a75e8c1212d4f287647d05-20240709000342
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 +10 -1
- package/dist/cjs/exports/wallets/smart.js.map +1 -1
- package/dist/cjs/react/core/hooks/others/useChainQuery.js +44 -0
- package/dist/cjs/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js +20 -4
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/smart/index.js +19 -9
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js +57 -9
- package/dist/cjs/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/calls.js +31 -21
- package/dist/cjs/wallets/smart/lib/calls.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/paymaster.js +5 -6
- package/dist/cjs/wallets/smart/lib/paymaster.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/userop.js +45 -21
- package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
- package/dist/esm/exports/wallets/smart.js +3 -1
- package/dist/esm/exports/wallets/smart.js.map +1 -1
- package/dist/esm/react/core/hooks/others/useChainQuery.js +43 -1
- package/dist/esm/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js +21 -5
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/smart/index.js +19 -9
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js +56 -8
- package/dist/esm/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/esm/wallets/smart/lib/calls.js +31 -21
- package/dist/esm/wallets/smart/lib/calls.js.map +1 -1
- package/dist/esm/wallets/smart/lib/paymaster.js +5 -6
- package/dist/esm/wallets/smart/lib/paymaster.js.map +1 -1
- package/dist/esm/wallets/smart/lib/userop.js +46 -22
- package/dist/esm/wallets/smart/lib/userop.js.map +1 -1
- package/dist/types/exports/wallets/smart.d.ts +3 -1
- package/dist/types/exports/wallets/smart.d.ts.map +1 -1
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts +10 -0
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/NetworkSelector.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/smart/index.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/bundler.d.ts +53 -5
- package/dist/types/wallets/smart/lib/bundler.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/calls.d.ts +25 -7
- package/dist/types/wallets/smart/lib/calls.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/paymaster.d.ts +7 -2
- package/dist/types/wallets/smart/lib/paymaster.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/userop.d.ts +15 -4
- package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
- package/dist/types/wallets/smart/types.d.ts +4 -2
- package/dist/types/wallets/smart/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/wallets/smart.ts +14 -1
- package/src/react/core/hooks/others/useChainQuery.ts +47 -1
- package/src/react/web/ui/ConnectWallet/NetworkSelector.tsx +27 -4
- package/src/version.ts +1 -1
- package/src/wallets/smart/index.ts +19 -9
- package/src/wallets/smart/lib/bundler.ts +56 -9
- package/src/wallets/smart/lib/calls.ts +67 -28
- package/src/wallets/smart/lib/paymaster.ts +12 -13
- package/src/wallets/smart/lib/userop.ts +74 -30
- package/src/wallets/smart/types.ts +6 -6
@@ -1,34 +1,52 @@
|
|
1
1
|
import type { ThirdwebContract } from "../../../contract/contract.js";
|
2
2
|
import type { PreparedTransaction } from "../../../transaction/prepare-transaction.js";
|
3
3
|
import type { SendTransactionOption } from "../../interfaces/wallet.js";
|
4
|
-
import type { SmartAccountOptions, SmartWalletOptions } from "../types.ts";
|
5
4
|
/**
|
6
|
-
*
|
5
|
+
* Predict the address of a smart account.
|
6
|
+
* @param args - The options for predicting the address of a smart account.
|
7
|
+
* @returns The predicted address of the smart account.
|
8
|
+
* @example
|
9
|
+
* ```ts
|
10
|
+
* import { predictAddress } from "thirdweb/wallets/smart";
|
11
|
+
*
|
12
|
+
* const predictedAddress = await predictAddress({
|
13
|
+
* factoryContract,
|
14
|
+
* adminAddress,
|
15
|
+
* accountSalt,
|
16
|
+
* });
|
17
|
+
* ```
|
18
|
+
* @walletUtils
|
7
19
|
*/
|
8
|
-
export declare function predictAddress(
|
9
|
-
|
20
|
+
export declare function predictAddress(args: {
|
21
|
+
factoryContract: ThirdwebContract;
|
22
|
+
predictAddressOverride?: (factoryContract: ThirdwebContract) => Promise<string>;
|
23
|
+
adminAddress: string;
|
24
|
+
accountSalt?: string;
|
25
|
+
accountAddress?: string;
|
10
26
|
}): Promise<string>;
|
11
27
|
/**
|
12
28
|
* @internal
|
13
29
|
*/
|
14
30
|
export declare function prepareCreateAccount(args: {
|
15
31
|
factoryContract: ThirdwebContract;
|
16
|
-
|
32
|
+
adminAddress: string;
|
33
|
+
accountSalt?: string;
|
34
|
+
createAccountOverride?: (factoryContract: ThirdwebContract) => PreparedTransaction;
|
17
35
|
}): PreparedTransaction;
|
18
36
|
/**
|
19
37
|
* @internal
|
20
38
|
*/
|
21
39
|
export declare function prepareExecute(args: {
|
22
40
|
accountContract: ThirdwebContract;
|
23
|
-
options: SmartAccountOptions;
|
24
41
|
transaction: SendTransactionOption;
|
42
|
+
executeOverride?: (accountContract: ThirdwebContract, transaction: SendTransactionOption) => PreparedTransaction;
|
25
43
|
}): PreparedTransaction;
|
26
44
|
/**
|
27
45
|
* @internal
|
28
46
|
*/
|
29
47
|
export declare function prepareBatchExecute(args: {
|
30
48
|
accountContract: ThirdwebContract;
|
31
|
-
options: SmartAccountOptions;
|
32
49
|
transactions: SendTransactionOption[];
|
50
|
+
executeBatchOverride?: (accountContract: ThirdwebContract, transactions: SendTransactionOption[]) => PreparedTransaction;
|
33
51
|
}): PreparedTransaction;
|
34
52
|
//# sourceMappingURL=calls.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAGvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAGvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,eAAe,EAAE,gBAAgB,CAAC;IAClC,sBAAsB,CAAC,EAAE,CACvB,eAAe,EAAE,gBAAgB,KAC9B,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,CACtB,eAAe,EAAE,gBAAgB,KAC9B,mBAAmB,CAAC;CAC1B,GAAG,mBAAmB,CAetB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,eAAe,EAAE,gBAAgB,CAAC;IAClC,WAAW,EAAE,qBAAqB,CAAC;IACnC,eAAe,CAAC,EAAE,CAChB,eAAe,EAAE,gBAAgB,EACjC,WAAW,EAAE,qBAAqB,KAC/B,mBAAmB,CAAC;CAC1B,GAAG,mBAAmB,CActB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,oBAAoB,CAAC,EAAE,CACrB,eAAe,EAAE,gBAAgB,EACjC,YAAY,EAAE,qBAAqB,EAAE,KAClC,mBAAmB,CAAC;CAC1B,GAAG,mBAAmB,CAkBtB"}
|
@@ -1,10 +1,15 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Chain } from "../../../chains/types.js";
|
2
|
+
import type { ThirdwebClient } from "../../../client/client.js";
|
3
|
+
import type { PaymasterResult, UserOperation } from "../types.js";
|
2
4
|
/**
|
3
5
|
* TODO Docs
|
4
6
|
* @internal
|
5
7
|
*/
|
6
8
|
export declare function getPaymasterAndData(args: {
|
7
9
|
userOp: UserOperation;
|
8
|
-
|
10
|
+
client: ThirdwebClient;
|
11
|
+
chain: Chain;
|
12
|
+
entrypointAddress?: string;
|
13
|
+
paymasterOverride?: (userOp: UserOperation) => Promise<PaymasterResult>;
|
9
14
|
}): Promise<PaymasterResult>;
|
10
15
|
//# sourceMappingURL=paymaster.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"paymaster.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/paymaster.ts"],"names":[],"mappings":"
|
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,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQlE;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CACzE,GAAG,OAAO,CAAC,eAAe,CAAC,CAkE3B"}
|
@@ -1,7 +1,10 @@
|
|
1
|
+
import type { Chain } from "../../../chains/types.js";
|
2
|
+
import type { ThirdwebContract } from "../../../contract/contract.js";
|
1
3
|
import type { PreparedTransaction } from "../../../transaction/prepare-transaction.js";
|
2
4
|
import type { TransactionReceipt } from "../../../transaction/types.js";
|
3
5
|
import type { Hex } from "../../../utils/encoding/hex.js";
|
4
|
-
import type {
|
6
|
+
import type { Account } from "../../interfaces/wallet.js";
|
7
|
+
import type { BundlerOptions, SmartWalletOptions, UserOperation } from "../types.js";
|
5
8
|
/**
|
6
9
|
* Wait for the user operation to be mined.
|
7
10
|
* @param args - The options and user operation hash
|
@@ -36,14 +39,20 @@ export declare function waitForUserOpReceipt(args: BundlerOptions & {
|
|
36
39
|
*
|
37
40
|
* const userOp = await createUnsignedUserOp({
|
38
41
|
* transaction,
|
39
|
-
*
|
42
|
+
* accountContract,
|
43
|
+
* sponsorGas,
|
44
|
+
* overrides,
|
40
45
|
* });
|
41
46
|
* ```
|
42
47
|
* @walletUtils
|
43
48
|
*/
|
44
49
|
export declare function createUnsignedUserOp(args: {
|
45
50
|
transaction: PreparedTransaction;
|
46
|
-
|
51
|
+
factoryContract: ThirdwebContract;
|
52
|
+
accountContract: ThirdwebContract;
|
53
|
+
adminAddress: string;
|
54
|
+
sponsorGas: boolean;
|
55
|
+
overrides?: SmartWalletOptions["overrides"];
|
47
56
|
}): Promise<UserOperation>;
|
48
57
|
/**
|
49
58
|
* Sign a user operation.
|
@@ -64,6 +73,8 @@ export declare function createUnsignedUserOp(args: {
|
|
64
73
|
*/
|
65
74
|
export declare function signUserOp(args: {
|
66
75
|
userOp: UserOperation;
|
67
|
-
|
76
|
+
chain: Chain;
|
77
|
+
entrypointAddress?: string;
|
78
|
+
adminAccount: Account;
|
68
79
|
}): Promise<UserOperation>;
|
69
80
|
//# sourceMappingURL=userop.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"
|
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,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAK1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,EACd,MAAM,aAAa,CAAC;AAerB;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;GAkBG;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,aAAa,CAAC,CAyIzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,aAAa,CAAC,CAmBzB"}
|
@@ -36,10 +36,12 @@ export type SmartAccountOptions = Prettify<Omit<SmartWalletOptions, "chain" | "g
|
|
36
36
|
accountContract: ThirdwebContract;
|
37
37
|
client: ThirdwebClient;
|
38
38
|
}>;
|
39
|
-
export type BundlerOptions =
|
39
|
+
export type BundlerOptions = {
|
40
|
+
bundlerUrl?: string;
|
41
|
+
entrypointAddress?: string;
|
40
42
|
chain: Chain;
|
41
43
|
client: ThirdwebClient;
|
42
|
-
}
|
44
|
+
};
|
43
45
|
export type SmartWalletConnectionOptions = {
|
44
46
|
personalAccount: Account;
|
45
47
|
client: ThirdwebClient;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallets/smart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,GAAG,CAAC;CACrB,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thirdweb",
|
3
|
-
"version": "5.34.0-nightly-
|
3
|
+
"version": "5.34.0-nightly-3f0291def5ac8b5006a75e8c1212d4f287647d05-20240709000342",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/thirdweb-dev/js.git#main"
|
@@ -1,6 +1,19 @@
|
|
1
1
|
export { smartWallet } from "../../wallets/smart/smart-wallet.js";
|
2
2
|
|
3
|
-
export {
|
3
|
+
export {
|
4
|
+
waitForUserOpReceipt,
|
5
|
+
createUnsignedUserOp,
|
6
|
+
signUserOp,
|
7
|
+
} from "../../wallets/smart/lib/userop.js";
|
8
|
+
|
9
|
+
export {
|
10
|
+
getUserOpReceipt,
|
11
|
+
bundleUserOp,
|
12
|
+
getUserOpGasFees,
|
13
|
+
estimateUserOpGas,
|
14
|
+
} from "../../wallets/smart/lib/bundler.js";
|
15
|
+
|
16
|
+
export { predictAddress } from "../../wallets/smart/lib/calls.js";
|
4
17
|
|
5
18
|
export type {
|
6
19
|
SmartWalletConnectionOptions,
|
@@ -1,9 +1,11 @@
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
1
|
+
import { useQueries, useQuery } from "@tanstack/react-query";
|
2
|
+
import { useMemo } from "react";
|
2
3
|
import type { Chain } from "../../../../chains/types.js";
|
3
4
|
import {
|
4
5
|
convertApiChainToChain,
|
5
6
|
getChainMetadata,
|
6
7
|
} from "../../../../chains/utils.js";
|
8
|
+
import { pLimit } from "../../../../utils/promise/p-limit.js";
|
7
9
|
|
8
10
|
export function useChainName(chain?: Chain) {
|
9
11
|
// only if we have a chain and no chain name!
|
@@ -128,3 +130,47 @@ export function useChainExplorers(chain?: Chain) {
|
|
128
130
|
isLoading: isEnabled && chainQuery.isLoading,
|
129
131
|
};
|
130
132
|
}
|
133
|
+
|
134
|
+
function getQueryOptions(chain?: Chain) {
|
135
|
+
return {
|
136
|
+
queryKey: ["chain", chain],
|
137
|
+
enabled: !!chain,
|
138
|
+
staleTime: 1000 * 60 * 60, // 1 hour
|
139
|
+
} as const;
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* @internal
|
144
|
+
*/
|
145
|
+
export function useChainQuery(chain?: Chain) {
|
146
|
+
return useQuery({
|
147
|
+
...getQueryOptions(chain),
|
148
|
+
queryFn: async () => {
|
149
|
+
if (!chain) {
|
150
|
+
throw new Error("chainId is required");
|
151
|
+
}
|
152
|
+
return getChainMetadata(chain);
|
153
|
+
},
|
154
|
+
});
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
* @param chains - array of `Chains`
|
159
|
+
* @param maxConcurrency - maximum number of concurrent requests to make
|
160
|
+
* @internal
|
161
|
+
*/
|
162
|
+
export function useChainsQuery(chains: Chain[], maxConcurrency: number) {
|
163
|
+
const queryList = useMemo(() => {
|
164
|
+
const limit = pLimit(maxConcurrency);
|
165
|
+
return chains.map((chain) => {
|
166
|
+
return {
|
167
|
+
...getQueryOptions(chain),
|
168
|
+
queryFn: () => limit(() => getChainMetadata(chain)),
|
169
|
+
};
|
170
|
+
});
|
171
|
+
}, [chains, maxConcurrency]);
|
172
|
+
|
173
|
+
return useQueries({
|
174
|
+
queries: queryList,
|
175
|
+
});
|
176
|
+
}
|
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
} from "react";
|
14
14
|
import type React from "react";
|
15
15
|
import type { Chain } from "../../../../chains/types.js";
|
16
|
+
import { convertApiChainToChain } from "../../../../chains/utils.js";
|
16
17
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
17
18
|
import {
|
18
19
|
CustomThemeProvider,
|
@@ -29,6 +30,7 @@ import {
|
|
29
30
|
import {
|
30
31
|
useChainIconUrl,
|
31
32
|
useChainName,
|
33
|
+
useChainsQuery,
|
32
34
|
} from "../../../core/hooks/others/useChainQuery.js";
|
33
35
|
import { SetRootElementContext } from "../../../core/providers/RootElementContext.js";
|
34
36
|
import { useActiveWalletChain } from "../../hooks/wallets/useActiveWalletChain.js";
|
@@ -265,9 +267,25 @@ export function NetworkSelectorContent(props: NetworkSelectorContentProps) {
|
|
265
267
|
othersLabel,
|
266
268
|
]);
|
267
269
|
|
270
|
+
// optimizing for dashboard - if we already have names - don't query - we already have the data we want
|
271
|
+
const chainsHaveName = allChains.every((c) => !!c.name);
|
272
|
+
|
273
|
+
const allChainsQuery = useChainsQuery(chainsHaveName ? [] : allChains, 10);
|
274
|
+
const isAllChainsQueryLoading = chainsHaveName
|
275
|
+
? false
|
276
|
+
: allChainsQuery.some((q) => q.isLoading);
|
277
|
+
|
278
|
+
const allChainsMetadata: Chain[] = chainsHaveName
|
279
|
+
? allChains
|
280
|
+
: !isAllChainsQueryLoading
|
281
|
+
? allChainsQuery
|
282
|
+
.filter((x) => !!x.data)
|
283
|
+
.map((q) => convertApiChainToChain(q.data))
|
284
|
+
: [];
|
285
|
+
|
268
286
|
// fuse instance for searching
|
269
287
|
const fuse = useMemo(() => {
|
270
|
-
return new Fuse(
|
288
|
+
return new Fuse(allChainsMetadata, {
|
271
289
|
threshold: 0.4,
|
272
290
|
keys: [
|
273
291
|
{
|
@@ -280,7 +298,7 @@ export function NetworkSelectorContent(props: NetworkSelectorContentProps) {
|
|
280
298
|
},
|
281
299
|
],
|
282
300
|
});
|
283
|
-
}, [
|
301
|
+
}, [allChainsMetadata]);
|
284
302
|
|
285
303
|
// chains filtered by search term
|
286
304
|
const searchedChainSections =
|
@@ -402,14 +420,19 @@ export function NetworkSelectorContent(props: NetworkSelectorContentProps) {
|
|
402
420
|
}}
|
403
421
|
tabIndex={-1}
|
404
422
|
variant="outline"
|
405
|
-
placeholder={locale.inputPlaceholder}
|
406
423
|
value={searchTerm}
|
407
424
|
onChange={(e) => {
|
408
425
|
setSearchTerm(e.target.value);
|
409
426
|
}}
|
427
|
+
disabled={isAllChainsQueryLoading}
|
428
|
+
placeholder={
|
429
|
+
isAllChainsQueryLoading
|
430
|
+
? "Loading chains..."
|
431
|
+
: locale.inputPlaceholder
|
432
|
+
}
|
410
433
|
/>
|
411
434
|
{/* Searching Spinner */}
|
412
|
-
{deferredSearchTerm !== searchTerm && (
|
435
|
+
{(deferredSearchTerm !== searchTerm || isAllChainsQueryLoading) && (
|
413
436
|
<div
|
414
437
|
style={{
|
415
438
|
position: "absolute",
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.34.0-nightly-
|
1
|
+
export const version = "5.34.0-nightly-3f0291def5ac8b5006a75e8c1212d4f287647d05-20240709000342";
|
@@ -110,9 +110,11 @@ export async function connectSmartWallet(
|
|
110
110
|
});
|
111
111
|
|
112
112
|
// TODO: listen for chainChanged event on the personal wallet and emit the disconnect event on the smart wallet
|
113
|
-
const accountAddress = await predictAddress(
|
114
|
-
|
115
|
-
|
113
|
+
const accountAddress = await predictAddress({
|
114
|
+
factoryContract,
|
115
|
+
adminAddress: personalAccount.address,
|
116
|
+
predictAddressOverride: options.overrides?.predictAddress,
|
117
|
+
accountSalt: options.overrides?.accountSalt,
|
116
118
|
})
|
117
119
|
.then((address) => address)
|
118
120
|
.catch((err) => {
|
@@ -168,8 +170,8 @@ async function createSmartAccount(
|
|
168
170
|
async sendTransaction(transaction: SendTransactionOption) {
|
169
171
|
const executeTx = prepareExecute({
|
170
172
|
accountContract,
|
171
|
-
options,
|
172
173
|
transaction,
|
174
|
+
executeOverride: options.overrides?.execute,
|
173
175
|
});
|
174
176
|
return _sendUserOp({
|
175
177
|
executeTx,
|
@@ -179,8 +181,8 @@ async function createSmartAccount(
|
|
179
181
|
async sendBatchTransaction(transactions: SendTransactionOption[]) {
|
180
182
|
const executeTx = prepareBatchExecute({
|
181
183
|
accountContract,
|
182
|
-
options,
|
183
184
|
transactions,
|
185
|
+
executeBatchOverride: options.overrides?.executeBatch,
|
184
186
|
});
|
185
187
|
return _sendUserOp({
|
186
188
|
executeTx,
|
@@ -387,8 +389,9 @@ function createZkSyncAccount(args: {
|
|
387
389
|
const pmData = await getZkPaymasterData({
|
388
390
|
options: {
|
389
391
|
client: connectionOptions.client,
|
390
|
-
overrides: creationOptions.overrides,
|
391
392
|
chain,
|
393
|
+
bundlerUrl: creationOptions.overrides?.bundlerUrl,
|
394
|
+
entrypointAddress: creationOptions.overrides?.entrypointAddress,
|
392
395
|
},
|
393
396
|
transaction: serializableTransaction,
|
394
397
|
});
|
@@ -409,8 +412,9 @@ function createZkSyncAccount(args: {
|
|
409
412
|
const txHash = await broadcastZkTransaction({
|
410
413
|
options: {
|
411
414
|
client: connectionOptions.client,
|
412
|
-
overrides: creationOptions.overrides,
|
413
415
|
chain,
|
416
|
+
bundlerUrl: creationOptions.overrides?.bundlerUrl,
|
417
|
+
entrypointAddress: creationOptions.overrides?.entrypointAddress,
|
414
418
|
},
|
415
419
|
transaction: serializableTransaction,
|
416
420
|
signedTransaction,
|
@@ -471,10 +475,16 @@ async function _sendUserOp(args: {
|
|
471
475
|
const { executeTx, options } = args;
|
472
476
|
const unsignedUserOp = await createUnsignedUserOp({
|
473
477
|
transaction: executeTx,
|
474
|
-
options,
|
478
|
+
factoryContract: options.factoryContract,
|
479
|
+
accountContract: options.accountContract,
|
480
|
+
adminAddress: options.personalAccount.address,
|
481
|
+
sponsorGas: options.sponsorGas,
|
482
|
+
overrides: options.overrides,
|
475
483
|
});
|
476
484
|
const signedUserOp = await signUserOp({
|
477
|
-
options,
|
485
|
+
chain: options.chain,
|
486
|
+
adminAccount: options.personalAccount,
|
487
|
+
entrypointAddress: options.overrides?.entrypointAddress,
|
478
488
|
userOp: unsignedUserOp,
|
479
489
|
});
|
480
490
|
const userOpHash = await bundleUserOp({
|
@@ -21,7 +21,19 @@ import {
|
|
21
21
|
import { hexlifyUserOp } from "./utils.js";
|
22
22
|
|
23
23
|
/**
|
24
|
-
*
|
24
|
+
* Bundle a user operation.
|
25
|
+
* @param args - The options for bundling a user operation.
|
26
|
+
* @returns The bundle hash of the user operation.
|
27
|
+
* @example
|
28
|
+
* ```ts
|
29
|
+
* import { bundleUserOp } from "thirdweb/wallets/smart";
|
30
|
+
*
|
31
|
+
* const userOpHash = await bundleUserOp({
|
32
|
+
* userOp,
|
33
|
+
* options,
|
34
|
+
* });
|
35
|
+
* ```
|
36
|
+
* @walletUtils
|
25
37
|
*/
|
26
38
|
export async function bundleUserOp(args: {
|
27
39
|
userOp: UserOperation;
|
@@ -32,13 +44,25 @@ export async function bundleUserOp(args: {
|
|
32
44
|
operation: "eth_sendUserOperation",
|
33
45
|
params: [
|
34
46
|
hexlifyUserOp(args.userOp),
|
35
|
-
args.options.
|
47
|
+
args.options.entrypointAddress ?? ENTRYPOINT_ADDRESS_v0_6,
|
36
48
|
],
|
37
49
|
});
|
38
50
|
}
|
39
51
|
|
40
52
|
/**
|
41
|
-
*
|
53
|
+
* Estimate the gas cost of a user operation.
|
54
|
+
* @param args - The options for estimating the gas cost of a user operation.
|
55
|
+
* @returns The estimated gas cost of the user operation.
|
56
|
+
* @example
|
57
|
+
* ```ts
|
58
|
+
* import { estimateUserOpGas } from "thirdweb/wallets/smart";
|
59
|
+
*
|
60
|
+
* const gasCost = await estimateUserOpGas({
|
61
|
+
* userOp,
|
62
|
+
* options,
|
63
|
+
* });
|
64
|
+
* ```
|
65
|
+
* @walletUtils
|
42
66
|
*/
|
43
67
|
export async function estimateUserOpGas(args: {
|
44
68
|
userOp: UserOperation;
|
@@ -49,7 +73,7 @@ export async function estimateUserOpGas(args: {
|
|
49
73
|
operation: "eth_estimateUserOperationGas",
|
50
74
|
params: [
|
51
75
|
hexlifyUserOp(args.userOp),
|
52
|
-
args.options.
|
76
|
+
args.options.entrypointAddress ?? ENTRYPOINT_ADDRESS_v0_6,
|
53
77
|
],
|
54
78
|
});
|
55
79
|
|
@@ -63,9 +87,20 @@ export async function estimateUserOpGas(args: {
|
|
63
87
|
}
|
64
88
|
|
65
89
|
/**
|
66
|
-
*
|
90
|
+
* Get the gas fees of a user operation.
|
91
|
+
* @param args - The options for getting the gas price of a user operation.
|
92
|
+
* @returns The gas price of the user operation.
|
93
|
+
* @example
|
94
|
+
* ```ts
|
95
|
+
* import { getUserOpGasPrice } from "thirdweb/wallets/smart";
|
96
|
+
*
|
97
|
+
* const fees = await getUserOpGasPrice({
|
98
|
+
* options,
|
99
|
+
* });
|
100
|
+
* ```
|
101
|
+
* @walletUtils
|
67
102
|
*/
|
68
|
-
export async function
|
103
|
+
export async function getUserOpGasFees(args: {
|
69
104
|
options: BundlerOptions;
|
70
105
|
}): Promise<GasPriceResult> {
|
71
106
|
const res = await sendBundlerRequest({
|
@@ -81,7 +116,20 @@ export async function getUserOpGasPrice(args: {
|
|
81
116
|
}
|
82
117
|
|
83
118
|
/**
|
84
|
-
*
|
119
|
+
* Get the receipt of a user operation.
|
120
|
+
* @param args - The options for getting the receipt of a user operation.
|
121
|
+
* @returns The receipt of the user operation.
|
122
|
+
* @example
|
123
|
+
* ```ts
|
124
|
+
* import { getUserOpReceipt } from "thirdweb/wallets/smart";
|
125
|
+
*
|
126
|
+
* const receipt = await getUserOpReceipt({
|
127
|
+
* client,
|
128
|
+
* chain,
|
129
|
+
* userOpHash,
|
130
|
+
* });
|
131
|
+
* ```
|
132
|
+
* @walletUtils
|
85
133
|
*/
|
86
134
|
export async function getUserOpReceipt(
|
87
135
|
args: BundlerOptions & {
|
@@ -176,8 +224,7 @@ async function sendBundlerRequest(args: {
|
|
176
224
|
console.debug(`>>> sending ${operation} with payload:`, params);
|
177
225
|
}
|
178
226
|
|
179
|
-
const bundlerUrl =
|
180
|
-
options.overrides?.bundlerUrl ?? getDefaultBundlerUrl(options.chain);
|
227
|
+
const bundlerUrl = options.bundlerUrl ?? getDefaultBundlerUrl(options.chain);
|
181
228
|
const fetchWithHeaders = getClientFetch(options.client);
|
182
229
|
const response = await fetchWithHeaders(bundlerUrl, {
|
183
230
|
method: "POST",
|