thirdweb 5.32.0 → 5.32.1
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/chains/utils.js +9 -7
- package/dist/cjs/chains/utils.js.map +1 -1
- package/dist/cjs/exports/react.js +3 -0
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/exports/wallets/smart.js +3 -1
- package/dist/cjs/exports/wallets/smart.js.map +1 -1
- package/dist/cjs/react/core/hooks/others/useChainQuery.js +104 -33
- package/dist/cjs/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/cjs/react/native/ui/components/ChainIcon.js +2 -3
- package/dist/cjs/react/native/ui/components/ChainIcon.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js +2 -2
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/SendScreen.js +2 -2
- package/dist/cjs/react/native/ui/connect/SendScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +6 -5
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js +217 -188
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +2 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +12 -10
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js +8 -6
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js +3 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/components/ChainIcon.js +1 -1
- package/dist/cjs/react/web/ui/components/ChainIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/components/ChainName.js +3 -5
- package/dist/cjs/react/web/ui/components/ChainName.js.map +1 -1
- package/dist/cjs/react/web/ui/components/TokenIcon.js +3 -3
- package/dist/cjs/react/web/ui/components/TokenIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/components/token/TokenSymbol.js +3 -3
- package/dist/cjs/react/web/ui/components/token/TokenSymbol.js.map +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletFormUI.js +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletFormUI.js.map +1 -1
- package/dist/cjs/utils/extensions/drops/get-claim-params.js +3 -2
- package/dist/cjs/utils/extensions/drops/get-claim-params.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/web/ecosystem.js +3 -14
- package/dist/cjs/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/cjs/wallets/smart/index.js +3 -17
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/userop.js +63 -8
- package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
- package/dist/esm/chains/utils.js +9 -7
- package/dist/esm/chains/utils.js.map +1 -1
- package/dist/esm/exports/react.js +1 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/wallets/smart.js +1 -0
- package/dist/esm/exports/wallets/smart.js.map +1 -1
- package/dist/esm/react/core/hooks/others/useChainQuery.js +101 -33
- package/dist/esm/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/esm/react/native/ui/components/ChainIcon.js +3 -4
- package/dist/esm/react/native/ui/components/ChainIcon.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js +3 -3
- package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/SendScreen.js +3 -3
- package/dist/esm/react/native/ui/connect/SendScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +7 -6
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js +219 -191
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +3 -5
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +13 -11
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js +9 -7
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js +4 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
- package/dist/esm/react/web/ui/components/ChainIcon.js +1 -1
- package/dist/esm/react/web/ui/components/ChainIcon.js.map +1 -1
- package/dist/esm/react/web/ui/components/ChainName.js +4 -6
- package/dist/esm/react/web/ui/components/ChainName.js.map +1 -1
- package/dist/esm/react/web/ui/components/TokenIcon.js +4 -4
- package/dist/esm/react/web/ui/components/TokenIcon.js.map +1 -1
- package/dist/esm/react/web/ui/components/token/TokenSymbol.js +4 -4
- package/dist/esm/react/web/ui/components/token/TokenSymbol.js.map +1 -1
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletFormUI.js +2 -2
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletFormUI.js.map +1 -1
- package/dist/esm/utils/extensions/drops/get-claim-params.js +3 -2
- package/dist/esm/utils/extensions/drops/get-claim-params.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/web/ecosystem.js +3 -14
- package/dist/esm/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/esm/wallets/smart/index.js +4 -18
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/esm/wallets/smart/lib/userop.js +63 -9
- package/dist/esm/wallets/smart/lib/userop.js.map +1 -1
- package/dist/types/chains/chain-definitions/anvil.d.ts +1 -0
- package/dist/types/chains/chain-definitions/anvil.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/arbitrum-nova.d.ts +1 -0
- package/dist/types/chains/chain-definitions/arbitrum-nova.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/arbitrum-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/arbitrum-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/arbitrum.d.ts +1 -0
- package/dist/types/chains/chain-definitions/arbitrum.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/avalanche-fuji.d.ts +1 -0
- package/dist/types/chains/chain-definitions/avalanche-fuji.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/avalanche.d.ts +1 -0
- package/dist/types/chains/chain-definitions/avalanche.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/base-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/base-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/base.d.ts +1 -0
- package/dist/types/chains/chain-definitions/base.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/bsc-testnet.d.ts +1 -0
- package/dist/types/chains/chain-definitions/bsc-testnet.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/bsc.d.ts +1 -0
- package/dist/types/chains/chain-definitions/bsc.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/ethereum.d.ts +2 -0
- package/dist/types/chains/chain-definitions/ethereum.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/hardhat.d.ts +1 -0
- package/dist/types/chains/chain-definitions/hardhat.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/linea-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/linea-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/linea.d.ts +1 -0
- package/dist/types/chains/chain-definitions/linea.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/optimism-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/optimism-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/optimism.d.ts +1 -0
- package/dist/types/chains/chain-definitions/optimism.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/polygon-amoy.d.ts +1 -0
- package/dist/types/chains/chain-definitions/polygon-amoy.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/polygon-mumbai.d.ts +2 -0
- package/dist/types/chains/chain-definitions/polygon-mumbai.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/polygon.d.ts +1 -0
- package/dist/types/chains/chain-definitions/polygon.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/zksync-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/zksync-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/zksync.d.ts +1 -0
- package/dist/types/chains/chain-definitions/zksync.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/zora-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/zora-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/zora.d.ts +1 -0
- package/dist/types/chains/chain-definitions/zora.d.ts.map +1 -1
- package/dist/types/chains/types.d.ts +1 -0
- package/dist/types/chains/types.d.ts.map +1 -1
- package/dist/types/chains/utils.d.ts +1 -0
- package/dist/types/chains/utils.d.ts.map +1 -1
- package/dist/types/exports/react.d.ts +1 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/wallets/smart.d.ts +1 -0
- package/dist/types/exports/wallets/smart.d.ts.map +1 -1
- package/dist/types/react/core/connectionManager.d.ts +1 -0
- package/dist/types/react/core/connectionManager.d.ts.map +1 -1
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts +24 -10
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts.map +1 -1
- package/dist/types/react/core/hooks/wallets/useActiveWalletChain.d.ts +1 -0
- package/dist/types/react/core/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
- package/dist/types/react/native/hooks/wallets/useActiveWalletChain.d.ts +1 -0
- package/dist/types/react/native/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
- package/dist/types/react/native/index.d.ts +1 -0
- package/dist/types/react/native/index.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/ChainIcon.d.ts.map +1 -1
- package/dist/types/react/web/hooks/wallets/useActiveWalletChain.d.ts +1 -0
- package/dist/types/react/web/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
- package/dist/types/react/web/index.d.ts +1 -0
- package/dist/types/react/web/index.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/NetworkSelector.d.ts +142 -0
- package/dist/types/react/web/ui/ConnectWallet/NetworkSelector.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +4 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/TokenSelector.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/ChainIcon.d.ts +1 -2
- package/dist/types/react/web/ui/components/ChainIcon.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/ChainName.d.ts.map +1 -1
- package/dist/types/react/web/wallets/ecosystem/EcosystemWalletFormUI.d.ts.map +1 -1
- package/dist/types/utils/extensions/drops/get-claim-params.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/web/ecosystem.d.ts +3 -14
- package/dist/types/wallets/in-app/web/ecosystem.d.ts.map +1 -1
- package/dist/types/wallets/manager/index.d.ts +1 -0
- package/dist/types/wallets/manager/index.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 +1 -2
- package/dist/types/wallets/smart/lib/bundler.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/userop.d.ts +53 -8
- package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/chains/types.ts +1 -1
- package/src/chains/utils.ts +9 -7
- package/src/exports/react.ts +5 -0
- package/src/exports/wallets/smart.ts +2 -0
- package/src/extensions/erc1155/drop1155.test.ts +7 -0
- package/src/extensions/erc20/drop20.test.ts +55 -0
- package/src/extensions/erc721/drop721.test.ts +28 -0
- package/src/react/core/hooks/others/useChainQuery.ts +116 -35
- package/src/react/native/ui/components/ChainIcon.tsx +3 -4
- package/src/react/native/ui/connect/ConnectedModal.tsx +4 -4
- package/src/react/native/ui/connect/SendScreen.tsx +3 -3
- package/src/react/web/ui/ConnectWallet/Details.tsx +13 -12
- package/src/react/web/ui/ConnectWallet/NetworkSelector.tsx +421 -323
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +4 -10
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +17 -15
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +6 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.tsx +4 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +4 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +4 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.tsx +3 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.tsx +14 -9
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.tsx +3 -4
- package/src/react/web/ui/ConnectWallet/screens/TokenSelector.tsx +10 -6
- package/src/react/web/ui/components/ChainIcon.tsx +2 -3
- package/src/react/web/ui/components/ChainName.tsx +4 -6
- package/src/react/web/ui/components/TokenIcon.tsx +4 -4
- package/src/react/web/ui/components/token/TokenSymbol.tsx +4 -4
- package/src/react/web/wallets/ecosystem/EcosystemWalletFormUI.tsx +6 -10
- package/src/utils/extensions/drops/get-claim-params.ts +4 -2
- package/src/version.ts +1 -1
- package/src/wallets/in-app/web/ecosystem.ts +3 -14
- package/src/wallets/smart/index.ts +7 -24
- package/src/wallets/smart/lib/bundler.ts +6 -5
- package/src/wallets/smart/lib/userop.ts +81 -11
@@ -1,21 +1,66 @@
|
|
1
1
|
import type { PreparedTransaction } from "../../../transaction/prepare-transaction.js";
|
2
|
-
import type {
|
2
|
+
import type { TransactionReceipt } from "../../../transaction/types.js";
|
3
|
+
import type { Hex } from "../../../utils/encoding/hex.js";
|
4
|
+
import type { BundlerOptions, SmartAccountOptions, UserOperation } from "../types.js";
|
3
5
|
/**
|
4
|
-
*
|
5
|
-
* @
|
6
|
+
* Wait for the user operation to be mined.
|
7
|
+
* @param args - The options and user operation hash
|
8
|
+
* @returns - The transaction receipt
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* ```ts
|
12
|
+
* import { waitForUserOpReceipt } from "thirdweb/wallets/smart";
|
13
|
+
*
|
14
|
+
* const receipt = await waitForUserOpReceipt({
|
15
|
+
* chain,
|
16
|
+
* client,
|
17
|
+
* userOpHash,
|
18
|
+
* });
|
19
|
+
* ```
|
20
|
+
* @walletUtils
|
6
21
|
*/
|
22
|
+
export declare function waitForUserOpReceipt(args: BundlerOptions & {
|
23
|
+
userOpHash: Hex;
|
24
|
+
timeoutMs?: number;
|
25
|
+
intervalMs?: number;
|
26
|
+
}): Promise<TransactionReceipt>;
|
7
27
|
/**
|
8
|
-
* Creates an unsigned user operation.
|
9
|
-
* @
|
28
|
+
* Creates an unsigned user operation from a prepared transaction.
|
29
|
+
* @param args - The prepared transaction and options
|
30
|
+
* @returns - The unsigned user operation
|
31
|
+
* @example
|
32
|
+
* ```ts
|
33
|
+
* import { createUnsignedUserOp } from "thirdweb/wallets/smart";
|
34
|
+
*
|
35
|
+
* const transaction = prepareContractCall(...);
|
36
|
+
*
|
37
|
+
* const userOp = await createUnsignedUserOp({
|
38
|
+
* transaction,
|
39
|
+
* options,
|
40
|
+
* });
|
41
|
+
* ```
|
42
|
+
* @walletUtils
|
10
43
|
*/
|
11
44
|
export declare function createUnsignedUserOp(args: {
|
12
|
-
|
45
|
+
transaction: PreparedTransaction;
|
13
46
|
options: SmartAccountOptions;
|
14
47
|
}): Promise<UserOperation>;
|
15
48
|
/**
|
16
|
-
* Sign
|
49
|
+
* Sign a user operation.
|
17
50
|
* @param userOp - The UserOperation to sign (with signature field ignored)
|
18
|
-
* @
|
51
|
+
* @returns - The user operation with the signature field populated
|
52
|
+
* @example
|
53
|
+
* ```ts
|
54
|
+
* import { signUserOp } from "thirdweb/wallets/smart";
|
55
|
+
*
|
56
|
+
* const userOp = createUnsignedUserOp(...);
|
57
|
+
*
|
58
|
+
* const signedUserOp = await signUserOp({
|
59
|
+
* userOp,
|
60
|
+
* options,
|
61
|
+
* });
|
62
|
+
* ```
|
63
|
+
* @walletUtils
|
19
64
|
*/
|
20
65
|
export declare function signUserOp(args: {
|
21
66
|
userOp: UserOperation;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;
|
1
|
+
{"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AAGA,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,EACV,cAAc,EACd,mBAAmB,EACnB,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;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,WAAW,EAAE,mBAAmB,CAAC;IACjC,OAAO,EAAE,mBAAmB,CAAC;CAC9B,GAAG,OAAO,CAAC,aAAa,CAAC,CAkHzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,mBAAmB,CAAC;CAC9B,GAAG,OAAO,CAAC,aAAa,CAAC,CAmBzB"}
|
package/package.json
CHANGED
package/src/chains/types.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { Prettify } from "../utils/type-utils.js";
|
2
|
-
|
3
2
|
export type Chain = Prettify<Readonly<ChainOptions & { rpc: string }>>;
|
4
3
|
|
5
4
|
export type ChainOptions = {
|
@@ -21,6 +20,7 @@ export type ChainOptions = {
|
|
21
20
|
experimental?: {
|
22
21
|
increaseZeroByteCount?: boolean;
|
23
22
|
};
|
23
|
+
faucets?: Array<string>;
|
24
24
|
};
|
25
25
|
|
26
26
|
type Icon = {
|
package/src/chains/utils.ts
CHANGED
@@ -81,7 +81,7 @@ function isLegacyChain(
|
|
81
81
|
}
|
82
82
|
|
83
83
|
function convertLegacyChain(legacyChain: LegacyChain): Chain {
|
84
|
-
|
84
|
+
return {
|
85
85
|
id: legacyChain.chainId,
|
86
86
|
name: legacyChain.name,
|
87
87
|
rpc:
|
@@ -96,11 +96,10 @@ function convertLegacyChain(legacyChain: LegacyChain): Chain {
|
|
96
96
|
symbol: legacyChain.nativeCurrency.symbol,
|
97
97
|
decimals: legacyChain.nativeCurrency.decimals,
|
98
98
|
},
|
99
|
+
faucets: legacyChain.faucets ? [...legacyChain.faucets] : undefined,
|
100
|
+
icon: legacyChain.icon,
|
101
|
+
testnet: legacyChain.testnet ? true : undefined,
|
99
102
|
};
|
100
|
-
if (legacyChain.testnet) {
|
101
|
-
return { ...c, testnet: true };
|
102
|
-
}
|
103
|
-
return c;
|
104
103
|
}
|
105
104
|
|
106
105
|
function isViemChain(
|
@@ -110,7 +109,7 @@ function isViemChain(
|
|
110
109
|
}
|
111
110
|
|
112
111
|
function convertViemChain(viemChain: ViemChain): Chain {
|
113
|
-
return
|
112
|
+
return {
|
114
113
|
id: viemChain.id,
|
115
114
|
name: viemChain.name,
|
116
115
|
nativeCurrency: {
|
@@ -130,7 +129,8 @@ function convertViemChain(viemChain: ViemChain): Chain {
|
|
130
129
|
};
|
131
130
|
})
|
132
131
|
: [],
|
133
|
-
|
132
|
+
testnet: viemChain.testnet ? true : undefined,
|
133
|
+
};
|
134
134
|
}
|
135
135
|
|
136
136
|
type GetRpcUrlForChainOptions = {
|
@@ -310,6 +310,8 @@ export function convertApiChainToChain(apiChain: ChainMetadata): Chain {
|
|
310
310
|
apiUrl: explorer.url,
|
311
311
|
};
|
312
312
|
}),
|
313
|
+
faucets: apiChain.faucets ? [...apiChain.faucets] : undefined,
|
314
|
+
icon: apiChain.icon,
|
313
315
|
};
|
314
316
|
}
|
315
317
|
|
package/src/exports/react.ts
CHANGED
@@ -135,3 +135,8 @@ export {
|
|
135
135
|
useWalletDetailsModal,
|
136
136
|
type UseWalletDetailsModalOptions,
|
137
137
|
} from "../react/web/ui/ConnectWallet/Details.js";
|
138
|
+
|
139
|
+
export {
|
140
|
+
useNetworkSwitcherModal,
|
141
|
+
type UseNetworkSwitcherModalOptions,
|
142
|
+
} from "../react/web/ui/ConnectWallet/NetworkSelector.js";
|
@@ -8,6 +8,8 @@ import {
|
|
8
8
|
} from "../../../test/src/test-wallets.js";
|
9
9
|
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
10
10
|
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
|
11
|
+
import { resolvePromisedValue } from "../../utils/promise/resolve-promised-value.js";
|
12
|
+
import { toEther } from "../../utils/units.js";
|
11
13
|
import { getContractMetadata } from "../common/read/getContractMetadata.js";
|
12
14
|
import { deployERC1155Contract } from "../prebuilts/deploy-erc1155.js";
|
13
15
|
import { balanceOf } from "./__generated__/IERC1155/read/balanceOf.js";
|
@@ -135,6 +137,11 @@ describe.runIf(process.env.TW_SECRET_KEY)(
|
|
135
137
|
tokenId: 0n,
|
136
138
|
quantity: 1n,
|
137
139
|
});
|
140
|
+
// assert value is set correctly
|
141
|
+
const value = await resolvePromisedValue(claimTx.value);
|
142
|
+
expect(value).toBeDefined();
|
143
|
+
if (!value) throw new Error("value is undefined");
|
144
|
+
expect(toEther(value)).toBe("0.001");
|
138
145
|
await sendAndConfirmTransaction({
|
139
146
|
transaction: claimTx,
|
140
147
|
account: TEST_ACCOUNT_A,
|
@@ -5,9 +5,12 @@ import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
|
5
5
|
import {
|
6
6
|
TEST_ACCOUNT_A,
|
7
7
|
TEST_ACCOUNT_B,
|
8
|
+
TEST_ACCOUNT_C,
|
8
9
|
} from "../../../test/src/test-wallets.js";
|
9
10
|
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
10
11
|
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
|
12
|
+
import { resolvePromisedValue } from "../../utils/promise/resolve-promised-value.js";
|
13
|
+
import { toEther } from "../../utils/units.js";
|
11
14
|
import { getContractMetadata } from "../common/read/getContractMetadata.js";
|
12
15
|
import { deployERC20Contract } from "../prebuilts/deploy-erc20.js";
|
13
16
|
import { claimTo } from "./drops/write/claimTo.js";
|
@@ -92,6 +95,58 @@ describe.runIf(process.env.TW_SECRET_KEY)(
|
|
92
95
|
`);
|
93
96
|
});
|
94
97
|
|
98
|
+
it("should allow to claim tokens with value", async () => {
|
99
|
+
await expect(
|
100
|
+
getBalance({ contract, address: TEST_ACCOUNT_C.address }),
|
101
|
+
).resolves.toMatchInlineSnapshot(`
|
102
|
+
{
|
103
|
+
"decimals": 18,
|
104
|
+
"displayValue": "0",
|
105
|
+
"name": "Test DropERC20",
|
106
|
+
"symbol": "",
|
107
|
+
"value": 0n,
|
108
|
+
}
|
109
|
+
`);
|
110
|
+
// set cc with price
|
111
|
+
await sendAndConfirmTransaction({
|
112
|
+
transaction: setClaimConditions({
|
113
|
+
contract,
|
114
|
+
phases: [
|
115
|
+
{
|
116
|
+
price: "0.01",
|
117
|
+
},
|
118
|
+
],
|
119
|
+
}),
|
120
|
+
account: TEST_ACCOUNT_A,
|
121
|
+
});
|
122
|
+
const claimTx = claimTo({
|
123
|
+
contract,
|
124
|
+
to: TEST_ACCOUNT_C.address,
|
125
|
+
quantity: "2",
|
126
|
+
});
|
127
|
+
// assert value is set correctly
|
128
|
+
const value = await resolvePromisedValue(claimTx.value);
|
129
|
+
expect(value).toBeDefined();
|
130
|
+
if (!value) throw new Error("value is undefined");
|
131
|
+
expect(toEther(value)).toBe("0.02");
|
132
|
+
// claim
|
133
|
+
await sendAndConfirmTransaction({
|
134
|
+
transaction: claimTx,
|
135
|
+
account: TEST_ACCOUNT_C,
|
136
|
+
});
|
137
|
+
await expect(
|
138
|
+
getBalance({ contract, address: TEST_ACCOUNT_C.address }),
|
139
|
+
).resolves.toMatchInlineSnapshot(`
|
140
|
+
{
|
141
|
+
"decimals": 18,
|
142
|
+
"displayValue": "2",
|
143
|
+
"name": "Test DropERC20",
|
144
|
+
"symbol": "",
|
145
|
+
"value": 2000000000000000000n,
|
146
|
+
}
|
147
|
+
`);
|
148
|
+
});
|
149
|
+
|
95
150
|
describe("Allowlists", () => {
|
96
151
|
it("should allow to claim tokens with an allowlist", async () => {
|
97
152
|
await sendAndConfirmTransaction({
|
@@ -5,9 +5,12 @@ import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
|
5
5
|
import {
|
6
6
|
TEST_ACCOUNT_A,
|
7
7
|
TEST_ACCOUNT_B,
|
8
|
+
TEST_ACCOUNT_C,
|
8
9
|
} from "../../../test/src/test-wallets.js";
|
9
10
|
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
10
11
|
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
|
12
|
+
import { resolvePromisedValue } from "../../utils/promise/resolve-promised-value.js";
|
13
|
+
import { toEther } from "../../utils/units.js";
|
11
14
|
import { getContractMetadata } from "../common/read/getContractMetadata.js";
|
12
15
|
import { deployERC721Contract } from "../prebuilts/deploy-erc721.js";
|
13
16
|
import { balanceOf } from "./__generated__/IERC721A/read/balanceOf.js";
|
@@ -110,6 +113,31 @@ describe.runIf(process.env.TW_SECRET_KEY)(
|
|
110
113
|
).resolves.toBe(1n);
|
111
114
|
});
|
112
115
|
|
116
|
+
it("should allow to claim tokens with value", async () => {
|
117
|
+
// set cc with price
|
118
|
+
await sendAndConfirmTransaction({
|
119
|
+
transaction: setClaimConditions({
|
120
|
+
contract,
|
121
|
+
phases: [
|
122
|
+
{
|
123
|
+
price: "0.01",
|
124
|
+
},
|
125
|
+
],
|
126
|
+
}),
|
127
|
+
account: TEST_ACCOUNT_A,
|
128
|
+
});
|
129
|
+
const claimTx = claimTo({
|
130
|
+
contract,
|
131
|
+
to: TEST_ACCOUNT_C.address,
|
132
|
+
quantity: 2n,
|
133
|
+
});
|
134
|
+
// assert value is set correctly
|
135
|
+
const value = await resolvePromisedValue(claimTx.value);
|
136
|
+
expect(value).toBeDefined();
|
137
|
+
if (!value) throw new Error("value is undefined");
|
138
|
+
expect(toEther(value)).toBe("0.02");
|
139
|
+
});
|
140
|
+
|
113
141
|
describe("Allowlists", () => {
|
114
142
|
it("should allow to claim tokens with an allowlist", async () => {
|
115
143
|
await sendAndConfirmTransaction({
|
@@ -1,49 +1,130 @@
|
|
1
|
-
import {
|
2
|
-
import { useMemo } from "react";
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
3
2
|
import type { Chain } from "../../../../chains/types.js";
|
4
|
-
import {
|
5
|
-
|
3
|
+
import {
|
4
|
+
convertApiChainToChain,
|
5
|
+
getChainMetadata,
|
6
|
+
} from "../../../../chains/utils.js";
|
7
|
+
|
8
|
+
export function useChainName(chain?: Chain) {
|
9
|
+
// only if we have a chain and no chain name!
|
10
|
+
const isEnabled = !!chain && !chain.name;
|
11
|
+
const chainQuery = useQuery({
|
12
|
+
queryKey: ["chain", chain?.id],
|
13
|
+
enabled: isEnabled,
|
14
|
+
retry: false,
|
15
|
+
// 1 hour
|
16
|
+
staleTime: 60 * 60 * 1000,
|
17
|
+
queryFn: async () => {
|
18
|
+
if (!chain) {
|
19
|
+
throw new Error("chain is required");
|
20
|
+
}
|
21
|
+
return convertApiChainToChain(await getChainMetadata(chain));
|
22
|
+
},
|
23
|
+
});
|
24
|
+
|
25
|
+
return {
|
26
|
+
name: chain?.name ?? chainQuery.data?.name,
|
27
|
+
isLoading: isEnabled && chainQuery.isLoading,
|
28
|
+
};
|
29
|
+
}
|
30
|
+
|
31
|
+
export function useChainIconUrl(chain?: Chain) {
|
32
|
+
// only if we have a chain and no chain icon url!
|
33
|
+
const isEnabled = !!chain && !chain.icon?.url;
|
34
|
+
const chainQuery = useQuery({
|
35
|
+
queryKey: ["chain", chain?.id],
|
36
|
+
// only if we have a chain and no chain icon url!
|
37
|
+
enabled: isEnabled,
|
38
|
+
retry: false,
|
39
|
+
// 1 hour
|
40
|
+
staleTime: 60 * 60 * 1000,
|
41
|
+
queryFn: async () => {
|
42
|
+
if (!chain) {
|
43
|
+
throw new Error("chain is required");
|
44
|
+
}
|
45
|
+
return convertApiChainToChain(await getChainMetadata(chain));
|
46
|
+
},
|
47
|
+
});
|
48
|
+
|
49
|
+
return {
|
50
|
+
url: chain?.icon?.url ?? chainQuery.data?.icon?.url,
|
51
|
+
isLoading: isEnabled && chainQuery.isLoading,
|
52
|
+
};
|
53
|
+
}
|
54
|
+
|
55
|
+
export function useChainFaucets(chain?: Chain) {
|
56
|
+
// only if we have a chain and it might be a testnet and no faucets and its not localhost
|
57
|
+
const isEnabled =
|
58
|
+
!!chain &&
|
59
|
+
"testnet" in chain &&
|
60
|
+
!chain.faucets?.length &&
|
61
|
+
chain.id !== 1337;
|
62
|
+
|
63
|
+
const chainQuery = useQuery({
|
64
|
+
queryKey: ["chain", chain?.id],
|
65
|
+
enabled: isEnabled,
|
66
|
+
retry: false,
|
67
|
+
// 1 hour
|
68
|
+
staleTime: 60 * 60 * 1000,
|
69
|
+
queryFn: async () => {
|
70
|
+
if (!chain) {
|
71
|
+
throw new Error("chain is required");
|
72
|
+
}
|
73
|
+
return convertApiChainToChain(await getChainMetadata(chain));
|
74
|
+
},
|
75
|
+
});
|
6
76
|
|
7
|
-
function getQueryOptions(chain?: Chain) {
|
8
77
|
return {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
} as const;
|
78
|
+
faucets: chain?.faucets ?? chainQuery.data?.faucets ?? [],
|
79
|
+
isLoading: isEnabled && chainQuery.isLoading,
|
80
|
+
};
|
13
81
|
}
|
14
82
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
83
|
+
export function useChainSymbol(chain?: Chain) {
|
84
|
+
// only if we have a chain and no chain icon url!
|
85
|
+
const isEnabled = !!chain && !chain.nativeCurrency?.symbol;
|
86
|
+
const chainQuery = useQuery({
|
87
|
+
queryKey: ["chain", chain?.id],
|
88
|
+
// only if we have a chain and no chain icon url!
|
89
|
+
enabled: isEnabled,
|
90
|
+
retry: false,
|
91
|
+
// 1 hour
|
92
|
+
staleTime: 60 * 60 * 1000,
|
21
93
|
queryFn: async () => {
|
22
94
|
if (!chain) {
|
23
|
-
throw new Error("
|
95
|
+
throw new Error("chain is required");
|
24
96
|
}
|
25
|
-
return getChainMetadata(chain);
|
97
|
+
return convertApiChainToChain(await getChainMetadata(chain));
|
26
98
|
},
|
27
99
|
});
|
100
|
+
|
101
|
+
return {
|
102
|
+
symbol:
|
103
|
+
chain?.nativeCurrency?.symbol ?? chainQuery.data?.nativeCurrency?.symbol,
|
104
|
+
isLoading: isEnabled && chainQuery.isLoading,
|
105
|
+
};
|
28
106
|
}
|
29
107
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
return useQueries({
|
47
|
-
queries: queryList,
|
108
|
+
export function useChainExplorers(chain?: Chain) {
|
109
|
+
// only if we have a chain and it might be a testnet and no faucets and its not localhost
|
110
|
+
const isEnabled = !!chain && !chain.blockExplorers?.length;
|
111
|
+
|
112
|
+
const chainQuery = useQuery({
|
113
|
+
queryKey: ["chain", chain?.id],
|
114
|
+
enabled: isEnabled,
|
115
|
+
retry: false,
|
116
|
+
// 1 hour
|
117
|
+
staleTime: 60 * 60 * 1000,
|
118
|
+
queryFn: async () => {
|
119
|
+
if (!chain) {
|
120
|
+
throw new Error("chain is required");
|
121
|
+
}
|
122
|
+
return convertApiChainToChain(await getChainMetadata(chain));
|
123
|
+
},
|
48
124
|
});
|
125
|
+
|
126
|
+
return {
|
127
|
+
explorers: chain?.blockExplorers ?? chainQuery.data?.blockExplorers ?? [],
|
128
|
+
isLoading: isEnabled && chainQuery.isLoading,
|
129
|
+
};
|
49
130
|
}
|
@@ -3,7 +3,7 @@ import type { Chain } from "../../../../chains/types.js";
|
|
3
3
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
4
|
import { resolveScheme } from "../../../../utils/ipfs.js";
|
5
5
|
import type { Theme } from "../../../core/design-system/index.js";
|
6
|
-
import {
|
6
|
+
import { useChainIconUrl } from "../../../core/hooks/others/useChainQuery.js";
|
7
7
|
import { CHAIN_ICON } from "../icons/svgs.js";
|
8
8
|
import { RNImage } from "./RNImage.js";
|
9
9
|
|
@@ -15,9 +15,8 @@ export type ChainIconProps = {
|
|
15
15
|
};
|
16
16
|
|
17
17
|
export const ChainIcon = (props: ChainIconProps) => {
|
18
|
-
const
|
18
|
+
const { url } = useChainIconUrl(props.chain);
|
19
19
|
const data = useMemo(() => {
|
20
|
-
const url = chainQuery?.data?.icon?.url;
|
21
20
|
if (!url) {
|
22
21
|
return CHAIN_ICON;
|
23
22
|
}
|
@@ -29,7 +28,7 @@ export const ChainIcon = (props: ChainIconProps) => {
|
|
29
28
|
} catch {
|
30
29
|
return CHAIN_ICON;
|
31
30
|
}
|
32
|
-
}, [props,
|
31
|
+
}, [props, url]);
|
33
32
|
return (
|
34
33
|
<RNImage
|
35
34
|
theme={props.theme}
|
@@ -6,7 +6,7 @@ import { isContractDeployed } from "../../../../utils/bytecode/is-contract-deplo
|
|
6
6
|
import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
|
7
7
|
import type { Theme } from "../../../core/design-system/index.js";
|
8
8
|
import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
9
|
-
import {
|
9
|
+
import { useChainName } from "../../../core/hooks/others/useChainQuery.js";
|
10
10
|
import { hasSmartAccount } from "../../../core/utils/isSmartWallet.js";
|
11
11
|
import { useConnectedWalletDetails } from "../../../core/utils/wallet.js";
|
12
12
|
import { fontSize, radius, spacing } from "../../design-system/index.js";
|
@@ -252,13 +252,13 @@ const WalletMenu = (props: ConnectedModalPropsInner) => {
|
|
252
252
|
const ChainSwitcher = (props: ConnectedModalPropsInner) => {
|
253
253
|
const { client, wallet, theme } = props;
|
254
254
|
const chain = wallet.getChain();
|
255
|
-
const
|
255
|
+
const { name } = useChainName(chain);
|
256
256
|
return (
|
257
257
|
<TouchableOpacity style={styles.walletMenuRow}>
|
258
258
|
<ChainIcon client={client} size={32} chain={chain} theme={theme} />
|
259
|
-
{
|
259
|
+
{name ? (
|
260
260
|
<ThemedText theme={theme} type="defaultSemiBold">
|
261
|
-
{
|
261
|
+
{name}
|
262
262
|
</ThemedText>
|
263
263
|
) : (
|
264
264
|
<Skeleton theme={theme} style={{ width: 80, height: 16 }} />
|
@@ -2,7 +2,7 @@ import { useState } from "react";
|
|
2
2
|
import { StyleSheet, View } from "react-native";
|
3
3
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
4
|
import type { Theme } from "../../../core/design-system/index.js";
|
5
|
-
import {
|
5
|
+
import { useChainSymbol } from "../../../core/hooks/others/useChainQuery.js";
|
6
6
|
import type {
|
7
7
|
SupportedTokens,
|
8
8
|
TokenInfo,
|
@@ -38,7 +38,7 @@ export const SendScreen = (props: SendScreenProps) => {
|
|
38
38
|
const [selectedToken, setSelectedToken] = useState<TokenInfo>();
|
39
39
|
const account = useActiveAccount();
|
40
40
|
const chain = useActiveWalletChain();
|
41
|
-
const
|
41
|
+
const { symbol } = useChainSymbol(chain);
|
42
42
|
const sendMutation = useSendToken(client);
|
43
43
|
const [screen, setScreen] = useState<
|
44
44
|
"base" | "tokenList" | "success" | "error"
|
@@ -193,7 +193,7 @@ export const SendScreen = (props: SendScreenProps) => {
|
|
193
193
|
type="subtext"
|
194
194
|
style={{ marginRight: spacing.md }}
|
195
195
|
>
|
196
|
-
{selectedToken?.symbol ||
|
196
|
+
{selectedToken?.symbol || symbol}
|
197
197
|
</ThemedText>
|
198
198
|
}
|
199
199
|
/>
|
@@ -34,8 +34,9 @@ import type {
|
|
34
34
|
PayUIOptions,
|
35
35
|
} from "../../../core/hooks/connection/ConnectButtonProps.js";
|
36
36
|
import {
|
37
|
-
|
38
|
-
|
37
|
+
useChainFaucets,
|
38
|
+
useChainIconUrl,
|
39
|
+
useChainName,
|
39
40
|
} from "../../../core/hooks/others/useChainQuery.js";
|
40
41
|
import { SetRootElementContext } from "../../../core/providers/RootElementContext.js";
|
41
42
|
import type { SupportedTokens } from "../../../core/utils/defaultTokens.js";
|
@@ -112,8 +113,6 @@ export const ConnectedWalletDetails: React.FC<{
|
|
112
113
|
const activeAccount = useActiveAccount();
|
113
114
|
const walletChain = useActiveWalletChain();
|
114
115
|
|
115
|
-
useChainsQuery(props.chains, 5);
|
116
|
-
|
117
116
|
const { ensAvatarQuery, addressOrENS, balanceQuery } =
|
118
117
|
useConnectedWalletDetails(
|
119
118
|
client,
|
@@ -256,7 +255,9 @@ function DetailsModal(props: {
|
|
256
255
|
);
|
257
256
|
|
258
257
|
const activeWallet = useActiveWallet();
|
259
|
-
const
|
258
|
+
const chainIconQuery = useChainIconUrl(walletChain);
|
259
|
+
const chainNameQuery = useChainName(walletChain);
|
260
|
+
const chainFaucetsQuery = useChainFaucets(walletChain);
|
260
261
|
|
261
262
|
const disableSwitchChain = !activeWallet?.switchChain;
|
262
263
|
|
@@ -289,9 +290,9 @@ function DetailsModal(props: {
|
|
289
290
|
position: "relative",
|
290
291
|
}}
|
291
292
|
>
|
292
|
-
{
|
293
|
+
{!chainIconQuery.isLoading ? (
|
293
294
|
<ChainIcon
|
294
|
-
|
295
|
+
chainIconUrl={chainIconQuery.url}
|
295
296
|
size={iconSize.md}
|
296
297
|
active
|
297
298
|
client={client}
|
@@ -301,11 +302,11 @@ function DetailsModal(props: {
|
|
301
302
|
)}
|
302
303
|
</div>
|
303
304
|
|
304
|
-
{
|
305
|
+
{chainNameQuery.isLoading ? (
|
305
306
|
<Skeleton height={"16px"} width={"200px"} />
|
306
307
|
) : (
|
307
308
|
<Text color="primaryText" multiline>
|
308
|
-
{
|
309
|
+
{chainNameQuery.name || `Unknown chain #${walletChain?.id}`}
|
309
310
|
</Text>
|
310
311
|
)}
|
311
312
|
|
@@ -535,11 +536,11 @@ function DetailsModal(props: {
|
|
535
536
|
|
536
537
|
{/* Request Testnet funds */}
|
537
538
|
{(props.detailsModal?.showTestnetFaucet ?? false) &&
|
538
|
-
(
|
539
|
-
|
539
|
+
(chainFaucetsQuery.faucets.length > 0 ||
|
540
|
+
walletChain?.id === LocalhostChainId) && (
|
540
541
|
<MenuLink
|
541
542
|
href={
|
542
|
-
|
543
|
+
chainFaucetsQuery.faucets ? chainFaucetsQuery.faucets[0] : "#"
|
543
544
|
}
|
544
545
|
target="_blank"
|
545
546
|
as="a"
|