thirdweb 5.88.6 → 5.88.8-nightly-1fa36c1d56758788a8f9053f8929497bacb2b115-20250224233959
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/contract/deployment/utils/create-2-factory.js +4 -0
- package/dist/cjs/contract/deployment/utils/create-2-factory.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js +1 -0
- package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/isSwapRequiredPostOnramp.js +44 -0
- package/dist/cjs/pay/buyWithFiat/isSwapRequiredPostOnramp.js.map +1 -1
- package/dist/cjs/pay/convert/type.js +30 -1
- package/dist/cjs/pay/convert/type.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSendToken.js +18 -2
- package/dist/cjs/react/core/hooks/wallets/useSendToken.js.map +1 -1
- package/dist/cjs/react/core/providers/invalidateWalletBalance.js +6 -1
- package/dist/cjs/react/core/providers/invalidateWalletBalance.js.map +1 -1
- package/dist/cjs/react/core/utils/account.js +2 -7
- package/dist/cjs/react/core/utils/account.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +6 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +0 -13
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +6 -26
- 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 +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +541 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +23 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +8 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +21 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js +4 -9
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/cjs/rpc/rpc.js +1 -1
- package/dist/cjs/storage/upload/mobile.js +1 -1
- package/dist/cjs/storage/upload/mobile.js.map +1 -1
- package/dist/cjs/storage/upload/web-node.js +1 -0
- package/dist/cjs/storage/upload/web-node.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/ecosystem.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/iframe-wallet.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/iframe-wallet.js.map +1 -1
- package/dist/esm/contract/deployment/utils/create-2-factory.js +4 -0
- package/dist/esm/contract/deployment/utils/create-2-factory.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js +1 -0
- package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/isSwapRequiredPostOnramp.js +43 -0
- package/dist/esm/pay/buyWithFiat/isSwapRequiredPostOnramp.js.map +1 -1
- package/dist/esm/pay/convert/type.js +29 -2
- package/dist/esm/pay/convert/type.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useSendToken.js +19 -3
- package/dist/esm/react/core/hooks/wallets/useSendToken.js.map +1 -1
- package/dist/esm/react/core/providers/invalidateWalletBalance.js +6 -1
- package/dist/esm/react/core/providers/invalidateWalletBalance.js.map +1 -1
- package/dist/esm/react/core/utils/account.js +1 -6
- package/dist/esm/react/core/utils/account.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +6 -4
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +0 -13
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +7 -27
- 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 +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +538 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +22 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +8 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +18 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js +5 -10
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/esm/rpc/rpc.js +1 -1
- package/dist/esm/storage/upload/mobile.js +1 -1
- package/dist/esm/storage/upload/mobile.js.map +1 -1
- package/dist/esm/storage/upload/web-node.js +1 -0
- package/dist/esm/storage/upload/web-node.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/web/ecosystem.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/iframe-wallet.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/iframe-wallet.js.map +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts +8 -32
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/isSwapRequiredPostOnramp.d.ts +7 -0
- package/dist/types/pay/buyWithFiat/isSwapRequiredPostOnramp.d.ts.map +1 -1
- package/dist/types/pay/convert/type.d.ts +2 -1
- package/dist/types/pay/convert/type.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +2 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatStatus.d.ts +2 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatStatus.d.ts.map +1 -1
- package/dist/types/react/core/hooks/wallets/useSendToken.d.ts +6 -1
- package/dist/types/react/core/hooks/wallets/useSendToken.d.ts.map +1 -1
- package/dist/types/react/core/providers/invalidateWalletBalance.d.ts +1 -1
- package/dist/types/react/core/providers/invalidateWalletBalance.d.ts.map +1 -1
- package/dist/types/react/core/utils/account.d.ts +1 -1
- package/dist/types/react/core/utils/account.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts +7 -2
- 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/{FiatFlow.d.ts → OnRampScreen.d.ts} +4 -4
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +6 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.d.ts +4 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts.map +1 -1
- package/dist/types/react/web/ui/MediaRenderer/MediaRenderer.d.ts +2 -2
- package/dist/types/react/web/ui/MediaRenderer/ModelViewer.d.ts +1 -1
- package/dist/types/storage/upload/web-node.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/ecosystem.d.ts +1 -1
- package/package.json +1 -1
- package/src/contract/deployment/utils/create-2-factory.ts +4 -0
- package/src/pay/buyWithFiat/getQuote.ts +9 -33
- package/src/pay/buyWithFiat/isSwapRequiredPostOnramp.ts +56 -0
- package/src/pay/convert/type.ts +30 -1
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +2 -1
- package/src/react/core/hooks/pay/useBuyWithFiatStatus.ts +3 -1
- package/src/react/core/hooks/wallets/useSendToken.ts +19 -3
- package/src/react/core/providers/invalidateWalletBalance.ts +6 -1
- package/src/react/core/utils/account.ts +4 -8
- package/src/react/web/ui/ConnectWallet/NetworkSelector.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +8 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.tsx +3 -6
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +0 -19
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +9 -32
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +790 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +38 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +0 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +10 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx +55 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.tsx +18 -41
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.tsx +25 -22
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +10 -1
- package/src/rpc/rpc.ts +1 -1
- package/src/storage/upload/mobile.ts +1 -1
- package/src/storage/upload/web-node.ts +1 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/web/ecosystem.ts +1 -1
- package/src/wallets/in-app/web/lib/iframe-wallet.ts +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +0 -63
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +0 -116
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +0 -60
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +0 -113
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts +0 -24
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts.map +0 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx +0 -152
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +0 -258
@@ -4,6 +4,7 @@ import {
|
|
4
4
|
type GetBuyWithFiatStatusParams,
|
5
5
|
getBuyWithFiatStatus,
|
6
6
|
} from "../../../../pay/buyWithFiat/getStatus.js";
|
7
|
+
import type { WithPickedOnceQueryOptions } from "../types.js";
|
7
8
|
|
8
9
|
/**
|
9
10
|
* A hook to get a status of a "Buy with Fiat" transaction to determine if the transaction is completed, failed or pending.
|
@@ -34,7 +35,7 @@ import {
|
|
34
35
|
* @buyCrypto
|
35
36
|
*/
|
36
37
|
export function useBuyWithFiatStatus(
|
37
|
-
params?: GetBuyWithFiatStatusParams
|
38
|
+
params?: WithPickedOnceQueryOptions<GetBuyWithFiatStatusParams>,
|
38
39
|
): UseQueryResult<BuyWithFiatStatus> {
|
39
40
|
return useQuery({
|
40
41
|
queryKey: ["useBuyWithFiatStatus", params],
|
@@ -64,5 +65,6 @@ export function useBuyWithFiatStatus(
|
|
64
65
|
},
|
65
66
|
refetchIntervalInBackground: true,
|
66
67
|
retry: true,
|
68
|
+
...params?.queryOptions,
|
67
69
|
});
|
68
70
|
}
|
@@ -1,13 +1,15 @@
|
|
1
|
-
import { useMutation } from "@tanstack/react-query";
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
2
2
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
3
3
|
import { getContract } from "../../../../contract/contract.js";
|
4
4
|
import { resolveAddress } from "../../../../extensions/ens/resolve-address.js";
|
5
5
|
import { transfer } from "../../../../extensions/erc20/write/transfer.js";
|
6
6
|
import { sendTransaction } from "../../../../transaction/actions/send-transaction.js";
|
7
|
+
import { waitForReceipt } from "../../../../transaction/actions/wait-for-tx-receipt.js";
|
7
8
|
import { prepareTransaction } from "../../../../transaction/prepare-transaction.js";
|
8
9
|
import { isAddress } from "../../../../utils/address.js";
|
9
10
|
import { isValidENSName } from "../../../../utils/ens/isValidENSName.js";
|
10
11
|
import { toWei } from "../../../../utils/units.js";
|
12
|
+
import { invalidateWalletBalance } from "../../providers/invalidateWalletBalance.js";
|
11
13
|
import { useActiveWallet } from "./useActiveWallet.js";
|
12
14
|
|
13
15
|
/**
|
@@ -33,6 +35,7 @@ import { useActiveWallet } from "./useActiveWallet.js";
|
|
33
35
|
*/
|
34
36
|
export function useSendToken(client: ThirdwebClient) {
|
35
37
|
const wallet = useActiveWallet();
|
38
|
+
const queryClient = useQueryClient();
|
36
39
|
return useMutation({
|
37
40
|
async mutationFn(option: {
|
38
41
|
tokenAddress?: string;
|
@@ -83,7 +86,7 @@ export function useSendToken(client: ThirdwebClient) {
|
|
83
86
|
value: toWei(amount),
|
84
87
|
});
|
85
88
|
|
86
|
-
|
89
|
+
return sendTransaction({
|
87
90
|
transaction: sendNativeTokenTx,
|
88
91
|
account,
|
89
92
|
});
|
@@ -103,11 +106,24 @@ export function useSendToken(client: ThirdwebClient) {
|
|
103
106
|
to,
|
104
107
|
});
|
105
108
|
|
106
|
-
|
109
|
+
return sendTransaction({
|
107
110
|
transaction: tx,
|
108
111
|
account,
|
109
112
|
});
|
110
113
|
}
|
111
114
|
},
|
115
|
+
onSettled: async (data, error) => {
|
116
|
+
if (error) {
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
if (data?.transactionHash) {
|
120
|
+
await waitForReceipt({
|
121
|
+
transactionHash: data.transactionHash,
|
122
|
+
client,
|
123
|
+
chain: data.chain,
|
124
|
+
});
|
125
|
+
}
|
126
|
+
invalidateWalletBalance(queryClient);
|
127
|
+
},
|
112
128
|
});
|
113
129
|
}
|
@@ -4,9 +4,14 @@ export function invalidateWalletBalance(
|
|
4
4
|
queryClient: QueryClient,
|
5
5
|
chainId?: number,
|
6
6
|
) {
|
7
|
-
|
7
|
+
queryClient.invalidateQueries({
|
8
8
|
// invalidate any walletBalance queries for this chainId
|
9
9
|
// TODO: add wallet address in here if we can get it somehow
|
10
10
|
queryKey: chainId ? ["walletBalance", chainId] : ["walletBalance"],
|
11
11
|
});
|
12
|
+
queryClient.invalidateQueries({
|
13
|
+
queryKey: chainId
|
14
|
+
? ["internal_account_balance", chainId]
|
15
|
+
: ["internal_account_balance"],
|
16
|
+
});
|
12
17
|
}
|
@@ -2,7 +2,10 @@ import type { Chain } from "../../../chains/types.js";
|
|
2
2
|
import type { ThirdwebClient } from "../../../client/client.js";
|
3
3
|
import { NATIVE_TOKEN_ADDRESS } from "../../../constants/addresses.js";
|
4
4
|
import { convertCryptoToFiat } from "../../../pay/convert/cryptoToFiat.js";
|
5
|
-
import
|
5
|
+
import {
|
6
|
+
type SupportedFiatCurrency,
|
7
|
+
getFiatSymbol,
|
8
|
+
} from "../../../pay/convert/type.js";
|
6
9
|
import { type Address, isAddress } from "../../../utils/address.js";
|
7
10
|
import { formatNumber } from "../../../utils/formatNumber.js";
|
8
11
|
import { shortenLargeNumber } from "../../../utils/shortenLargeNumber.js";
|
@@ -112,13 +115,6 @@ export async function loadAccountBalance(props: {
|
|
112
115
|
};
|
113
116
|
}
|
114
117
|
|
115
|
-
function getFiatSymbol(showBalanceInFiat: SupportedFiatCurrency) {
|
116
|
-
switch (showBalanceInFiat) {
|
117
|
-
case "USD":
|
118
|
-
return "$";
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
118
|
/**
|
123
119
|
* Format the display balance for both crypto and fiat, in the Details button and Modal
|
124
120
|
* If both crypto balance and fiat balance exist, we have to keep the string very short to avoid UI issues.
|
@@ -704,7 +704,7 @@ export const ChainButton = /* @__PURE__ */ memo(function ChainButton(props: {
|
|
704
704
|
{confirming && (
|
705
705
|
<>
|
706
706
|
<Text size="xs" color="accentText">
|
707
|
-
{locale.
|
707
|
+
{locale.switchingNetwork}
|
708
708
|
</Text>
|
709
709
|
<Spinner size="xs" color="accentText" />
|
710
710
|
</>
|
@@ -9,7 +9,7 @@ export const JPYIcon: IconFC = (props) => {
|
|
9
9
|
xmlns="http://www.w3.org/2000/svg"
|
10
10
|
role="presentation"
|
11
11
|
>
|
12
|
-
<g fill="none"
|
12
|
+
<g fill="none" fillRule="evenodd">
|
13
13
|
<circle cx="16" cy="16" fill="#a81b1b" r="16" />
|
14
14
|
<path
|
15
15
|
d="M17.548 18.711v1.878h5.063v2.288h-5.063V25.5h-3.096v-2.623H9.389v-2.288h5.063v-1.878H9.389v-2.288h4.171L7.5 7.5h3.752l4.8 7.534L20.853 7.5H24.5l-6.086 8.923h4.197v2.288z"
|
@@ -39,8 +39,8 @@ import { DirectPaymentModeScreen } from "./DirectPaymentModeScreen.js";
|
|
39
39
|
import { PayTokenIcon } from "./PayTokenIcon.js";
|
40
40
|
import { TransactionModeScreen } from "./TransactionModeScreen.js";
|
41
41
|
import { CurrencySelection } from "./fiat/CurrencySelection.js";
|
42
|
-
import { FiatFlow } from "./fiat/FiatFlow.js";
|
43
42
|
import { FiatScreenContent } from "./fiat/FiatScreenContent.js";
|
43
|
+
import { OnRampScreen } from "./fiat/OnRampScreen.js";
|
44
44
|
import type { SelectedScreen } from "./main/types.js";
|
45
45
|
import {
|
46
46
|
type PaymentMethods,
|
@@ -312,8 +312,12 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
312
312
|
}
|
313
313
|
|
314
314
|
if (screen.id === "fiat-flow" && payer) {
|
315
|
+
const defaultRecipientAddress = (
|
316
|
+
props.payOptions as Extract<PayUIOptions, { mode: "direct_payment" }>
|
317
|
+
)?.paymentInfo?.sellerAddress;
|
318
|
+
const receiverAddress = defaultRecipientAddress || payer.account.address;
|
315
319
|
return (
|
316
|
-
<
|
320
|
+
<OnRampScreen
|
317
321
|
title={props.title}
|
318
322
|
transactionMode={payOptions.mode === "transaction"}
|
319
323
|
quote={screen.quote}
|
@@ -328,10 +332,10 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
328
332
|
props.payOptions.buyWithFiat?.testMode === true
|
329
333
|
}
|
330
334
|
theme={typeof props.theme === "string" ? props.theme : props.theme.type}
|
331
|
-
openedWindow={screen.openedWindow}
|
332
335
|
onDone={onDone}
|
333
336
|
isEmbed={props.isEmbed}
|
334
337
|
payer={payer}
|
338
|
+
receiverAddress={receiverAddress}
|
335
339
|
onSuccess={onFiatSuccess}
|
336
340
|
/>
|
337
341
|
);
|
@@ -558,6 +562,7 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
558
562
|
supportedSourcesQuery.data &&
|
559
563
|
sourceSupportedTokens && (
|
560
564
|
<TokenSelectorScreen
|
565
|
+
fiatSupported={props.payOptions.buyWithFiat !== false}
|
561
566
|
client={props.client}
|
562
567
|
sourceTokens={sourceSupportedTokens}
|
563
568
|
sourceSupportedTokens={sourceSupportedTokens}
|
@@ -12,7 +12,7 @@ import { Skeleton } from "../../../components/Skeleton.js";
|
|
12
12
|
import { Container } from "../../../components/basic.js";
|
13
13
|
import { Button } from "../../../components/buttons.js";
|
14
14
|
import { Text } from "../../../components/text.js";
|
15
|
-
import type
|
15
|
+
import { type CurrencyMeta, getFiatIcon } from "./fiat/currencies.js";
|
16
16
|
|
17
17
|
/**
|
18
18
|
* Shows an amount "value" and renders the selected token and chain
|
@@ -55,7 +55,7 @@ export function PayWithCreditCard(props: {
|
|
55
55
|
}}
|
56
56
|
gap="sm"
|
57
57
|
>
|
58
|
-
|
58
|
+
{getFiatIcon(props.currency, "md")}
|
59
59
|
<Container flex="row" center="y" gap="xxs" color="secondaryText">
|
60
60
|
<Text color="primaryText">{props.currency.shorthand}</Text>
|
61
61
|
<ChevronDownIcon width={iconSize.sm} height={iconSize.sm} />
|
@@ -1,14 +1,11 @@
|
|
1
1
|
import styled from "@emotion/styled";
|
2
2
|
import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
|
3
|
-
import {
|
4
|
-
iconSize,
|
5
|
-
spacing,
|
6
|
-
} from "../../../../../../core/design-system/index.js";
|
3
|
+
import { spacing } from "../../../../../../core/design-system/index.js";
|
7
4
|
import { Spacer } from "../../../../components/Spacer.js";
|
8
5
|
import { Container, Line, ModalHeader } from "../../../../components/basic.js";
|
9
6
|
import { Button } from "../../../../components/buttons.js";
|
10
7
|
import { Text } from "../../../../components/text.js";
|
11
|
-
import { type CurrencyMeta, currencies } from "./currencies.js";
|
8
|
+
import { type CurrencyMeta, currencies, getFiatIcon } from "./currencies.js";
|
12
9
|
|
13
10
|
export function CurrencySelection(props: {
|
14
11
|
onSelect: (currency: CurrencyMeta) => void;
|
@@ -33,7 +30,7 @@ export function CurrencySelection(props: {
|
|
33
30
|
onClick={() => props.onSelect(c)}
|
34
31
|
gap="sm"
|
35
32
|
>
|
36
|
-
|
33
|
+
{getFiatIcon(c, "lg")}
|
37
34
|
<Container flex="column" gap="xxs">
|
38
35
|
<Text color="primaryText">{c.shorthand}</Text>
|
39
36
|
<Text size="sm">{c.name}</Text>
|
@@ -3,7 +3,6 @@ import { useState } from "react";
|
|
3
3
|
import type { Chain } from "../../../../../../../chains/types.js";
|
4
4
|
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
5
5
|
import { NATIVE_TOKEN_ADDRESS } from "../../../../../../../constants/addresses.js";
|
6
|
-
import { isSwapRequiredPostOnramp } from "../../../../../../../pay/buyWithFiat/isSwapRequiredPostOnramp.js";
|
7
6
|
import type { FiatProvider } from "../../../../../../../pay/utils/commonTypes.js";
|
8
7
|
import { formatNumber } from "../../../../../../../utils/formatNumber.js";
|
9
8
|
import {
|
@@ -33,9 +32,7 @@ import { type ERC20OrNativeToken, isNativeToken } from "../../nativeToken.js";
|
|
33
32
|
import { EstimatedTimeAndFees } from "../EstimatedTimeAndFees.js";
|
34
33
|
import { PayWithCreditCard } from "../PayWIthCreditCard.js";
|
35
34
|
import type { SelectedScreen } from "../main/types.js";
|
36
|
-
import { openOnrampPopup } from "../openOnRamppopup.js";
|
37
35
|
import { FiatFees } from "../swap/Fees.js";
|
38
|
-
import { addPendingTx } from "../swap/pendingSwapTx.js";
|
39
36
|
import type { PayerInfo } from "../types.js";
|
40
37
|
import { Providers } from "./Providers.js";
|
41
38
|
import type { CurrencyMeta } from "./currencies.js";
|
@@ -113,25 +110,9 @@ export function FiatScreenContent(props: {
|
|
113
110
|
return;
|
114
111
|
}
|
115
112
|
|
116
|
-
const hasTwoSteps = isSwapRequiredPostOnramp(fiatQuoteQuery.data);
|
117
|
-
let openedWindow: Window | null = null;
|
118
|
-
|
119
|
-
if (!hasTwoSteps) {
|
120
|
-
openedWindow = openOnrampPopup(
|
121
|
-
fiatQuoteQuery.data.onRampLink,
|
122
|
-
typeof props.theme === "string" ? props.theme : props.theme.type,
|
123
|
-
);
|
124
|
-
|
125
|
-
addPendingTx({
|
126
|
-
type: "fiat",
|
127
|
-
intentId: fiatQuoteQuery.data.intentId,
|
128
|
-
});
|
129
|
-
}
|
130
|
-
|
131
113
|
setScreen({
|
132
114
|
id: "fiat-flow",
|
133
115
|
quote: fiatQuoteQuery.data,
|
134
|
-
openedWindow,
|
135
116
|
});
|
136
117
|
}
|
137
118
|
|
@@ -7,7 +7,6 @@ import { useMemo } from "react";
|
|
7
7
|
import { getCachedChain } from "../../../../../../../chains/utils.js";
|
8
8
|
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
9
9
|
import { NATIVE_TOKEN_ADDRESS } from "../../../../../../../constants/addresses.js";
|
10
|
-
import type { BuyWithFiatQuote } from "../../../../../../../pay/buyWithFiat/getQuote.js";
|
11
10
|
import type { BuyWithFiatStatus } from "../../../../../../../pay/buyWithFiat/getStatus.js";
|
12
11
|
import { formatNumber } from "../../../../../../../utils/formatNumber.js";
|
13
12
|
import { formatExplorerTxUrl } from "../../../../../../../utils/url.js";
|
@@ -36,7 +35,7 @@ import {
|
|
36
35
|
type FiatStatusMeta,
|
37
36
|
getBuyWithFiatStatusMeta,
|
38
37
|
} from "../pay-transactions/statusMeta.js";
|
39
|
-
import { getCurrencyMeta } from "./currencies.js";
|
38
|
+
import { getCurrencyMeta, getFiatIcon } from "./currencies.js";
|
40
39
|
|
41
40
|
export type BuyWithFiatPartialQuote = {
|
42
41
|
fromCurrencySymbol: string;
|
@@ -58,31 +57,6 @@ export type BuyWithFiatPartialQuote = {
|
|
58
57
|
};
|
59
58
|
};
|
60
59
|
|
61
|
-
export function fiatQuoteToPartialQuote(
|
62
|
-
quote: BuyWithFiatQuote,
|
63
|
-
): BuyWithFiatPartialQuote {
|
64
|
-
const data: BuyWithFiatPartialQuote = {
|
65
|
-
fromCurrencyAmount: quote.fromCurrencyWithFees.amount,
|
66
|
-
fromCurrencySymbol: quote.fromCurrencyWithFees.currencySymbol,
|
67
|
-
onRampTokenAmount: quote.onRampToken.amount,
|
68
|
-
toTokenAmount: quote.estimatedToAmountMin,
|
69
|
-
onRampToken: {
|
70
|
-
chainId: quote.onRampToken.token.chainId,
|
71
|
-
tokenAddress: quote.onRampToken.token.tokenAddress,
|
72
|
-
name: quote.onRampToken.token.name,
|
73
|
-
symbol: quote.onRampToken.token.symbol,
|
74
|
-
},
|
75
|
-
toToken: {
|
76
|
-
chainId: quote.toToken.chainId,
|
77
|
-
tokenAddress: quote.toToken.tokenAddress,
|
78
|
-
name: quote.toToken.name,
|
79
|
-
symbol: quote.toToken.symbol,
|
80
|
-
},
|
81
|
-
};
|
82
|
-
|
83
|
-
return data;
|
84
|
-
}
|
85
|
-
|
86
60
|
export function FiatSteps(props: {
|
87
61
|
title: string;
|
88
62
|
partialQuote: BuyWithFiatPartialQuote;
|
@@ -171,7 +145,7 @@ export function FiatSteps(props: {
|
|
171
145
|
</div>
|
172
146
|
);
|
173
147
|
|
174
|
-
const fiatIcon =
|
148
|
+
const fiatIcon = getFiatIcon(currency, "sm");
|
175
149
|
|
176
150
|
const onRampTokenIcon = (
|
177
151
|
<PayTokenIcon
|
@@ -541,9 +515,11 @@ function PaymentSubStep(props: {
|
|
541
515
|
);
|
542
516
|
}
|
543
517
|
|
544
|
-
function StepContainer(props: {
|
518
|
+
export function StepContainer(props: {
|
545
519
|
state?: FiatStatusMeta["progressStatus"];
|
546
520
|
children: React.ReactNode;
|
521
|
+
style?: React.CSSProperties;
|
522
|
+
index?: number;
|
547
523
|
}) {
|
548
524
|
let color: keyof Theme["colors"] = "borderColor";
|
549
525
|
let text: string | undefined;
|
@@ -576,21 +552,22 @@ function StepContainer(props: {
|
|
576
552
|
borderWidth: "1px",
|
577
553
|
borderStyle: "solid",
|
578
554
|
position: "relative",
|
555
|
+
...props.style,
|
579
556
|
}}
|
580
557
|
>
|
581
558
|
{props.children}
|
582
559
|
<div
|
583
560
|
style={{
|
584
561
|
position: "absolute",
|
585
|
-
right: spacing.
|
586
|
-
top: spacing.
|
562
|
+
right: spacing.xs,
|
563
|
+
top: spacing.xs,
|
587
564
|
display: "flex",
|
588
565
|
gap: spacing.xs,
|
589
566
|
alignItems: "center",
|
590
567
|
}}
|
591
568
|
>
|
592
569
|
{props.state && text && (
|
593
|
-
<Text size="
|
570
|
+
<Text size="xs" color={color}>
|
594
571
|
{text}
|
595
572
|
</Text>
|
596
573
|
)}
|
@@ -14,7 +14,7 @@ import { ButtonLink } from "../../../../components/buttons.js";
|
|
14
14
|
import { Text } from "../../../../components/text.js";
|
15
15
|
import { TokenInfoRow } from "../pay-transactions/TokenInfoRow.js";
|
16
16
|
import type { FiatStatusMeta } from "../pay-transactions/statusMeta.js";
|
17
|
-
import { getCurrencyMeta } from "./currencies.js";
|
17
|
+
import { getCurrencyMeta, getFiatIcon } from "./currencies.js";
|
18
18
|
|
19
19
|
/**
|
20
20
|
* Show a table with the details of a "OnRamp" transaction step in the "Buy with Fiat" flow.
|
@@ -71,7 +71,7 @@ export function OnRampTxDetailsTable(props: {
|
|
71
71
|
}}
|
72
72
|
>
|
73
73
|
<Container flex="row" gap="xs" center="y">
|
74
|
-
|
74
|
+
{getFiatIcon(currencyMeta, "sm")}
|
75
75
|
<Text color="primaryText">
|
76
76
|
{formatNumber(Number(props.fiat.amount), 2)}{" "}
|
77
77
|
{props.fiat.currencySymbol}
|