thirdweb 5.96.5-nightly-c137dd653c3640874f3cc953f4514c51f08c1ae9-20250429000412 → 5.96.6
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/analytics/track/pay.js +14 -13
- package/dist/cjs/analytics/track/pay.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +6 -4
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/core/utils/wallet.js +6 -1
- package/dist/cjs/react/core/utils/wallet.js.map +1 -1
- package/dist/cjs/react/core/utils/walletIcon.js +5 -0
- package/dist/cjs/react/core/utils/walletIcon.js.map +1 -1
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +2 -1
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +10 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +2 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +4 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +13 -2
- 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/OnRampScreen.js +12 -13
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +8 -12
- 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/SwapScreenContent.js +14 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +45 -4
- 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/TransferConfirmationScreen.js +41 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +8 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +7 -3
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
- package/dist/cjs/react/web/utils/errors.js +1 -1
- package/dist/cjs/react/web/utils/errors.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/analytics/track/pay.js +14 -13
- package/dist/esm/analytics/track/pay.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +6 -4
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/core/utils/wallet.js +6 -1
- package/dist/esm/react/core/utils/wallet.js.map +1 -1
- package/dist/esm/react/core/utils/walletIcon.js +5 -0
- package/dist/esm/react/core/utils/walletIcon.js.map +1 -1
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +2 -1
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +10 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +2 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +4 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +13 -2
- 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/OnRampScreen.js +12 -13
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +8 -12
- 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/SwapScreenContent.js +14 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +45 -4
- 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/TransferConfirmationScreen.js +41 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +8 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +7 -3
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
- package/dist/esm/react/web/utils/errors.js +1 -1
- package/dist/esm/react/web/utils/errors.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/analytics/track/pay.d.ts +3 -4
- package/dist/types/analytics/track/pay.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
- package/dist/types/react/core/utils/walletIcon.d.ts.map +1 -1
- package/dist/types/react/web/hooks/transaction/useSendTransaction.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/DirectPaymentModeScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.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/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.d.ts.map +1 -1
- 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/TransferConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +1 -0
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/analytics/track/pay.test.ts +5 -7
- package/src/analytics/track/pay.ts +17 -17
- package/src/react/core/hooks/transaction/useSendTransaction.ts +6 -4
- package/src/react/core/utils/wallet.ts +10 -1
- package/src/react/core/utils/walletIcon.ts +10 -3
- package/src/react/web/hooks/transaction/useSendTransaction.tsx +2 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +10 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +2 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +4 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +13 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +12 -13
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +8 -12
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx +14 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.tsx +45 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +43 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.ts +10 -0
- package/src/react/web/ui/TransactionButton/TransactionModal.tsx +8 -3
- package/src/react/web/utils/errors.ts +1 -1
- package/src/version.ts +1 -1
@@ -1,4 +1,5 @@
|
|
1
1
|
import { useContext } from "react";
|
2
|
+
import { randomBytesHex } from "../../../../utils/random.js";
|
2
3
|
import {
|
3
4
|
type SendTransactionConfig,
|
4
5
|
type ShowModalData,
|
@@ -106,6 +107,7 @@ export function useSendTransaction(config: SendTransactionConfig = {}) {
|
|
106
107
|
setRootEl(
|
107
108
|
<TransactionModal
|
108
109
|
title={payModal?.metadata?.name || "Transaction"}
|
110
|
+
txId={randomBytesHex()}
|
109
111
|
tx={data.tx}
|
110
112
|
onComplete={data.sendTx}
|
111
113
|
onClose={() => {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { useQueryClient } from "@tanstack/react-query";
|
2
2
|
import { useCallback, useMemo, useState } from "react";
|
3
|
+
import { trackPayEvent } from "../../../../../../analytics/track/pay.js";
|
3
4
|
import type { Chain } from "../../../../../../chains/types.js";
|
4
5
|
import { getCachedChain } from "../../../../../../chains/utils.js";
|
5
6
|
import type { ThirdwebClient } from "../../../../../../client/client.js";
|
@@ -895,6 +896,15 @@ function MainScreen(props: {
|
|
895
896
|
backScreen: { id: "main" },
|
896
897
|
});
|
897
898
|
}
|
899
|
+
trackPayEvent({
|
900
|
+
event: "choose_payment_method_fund_wallet_mode",
|
901
|
+
client,
|
902
|
+
walletAddress: payerAccount.address,
|
903
|
+
toChainId: toChain.id,
|
904
|
+
toToken: isNativeToken(toToken)
|
905
|
+
? undefined
|
906
|
+
: toToken.address,
|
907
|
+
});
|
898
908
|
}}
|
899
909
|
>
|
900
910
|
Continue
|
@@ -250,6 +250,8 @@ export function DirectPaymentModeScreen(props: {
|
|
250
250
|
client,
|
251
251
|
walletAddress: payerAccount.address,
|
252
252
|
walletType: activeWallet?.id,
|
253
|
+
toChainId: paymentInfo.chain.id,
|
254
|
+
toToken: paymentInfo.token?.address,
|
253
255
|
});
|
254
256
|
onContinue(totalCost, paymentInfo.chain, token);
|
255
257
|
}}
|
@@ -193,7 +193,7 @@ export function TransactionModeScreen(props: {
|
|
193
193
|
Insufficient Funds
|
194
194
|
</Text>
|
195
195
|
<Text size="xs" center multiline>
|
196
|
-
Select another token or pay with
|
196
|
+
Select another token or pay with card.
|
197
197
|
</Text>
|
198
198
|
</div>
|
199
199
|
)}
|
@@ -356,6 +356,9 @@ export function TransactionModeScreen(props: {
|
|
356
356
|
client,
|
357
357
|
walletAddress: payerAccount.address,
|
358
358
|
walletType: activeWallet?.id,
|
359
|
+
toChainId: payUiOptions.transaction.chain.id,
|
360
|
+
toToken: transactionCostAndData.token.address,
|
361
|
+
amountWei: totalCostWei.toString(),
|
359
362
|
});
|
360
363
|
onContinue(
|
361
364
|
toTokens(totalCostWei, transactionCostAndData.decimals),
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ChevronDownIcon } from "@radix-ui/react-icons";
|
2
2
|
import { useState } from "react";
|
3
|
+
import { trackPayEvent } from "../../../../../../../analytics/track/pay.js";
|
3
4
|
import type { Chain } from "../../../../../../../chains/types.js";
|
4
5
|
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
5
6
|
import { NATIVE_TOKEN_ADDRESS } from "../../../../../../../constants/addresses.js";
|
@@ -177,7 +178,7 @@ export function FiatScreenContent(props: {
|
|
177
178
|
)}
|
178
179
|
|
179
180
|
<Container flex="column" gap="sm">
|
180
|
-
<Text size="sm">Pay with
|
181
|
+
<Text size="sm">Pay with card</Text>
|
181
182
|
<div>
|
182
183
|
<PayWithCreditCard
|
183
184
|
isLoading={fiatQuoteQuery.isLoading}
|
@@ -274,7 +275,17 @@ export function FiatScreenContent(props: {
|
|
274
275
|
data-disabled={disableSubmit}
|
275
276
|
disabled={disableSubmit}
|
276
277
|
fullWidth
|
277
|
-
onClick={
|
278
|
+
onClick={() => {
|
279
|
+
trackPayEvent({
|
280
|
+
event: "confirm_onramp_quote",
|
281
|
+
client: client,
|
282
|
+
walletAddress: payer.account.address,
|
283
|
+
walletType: payer.wallet.id,
|
284
|
+
toChainId: toChain.id,
|
285
|
+
toToken: isNativeToken(toToken) ? undefined : toToken.address,
|
286
|
+
});
|
287
|
+
handleSubmit();
|
288
|
+
}}
|
278
289
|
gap="xs"
|
279
290
|
>
|
280
291
|
{fiatQuoteQuery.isLoading ? (
|
@@ -398,6 +398,9 @@ function useOnRampScreenState(props: {
|
|
398
398
|
client: props.client,
|
399
399
|
walletAddress: props.payer.account.address,
|
400
400
|
walletType: props.payer.wallet.id,
|
401
|
+
toChainId: props.quote.onRampToken.token.chainId,
|
402
|
+
toToken: props.quote.onRampToken.token.tokenAddress,
|
403
|
+
amountWei: props.quote.onRampToken.amountWei,
|
401
404
|
});
|
402
405
|
setPopupWindow(popup);
|
403
406
|
addPendingTx({
|
@@ -679,11 +682,10 @@ function useSwapMutation(props: {
|
|
679
682
|
walletAddress: account.address,
|
680
683
|
walletType: props.payer.wallet.id,
|
681
684
|
fromToken: quote.swapDetails.fromToken.tokenAddress,
|
682
|
-
fromAmount: quote.swapDetails.fromAmountWei,
|
683
|
-
toToken: quote.swapDetails.toToken.tokenAddress,
|
684
|
-
toAmount: quote.swapDetails.toAmountWei,
|
685
685
|
chainId: quote.swapDetails.fromToken.chainId,
|
686
|
-
|
686
|
+
amountWei: quote.swapDetails.fromAmountWei,
|
687
|
+
toToken: quote.swapDetails.toToken.tokenAddress,
|
688
|
+
toChainId: quote.swapDetails.toToken.chainId,
|
687
689
|
});
|
688
690
|
|
689
691
|
const transaction = approve({
|
@@ -705,11 +707,10 @@ function useSwapMutation(props: {
|
|
705
707
|
walletAddress: account.address,
|
706
708
|
walletType: props.payer.wallet.id,
|
707
709
|
fromToken: quote.swapDetails.fromToken.tokenAddress,
|
708
|
-
|
710
|
+
amountWei: quote.swapDetails.fromAmountWei,
|
709
711
|
toToken: quote.swapDetails.toToken.tokenAddress,
|
710
|
-
toAmount: quote.swapDetails.toAmountWei,
|
711
712
|
chainId: quote.swapDetails.fromToken.chainId,
|
712
|
-
|
713
|
+
toChainId: quote.swapDetails.toToken.chainId,
|
713
714
|
});
|
714
715
|
}
|
715
716
|
|
@@ -719,11 +720,10 @@ function useSwapMutation(props: {
|
|
719
720
|
walletAddress: account.address,
|
720
721
|
walletType: props.payer.wallet.id,
|
721
722
|
fromToken: quote.swapDetails.fromToken.tokenAddress,
|
722
|
-
|
723
|
+
amountWei: quote.swapDetails.fromAmountWei,
|
723
724
|
toToken: quote.swapDetails.toToken.tokenAddress,
|
724
|
-
toAmount: quote.swapDetails.toAmountWei,
|
725
725
|
chainId: quote.swapDetails.fromToken.chainId,
|
726
|
-
|
726
|
+
toChainId: quote.swapDetails.toToken.chainId,
|
727
727
|
});
|
728
728
|
const tx = quote.transactionRequest;
|
729
729
|
let _swapTx: WaitForReceiptOptions;
|
@@ -754,11 +754,10 @@ function useSwapMutation(props: {
|
|
754
754
|
walletAddress: account.address,
|
755
755
|
walletType: props.payer.wallet.id,
|
756
756
|
fromToken: quote.swapDetails.fromToken.tokenAddress,
|
757
|
-
|
757
|
+
amountWei: quote.swapDetails.fromAmountWei,
|
758
758
|
toToken: quote.swapDetails.toToken.tokenAddress,
|
759
|
-
|
759
|
+
toChainId: quote.swapDetails.toToken.chainId,
|
760
760
|
chainId: quote.swapDetails.fromToken.chainId,
|
761
|
-
dstChainId: quote.swapDetails.toToken.chainId,
|
762
761
|
});
|
763
762
|
|
764
763
|
// do not add pending tx if the swap is part of fiat flow
|
@@ -220,11 +220,10 @@ export function SwapConfirmationScreen(props: {
|
|
220
220
|
walletAddress: account.address,
|
221
221
|
walletType: wallet.id,
|
222
222
|
fromToken: props.quote.swapDetails.fromToken.tokenAddress,
|
223
|
-
|
223
|
+
amountWei: props.quote.swapDetails.fromAmountWei,
|
224
224
|
toToken: props.quote.swapDetails.toToken.tokenAddress,
|
225
|
-
|
225
|
+
toChainId: props.quote.swapDetails.toToken.chainId,
|
226
226
|
chainId: props.quote.swapDetails.fromToken.chainId,
|
227
|
-
dstChainId: props.quote.swapDetails.toToken.chainId,
|
228
227
|
});
|
229
228
|
|
230
229
|
const transaction = approve({
|
@@ -250,11 +249,10 @@ export function SwapConfirmationScreen(props: {
|
|
250
249
|
walletAddress: account.address,
|
251
250
|
walletType: wallet.id,
|
252
251
|
fromToken: props.quote.swapDetails.fromToken.tokenAddress,
|
253
|
-
|
252
|
+
amountWei: props.quote.swapDetails.fromAmountWei,
|
254
253
|
toToken: props.quote.swapDetails.toToken.tokenAddress,
|
255
|
-
|
254
|
+
toChainId: props.quote.swapDetails.toToken.chainId,
|
256
255
|
chainId: props.quote.swapDetails.fromToken.chainId,
|
257
|
-
dstChainId: props.quote.swapDetails.toToken.chainId,
|
258
256
|
});
|
259
257
|
|
260
258
|
setStep("swap");
|
@@ -275,11 +273,10 @@ export function SwapConfirmationScreen(props: {
|
|
275
273
|
walletAddress: account.address,
|
276
274
|
walletType: wallet.id,
|
277
275
|
fromToken: props.quote.swapDetails.fromToken.tokenAddress,
|
278
|
-
|
276
|
+
amountWei: props.quote.swapDetails.fromAmountWei,
|
279
277
|
toToken: props.quote.swapDetails.toToken.tokenAddress,
|
280
|
-
|
278
|
+
toChainId: props.quote.swapDetails.toToken.chainId,
|
281
279
|
chainId: props.quote.swapDetails.fromToken.chainId,
|
282
|
-
dstChainId: props.quote.swapDetails.toToken.chainId,
|
283
280
|
});
|
284
281
|
const tx = props.quote.transactionRequest;
|
285
282
|
let _swapTx: WaitForReceiptOptions;
|
@@ -317,11 +314,10 @@ export function SwapConfirmationScreen(props: {
|
|
317
314
|
walletAddress: account.address,
|
318
315
|
walletType: wallet.id,
|
319
316
|
fromToken: props.quote.swapDetails.fromToken.tokenAddress,
|
320
|
-
|
317
|
+
amountWei: props.quote.swapDetails.fromAmountWei,
|
321
318
|
toToken: props.quote.swapDetails.toToken.tokenAddress,
|
322
|
-
|
319
|
+
toChainId: props.quote.swapDetails.toToken.chainId,
|
323
320
|
chainId: props.quote.swapDetails.fromToken.chainId,
|
324
|
-
dstChainId: props.quote.swapDetails.toToken.chainId,
|
325
321
|
});
|
326
322
|
|
327
323
|
// do not add pending tx if the swap is part of fiat flow
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
2
2
|
import { useState } from "react";
|
3
|
+
import { trackPayEvent } from "../../../../../../../analytics/track/pay.js";
|
3
4
|
import type { Chain } from "../../../../../../../chains/types.js";
|
4
5
|
import { getCachedChain } from "../../../../../../../chains/utils.js";
|
5
6
|
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
@@ -316,7 +317,7 @@ export function SwapScreenContent(props: {
|
|
316
317
|
Insufficient Funds
|
317
318
|
</Text>
|
318
319
|
<Text size="xs" center multiline>
|
319
|
-
Select another token or pay with
|
320
|
+
Select another token or pay with card.
|
320
321
|
</Text>
|
321
322
|
</div>
|
322
323
|
)}
|
@@ -369,6 +370,18 @@ export function SwapScreenContent(props: {
|
|
369
370
|
onClick={async () => {
|
370
371
|
if (!disableContinue) {
|
371
372
|
showSwapFlow();
|
373
|
+
trackPayEvent({
|
374
|
+
event: "confirm_swap_quote",
|
375
|
+
client: client,
|
376
|
+
walletAddress: payer.account.address,
|
377
|
+
walletType: payer.wallet.id,
|
378
|
+
chainId: fromChain.id,
|
379
|
+
fromToken: isNativeToken(fromToken)
|
380
|
+
? undefined
|
381
|
+
: fromToken.address,
|
382
|
+
toChainId: toChain.id,
|
383
|
+
toToken: isNativeToken(toToken) ? undefined : toToken.address,
|
384
|
+
});
|
372
385
|
}
|
373
386
|
}}
|
374
387
|
gap="xs"
|
@@ -5,6 +5,7 @@ import {
|
|
5
5
|
Cross2Icon,
|
6
6
|
} from "@radix-ui/react-icons";
|
7
7
|
import { useQuery } from "@tanstack/react-query";
|
8
|
+
import { trackPayEvent } from "../../../../../../../analytics/track/pay.js";
|
8
9
|
import type { Chain } from "../../../../../../../chains/types.js";
|
9
10
|
import { getCachedChain } from "../../../../../../../chains/utils.js";
|
10
11
|
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
@@ -27,6 +28,7 @@ import {
|
|
27
28
|
useChainName,
|
28
29
|
} from "../../../../../../core/hooks/others/useChainQuery.js";
|
29
30
|
import { useActiveAccount } from "../../../../../../core/hooks/wallets/useActiveAccount.js";
|
31
|
+
import { useActiveWallet } from "../../../../../../core/hooks/wallets/useActiveWallet.js";
|
30
32
|
import { useConnectedWallets } from "../../../../../../core/hooks/wallets/useConnectedWallets.js";
|
31
33
|
import { useDisconnect } from "../../../../../../core/hooks/wallets/useDisconnect.js";
|
32
34
|
import type {
|
@@ -73,6 +75,7 @@ export function TokenSelectorScreen(props: {
|
|
73
75
|
}) {
|
74
76
|
const connectedWallets = useConnectedWallets();
|
75
77
|
const activeAccount = useActiveAccount();
|
78
|
+
const activeWallet = useActiveWallet();
|
76
79
|
const chainInfo = useChainMetadata(props.toChain);
|
77
80
|
const theme = useCustomTheme();
|
78
81
|
|
@@ -233,7 +236,21 @@ export function TokenSelectorScreen(props: {
|
|
233
236
|
balances={balances}
|
234
237
|
client={props.client}
|
235
238
|
address={address}
|
236
|
-
onClick={
|
239
|
+
onClick={(wallet, token, chain) => {
|
240
|
+
trackPayEvent({
|
241
|
+
event: "choose_payment_method_token",
|
242
|
+
client: props.client,
|
243
|
+
walletAddress: activeAccount?.address,
|
244
|
+
walletType: activeWallet?.id,
|
245
|
+
chainId: chain.id,
|
246
|
+
fromToken: isNativeToken(token) ? undefined : token.address,
|
247
|
+
toToken: isNativeToken(props.toToken)
|
248
|
+
? undefined
|
249
|
+
: props.toToken.address,
|
250
|
+
toChainId: props.toChain.id,
|
251
|
+
});
|
252
|
+
props.onSelectToken(wallet, token, chain);
|
253
|
+
}}
|
237
254
|
/>
|
238
255
|
);
|
239
256
|
})}
|
@@ -241,7 +258,19 @@ export function TokenSelectorScreen(props: {
|
|
241
258
|
<Button
|
242
259
|
variant="secondary"
|
243
260
|
fullWidth
|
244
|
-
onClick={
|
261
|
+
onClick={() => {
|
262
|
+
trackPayEvent({
|
263
|
+
event: "choose_payment_method_another_wallet",
|
264
|
+
client: props.client,
|
265
|
+
walletAddress: activeAccount?.address,
|
266
|
+
walletType: activeWallet?.id,
|
267
|
+
toChainId: props.toChain.id,
|
268
|
+
toToken: isNativeToken(props.toToken)
|
269
|
+
? undefined
|
270
|
+
: props.toToken.address,
|
271
|
+
});
|
272
|
+
props.onConnect();
|
273
|
+
}}
|
245
274
|
bg="tertiaryBg"
|
246
275
|
style={{
|
247
276
|
border: `1px solid ${theme.colors.borderColor}`,
|
@@ -265,7 +294,19 @@ export function TokenSelectorScreen(props: {
|
|
265
294
|
<Button
|
266
295
|
variant="secondary"
|
267
296
|
fullWidth
|
268
|
-
onClick={
|
297
|
+
onClick={() => {
|
298
|
+
trackPayEvent({
|
299
|
+
event: "choose_payment_method_with_card",
|
300
|
+
client: props.client,
|
301
|
+
walletAddress: activeAccount?.address,
|
302
|
+
walletType: activeWallet?.id,
|
303
|
+
toChainId: props.toChain.id,
|
304
|
+
toToken: isNativeToken(props.toToken)
|
305
|
+
? undefined
|
306
|
+
: props.toToken.address,
|
307
|
+
});
|
308
|
+
props.onPayWithFiat();
|
309
|
+
}}
|
269
310
|
bg="tertiaryBg"
|
270
311
|
style={{
|
271
312
|
border: `1px solid ${theme.colors.borderColor}`,
|
@@ -281,7 +322,7 @@ export function TokenSelectorScreen(props: {
|
|
281
322
|
>
|
282
323
|
<CardStackIcon width={iconSize.md} height={iconSize.md} />
|
283
324
|
<Text size="sm" color="primaryText">
|
284
|
-
Pay with
|
325
|
+
Pay with card
|
285
326
|
</Text>
|
286
327
|
</Container>
|
287
328
|
</Button>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { CheckCircledIcon } from "@radix-ui/react-icons";
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
3
3
|
import { useMemo, useState } from "react";
|
4
|
+
import { trackPayEvent } from "../../../../../../../analytics/track/pay.js";
|
4
5
|
import type { Chain } from "../../../../../../../chains/types.js";
|
5
6
|
import { getCachedChain } from "../../../../../../../chains/utils.js";
|
6
7
|
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
@@ -309,6 +310,14 @@ export function TransferConfirmationScreen(
|
|
309
310
|
}),
|
310
311
|
}),
|
311
312
|
]);
|
313
|
+
trackPayEvent({
|
314
|
+
client: props.client,
|
315
|
+
walletAddress: payer.account.address,
|
316
|
+
walletType: payer.wallet.id,
|
317
|
+
toChainId: chain.id,
|
318
|
+
toToken: isNativeToken(token) ? undefined : token.address,
|
319
|
+
event: "transfer_confirmation_success_transaction_mode",
|
320
|
+
});
|
312
321
|
// its the last step before the transaction, so propagate onPurchaseSuccess here
|
313
322
|
props.onSuccess?.(
|
314
323
|
transferBuyWithCryptoQuote({
|
@@ -353,6 +362,14 @@ export function TransferConfirmationScreen(
|
|
353
362
|
BigInt(transferResponse.approvalData.amountWei)
|
354
363
|
) {
|
355
364
|
setStep("approve");
|
365
|
+
trackPayEvent({
|
366
|
+
client: props.client,
|
367
|
+
walletAddress: payer.account.address,
|
368
|
+
walletType: payer.wallet.id,
|
369
|
+
toChainId: chain.id,
|
370
|
+
toToken: isNativeToken(token) ? undefined : token.address,
|
371
|
+
event: "prompt_transfer_approval",
|
372
|
+
});
|
356
373
|
const transaction = approve({
|
357
374
|
contract: getContract({
|
358
375
|
client: client,
|
@@ -372,9 +389,26 @@ export function TransferConfirmationScreen(
|
|
372
389
|
account: props.payer.account,
|
373
390
|
transaction,
|
374
391
|
});
|
392
|
+
trackPayEvent({
|
393
|
+
client: props.client,
|
394
|
+
walletAddress: payer.account.address,
|
395
|
+
walletType: payer.wallet.id,
|
396
|
+
toChainId: chain.id,
|
397
|
+
toToken: isNativeToken(token) ? undefined : token.address,
|
398
|
+
event: "transfer_approval_success",
|
399
|
+
});
|
375
400
|
}
|
376
401
|
}
|
377
402
|
|
403
|
+
trackPayEvent({
|
404
|
+
client: props.client,
|
405
|
+
walletAddress: payer.account.address,
|
406
|
+
walletType: payer.wallet.id,
|
407
|
+
toChainId: chain.id,
|
408
|
+
toToken: isNativeToken(token) ? undefined : token.address,
|
409
|
+
event: "prompt_transfer_confirmation",
|
410
|
+
});
|
411
|
+
|
378
412
|
setStep("transfer");
|
379
413
|
// execute the transfer
|
380
414
|
const transaction = transferResponse.transactionRequest;
|
@@ -385,6 +419,15 @@ export function TransferConfirmationScreen(
|
|
385
419
|
// switches to the status polling screen
|
386
420
|
setTransactionHash(tx.transactionHash);
|
387
421
|
setStatus({ id: "idle" });
|
422
|
+
|
423
|
+
trackPayEvent({
|
424
|
+
client: props.client,
|
425
|
+
walletAddress: payer.account.address,
|
426
|
+
walletType: payer.wallet.id,
|
427
|
+
toChainId: chain.id,
|
428
|
+
toToken: isNativeToken(token) ? undefined : token.address,
|
429
|
+
event: "transfer_confirmation_success",
|
430
|
+
});
|
388
431
|
}
|
389
432
|
// biome-ignore lint/suspicious/noExplicitAny: catch multiple errors
|
390
433
|
} catch (e: any) {
|
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
getPaySupportedSources,
|
8
8
|
} from "../../../../../../../pay/utils/definitions.js";
|
9
9
|
import { getClientFetch } from "../../../../../../../utils/fetch.js";
|
10
|
+
import { stringify } from "../../../../../../../utils/json.js";
|
10
11
|
import { withCache } from "../../../../../../../utils/promise/withCache.js";
|
11
12
|
|
12
13
|
type Response = {
|
@@ -44,7 +45,16 @@ export async function fetchBuySupportedDestinations(
|
|
44
45
|
const res = await fetchWithHeaders(
|
45
46
|
`${getPaySupportedDestinations()}${isTestMode ? "?isTestMode=true" : ""}`,
|
46
47
|
);
|
48
|
+
if (!res.ok) {
|
49
|
+
const error = await res.text();
|
50
|
+
throw new Error(`Failed to fetch supported destinations: ${error}`);
|
51
|
+
}
|
47
52
|
const data = (await res.json()) as Response;
|
53
|
+
if (!data.result) {
|
54
|
+
throw new Error(
|
55
|
+
`Failed to parse supported destinations: ${data ? stringify(data) : undefined}`,
|
56
|
+
);
|
57
|
+
}
|
48
58
|
return data.result.map((item) => ({
|
49
59
|
chain: defineChain({
|
50
60
|
id: item.chainId,
|
@@ -4,6 +4,7 @@ import { trackPayEvent } from "../../../../analytics/track/pay.js";
|
|
4
4
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
5
5
|
import type { WaitForReceiptOptions } from "../../../../transaction/actions/wait-for-tx-receipt.js";
|
6
6
|
import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
|
7
|
+
import { resolvePromisedValue } from "../../../../utils/promise/resolve-promised-value.js";
|
7
8
|
import { CustomThemeProvider } from "../../../core/design-system/CustomThemeProvider.js";
|
8
9
|
import type { Theme } from "../../../core/design-system/index.js";
|
9
10
|
import type { PayUIOptions } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
@@ -19,6 +20,7 @@ import { ExecutingTxScreen } from "./ExecutingScreen.js";
|
|
19
20
|
|
20
21
|
type ModalProps = {
|
21
22
|
title: string;
|
23
|
+
txId: string;
|
22
24
|
onComplete: () => void;
|
23
25
|
onClose: () => void;
|
24
26
|
client: ThirdwebClient;
|
@@ -35,8 +37,8 @@ export function TransactionModal(props: ModalProps) {
|
|
35
37
|
const wallet = useActiveWallet();
|
36
38
|
|
37
39
|
useQuery({
|
38
|
-
queryKey: ["transaction-modal-event"],
|
39
|
-
queryFn: () => {
|
40
|
+
queryKey: ["transaction-modal-event", props.txId],
|
41
|
+
queryFn: async () => {
|
40
42
|
if (!account || !wallet) {
|
41
43
|
throw new Error(); // never happens, because enabled is false
|
42
44
|
}
|
@@ -44,7 +46,10 @@ export function TransactionModal(props: ModalProps) {
|
|
44
46
|
client: props.client,
|
45
47
|
walletAddress: account.address,
|
46
48
|
walletType: wallet.id,
|
47
|
-
|
49
|
+
toChainId: props.tx.chain.id,
|
50
|
+
toToken: props.tx.erc20Value
|
51
|
+
? (await resolvePromisedValue(props.tx.erc20Value))?.tokenAddress
|
52
|
+
: undefined,
|
48
53
|
event: "open_pay_transaction_modal",
|
49
54
|
});
|
50
55
|
|
@@ -29,6 +29,6 @@ export function getErrorMessage(err: any): ApiError {
|
|
29
29
|
code: "UNABLE_TO_GET_PRICE_QUOTE",
|
30
30
|
title: "Failed to Find Quote",
|
31
31
|
message:
|
32
|
-
"We couldn't get a quote for this token pair. Select another token or pay with
|
32
|
+
"We couldn't get a quote for this token pair. Select another token or pay with card.",
|
33
33
|
};
|
34
34
|
}
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.96.
|
1
|
+
export const version = "5.96.6";
|