thirdweb 5.96.5 → 5.96.7-nightly-e23f53bd786b871fd0ba0c9154da7280cc4a8817-20250501202025
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/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 +3 -0
- 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 +12 -1
- 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 +13 -0
- 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 +44 -3
- 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/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/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 +3 -0
- 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 +12 -1
- 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 +13 -0
- 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 +44 -3
- 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/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/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 +9 -9
- 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/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 +3 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +12 -1
- 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 +13 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.tsx +44 -3
- 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/version.ts +1 -1
@@ -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
|
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.96.
|
1
|
+
export const version = "5.96.7-nightly-e23f53bd786b871fd0ba0c9154da7280cc4a8817-20250501202025";
|