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.
Files changed (111) hide show
  1. package/dist/cjs/analytics/track/pay.js +14 -13
  2. package/dist/cjs/analytics/track/pay.js.map +1 -1
  3. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +6 -4
  4. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  5. package/dist/cjs/react/core/utils/wallet.js +6 -1
  6. package/dist/cjs/react/core/utils/wallet.js.map +1 -1
  7. package/dist/cjs/react/core/utils/walletIcon.js +5 -0
  8. package/dist/cjs/react/core/utils/walletIcon.js.map +1 -1
  9. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +2 -1
  10. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  11. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +10 -0
  12. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  13. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +2 -0
  14. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
  15. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +4 -1
  16. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
  17. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +13 -2
  18. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
  19. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +12 -13
  20. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
  21. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +8 -12
  22. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  23. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js +14 -1
  24. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +1 -1
  25. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +45 -4
  26. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +1 -1
  27. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +41 -0
  28. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +8 -0
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
  31. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +7 -3
  32. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
  33. package/dist/cjs/react/web/utils/errors.js +1 -1
  34. package/dist/cjs/react/web/utils/errors.js.map +1 -1
  35. package/dist/cjs/version.js +1 -1
  36. package/dist/cjs/version.js.map +1 -1
  37. package/dist/esm/analytics/track/pay.js +14 -13
  38. package/dist/esm/analytics/track/pay.js.map +1 -1
  39. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +6 -4
  40. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  41. package/dist/esm/react/core/utils/wallet.js +6 -1
  42. package/dist/esm/react/core/utils/wallet.js.map +1 -1
  43. package/dist/esm/react/core/utils/walletIcon.js +5 -0
  44. package/dist/esm/react/core/utils/walletIcon.js.map +1 -1
  45. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +2 -1
  46. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  47. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +10 -0
  48. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  49. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +2 -0
  50. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
  51. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +4 -1
  52. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
  53. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +13 -2
  54. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
  55. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +12 -13
  56. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
  57. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +8 -12
  58. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  59. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js +14 -1
  60. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +1 -1
  61. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +45 -4
  62. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +1 -1
  63. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +41 -0
  64. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
  65. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +8 -0
  66. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
  67. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +7 -3
  68. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
  69. package/dist/esm/react/web/utils/errors.js +1 -1
  70. package/dist/esm/react/web/utils/errors.js.map +1 -1
  71. package/dist/esm/version.js +1 -1
  72. package/dist/esm/version.js.map +1 -1
  73. package/dist/types/analytics/track/pay.d.ts +3 -4
  74. package/dist/types/analytics/track/pay.d.ts.map +1 -1
  75. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  76. package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
  77. package/dist/types/react/core/utils/walletIcon.d.ts.map +1 -1
  78. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  79. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
  80. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts.map +1 -1
  81. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts.map +1 -1
  82. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts.map +1 -1
  83. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
  84. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.d.ts.map +1 -1
  85. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.d.ts.map +1 -1
  86. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +1 -1
  87. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
  88. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +1 -0
  89. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -1
  90. package/dist/types/version.d.ts +1 -1
  91. package/dist/types/version.d.ts.map +1 -1
  92. package/package.json +3 -3
  93. package/src/analytics/track/pay.test.ts +5 -7
  94. package/src/analytics/track/pay.ts +17 -17
  95. package/src/react/core/hooks/transaction/useSendTransaction.ts +6 -4
  96. package/src/react/core/utils/wallet.ts +10 -1
  97. package/src/react/core/utils/walletIcon.ts +10 -3
  98. package/src/react/web/hooks/transaction/useSendTransaction.tsx +2 -0
  99. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +10 -0
  100. package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +2 -0
  101. package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +4 -1
  102. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +13 -2
  103. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +12 -13
  104. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +8 -12
  105. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx +14 -1
  106. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.tsx +45 -4
  107. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +43 -0
  108. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.ts +10 -0
  109. package/src/react/web/ui/TransactionButton/TransactionModal.tsx +8 -3
  110. package/src/react/web/utils/errors.ts +1 -1
  111. 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 a debit card.
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 a debit card</Text>
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={handleSubmit}
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
- dstChainId: quote.swapDetails.toToken.chainId,
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
- fromAmount: quote.swapDetails.fromAmountWei,
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
- dstChainId: quote.swapDetails.toToken.chainId,
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
- fromAmount: quote.swapDetails.fromAmountWei,
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
- dstChainId: quote.swapDetails.toToken.chainId,
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
- fromAmount: quote.swapDetails.fromAmountWei,
757
+ amountWei: quote.swapDetails.fromAmountWei,
758
758
  toToken: quote.swapDetails.toToken.tokenAddress,
759
- toAmount: quote.swapDetails.toAmountWei,
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
- fromAmount: props.quote.swapDetails.fromAmountWei,
223
+ amountWei: props.quote.swapDetails.fromAmountWei,
224
224
  toToken: props.quote.swapDetails.toToken.tokenAddress,
225
- toAmount: props.quote.swapDetails.toAmountWei,
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
- fromAmount: props.quote.swapDetails.fromAmountWei,
252
+ amountWei: props.quote.swapDetails.fromAmountWei,
254
253
  toToken: props.quote.swapDetails.toToken.tokenAddress,
255
- toAmount: props.quote.swapDetails.toAmountWei,
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
- fromAmount: props.quote.swapDetails.fromAmountWei,
276
+ amountWei: props.quote.swapDetails.fromAmountWei,
279
277
  toToken: props.quote.swapDetails.toToken.tokenAddress,
280
- toAmount: props.quote.swapDetails.toAmountWei,
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
- fromAmount: props.quote.swapDetails.fromAmountWei,
317
+ amountWei: props.quote.swapDetails.fromAmountWei,
321
318
  toToken: props.quote.swapDetails.toToken.tokenAddress,
322
- toAmount: props.quote.swapDetails.toAmountWei,
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 a debit card.
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={props.onSelectToken}
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={props.onConnect}
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={props.onPayWithFiat}
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 a debit card
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
- dstChainId: props.tx.chain.id,
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 a debit card.",
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.5-nightly-c137dd653c3640874f3cc953f4514c51f08c1ae9-20250429000412";
1
+ export const version = "5.96.6";