thirdweb 5.105.8 → 5.105.10
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/bridge/Chains.js +20 -14
- package/dist/cjs/bridge/Chains.js.map +1 -1
- package/dist/cjs/chains/chain-definitions/t-rex-testnet.js +20 -0
- package/dist/cjs/chains/chain-definitions/t-rex-testnet.js.map +1 -0
- package/dist/cjs/chains/utils.js +8 -34
- package/dist/cjs/chains/utils.js.map +1 -1
- package/dist/cjs/exports/chains.js +3 -1
- package/dist/cjs/exports/chains.js.map +1 -1
- package/dist/cjs/insight/common.js +5 -13
- package/dist/cjs/insight/common.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/isSwapRequiredPostOnramp.js +0 -44
- package/dist/cjs/pay/buyWithFiat/isSwapRequiredPostOnramp.js.map +1 -1
- package/dist/cjs/pay/utils/commonTypes.js +1 -2
- package/dist/cjs/pay/utils/commonTypes.js.map +1 -1
- package/dist/cjs/react/core/hooks/useBridgeQuote.js +3 -1
- package/dist/cjs/react/core/hooks/useBridgeQuote.js.map +1 -1
- package/dist/cjs/react/core/hooks/usePaymentMethods.js +87 -53
- package/dist/cjs/react/core/hooks/usePaymentMethods.js.map +1 -1
- package/dist/cjs/react/core/utils/storage.js +1 -2
- package/dist/cjs/react/core/utils/storage.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js +7 -2
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js +3 -2
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js +4 -3
- package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +11 -6
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/MenuButton.js +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/MenuButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js +1 -7
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +0 -112
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/utils.js +0 -9
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/utils.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ReceiveFunds.js +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ReceiveFunds.js.map +1 -1
- package/dist/cjs/react/web/ui/PayEmbed.js +1 -30
- package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js +0 -1
- package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/components/Modal.js +3 -3
- package/dist/cjs/react/web/ui/components/Modal.js.map +1 -1
- package/dist/cjs/react/web/ui/components/buttons.js +0 -2
- package/dist/cjs/react/web/ui/components/buttons.js.map +1 -1
- package/dist/cjs/react/web/ui/components/text.js +0 -1
- package/dist/cjs/react/web/ui/components/text.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/GetStartedScreen.js +0 -1
- package/dist/cjs/react/web/wallets/shared/GetStartedScreen.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js +0 -1
- package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/bridge/Chains.js +20 -14
- package/dist/esm/bridge/Chains.js.map +1 -1
- package/dist/esm/chains/chain-definitions/t-rex-testnet.js +17 -0
- package/dist/esm/chains/chain-definitions/t-rex-testnet.js.map +1 -0
- package/dist/esm/chains/utils.js +7 -33
- package/dist/esm/chains/utils.js.map +1 -1
- package/dist/esm/exports/chains.js +1 -0
- package/dist/esm/exports/chains.js.map +1 -1
- package/dist/esm/insight/common.js +6 -13
- package/dist/esm/insight/common.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/isSwapRequiredPostOnramp.js +0 -43
- package/dist/esm/pay/buyWithFiat/isSwapRequiredPostOnramp.js.map +1 -1
- package/dist/esm/pay/utils/commonTypes.js +2 -1
- package/dist/esm/pay/utils/commonTypes.js.map +1 -1
- package/dist/esm/react/core/hooks/useBridgeQuote.js +3 -1
- package/dist/esm/react/core/hooks/useBridgeQuote.js.map +1 -1
- package/dist/esm/react/core/hooks/usePaymentMethods.js +88 -54
- package/dist/esm/react/core/hooks/usePaymentMethods.js.map +1 -1
- package/dist/esm/react/core/utils/storage.js +0 -1
- package/dist/esm/react/core/utils/storage.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js +7 -2
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js +3 -2
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js +4 -3
- package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +12 -7
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/MenuButton.js +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/MenuButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js +1 -7
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +1 -110
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/utils.js +0 -8
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/utils.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ReceiveFunds.js +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ReceiveFunds.js.map +1 -1
- package/dist/esm/react/web/ui/PayEmbed.js +3 -32
- package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js +0 -1
- package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
- package/dist/esm/react/web/ui/components/Modal.js +1 -1
- package/dist/esm/react/web/ui/components/Modal.js.map +1 -1
- package/dist/esm/react/web/ui/components/buttons.js +0 -2
- package/dist/esm/react/web/ui/components/buttons.js.map +1 -1
- package/dist/esm/react/web/ui/components/text.js +0 -1
- package/dist/esm/react/web/ui/components/text.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/GetStartedScreen.js +0 -1
- package/dist/esm/react/web/wallets/shared/GetStartedScreen.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/OTPLoginUI.js +0 -1
- package/dist/esm/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/bridge/Chains.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/t-rex-testnet.d.ts +7 -0
- package/dist/types/chains/chain-definitions/t-rex-testnet.d.ts.map +1 -0
- package/dist/types/chains/types.d.ts +0 -7
- package/dist/types/chains/types.d.ts.map +1 -1
- package/dist/types/chains/utils.d.ts +2 -15
- package/dist/types/chains/utils.d.ts.map +1 -1
- package/dist/types/exports/chains.d.ts +1 -0
- package/dist/types/exports/chains.d.ts.map +1 -1
- package/dist/types/insight/common.d.ts +0 -1
- package/dist/types/insight/common.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts +0 -3
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/isSwapRequiredPostOnramp.d.ts +0 -7
- package/dist/types/pay/buyWithFiat/isSwapRequiredPostOnramp.d.ts.map +1 -1
- package/dist/types/pay/utils/commonTypes.d.ts +2 -1
- package/dist/types/pay/utils/commonTypes.d.ts.map +1 -1
- package/dist/types/react/core/hooks/useBridgeQuote.d.ts +2 -1
- package/dist/types/react/core/hooks/useBridgeQuote.d.ts.map +1 -1
- package/dist/types/react/core/hooks/usePaymentMethods.d.ts.map +1 -1
- package/dist/types/react/core/utils/storage.d.ts +0 -1
- package/dist/types/react/core/utils/storage.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts +5 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts +2 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/MenuButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/NetworkSelector.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +0 -1
- 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 -29
- 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/useSwapSupportedChains.d.ts +0 -26
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/utils.d.ts +0 -6
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/utils.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Modal.d.ts +0 -4
- package/dist/types/react/web/ui/components/Modal.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/buttons.d.ts +2 -1
- package/dist/types/react/web/ui/components/buttons.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/text.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 +2 -2
- package/src/bridge/Chains.ts +23 -14
- package/src/chains/chain-definitions/t-rex-testnet.ts +17 -0
- package/src/chains/types.ts +0 -8
- package/src/chains/utils.ts +10 -51
- package/src/exports/chains.ts +1 -0
- package/src/insight/common.ts +6 -19
- package/src/pay/buyWithCrypto/getStatus.ts +0 -5
- package/src/pay/buyWithFiat/isSwapRequiredPostOnramp.ts +0 -56
- package/src/pay/utils/commonTypes.ts +1 -1
- package/src/react/core/hooks/useBridgeQuote.ts +4 -0
- package/src/react/core/hooks/usePaymentMethods.ts +112 -65
- package/src/react/core/utils/storage.ts +0 -1
- package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +9 -1
- package/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx +8 -0
- package/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx +6 -0
- package/src/react/web/ui/ConnectWallet/Details.tsx +52 -43
- package/src/react/web/ui/ConnectWallet/MenuButton.tsx +0 -1
- package/src/react/web/ui/ConnectWallet/NetworkSelector.tsx +5 -9
- package/src/react/web/ui/ConnectWallet/WalletSelector.tsx +0 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +0 -39
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.ts +0 -160
- package/src/react/web/ui/ConnectWallet/screens/Buy/utils.ts +0 -9
- package/src/react/web/ui/ConnectWallet/screens/ReceiveFunds.tsx +0 -1
- package/src/react/web/ui/PayEmbed.tsx +3 -66
- package/src/react/web/ui/TransactionButton/DepositScreen.tsx +0 -1
- package/src/react/web/ui/components/Modal.tsx +1 -1
- package/src/react/web/ui/components/buttons.tsx +1 -3
- package/src/react/web/ui/components/text.tsx +0 -1
- package/src/react/web/wallets/shared/GetStartedScreen.tsx +0 -1
- package/src/react/web/wallets/shared/OTPLoginUI.tsx +0 -1
- package/src/version.ts +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +0 -468
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +0 -116
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/EstimatedTimeAndFees.js +0 -29
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/EstimatedTimeAndFees.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/LazyBuyScreen.js +0 -11
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/LazyBuyScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js +0 -28
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayTokenIcon.js +0 -26
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayTokenIcon.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js +0 -58
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/Stepper.js +0 -59
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/Stepper.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +0 -118
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js +0 -32
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +0 -108
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +0 -45
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +0 -532
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js +0 -21
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +0 -39
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +0 -134
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/openOnRamppopup.js +0 -11
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/openOnRamppopup.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +0 -106
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js +0 -23
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js +0 -50
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js +0 -68
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +0 -225
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ErrorText.js +0 -12
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ErrorText.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +0 -39
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +0 -55
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +0 -49
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js +0 -176
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +0 -69
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js +0 -34
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +0 -194
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +0 -344
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +0 -15
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js +0 -198
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js +0 -15
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.js +0 -54
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.js.map +0 -1
- package/dist/cjs/react/web/ui/components/Drawer.js +0 -123
- package/dist/cjs/react/web/ui/components/Drawer.js.map +0 -1
- package/dist/cjs/react/web/ui/components/StepBar.js +0 -16
- package/dist/cjs/react/web/ui/components/StepBar.js.map +0 -1
- package/dist/cjs/react/web/ui/components/SwitchNetwork.js +0 -19
- package/dist/cjs/react/web/ui/components/SwitchNetwork.js.map +0 -1
- package/dist/cjs/react/web/ui/components/token/TokenRow.js +0 -43
- package/dist/cjs/react/web/ui/components/token/TokenRow.js.map +0 -1
- package/dist/cjs/react/web/utils/errors.js +0 -44
- package/dist/cjs/react/web/utils/errors.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +0 -465
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +0 -113
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/EstimatedTimeAndFees.js +0 -26
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/EstimatedTimeAndFees.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/LazyBuyScreen.js +0 -8
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/LazyBuyScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js +0 -24
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayTokenIcon.js +0 -23
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayTokenIcon.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js +0 -55
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/Stepper.js +0 -55
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/Stepper.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +0 -115
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js +0 -29
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +0 -105
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +0 -42
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +0 -529
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js +0 -18
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +0 -36
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +0 -129
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/openOnRamppopup.js +0 -8
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/openOnRamppopup.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +0 -103
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js +0 -20
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js +0 -47
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js +0 -65
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +0 -221
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ErrorText.js +0 -9
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ErrorText.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +0 -35
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +0 -52
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +0 -46
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js +0 -173
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +0 -66
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js +0 -31
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +0 -191
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +0 -341
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +0 -12
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js +0 -195
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js +0 -11
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.js +0 -51
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.js.map +0 -1
- package/dist/esm/react/web/ui/components/Drawer.js +0 -119
- package/dist/esm/react/web/ui/components/Drawer.js.map +0 -1
- package/dist/esm/react/web/ui/components/StepBar.js +0 -13
- package/dist/esm/react/web/ui/components/StepBar.js.map +0 -1
- package/dist/esm/react/web/ui/components/SwitchNetwork.js +0 -16
- package/dist/esm/react/web/ui/components/SwitchNetwork.js.map +0 -1
- package/dist/esm/react/web/ui/components/token/TokenRow.js +0 -40
- package/dist/esm/react/web/ui/components/token/TokenRow.js.map +0 -1
- package/dist/esm/react/web/utils/errors.js +0 -41
- package/dist/esm/react/web/utils/errors.js.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts +0 -26
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts +0 -18
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/EstimatedTimeAndFees.d.ts +0 -6
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/EstimatedTimeAndFees.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/LazyBuyScreen.d.ts +0 -3
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/LazyBuyScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.d.ts +0 -12
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayTokenIcon.d.ts +0 -14
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayTokenIcon.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.d.ts +0 -16
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/Stepper.d.ts +0 -10
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/Stepper.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts +0 -18
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.d.ts +0 -6
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts +0 -26
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts +0 -8
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.d.ts +0 -20
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.d.ts +0 -10
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts +0 -15
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +0 -55
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/openOnRamppopup.d.ts +0 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/openOnRamppopup.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts +0 -14
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.d.ts +0 -10
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.d.ts +0 -16
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.d.ts +0 -18
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts +0 -32
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ErrorText.d.ts +0 -5
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ErrorText.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.d.ts +0 -15
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts +0 -23
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts +0 -21
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.d.ts +0 -32
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts +0 -18
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.d.ts +0 -15
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.d.ts +0 -22
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts +0 -25
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts +0 -26
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.d.ts +0 -25
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.d.ts +0 -14
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.d.ts +0 -6
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.d.ts.map +0 -1
- package/dist/types/react/web/ui/components/Drawer.d.ts +0 -25
- package/dist/types/react/web/ui/components/Drawer.d.ts.map +0 -1
- package/dist/types/react/web/ui/components/StepBar.d.ts +0 -5
- package/dist/types/react/web/ui/components/StepBar.d.ts.map +0 -1
- package/dist/types/react/web/ui/components/SwitchNetwork.d.ts +0 -6
- package/dist/types/react/web/ui/components/SwitchNetwork.d.ts.map +0 -1
- package/dist/types/react/web/ui/components/token/TokenRow.d.ts +0 -14
- package/dist/types/react/web/ui/components/token/TokenRow.d.ts.map +0 -1
- package/dist/types/react/web/utils/errors.d.ts +0 -8
- package/dist/types/react/web/utils/errors.d.ts.map +0 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +0 -1075
- package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +0 -286
- package/src/react/web/ui/ConnectWallet/screens/Buy/EstimatedTimeAndFees.tsx +0 -85
- package/src/react/web/ui/ConnectWallet/screens/Buy/LazyBuyScreen.tsx +0 -13
- package/src/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.tsx +0 -68
- package/src/react/web/ui/ConnectWallet/screens/Buy/PayTokenIcon.tsx +0 -48
- package/src/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.tsx +0 -104
- package/src/react/web/ui/ConnectWallet/screens/Buy/Stepper.tsx +0 -91
- package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +0 -395
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.tsx +0 -61
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +0 -263
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +0 -85
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +0 -775
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.tsx +0 -54
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.ts +0 -65
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +0 -193
- package/src/react/web/ui/ConnectWallet/screens/Buy/openOnRamppopup.tsx +0 -12
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +0 -294
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.tsx +0 -56
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.test.ts +0 -80
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.ts +0 -77
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.tsx +0 -154
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +0 -377
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ErrorText.tsx +0 -20
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.tsx +0 -109
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +0 -114
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.tsx +0 -117
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx +0 -359
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +0 -232
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.tsx +0 -111
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.tsx +0 -448
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +0 -558
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.tsx +0 -56
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.tsx +0 -282
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.ts +0 -23
- package/src/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.tsx +0 -61
- package/src/react/web/ui/components/Drawer.tsx +0 -171
- package/src/react/web/ui/components/StepBar.tsx +0 -25
- package/src/react/web/ui/components/SwitchNetwork.tsx +0 -35
- package/src/react/web/ui/components/token/TokenRow.tsx +0 -135
- package/src/react/web/utils/errors.ts +0 -52
@@ -1,775 +0,0 @@
|
|
1
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
2
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
3
|
-
import { trackPayEvent } from "../../../../../../../analytics/track/pay.js";
|
4
|
-
import { getCachedChain } from "../../../../../../../chains/utils.js";
|
5
|
-
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
6
|
-
import { getContract } from "../../../../../../../contract/contract.js";
|
7
|
-
import { allowance } from "../../../../../../../extensions/erc20/__generated__/IERC20/read/allowance.js";
|
8
|
-
import { approve } from "../../../../../../../extensions/erc20/write/approve.js";
|
9
|
-
import { getBuyWithCryptoQuote } from "../../../../../../../pay/buyWithCrypto/getQuote.js";
|
10
|
-
import type { BuyWithCryptoStatus } from "../../../../../../../pay/buyWithCrypto/getStatus.js";
|
11
|
-
import type { BuyWithFiatQuote } from "../../../../../../../pay/buyWithFiat/getQuote.js";
|
12
|
-
import {
|
13
|
-
type BuyWithFiatStatus,
|
14
|
-
getBuyWithFiatStatus,
|
15
|
-
} from "../../../../../../../pay/buyWithFiat/getStatus.js";
|
16
|
-
import {
|
17
|
-
getOnRampSteps,
|
18
|
-
type OnRampStep,
|
19
|
-
} from "../../../../../../../pay/buyWithFiat/isSwapRequiredPostOnramp.js";
|
20
|
-
import type { PayTokenInfo } from "../../../../../../../pay/utils/commonTypes.js";
|
21
|
-
import { sendBatchTransaction } from "../../../../../../../transaction/actions/send-batch-transaction.js";
|
22
|
-
import { sendTransaction } from "../../../../../../../transaction/actions/send-transaction.js";
|
23
|
-
import type { WaitForReceiptOptions } from "../../../../../../../transaction/actions/wait-for-tx-receipt.js";
|
24
|
-
import { waitForReceipt } from "../../../../../../../transaction/actions/wait-for-tx-receipt.js";
|
25
|
-
import { formatNumber } from "../../../../../../../utils/formatNumber.js";
|
26
|
-
import { isInAppSigner } from "../../../../../../../wallets/in-app/core/wallet/is-in-app-signer.js";
|
27
|
-
import { spacing } from "../../../../../../core/design-system/index.js";
|
28
|
-
import { useChainName } from "../../../../../../core/hooks/others/useChainQuery.js";
|
29
|
-
import { useBuyWithCryptoStatus } from "../../../../../../core/hooks/pay/useBuyWithCryptoStatus.js";
|
30
|
-
import { useBuyWithFiatStatus } from "../../../../../../core/hooks/pay/useBuyWithFiatStatus.js";
|
31
|
-
import { useConnectedWallets } from "../../../../../../core/hooks/wallets/useConnectedWallets.js";
|
32
|
-
import { invalidateWalletBalance } from "../../../../../../core/providers/invalidateWalletBalance.js";
|
33
|
-
import { Container, ModalHeader } from "../../../../components/basic.js";
|
34
|
-
import { Button } from "../../../../components/buttons.js";
|
35
|
-
import { Spacer } from "../../../../components/Spacer.js";
|
36
|
-
import { Spinner } from "../../../../components/Spinner.js";
|
37
|
-
import { SwitchNetworkButton } from "../../../../components/SwitchNetwork.js";
|
38
|
-
import { Text } from "../../../../components/text.js";
|
39
|
-
import { TokenSymbol } from "../../../../components/token/TokenSymbol.js";
|
40
|
-
import { openOnrampPopup } from "../openOnRamppopup.js";
|
41
|
-
import { PayTokenIcon } from "../PayTokenIcon.js";
|
42
|
-
import type { FiatStatusMeta } from "../pay-transactions/statusMeta.js";
|
43
|
-
import { addPendingTx } from "../swap/pendingSwapTx.js";
|
44
|
-
import { StepConnectorArrow } from "../swap/StepConnector.js";
|
45
|
-
import { WalletRow } from "../swap/WalletRow.js";
|
46
|
-
import type { PayerInfo } from "../types.js";
|
47
|
-
import { getProviderLabel } from "../utils.js";
|
48
|
-
import { StepContainer } from "./FiatSteps.js";
|
49
|
-
|
50
|
-
type OnRampScreenState = {
|
51
|
-
steps: Array<{
|
52
|
-
index: number;
|
53
|
-
step: OnRampStep;
|
54
|
-
status: FiatStatusMeta["progressStatus"];
|
55
|
-
}>;
|
56
|
-
handleContinue: () => void;
|
57
|
-
isLoading: boolean;
|
58
|
-
isDone: boolean;
|
59
|
-
isFailed: boolean;
|
60
|
-
};
|
61
|
-
|
62
|
-
export function OnRampScreen(props: {
|
63
|
-
title: string;
|
64
|
-
quote: BuyWithFiatQuote;
|
65
|
-
onBack: () => void;
|
66
|
-
client: ThirdwebClient;
|
67
|
-
testMode: boolean;
|
68
|
-
theme: "light" | "dark";
|
69
|
-
onDone: () => void;
|
70
|
-
transactionMode: boolean;
|
71
|
-
isEmbed: boolean;
|
72
|
-
payer: PayerInfo;
|
73
|
-
onSuccess: (status: BuyWithFiatStatus) => void;
|
74
|
-
receiverAddress: string;
|
75
|
-
paymentLinkId?: string;
|
76
|
-
}) {
|
77
|
-
const connectedWallets = useConnectedWallets();
|
78
|
-
const isAutoMode = isInAppSigner({
|
79
|
-
connectedWallets,
|
80
|
-
wallet: props.payer.wallet,
|
81
|
-
});
|
82
|
-
const state = useOnRampScreenState({
|
83
|
-
client: props.client,
|
84
|
-
isAutoMode,
|
85
|
-
onDone: props.onDone,
|
86
|
-
onSuccess: props.onSuccess,
|
87
|
-
payer: props.payer,
|
88
|
-
paymentLinkId: props.paymentLinkId,
|
89
|
-
quote: props.quote,
|
90
|
-
theme: props.theme,
|
91
|
-
});
|
92
|
-
const firstStepChainId = state.steps[0]?.step.token.chainId;
|
93
|
-
return (
|
94
|
-
<Container p="lg">
|
95
|
-
<ModalHeader onBack={props.onBack} title={props.title} />
|
96
|
-
<Spacer y="xl" />
|
97
|
-
<Container
|
98
|
-
center="y"
|
99
|
-
flex="column"
|
100
|
-
gap="xs"
|
101
|
-
style={{
|
102
|
-
paddingLeft: spacing.md,
|
103
|
-
}}
|
104
|
-
>
|
105
|
-
<WalletRow
|
106
|
-
address={props.receiverAddress}
|
107
|
-
client={props.client}
|
108
|
-
iconSize="md"
|
109
|
-
label="Recipient wallet"
|
110
|
-
textSize="sm"
|
111
|
-
/>
|
112
|
-
</Container>
|
113
|
-
<Spacer y="md" />
|
114
|
-
<Container flex="column">
|
115
|
-
{state.steps.map(({ step, status }, index) => (
|
116
|
-
<Container flex="column" key={step.action}>
|
117
|
-
<StepContainer
|
118
|
-
index={index}
|
119
|
-
state={status}
|
120
|
-
style={{
|
121
|
-
flex: "1",
|
122
|
-
}}
|
123
|
-
>
|
124
|
-
<StepUI
|
125
|
-
client={props.client}
|
126
|
-
index={index}
|
127
|
-
payer={props.payer}
|
128
|
-
step={step}
|
129
|
-
/>
|
130
|
-
</StepContainer>
|
131
|
-
{index < state.steps.length - 1 && <StepConnectorArrow />}
|
132
|
-
</Container>
|
133
|
-
))}
|
134
|
-
</Container>
|
135
|
-
|
136
|
-
<Spacer y="md" />
|
137
|
-
|
138
|
-
<Text
|
139
|
-
center
|
140
|
-
color="secondaryText"
|
141
|
-
size="xs"
|
142
|
-
style={{ padding: `0 ${spacing.xl}` }}
|
143
|
-
>
|
144
|
-
Keep this window open until all transactions are complete.
|
145
|
-
</Text>
|
146
|
-
|
147
|
-
<Spacer y="lg" />
|
148
|
-
|
149
|
-
<Container flex="column" gap="md">
|
150
|
-
{!state.isDone &&
|
151
|
-
firstStepChainId &&
|
152
|
-
firstStepChainId !== props.payer.chain.id ? (
|
153
|
-
<SwitchNetworkButton
|
154
|
-
fullWidth
|
155
|
-
switchChain={async () => {
|
156
|
-
await props.payer.wallet.switchChain(
|
157
|
-
getCachedChain(firstStepChainId),
|
158
|
-
);
|
159
|
-
}}
|
160
|
-
variant="accent"
|
161
|
-
/>
|
162
|
-
) : (
|
163
|
-
<Button
|
164
|
-
disabled={state.isLoading}
|
165
|
-
fullWidth
|
166
|
-
gap="sm"
|
167
|
-
onClick={state.handleContinue}
|
168
|
-
variant="accent"
|
169
|
-
>
|
170
|
-
{state.isLoading
|
171
|
-
? "Processing"
|
172
|
-
: state.isDone
|
173
|
-
? props.transactionMode
|
174
|
-
? "Continue Transaction"
|
175
|
-
: "Done"
|
176
|
-
: state.isFailed
|
177
|
-
? "Retry"
|
178
|
-
: "Continue"}
|
179
|
-
{state.isLoading && <Spinner color="primaryText" size="sm" />}
|
180
|
-
</Button>
|
181
|
-
)}
|
182
|
-
</Container>
|
183
|
-
</Container>
|
184
|
-
);
|
185
|
-
}
|
186
|
-
|
187
|
-
function StepUI(props: {
|
188
|
-
step: OnRampStep;
|
189
|
-
index: number;
|
190
|
-
client: ThirdwebClient;
|
191
|
-
payer: PayerInfo;
|
192
|
-
}) {
|
193
|
-
const { step, client } = props;
|
194
|
-
const chain = useChainName(getCachedChain(step.token.chainId));
|
195
|
-
return (
|
196
|
-
<Container flex="column" gap="xs" py="3xs">
|
197
|
-
<Container
|
198
|
-
center="y"
|
199
|
-
flex="row"
|
200
|
-
gap="sm"
|
201
|
-
style={{
|
202
|
-
display: "flex",
|
203
|
-
flexWrap: "nowrap",
|
204
|
-
justifyContent: "space-between",
|
205
|
-
}}
|
206
|
-
>
|
207
|
-
<PayTokenIcon
|
208
|
-
chain={getCachedChain(step.token.chainId)}
|
209
|
-
client={client}
|
210
|
-
size="md"
|
211
|
-
token={{
|
212
|
-
address: step.token.tokenAddress,
|
213
|
-
}}
|
214
|
-
/>
|
215
|
-
<Container center="y" flex="column" gap="3xs" style={{ flex: "1" }}>
|
216
|
-
<Text color="primaryText" size="sm">
|
217
|
-
{getProviderLabel(step.action)}
|
218
|
-
</Text>
|
219
|
-
|
220
|
-
<Container
|
221
|
-
center="y"
|
222
|
-
flex="row"
|
223
|
-
gap="xs"
|
224
|
-
style={{
|
225
|
-
display: "flex",
|
226
|
-
flexWrap: "nowrap",
|
227
|
-
justifyContent: "space-between",
|
228
|
-
}}
|
229
|
-
>
|
230
|
-
<Container
|
231
|
-
center="y"
|
232
|
-
flex="row"
|
233
|
-
gap="xxs"
|
234
|
-
style={{
|
235
|
-
flex: "1 1 60%",
|
236
|
-
flexWrap: "nowrap",
|
237
|
-
maxWidth: "60%",
|
238
|
-
minWidth: 0,
|
239
|
-
overflow: "hidden",
|
240
|
-
}}
|
241
|
-
>
|
242
|
-
<Text color="primaryText" size="sm">
|
243
|
-
{formatNumber(Number(step.amount), 5)}
|
244
|
-
</Text>
|
245
|
-
<TokenSymbol
|
246
|
-
chain={getCachedChain(step.token.chainId)}
|
247
|
-
color="secondaryText"
|
248
|
-
size="sm"
|
249
|
-
token={{
|
250
|
-
address: step.token.tokenAddress,
|
251
|
-
name: step.token.name || "",
|
252
|
-
symbol: step.token.symbol || "",
|
253
|
-
}}
|
254
|
-
/>
|
255
|
-
</Container>
|
256
|
-
<Container
|
257
|
-
center="y"
|
258
|
-
flex="row"
|
259
|
-
gap="xs"
|
260
|
-
style={{
|
261
|
-
flex: "1 1 40%",
|
262
|
-
flexWrap: "nowrap",
|
263
|
-
justifyContent: "flex-end",
|
264
|
-
maxWidth: "40%",
|
265
|
-
minWidth: 0,
|
266
|
-
}}
|
267
|
-
>
|
268
|
-
<Text
|
269
|
-
size="xs"
|
270
|
-
style={{
|
271
|
-
overflow: "hidden",
|
272
|
-
textOverflow: "ellipsis",
|
273
|
-
whiteSpace: "nowrap",
|
274
|
-
}}
|
275
|
-
>
|
276
|
-
{chain.name}
|
277
|
-
</Text>
|
278
|
-
</Container>
|
279
|
-
</Container>
|
280
|
-
</Container>
|
281
|
-
</Container>
|
282
|
-
</Container>
|
283
|
-
);
|
284
|
-
}
|
285
|
-
|
286
|
-
function useOnRampScreenState(props: {
|
287
|
-
quote: BuyWithFiatQuote;
|
288
|
-
client: ThirdwebClient;
|
289
|
-
onSuccess: (status: BuyWithFiatStatus) => void;
|
290
|
-
onDone: () => void;
|
291
|
-
payer: PayerInfo;
|
292
|
-
theme: "light" | "dark";
|
293
|
-
isAutoMode?: boolean;
|
294
|
-
paymentLinkId?: string;
|
295
|
-
}): OnRampScreenState {
|
296
|
-
const onRampSteps = getOnRampSteps(props.quote);
|
297
|
-
const [currentStepIndex, setCurrentStepIndex] = useState(0);
|
298
|
-
const [swapTxHash, setSwapTxHash] = useState<{
|
299
|
-
hash: string;
|
300
|
-
chainId: number;
|
301
|
-
}>();
|
302
|
-
const [popupWindow, setPopupWindow] = useState<Window | null>(null);
|
303
|
-
|
304
|
-
// Track onramp status
|
305
|
-
const { uiStatus: fiatOnrampStatus } = useOnRampStatus({
|
306
|
-
client: props.client,
|
307
|
-
intentId: props.quote.intentId,
|
308
|
-
onSuccess: (status) => {
|
309
|
-
if (onRampSteps.length === 1) {
|
310
|
-
// If only one step, this is the final success
|
311
|
-
props.onSuccess(status);
|
312
|
-
} else {
|
313
|
-
// Move to next step (swap)
|
314
|
-
setCurrentStepIndex((prev) => prev + 1);
|
315
|
-
}
|
316
|
-
},
|
317
|
-
openedWindow: popupWindow,
|
318
|
-
});
|
319
|
-
|
320
|
-
// Get quote for current swap/bridge step if needed
|
321
|
-
const previousStep = onRampSteps[currentStepIndex - 1];
|
322
|
-
const currentStep = onRampSteps[currentStepIndex];
|
323
|
-
|
324
|
-
// Handle swap execution
|
325
|
-
const swapMutation = useSwapMutation({
|
326
|
-
client: props.client,
|
327
|
-
isFiatFlow: true,
|
328
|
-
payer: props.payer,
|
329
|
-
paymentLinkId: props.paymentLinkId,
|
330
|
-
});
|
331
|
-
|
332
|
-
// Track swap status
|
333
|
-
const { uiStatus: swapStatus } = useSwapStatus({
|
334
|
-
chainId: swapTxHash?.chainId,
|
335
|
-
client: props.client,
|
336
|
-
onSuccess: () => {
|
337
|
-
if (currentStepIndex === onRampSteps.length - 1) {
|
338
|
-
// Last step completed - call final success
|
339
|
-
getBuyWithFiatStatus({
|
340
|
-
client: props.client,
|
341
|
-
intentId: props.quote.intentId,
|
342
|
-
}).then(props.onSuccess);
|
343
|
-
} else {
|
344
|
-
// Reset swap state before moving to next step
|
345
|
-
setSwapTxHash(undefined);
|
346
|
-
swapMutation.reset();
|
347
|
-
// Move to next step
|
348
|
-
setCurrentStepIndex((prev) => prev + 1);
|
349
|
-
}
|
350
|
-
},
|
351
|
-
transactionHash: swapTxHash?.hash,
|
352
|
-
});
|
353
|
-
|
354
|
-
// Map steps to their current status
|
355
|
-
const steps = onRampSteps.map((step, index) => {
|
356
|
-
let status: FiatStatusMeta["progressStatus"] = "unknown";
|
357
|
-
|
358
|
-
if (index === 0) {
|
359
|
-
// First step (onramp) status
|
360
|
-
status = fiatOnrampStatus;
|
361
|
-
} else if (index < currentStepIndex) {
|
362
|
-
// Previous steps are completed
|
363
|
-
status = "completed";
|
364
|
-
} else if (index === currentStepIndex) {
|
365
|
-
// Current step - could be swap or bridge
|
366
|
-
if (swapMutation.isPending) {
|
367
|
-
status = "pending";
|
368
|
-
} else if (swapMutation.error) {
|
369
|
-
status = "failed";
|
370
|
-
} else if (swapTxHash) {
|
371
|
-
status = swapStatus;
|
372
|
-
} else {
|
373
|
-
status = "actionRequired";
|
374
|
-
}
|
375
|
-
}
|
376
|
-
|
377
|
-
return {
|
378
|
-
index,
|
379
|
-
status,
|
380
|
-
step,
|
381
|
-
};
|
382
|
-
});
|
383
|
-
|
384
|
-
const isLoading = steps.some((step) => step.status === "pending");
|
385
|
-
const isDone = steps.every((step) => step.status === "completed");
|
386
|
-
const isFailed = steps.some((step) => step.status === "failed");
|
387
|
-
|
388
|
-
// Update handleContinue to handle done state
|
389
|
-
const handleContinue = useCallback(async () => {
|
390
|
-
if (isDone) {
|
391
|
-
props.onDone();
|
392
|
-
return;
|
393
|
-
}
|
394
|
-
|
395
|
-
if (currentStepIndex === 0) {
|
396
|
-
// First step - open onramp popup
|
397
|
-
const popup = openOnrampPopup(props.quote.onRampLink, props.theme);
|
398
|
-
trackPayEvent({
|
399
|
-
amountWei: props.quote.onRampToken.amountWei,
|
400
|
-
client: props.client,
|
401
|
-
event: "open_onramp_popup",
|
402
|
-
toChainId: props.quote.onRampToken.token.chainId,
|
403
|
-
toToken: props.quote.onRampToken.token.tokenAddress,
|
404
|
-
walletAddress: props.payer.account.address,
|
405
|
-
walletType: props.payer.wallet.id,
|
406
|
-
});
|
407
|
-
setPopupWindow(popup);
|
408
|
-
addPendingTx({
|
409
|
-
intentId: props.quote.intentId,
|
410
|
-
type: "fiat",
|
411
|
-
});
|
412
|
-
} else if (previousStep && currentStep && !swapTxHash) {
|
413
|
-
// Execute swap/bridge
|
414
|
-
try {
|
415
|
-
const result = await swapMutation.mutateAsync({
|
416
|
-
amount: currentStep.amount,
|
417
|
-
fromToken: previousStep.token,
|
418
|
-
toToken: currentStep.token,
|
419
|
-
});
|
420
|
-
setSwapTxHash({
|
421
|
-
chainId: result.chainId,
|
422
|
-
hash: result.transactionHash,
|
423
|
-
});
|
424
|
-
} catch (e) {
|
425
|
-
console.error("Failed to execute swap:", e);
|
426
|
-
}
|
427
|
-
} else if (isFailed) {
|
428
|
-
// retry the quote step
|
429
|
-
setSwapTxHash(undefined);
|
430
|
-
swapMutation.reset();
|
431
|
-
}
|
432
|
-
}, [
|
433
|
-
isDone,
|
434
|
-
currentStepIndex,
|
435
|
-
swapTxHash,
|
436
|
-
props.quote,
|
437
|
-
props.onDone,
|
438
|
-
swapMutation,
|
439
|
-
props.theme,
|
440
|
-
isFailed,
|
441
|
-
swapMutation.reset,
|
442
|
-
props.client,
|
443
|
-
props.payer.account.address,
|
444
|
-
props.payer.wallet.id,
|
445
|
-
currentStep,
|
446
|
-
previousStep,
|
447
|
-
]);
|
448
|
-
|
449
|
-
// Auto-progress effect
|
450
|
-
useEffect(() => {
|
451
|
-
if (!props.isAutoMode) {
|
452
|
-
return;
|
453
|
-
}
|
454
|
-
|
455
|
-
// Auto-start next swap step when previous step completes
|
456
|
-
if (
|
457
|
-
!isLoading &&
|
458
|
-
!isDone &&
|
459
|
-
!isFailed &&
|
460
|
-
currentStepIndex > 0 &&
|
461
|
-
currentStepIndex < onRampSteps.length &&
|
462
|
-
!swapTxHash
|
463
|
-
) {
|
464
|
-
handleContinue();
|
465
|
-
}
|
466
|
-
}, [
|
467
|
-
props.isAutoMode,
|
468
|
-
currentStepIndex,
|
469
|
-
swapTxHash,
|
470
|
-
onRampSteps.length,
|
471
|
-
handleContinue,
|
472
|
-
isDone,
|
473
|
-
isFailed,
|
474
|
-
isLoading,
|
475
|
-
]);
|
476
|
-
|
477
|
-
return {
|
478
|
-
handleContinue,
|
479
|
-
isDone,
|
480
|
-
isFailed,
|
481
|
-
isLoading,
|
482
|
-
steps,
|
483
|
-
};
|
484
|
-
}
|
485
|
-
|
486
|
-
function useOnRampStatus(props: {
|
487
|
-
intentId: string;
|
488
|
-
client: ThirdwebClient;
|
489
|
-
onSuccess: (status: BuyWithFiatStatus) => void;
|
490
|
-
openedWindow: Window | null;
|
491
|
-
}) {
|
492
|
-
const queryClient = useQueryClient();
|
493
|
-
const statusQuery = useBuyWithFiatStatus({
|
494
|
-
client: props.client,
|
495
|
-
intentId: props.intentId,
|
496
|
-
queryOptions: {
|
497
|
-
enabled: !!props.openedWindow,
|
498
|
-
},
|
499
|
-
});
|
500
|
-
let uiStatus: FiatStatusMeta["progressStatus"] = "actionRequired";
|
501
|
-
|
502
|
-
switch (statusQuery.data?.status) {
|
503
|
-
case "ON_RAMP_TRANSFER_COMPLETED":
|
504
|
-
uiStatus = "completed";
|
505
|
-
break;
|
506
|
-
case "PAYMENT_FAILED":
|
507
|
-
uiStatus = "failed";
|
508
|
-
break;
|
509
|
-
case "PENDING_PAYMENT":
|
510
|
-
uiStatus = "pending";
|
511
|
-
break;
|
512
|
-
default:
|
513
|
-
uiStatus = "actionRequired";
|
514
|
-
break;
|
515
|
-
}
|
516
|
-
|
517
|
-
const purchaseCbCalled = useRef(false);
|
518
|
-
useEffect(() => {
|
519
|
-
if (purchaseCbCalled.current || !props.onSuccess) {
|
520
|
-
return;
|
521
|
-
}
|
522
|
-
|
523
|
-
if (statusQuery.data && uiStatus === "completed") {
|
524
|
-
purchaseCbCalled.current = true;
|
525
|
-
props.onSuccess(statusQuery.data);
|
526
|
-
}
|
527
|
-
}, [props.onSuccess, statusQuery.data, uiStatus]);
|
528
|
-
|
529
|
-
// close the onramp popup if onramp is completed
|
530
|
-
useEffect(() => {
|
531
|
-
if (!props.openedWindow) {
|
532
|
-
return;
|
533
|
-
}
|
534
|
-
|
535
|
-
if (uiStatus === "completed") {
|
536
|
-
try {
|
537
|
-
if (props.openedWindow && !props.openedWindow.closed) {
|
538
|
-
props.openedWindow.close();
|
539
|
-
}
|
540
|
-
} catch (e) {
|
541
|
-
console.warn("Failed to close payment window:", e);
|
542
|
-
}
|
543
|
-
}
|
544
|
-
}, [props.openedWindow, uiStatus]);
|
545
|
-
|
546
|
-
// invalidate wallet balance when onramp is completed
|
547
|
-
const invalidatedBalance = useRef(false);
|
548
|
-
useEffect(() => {
|
549
|
-
if (!invalidatedBalance.current && uiStatus === "completed") {
|
550
|
-
invalidatedBalance.current = true;
|
551
|
-
invalidateWalletBalance(queryClient);
|
552
|
-
}
|
553
|
-
}, [uiStatus, queryClient]);
|
554
|
-
|
555
|
-
return { uiStatus };
|
556
|
-
}
|
557
|
-
|
558
|
-
function useSwapStatus(props: {
|
559
|
-
client: ThirdwebClient;
|
560
|
-
transactionHash?: string;
|
561
|
-
chainId?: number;
|
562
|
-
onSuccess: (status: BuyWithCryptoStatus) => void;
|
563
|
-
}) {
|
564
|
-
const swapStatus = useBuyWithCryptoStatus(
|
565
|
-
props.transactionHash && props.chainId
|
566
|
-
? {
|
567
|
-
chainId: props.chainId,
|
568
|
-
client: props.client,
|
569
|
-
transactionHash: props.transactionHash,
|
570
|
-
}
|
571
|
-
: undefined,
|
572
|
-
);
|
573
|
-
|
574
|
-
let uiStatus: FiatStatusMeta["progressStatus"] = "unknown";
|
575
|
-
|
576
|
-
switch (swapStatus.data?.status) {
|
577
|
-
case "COMPLETED":
|
578
|
-
uiStatus = "completed";
|
579
|
-
break;
|
580
|
-
case "FAILED":
|
581
|
-
uiStatus = "failed";
|
582
|
-
break;
|
583
|
-
case "PENDING":
|
584
|
-
case "NOT_FOUND":
|
585
|
-
uiStatus = "pending";
|
586
|
-
break;
|
587
|
-
case "NONE":
|
588
|
-
uiStatus = "unknown";
|
589
|
-
break;
|
590
|
-
default:
|
591
|
-
uiStatus = "unknown";
|
592
|
-
break;
|
593
|
-
}
|
594
|
-
|
595
|
-
const purchaseCbCalled = useRef(false);
|
596
|
-
useEffect(() => {
|
597
|
-
if (purchaseCbCalled.current || !props.onSuccess) {
|
598
|
-
return;
|
599
|
-
}
|
600
|
-
|
601
|
-
if (swapStatus.data?.status === "COMPLETED") {
|
602
|
-
purchaseCbCalled.current = true;
|
603
|
-
props.onSuccess(swapStatus.data);
|
604
|
-
}
|
605
|
-
}, [props.onSuccess, swapStatus]);
|
606
|
-
|
607
|
-
const queryClient = useQueryClient();
|
608
|
-
const balanceInvalidated = useRef(false);
|
609
|
-
useEffect(() => {
|
610
|
-
if (uiStatus === "completed" && !balanceInvalidated.current) {
|
611
|
-
balanceInvalidated.current = true;
|
612
|
-
invalidateWalletBalance(queryClient);
|
613
|
-
}
|
614
|
-
}, [queryClient, uiStatus]);
|
615
|
-
|
616
|
-
return { uiStatus };
|
617
|
-
}
|
618
|
-
|
619
|
-
function useSwapMutation(props: {
|
620
|
-
client: ThirdwebClient;
|
621
|
-
payer: PayerInfo;
|
622
|
-
isFiatFlow: boolean;
|
623
|
-
paymentLinkId?: string;
|
624
|
-
}) {
|
625
|
-
const queryClient = useQueryClient();
|
626
|
-
return useMutation({
|
627
|
-
mutationFn: async (input: {
|
628
|
-
fromToken: PayTokenInfo;
|
629
|
-
toToken: PayTokenInfo;
|
630
|
-
amount: string;
|
631
|
-
}) => {
|
632
|
-
const { fromToken, toToken, amount } = input;
|
633
|
-
const wallet = props.payer.wallet;
|
634
|
-
|
635
|
-
// in case the wallet is not on the same chain as the fromToken, switch to it
|
636
|
-
if (wallet.getChain()?.id !== fromToken.chainId) {
|
637
|
-
await wallet.switchChain(getCachedChain(fromToken.chainId));
|
638
|
-
}
|
639
|
-
|
640
|
-
const account = wallet.getAccount();
|
641
|
-
|
642
|
-
if (!account) {
|
643
|
-
throw new Error("Payer wallet has no account");
|
644
|
-
}
|
645
|
-
|
646
|
-
// always get a fresh quote before executing
|
647
|
-
const quote = await getBuyWithCryptoQuote({
|
648
|
-
client: props.client,
|
649
|
-
fromAddress: account.address,
|
650
|
-
fromChainId: fromToken.chainId,
|
651
|
-
fromTokenAddress: fromToken.tokenAddress,
|
652
|
-
paymentLinkId: props.paymentLinkId,
|
653
|
-
toAddress: account.address,
|
654
|
-
toAmount: amount,
|
655
|
-
toChainId: toToken.chainId,
|
656
|
-
toTokenAddress: toToken.tokenAddress,
|
657
|
-
});
|
658
|
-
|
659
|
-
const canBatch = account.sendBatchTransaction;
|
660
|
-
const tokenContract = getContract({
|
661
|
-
address: quote.swapDetails.fromToken.tokenAddress,
|
662
|
-
chain: getCachedChain(quote.swapDetails.fromToken.chainId),
|
663
|
-
client: props.client,
|
664
|
-
});
|
665
|
-
const approveTxRequired =
|
666
|
-
quote.approvalData &&
|
667
|
-
(await allowance({
|
668
|
-
contract: tokenContract,
|
669
|
-
owner: account.address,
|
670
|
-
spender: quote.approvalData.spenderAddress,
|
671
|
-
})) < BigInt(quote.approvalData.amountWei);
|
672
|
-
if (approveTxRequired && quote.approvalData && !canBatch) {
|
673
|
-
trackPayEvent({
|
674
|
-
amountWei: quote.swapDetails.fromAmountWei,
|
675
|
-
chainId: quote.swapDetails.fromToken.chainId,
|
676
|
-
client: props.client,
|
677
|
-
event: "prompt_swap_approval",
|
678
|
-
fromToken: quote.swapDetails.fromToken.tokenAddress,
|
679
|
-
toChainId: quote.swapDetails.toToken.chainId,
|
680
|
-
toToken: quote.swapDetails.toToken.tokenAddress,
|
681
|
-
walletAddress: account.address,
|
682
|
-
walletType: props.payer.wallet.id,
|
683
|
-
});
|
684
|
-
|
685
|
-
const transaction = approve({
|
686
|
-
amountWei: BigInt(quote.approvalData.amountWei),
|
687
|
-
contract: tokenContract,
|
688
|
-
spender: quote.approvalData.spenderAddress,
|
689
|
-
});
|
690
|
-
|
691
|
-
const tx = await sendTransaction({
|
692
|
-
account,
|
693
|
-
transaction,
|
694
|
-
});
|
695
|
-
|
696
|
-
await waitForReceipt({ ...tx, maxBlocksWaitTime: 50 });
|
697
|
-
|
698
|
-
trackPayEvent({
|
699
|
-
amountWei: quote.swapDetails.fromAmountWei,
|
700
|
-
chainId: quote.swapDetails.fromToken.chainId,
|
701
|
-
client: props.client,
|
702
|
-
event: "swap_approval_success",
|
703
|
-
fromToken: quote.swapDetails.fromToken.tokenAddress,
|
704
|
-
toChainId: quote.swapDetails.toToken.chainId,
|
705
|
-
toToken: quote.swapDetails.toToken.tokenAddress,
|
706
|
-
walletAddress: account.address,
|
707
|
-
walletType: props.payer.wallet.id,
|
708
|
-
});
|
709
|
-
}
|
710
|
-
|
711
|
-
trackPayEvent({
|
712
|
-
amountWei: quote.swapDetails.fromAmountWei,
|
713
|
-
chainId: quote.swapDetails.fromToken.chainId,
|
714
|
-
client: props.client,
|
715
|
-
event: "prompt_swap_execution",
|
716
|
-
fromToken: quote.swapDetails.fromToken.tokenAddress,
|
717
|
-
toChainId: quote.swapDetails.toToken.chainId,
|
718
|
-
toToken: quote.swapDetails.toToken.tokenAddress,
|
719
|
-
walletAddress: account.address,
|
720
|
-
walletType: props.payer.wallet.id,
|
721
|
-
});
|
722
|
-
const tx = quote.transactionRequest;
|
723
|
-
let _swapTx: WaitForReceiptOptions;
|
724
|
-
// check if we can batch approval and swap
|
725
|
-
if (canBatch && quote.approvalData && approveTxRequired) {
|
726
|
-
const approveTx = approve({
|
727
|
-
amountWei: BigInt(quote.approvalData.amountWei),
|
728
|
-
contract: tokenContract,
|
729
|
-
spender: quote.approvalData.spenderAddress,
|
730
|
-
});
|
731
|
-
|
732
|
-
_swapTx = await sendBatchTransaction({
|
733
|
-
account,
|
734
|
-
transactions: [approveTx, tx],
|
735
|
-
});
|
736
|
-
} else {
|
737
|
-
_swapTx = await sendTransaction({
|
738
|
-
account,
|
739
|
-
transaction: tx,
|
740
|
-
});
|
741
|
-
}
|
742
|
-
|
743
|
-
await waitForReceipt({ ..._swapTx, maxBlocksWaitTime: 50 });
|
744
|
-
|
745
|
-
trackPayEvent({
|
746
|
-
amountWei: quote.swapDetails.fromAmountWei,
|
747
|
-
chainId: quote.swapDetails.fromToken.chainId,
|
748
|
-
client: props.client,
|
749
|
-
event: "swap_execution_success",
|
750
|
-
fromToken: quote.swapDetails.fromToken.tokenAddress,
|
751
|
-
toChainId: quote.swapDetails.toToken.chainId,
|
752
|
-
toToken: quote.swapDetails.toToken.tokenAddress,
|
753
|
-
walletAddress: account.address,
|
754
|
-
walletType: props.payer.wallet.id,
|
755
|
-
});
|
756
|
-
|
757
|
-
// do not add pending tx if the swap is part of fiat flow
|
758
|
-
if (!props.isFiatFlow) {
|
759
|
-
addPendingTx({
|
760
|
-
chainId: _swapTx.chain.id,
|
761
|
-
txHash: _swapTx.transactionHash,
|
762
|
-
type: "swap",
|
763
|
-
});
|
764
|
-
}
|
765
|
-
|
766
|
-
return {
|
767
|
-
chainId: _swapTx.chain.id,
|
768
|
-
transactionHash: _swapTx.transactionHash,
|
769
|
-
};
|
770
|
-
},
|
771
|
-
onSuccess: () => {
|
772
|
-
invalidateWalletBalance(queryClient);
|
773
|
-
},
|
774
|
-
});
|
775
|
-
}
|