thirdweb 5.105.9 → 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/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/exports/chains.js +3 -1
- package/dist/cjs/exports/chains.js.map +1 -1
- package/dist/cjs/insight/common.js +0 -5
- 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 +6 -1
- 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/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/exports/chains.js +1 -0
- package/dist/esm/exports/chains.js.map +1 -1
- package/dist/esm/insight/common.js +0 -4
- 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 +6 -1
- 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/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/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/chains/chain-definitions/t-rex-testnet.ts +17 -0
- package/src/exports/chains.ts +1 -0
- package/src/insight/common.ts +0 -5
- 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 +8 -1
- 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,1075 +0,0 @@
|
|
1
|
-
import { useQueryClient } from "@tanstack/react-query";
|
2
|
-
import { useCallback, useMemo, useState } from "react";
|
3
|
-
import { trackPayEvent } from "../../../../../../analytics/track/pay.js";
|
4
|
-
import type { Chain } from "../../../../../../chains/types.js";
|
5
|
-
import { getCachedChain } from "../../../../../../chains/utils.js";
|
6
|
-
import type { ThirdwebClient } from "../../../../../../client/client.js";
|
7
|
-
import {
|
8
|
-
NATIVE_TOKEN_ADDRESS,
|
9
|
-
ZERO_ADDRESS,
|
10
|
-
} from "../../../../../../constants/addresses.js";
|
11
|
-
import type { BuyWithCryptoStatus } from "../../../../../../pay/buyWithCrypto/getStatus.js";
|
12
|
-
import type { BuyWithFiatStatus } from "../../../../../../pay/buyWithFiat/getStatus.js";
|
13
|
-
import { formatNumber } from "../../../../../../utils/formatNumber.js";
|
14
|
-
import type { Account } from "../../../../../../wallets/interfaces/wallet.js";
|
15
|
-
import type { WalletId } from "../../../../../../wallets/wallet-types.js";
|
16
|
-
import {
|
17
|
-
fontSize,
|
18
|
-
spacing,
|
19
|
-
type Theme,
|
20
|
-
} from "../../../../../core/design-system/index.js";
|
21
|
-
import type {
|
22
|
-
FundWalletOptions,
|
23
|
-
PayUIOptions,
|
24
|
-
} from "../../../../../core/hooks/connection/ConnectButtonProps.js";
|
25
|
-
import { useActiveAccount } from "../../../../../core/hooks/wallets/useActiveAccount.js";
|
26
|
-
import { invalidateWalletBalance } from "../../../../../core/providers/invalidateWalletBalance.js";
|
27
|
-
import type {
|
28
|
-
SupportedTokens,
|
29
|
-
TokenInfo,
|
30
|
-
} from "../../../../../core/utils/defaultTokens.js";
|
31
|
-
import { ErrorState } from "../../../../wallets/shared/ErrorState.js";
|
32
|
-
import { LoadingScreen } from "../../../../wallets/shared/LoadingScreen.js";
|
33
|
-
import { Container, Line, ModalHeader } from "../../../components/basic.js";
|
34
|
-
import { Button } from "../../../components/buttons.js";
|
35
|
-
import { ChainName } from "../../../components/ChainName.js";
|
36
|
-
import { Input } from "../../../components/formElements.js";
|
37
|
-
import { Spacer } from "../../../components/Spacer.js";
|
38
|
-
import { TokenSymbol } from "../../../components/token/TokenSymbol.js";
|
39
|
-
import type { PayEmbedConnectOptions } from "../../../PayEmbed.js";
|
40
|
-
import { ConnectButton } from "../../ConnectButton.js";
|
41
|
-
import type { ConnectLocale } from "../../locale/types.js";
|
42
|
-
import { ChainButton, NetworkSelectorContent } from "../../NetworkSelector.js";
|
43
|
-
import { PoweredByThirdweb } from "../../PoweredByTW.js";
|
44
|
-
import { type ERC20OrNativeToken, isNativeToken } from "../nativeToken.js";
|
45
|
-
import { TokenSelector } from "../TokenSelector.js";
|
46
|
-
import { WalletSwitcherConnectionScreen } from "../WalletSwitcherConnectionScreen.js";
|
47
|
-
import { DirectPaymentModeScreen } from "./DirectPaymentModeScreen.js";
|
48
|
-
import { CurrencySelection } from "./fiat/CurrencySelection.js";
|
49
|
-
import { FiatScreenContent } from "./fiat/FiatScreenContent.js";
|
50
|
-
import { OnRampScreen } from "./fiat/OnRampScreen.js";
|
51
|
-
import type { SelectedScreen } from "./main/types.js";
|
52
|
-
import {
|
53
|
-
type PaymentMethods,
|
54
|
-
useEnabledPaymentMethods,
|
55
|
-
} from "./main/useEnabledPaymentMethods.js";
|
56
|
-
import {
|
57
|
-
useFiatCurrencySelectionStates,
|
58
|
-
useFromTokenSelectionStates,
|
59
|
-
useToTokenSelectionStates,
|
60
|
-
} from "./main/useUISelectionStates.js";
|
61
|
-
import { PayTokenIcon } from "./PayTokenIcon.js";
|
62
|
-
import { BuyTokenInput } from "./swap/BuyTokenInput.js";
|
63
|
-
import { FiatValue } from "./swap/FiatValue.js";
|
64
|
-
import { useWalletsAndBalances } from "./swap/fetchBalancesForWallet.js";
|
65
|
-
import { SwapFlow } from "./swap/SwapFlow.js";
|
66
|
-
import { SwapScreenContent } from "./swap/SwapScreenContent.js";
|
67
|
-
import { TokenSelectorScreen } from "./swap/TokenSelectorScreen.js";
|
68
|
-
import { TransferFlow } from "./swap/TransferFlow.js";
|
69
|
-
import {
|
70
|
-
type SupportedChainAndTokens,
|
71
|
-
useBuySupportedDestinations,
|
72
|
-
useBuySupportedSources,
|
73
|
-
} from "./swap/useSwapSupportedChains.js";
|
74
|
-
import { TransactionModeScreen } from "./TransactionModeScreen.js";
|
75
|
-
import { usePayerSetup } from "./usePayerSetup.js";
|
76
|
-
|
77
|
-
export type BuyScreenProps = {
|
78
|
-
title: string;
|
79
|
-
onBack: (() => void) | undefined;
|
80
|
-
supportedTokens: SupportedTokens | undefined;
|
81
|
-
client: ThirdwebClient;
|
82
|
-
connectLocale: ConnectLocale;
|
83
|
-
payOptions: PayUIOptions;
|
84
|
-
theme: "light" | "dark" | Theme;
|
85
|
-
onDone: () => void;
|
86
|
-
connectOptions: PayEmbedConnectOptions | undefined;
|
87
|
-
hiddenWallets?: WalletId[];
|
88
|
-
isEmbed: boolean;
|
89
|
-
paymentLinkId?: string;
|
90
|
-
};
|
91
|
-
|
92
|
-
/**
|
93
|
-
* @internal
|
94
|
-
*/
|
95
|
-
export default function BuyScreen(props: BuyScreenProps) {
|
96
|
-
const isTestMode = props.payOptions.buyWithCrypto
|
97
|
-
? props.payOptions.buyWithCrypto.testMode
|
98
|
-
: undefined;
|
99
|
-
const supportedDestinationsQuery = useBuySupportedDestinations(
|
100
|
-
props.client,
|
101
|
-
isTestMode,
|
102
|
-
);
|
103
|
-
|
104
|
-
if (supportedDestinationsQuery.isError) {
|
105
|
-
return (
|
106
|
-
<Container
|
107
|
-
center="both"
|
108
|
-
flex="row"
|
109
|
-
fullHeight
|
110
|
-
style={{
|
111
|
-
minHeight: "350px",
|
112
|
-
}}
|
113
|
-
>
|
114
|
-
<ErrorState
|
115
|
-
onTryAgain={supportedDestinationsQuery.refetch}
|
116
|
-
title="Something went wrong"
|
117
|
-
/>
|
118
|
-
</Container>
|
119
|
-
);
|
120
|
-
}
|
121
|
-
|
122
|
-
if (!supportedDestinationsQuery.data) {
|
123
|
-
return <LoadingScreen />;
|
124
|
-
}
|
125
|
-
|
126
|
-
const supportedDestinations = props.supportedTokens
|
127
|
-
? Object.entries(props.supportedTokens).map(([chainId, tokens]) => ({
|
128
|
-
chain: getCachedChain(Number.parseInt(chainId)),
|
129
|
-
tokens: tokens.map((t) => ({
|
130
|
-
...t,
|
131
|
-
buyWithCryptoEnabled: true,
|
132
|
-
buyWithFiatEnabled: true,
|
133
|
-
})),
|
134
|
-
}))
|
135
|
-
: supportedDestinationsQuery.data;
|
136
|
-
|
137
|
-
return (
|
138
|
-
<BuyScreenContent
|
139
|
-
{...props}
|
140
|
-
supportedDestinations={supportedDestinations}
|
141
|
-
/>
|
142
|
-
);
|
143
|
-
}
|
144
|
-
|
145
|
-
type BuyScreenContentProps = {
|
146
|
-
title: string;
|
147
|
-
client: ThirdwebClient;
|
148
|
-
onBack?: () => void;
|
149
|
-
supportedTokens?: SupportedTokens;
|
150
|
-
supportedDestinations: SupportedChainAndTokens;
|
151
|
-
connectLocale: ConnectLocale;
|
152
|
-
theme: "light" | "dark" | Theme;
|
153
|
-
payOptions: PayUIOptions;
|
154
|
-
onDone: () => void;
|
155
|
-
hiddenWallets?: WalletId[];
|
156
|
-
connectOptions: PayEmbedConnectOptions | undefined;
|
157
|
-
isEmbed: boolean;
|
158
|
-
paymentLinkId?: string;
|
159
|
-
};
|
160
|
-
|
161
|
-
/**
|
162
|
-
* @internal
|
163
|
-
*/
|
164
|
-
function BuyScreenContent(props: BuyScreenContentProps) {
|
165
|
-
const { client, supportedDestinations, connectLocale, payOptions } = props;
|
166
|
-
|
167
|
-
const activeAccount = useActiveAccount();
|
168
|
-
const { payer, setPayer } = usePayerSetup();
|
169
|
-
|
170
|
-
const [screen, setScreen] = useState<SelectedScreen>({
|
171
|
-
id: "main",
|
172
|
-
});
|
173
|
-
|
174
|
-
const {
|
175
|
-
tokenAmount,
|
176
|
-
setTokenAmount,
|
177
|
-
toChain,
|
178
|
-
setToChain,
|
179
|
-
deferredTokenAmount,
|
180
|
-
toToken,
|
181
|
-
setToToken,
|
182
|
-
} = useToTokenSelectionStates({
|
183
|
-
payOptions,
|
184
|
-
supportedDestinations,
|
185
|
-
});
|
186
|
-
|
187
|
-
const [hasEditedAmount, setHasEditedAmount] = useState(false);
|
188
|
-
|
189
|
-
const onDone = useCallback(() => {
|
190
|
-
setScreen({ id: "main" });
|
191
|
-
props.onDone();
|
192
|
-
}, [props.onDone]);
|
193
|
-
|
194
|
-
// check if the screen is expanded or not
|
195
|
-
|
196
|
-
// update supportedSources whenever toToken or toChain is updated
|
197
|
-
const supportedSourcesQuery = useBuySupportedSources({
|
198
|
-
client: props.client,
|
199
|
-
destinationChainId: toChain.id,
|
200
|
-
destinationTokenAddress: isNativeToken(toToken)
|
201
|
-
? NATIVE_TOKEN_ADDRESS
|
202
|
-
: toToken.address,
|
203
|
-
});
|
204
|
-
|
205
|
-
const destinationSupportedTokens: SupportedTokens = useMemo(() => {
|
206
|
-
return createSupportedTokens(
|
207
|
-
supportedDestinations,
|
208
|
-
payOptions,
|
209
|
-
props.supportedTokens,
|
210
|
-
);
|
211
|
-
}, [props.supportedTokens, supportedDestinations, payOptions]);
|
212
|
-
|
213
|
-
const sourceSupportedTokens: SupportedTokens | undefined = useMemo(() => {
|
214
|
-
if (!supportedSourcesQuery.data) {
|
215
|
-
return undefined;
|
216
|
-
}
|
217
|
-
|
218
|
-
const supportedSources = supportedSourcesQuery.data;
|
219
|
-
|
220
|
-
return createSupportedTokens(
|
221
|
-
supportedSources,
|
222
|
-
payOptions,
|
223
|
-
props.supportedTokens,
|
224
|
-
);
|
225
|
-
}, [props.supportedTokens, supportedSourcesQuery.data, payOptions]);
|
226
|
-
|
227
|
-
// preload wallets and balances
|
228
|
-
useWalletsAndBalances({
|
229
|
-
client: props.client,
|
230
|
-
mode: payOptions.mode,
|
231
|
-
sourceSupportedTokens: sourceSupportedTokens || [],
|
232
|
-
toChain: toChain,
|
233
|
-
toToken: toToken,
|
234
|
-
});
|
235
|
-
|
236
|
-
const { fromChain, setFromChain, fromToken, setFromToken } =
|
237
|
-
useFromTokenSelectionStates({
|
238
|
-
payOptions,
|
239
|
-
supportedSources: supportedSourcesQuery.data || [],
|
240
|
-
});
|
241
|
-
|
242
|
-
const { selectedCurrency, setSelectedCurrency } =
|
243
|
-
useFiatCurrencySelectionStates({
|
244
|
-
payOptions,
|
245
|
-
});
|
246
|
-
|
247
|
-
const enabledPaymentMethods = useEnabledPaymentMethods({
|
248
|
-
payOptions: props.payOptions,
|
249
|
-
supportedDestinations: props.supportedDestinations,
|
250
|
-
toChain: toChain,
|
251
|
-
toToken: toToken,
|
252
|
-
});
|
253
|
-
|
254
|
-
const payDisabled =
|
255
|
-
enabledPaymentMethods.buyWithCryptoEnabled === false &&
|
256
|
-
enabledPaymentMethods.buyWithFiatEnabled === false;
|
257
|
-
|
258
|
-
// screens ----------------------------
|
259
|
-
|
260
|
-
const queryClient = useQueryClient();
|
261
|
-
|
262
|
-
const onSwapSuccess = useCallback(
|
263
|
-
(_status: BuyWithCryptoStatus) => {
|
264
|
-
props.payOptions.onPurchaseSuccess?.({
|
265
|
-
status: _status,
|
266
|
-
type: "crypto",
|
267
|
-
});
|
268
|
-
invalidateWalletBalance(queryClient);
|
269
|
-
},
|
270
|
-
[props.payOptions.onPurchaseSuccess, queryClient],
|
271
|
-
);
|
272
|
-
|
273
|
-
const onFiatSuccess = useCallback(
|
274
|
-
(_status: BuyWithFiatStatus) => {
|
275
|
-
props.payOptions.onPurchaseSuccess?.({
|
276
|
-
status: _status,
|
277
|
-
type: "fiat",
|
278
|
-
});
|
279
|
-
invalidateWalletBalance(queryClient);
|
280
|
-
},
|
281
|
-
[props.payOptions.onPurchaseSuccess, queryClient],
|
282
|
-
);
|
283
|
-
|
284
|
-
if (screen.id === "connect-payer-wallet") {
|
285
|
-
return (
|
286
|
-
<WalletSwitcherConnectionScreen
|
287
|
-
accountAbstraction={props.connectOptions?.accountAbstraction}
|
288
|
-
appMetadata={props.connectOptions?.appMetadata}
|
289
|
-
chain={toChain || props.connectOptions?.chain}
|
290
|
-
chains={[toChain, ...(props.connectOptions?.chains || [])]}
|
291
|
-
client={props.client}
|
292
|
-
connectLocale={props.connectLocale}
|
293
|
-
hiddenWallets={props.hiddenWallets}
|
294
|
-
isEmbed={props.isEmbed}
|
295
|
-
onBack={() => setScreen(screen.backScreen)}
|
296
|
-
onSelect={(w) => {
|
297
|
-
const account = w.getAccount();
|
298
|
-
const chain = w.getChain();
|
299
|
-
if (w && account && chain) {
|
300
|
-
setPayer({
|
301
|
-
account,
|
302
|
-
chain,
|
303
|
-
wallet: w,
|
304
|
-
});
|
305
|
-
}
|
306
|
-
}}
|
307
|
-
recommendedWallets={props.connectOptions?.recommendedWallets}
|
308
|
-
showAllWallets={
|
309
|
-
props.connectOptions?.showAllWallets === undefined
|
310
|
-
? true
|
311
|
-
: props.connectOptions?.showAllWallets
|
312
|
-
}
|
313
|
-
walletConnect={props.connectOptions?.walletConnect}
|
314
|
-
wallets={props.connectOptions?.wallets?.filter((w) => w.id !== "inApp")}
|
315
|
-
/>
|
316
|
-
);
|
317
|
-
}
|
318
|
-
|
319
|
-
if (screen.id === "swap-flow" && payer) {
|
320
|
-
return (
|
321
|
-
<SwapFlow
|
322
|
-
approvalAmount={screen.approvalAmount}
|
323
|
-
buyWithCryptoQuote={screen.quote}
|
324
|
-
client={client}
|
325
|
-
isEmbed={props.isEmbed}
|
326
|
-
isFiatFlow={false}
|
327
|
-
onBack={() => {
|
328
|
-
setScreen({
|
329
|
-
id: "buy-with-crypto",
|
330
|
-
});
|
331
|
-
}}
|
332
|
-
onDone={onDone}
|
333
|
-
onSuccess={onSwapSuccess}
|
334
|
-
onTryAgain={() => {
|
335
|
-
setScreen({
|
336
|
-
id: "buy-with-crypto",
|
337
|
-
});
|
338
|
-
}}
|
339
|
-
payer={payer}
|
340
|
-
title={props.title}
|
341
|
-
transactionMode={payOptions.mode === "transaction"}
|
342
|
-
/>
|
343
|
-
);
|
344
|
-
}
|
345
|
-
|
346
|
-
if (screen.id === "fiat-flow" && payer) {
|
347
|
-
const defaultRecipientAddress = (
|
348
|
-
props.payOptions as Extract<PayUIOptions, { mode: "direct_payment" }>
|
349
|
-
)?.paymentInfo?.sellerAddress;
|
350
|
-
const receiverAddress = defaultRecipientAddress || payer.account.address;
|
351
|
-
return (
|
352
|
-
<OnRampScreen
|
353
|
-
client={client}
|
354
|
-
isEmbed={props.isEmbed}
|
355
|
-
onBack={() => {
|
356
|
-
setScreen({
|
357
|
-
id: "buy-with-fiat",
|
358
|
-
});
|
359
|
-
}}
|
360
|
-
onDone={onDone}
|
361
|
-
onSuccess={onFiatSuccess}
|
362
|
-
payer={payer}
|
363
|
-
paymentLinkId={props.paymentLinkId}
|
364
|
-
quote={screen.quote}
|
365
|
-
receiverAddress={receiverAddress}
|
366
|
-
testMode={
|
367
|
-
props.payOptions.buyWithFiat !== false &&
|
368
|
-
props.payOptions.buyWithFiat?.testMode === true
|
369
|
-
}
|
370
|
-
theme={typeof props.theme === "string" ? props.theme : props.theme.type}
|
371
|
-
title={props.title}
|
372
|
-
transactionMode={payOptions.mode === "transaction"}
|
373
|
-
/>
|
374
|
-
);
|
375
|
-
}
|
376
|
-
|
377
|
-
if (screen.id === "transfer-flow" && payer && activeAccount) {
|
378
|
-
const goBack = () => setScreen({ id: "buy-with-crypto" });
|
379
|
-
// TODO (pay) pass it via screen props
|
380
|
-
const defaultRecipientAddress = (
|
381
|
-
props.payOptions as Extract<PayUIOptions, { mode: "direct_payment" }>
|
382
|
-
)?.paymentInfo?.sellerAddress;
|
383
|
-
const receiverAddress = defaultRecipientAddress || activeAccount.address;
|
384
|
-
return (
|
385
|
-
<TransferFlow
|
386
|
-
chain={toChain}
|
387
|
-
client={props.client}
|
388
|
-
isEmbed={props.isEmbed}
|
389
|
-
onBack={goBack}
|
390
|
-
onDone={onDone}
|
391
|
-
onSuccess={onSwapSuccess}
|
392
|
-
onTryAgain={() => {
|
393
|
-
setScreen({
|
394
|
-
id: "buy-with-crypto",
|
395
|
-
});
|
396
|
-
}}
|
397
|
-
payer={payer}
|
398
|
-
paymentLinkId={props.paymentLinkId}
|
399
|
-
payOptions={payOptions}
|
400
|
-
receiverAddress={receiverAddress}
|
401
|
-
title={props.title}
|
402
|
-
token={toToken}
|
403
|
-
tokenAmount={tokenAmount}
|
404
|
-
transactionMode={props.payOptions.mode === "transaction"}
|
405
|
-
/>
|
406
|
-
);
|
407
|
-
}
|
408
|
-
|
409
|
-
if (screen.id === "select-currency") {
|
410
|
-
const goBack = () => setScreen(screen.backScreen);
|
411
|
-
return (
|
412
|
-
<CurrencySelection
|
413
|
-
onBack={goBack}
|
414
|
-
onSelect={(currency) => {
|
415
|
-
goBack();
|
416
|
-
setSelectedCurrency(currency);
|
417
|
-
}}
|
418
|
-
/>
|
419
|
-
);
|
420
|
-
}
|
421
|
-
|
422
|
-
if (screen.id === "select-to-token") {
|
423
|
-
const chains = supportedDestinations.map((x) => x.chain);
|
424
|
-
const goBack = () => setScreen(screen.backScreen);
|
425
|
-
const allowEdits = (payOptions as FundWalletOptions)?.prefillBuy
|
426
|
-
?.allowEdits;
|
427
|
-
// if token selection is disabled - only show network selector screen
|
428
|
-
if (allowEdits?.token === false) {
|
429
|
-
return (
|
430
|
-
<ChainSelectionScreen
|
431
|
-
chains={chains}
|
432
|
-
client={props.client}
|
433
|
-
connectLocale={props.connectLocale}
|
434
|
-
goBack={goBack}
|
435
|
-
setChain={setToChain}
|
436
|
-
/>
|
437
|
-
);
|
438
|
-
}
|
439
|
-
|
440
|
-
return (
|
441
|
-
<TokenSelector
|
442
|
-
chain={toChain}
|
443
|
-
chainSelection={
|
444
|
-
// hide chain selection if it's disabled
|
445
|
-
allowEdits?.chain !== false
|
446
|
-
? {
|
447
|
-
chains: chains,
|
448
|
-
select: (c) => {
|
449
|
-
setToChain(c);
|
450
|
-
},
|
451
|
-
}
|
452
|
-
: undefined
|
453
|
-
}
|
454
|
-
client={client}
|
455
|
-
connectLocale={connectLocale}
|
456
|
-
modalTitle={props.title}
|
457
|
-
onBack={goBack}
|
458
|
-
onTokenSelect={(tokenInfo) => {
|
459
|
-
setToToken(tokenInfo);
|
460
|
-
goBack();
|
461
|
-
}}
|
462
|
-
tokenList={(
|
463
|
-
(toChain?.id ? destinationSupportedTokens[toChain.id] : undefined) ||
|
464
|
-
[]
|
465
|
-
).filter(
|
466
|
-
(x) => x.address.toLowerCase() !== NATIVE_TOKEN_ADDRESS.toLowerCase(),
|
467
|
-
)}
|
468
|
-
/>
|
469
|
-
);
|
470
|
-
}
|
471
|
-
|
472
|
-
return (
|
473
|
-
<Container animate="fadein">
|
474
|
-
<div>
|
475
|
-
{screen.id === "main" && (
|
476
|
-
<MainScreen
|
477
|
-
client={client}
|
478
|
-
connectOptions={props.connectOptions}
|
479
|
-
enabledPaymentMethods={enabledPaymentMethods}
|
480
|
-
hasEditedAmount={hasEditedAmount}
|
481
|
-
onBack={props.onBack}
|
482
|
-
onSelectBuyToken={() =>
|
483
|
-
setScreen({ backScreen: screen, id: "select-to-token" })
|
484
|
-
}
|
485
|
-
payerAccount={payer?.account}
|
486
|
-
payOptions={payOptions}
|
487
|
-
setFromChain={setFromChain}
|
488
|
-
setFromToken={setFromToken}
|
489
|
-
setHasEditedAmount={setHasEditedAmount}
|
490
|
-
setScreen={setScreen}
|
491
|
-
setToChain={setToChain}
|
492
|
-
setTokenAmount={setTokenAmount}
|
493
|
-
setToToken={setToToken}
|
494
|
-
supportedDestinations={supportedDestinations}
|
495
|
-
theme={props.theme}
|
496
|
-
title={props.title}
|
497
|
-
toChain={toChain}
|
498
|
-
tokenAmount={tokenAmount}
|
499
|
-
toToken={toToken}
|
500
|
-
/>
|
501
|
-
)}
|
502
|
-
|
503
|
-
{(screen.id === "select-payment-method" ||
|
504
|
-
screen.id === "buy-with-crypto" ||
|
505
|
-
screen.id === "buy-with-fiat" ||
|
506
|
-
screen.id === "select-from-token") &&
|
507
|
-
payer && (
|
508
|
-
<TokenSelectedLayout
|
509
|
-
client={client}
|
510
|
-
disabled={
|
511
|
-
("prefillBuy" in payOptions &&
|
512
|
-
payOptions.prefillBuy?.allowEdits?.amount === false) ||
|
513
|
-
payOptions.mode !== "fund_wallet"
|
514
|
-
}
|
515
|
-
onBack={() => {
|
516
|
-
if (
|
517
|
-
(screen.id === "buy-with-crypto" ||
|
518
|
-
screen.id === "buy-with-fiat") &&
|
519
|
-
enabledPaymentMethods.buyWithCryptoEnabled
|
520
|
-
) {
|
521
|
-
setScreen({
|
522
|
-
backScreen: { id: "main" },
|
523
|
-
id: "select-from-token",
|
524
|
-
});
|
525
|
-
} else if (screen.id === "select-from-token") {
|
526
|
-
setScreen(screen.backScreen);
|
527
|
-
} else {
|
528
|
-
setScreen({ id: "main" });
|
529
|
-
}
|
530
|
-
}}
|
531
|
-
selectedChain={toChain}
|
532
|
-
selectedToken={toToken}
|
533
|
-
setTokenAmount={setTokenAmount}
|
534
|
-
title={props.title}
|
535
|
-
tokenAmount={tokenAmount}
|
536
|
-
>
|
537
|
-
{screen.id === "buy-with-crypto" && activeAccount && (
|
538
|
-
<SwapScreenContent
|
539
|
-
activeAccount={activeAccount}
|
540
|
-
client={client}
|
541
|
-
connectLocale={connectLocale}
|
542
|
-
connectOptions={props.connectOptions}
|
543
|
-
disableTokenSelection={
|
544
|
-
payDisabled === true ||
|
545
|
-
(payOptions.buyWithCrypto !== false &&
|
546
|
-
payOptions.buyWithCrypto?.prefillSource?.allowEdits
|
547
|
-
?.chain === false &&
|
548
|
-
payOptions.buyWithCrypto?.prefillSource?.allowEdits
|
549
|
-
?.token === false)
|
550
|
-
}
|
551
|
-
fromChain={fromChain}
|
552
|
-
fromToken={fromToken as TokenInfo}
|
553
|
-
isEmbed={props.isEmbed}
|
554
|
-
onDone={onDone}
|
555
|
-
payer={payer}
|
556
|
-
paymentLinkId={props.paymentLinkId}
|
557
|
-
payOptions={payOptions}
|
558
|
-
setHasEditedAmount={setHasEditedAmount}
|
559
|
-
setPayer={setPayer}
|
560
|
-
setScreen={setScreen}
|
561
|
-
setTokenAmount={setTokenAmount}
|
562
|
-
// pass it even though we are passing payer, because payer might be different
|
563
|
-
showFromTokenSelector={() => {
|
564
|
-
setScreen({
|
565
|
-
backScreen: screen,
|
566
|
-
id: "select-from-token",
|
567
|
-
});
|
568
|
-
}}
|
569
|
-
toChain={toChain}
|
570
|
-
tokenAmount={deferredTokenAmount}
|
571
|
-
toToken={toToken}
|
572
|
-
/>
|
573
|
-
)}
|
574
|
-
|
575
|
-
{screen.id === "buy-with-fiat" && (
|
576
|
-
<FiatScreenContent
|
577
|
-
client={client}
|
578
|
-
isEmbed={props.isEmbed}
|
579
|
-
onDone={onDone}
|
580
|
-
payer={payer}
|
581
|
-
paymentLinkId={props.paymentLinkId}
|
582
|
-
payOptions={payOptions}
|
583
|
-
selectedCurrency={selectedCurrency}
|
584
|
-
setHasEditedAmount={setHasEditedAmount}
|
585
|
-
setScreen={setScreen}
|
586
|
-
setTokenAmount={setTokenAmount}
|
587
|
-
showCurrencySelector={() => {
|
588
|
-
setScreen({
|
589
|
-
backScreen: screen,
|
590
|
-
id: "select-currency",
|
591
|
-
});
|
592
|
-
}}
|
593
|
-
theme={props.theme}
|
594
|
-
toChain={toChain}
|
595
|
-
tokenAmount={deferredTokenAmount}
|
596
|
-
toToken={toToken}
|
597
|
-
/>
|
598
|
-
)}
|
599
|
-
|
600
|
-
{screen.id === "select-from-token" &&
|
601
|
-
supportedSourcesQuery.data &&
|
602
|
-
sourceSupportedTokens && (
|
603
|
-
<TokenSelectorScreen
|
604
|
-
client={props.client}
|
605
|
-
fiatSupported={props.payOptions.buyWithFiat !== false}
|
606
|
-
hiddenWallets={props.hiddenWallets}
|
607
|
-
mode={payOptions.mode}
|
608
|
-
onConnect={() => {
|
609
|
-
setScreen({
|
610
|
-
backScreen: screen,
|
611
|
-
id: "connect-payer-wallet",
|
612
|
-
});
|
613
|
-
}}
|
614
|
-
onPayWithFiat={() => {
|
615
|
-
setScreen({
|
616
|
-
id: "buy-with-fiat",
|
617
|
-
});
|
618
|
-
}}
|
619
|
-
onSelectToken={(w, token, chain) => {
|
620
|
-
const account = w.getAccount();
|
621
|
-
if (account) {
|
622
|
-
setPayer({
|
623
|
-
account,
|
624
|
-
chain,
|
625
|
-
wallet: w,
|
626
|
-
});
|
627
|
-
setFromToken(token);
|
628
|
-
setFromChain(chain);
|
629
|
-
}
|
630
|
-
setScreen({ id: "buy-with-crypto" });
|
631
|
-
}}
|
632
|
-
sourceSupportedTokens={sourceSupportedTokens}
|
633
|
-
sourceTokens={sourceSupportedTokens}
|
634
|
-
toChain={toChain}
|
635
|
-
tokenAmount={tokenAmount}
|
636
|
-
toToken={toToken}
|
637
|
-
/>
|
638
|
-
)}
|
639
|
-
</TokenSelectedLayout>
|
640
|
-
)}
|
641
|
-
</div>
|
642
|
-
</Container>
|
643
|
-
);
|
644
|
-
}
|
645
|
-
|
646
|
-
function SelectedTokenInfo(props: {
|
647
|
-
selectedToken: ERC20OrNativeToken;
|
648
|
-
selectedChain: Chain;
|
649
|
-
tokenAmount: string;
|
650
|
-
setTokenAmount: (amount: string) => void;
|
651
|
-
client: ThirdwebClient;
|
652
|
-
disabled?: boolean;
|
653
|
-
}) {
|
654
|
-
const getWidth = () => {
|
655
|
-
const amount = formatNumber(Number(props.tokenAmount), 6).toString();
|
656
|
-
let chars = amount.replace(".", "").length;
|
657
|
-
const hasDot = amount.includes(".");
|
658
|
-
if (hasDot) {
|
659
|
-
chars += 0.3;
|
660
|
-
}
|
661
|
-
return `calc(${`${Math.max(1, chars)}ch + 2px`})`;
|
662
|
-
};
|
663
|
-
return (
|
664
|
-
<div>
|
665
|
-
<Container
|
666
|
-
center="y"
|
667
|
-
flex="row"
|
668
|
-
gap="sm"
|
669
|
-
style={{
|
670
|
-
justifyContent: "space-between",
|
671
|
-
}}
|
672
|
-
>
|
673
|
-
<Container center="y" flex="row" gap="xxs">
|
674
|
-
<Input
|
675
|
-
data-placeholder={props.tokenAmount === ""}
|
676
|
-
disabled={props.disabled}
|
677
|
-
inputMode="decimal"
|
678
|
-
onChange={(e) => {
|
679
|
-
let value = e.target.value;
|
680
|
-
|
681
|
-
// Replace comma with period if it exists
|
682
|
-
value = value.replace(",", ".");
|
683
|
-
|
684
|
-
if (value.startsWith(".")) {
|
685
|
-
value = `0${value}`;
|
686
|
-
}
|
687
|
-
|
688
|
-
if (value.length > 10) {
|
689
|
-
return;
|
690
|
-
}
|
691
|
-
|
692
|
-
const numValue = Number(value);
|
693
|
-
if (Number.isNaN(numValue)) {
|
694
|
-
return;
|
695
|
-
}
|
696
|
-
|
697
|
-
if (value.startsWith("0") && !value.startsWith("0.")) {
|
698
|
-
props.setTokenAmount(value.slice(1));
|
699
|
-
} else {
|
700
|
-
props.setTokenAmount(value);
|
701
|
-
}
|
702
|
-
}}
|
703
|
-
onClick={(e) => {
|
704
|
-
// put cursor at the end of the input
|
705
|
-
if (props.tokenAmount === "") {
|
706
|
-
e.currentTarget.setSelectionRange(
|
707
|
-
e.currentTarget.value.length,
|
708
|
-
e.currentTarget.value.length,
|
709
|
-
);
|
710
|
-
}
|
711
|
-
}}
|
712
|
-
pattern="^[0-9]*[.,]?[0-9]*$"
|
713
|
-
placeholder="0"
|
714
|
-
style={{
|
715
|
-
border: "none",
|
716
|
-
borderRadius: "0",
|
717
|
-
boxShadow: "none",
|
718
|
-
fontSize: fontSize.lg,
|
719
|
-
fontWeight: 600,
|
720
|
-
padding: "0",
|
721
|
-
paddingBlock: "2px",
|
722
|
-
textAlign: "left",
|
723
|
-
width: getWidth(),
|
724
|
-
}}
|
725
|
-
tabIndex={-1}
|
726
|
-
type="text"
|
727
|
-
value={props.tokenAmount || "0"}
|
728
|
-
variant="outline"
|
729
|
-
/>
|
730
|
-
|
731
|
-
<Container center="y" flex="row" gap="xxs">
|
732
|
-
<TokenSymbol
|
733
|
-
chain={props.selectedChain}
|
734
|
-
color="secondaryText"
|
735
|
-
size="md"
|
736
|
-
token={props.selectedToken}
|
737
|
-
/>
|
738
|
-
<PayTokenIcon
|
739
|
-
chain={props.selectedChain}
|
740
|
-
client={props.client}
|
741
|
-
size="sm"
|
742
|
-
token={props.selectedToken}
|
743
|
-
/>
|
744
|
-
</Container>
|
745
|
-
|
746
|
-
<FiatValue
|
747
|
-
chain={props.selectedChain}
|
748
|
-
client={props.client}
|
749
|
-
size="sm"
|
750
|
-
token={props.selectedToken}
|
751
|
-
tokenAmount={props.tokenAmount}
|
752
|
-
/>
|
753
|
-
</Container>
|
754
|
-
|
755
|
-
<ChainName
|
756
|
-
chain={props.selectedChain}
|
757
|
-
client={props.client}
|
758
|
-
short
|
759
|
-
size="sm"
|
760
|
-
/>
|
761
|
-
</Container>
|
762
|
-
</div>
|
763
|
-
);
|
764
|
-
}
|
765
|
-
|
766
|
-
function MainScreen(props: {
|
767
|
-
title: string;
|
768
|
-
client: ThirdwebClient;
|
769
|
-
setTokenAmount: (amount: string) => void;
|
770
|
-
setFromChain: (chain: Chain) => void;
|
771
|
-
setFromToken: (token: ERC20OrNativeToken) => void;
|
772
|
-
setToChain: (chain: Chain) => void;
|
773
|
-
setToToken: (token: ERC20OrNativeToken) => void;
|
774
|
-
payerAccount: Account | undefined;
|
775
|
-
tokenAmount: string;
|
776
|
-
payOptions: PayUIOptions;
|
777
|
-
toToken: ERC20OrNativeToken;
|
778
|
-
toChain: Chain;
|
779
|
-
onSelectBuyToken: () => void;
|
780
|
-
connectOptions: PayEmbedConnectOptions | undefined;
|
781
|
-
setScreen: (screen: SelectedScreen) => void;
|
782
|
-
supportedDestinations: SupportedChainAndTokens;
|
783
|
-
onBack: (() => void) | undefined;
|
784
|
-
theme: "light" | "dark" | Theme;
|
785
|
-
hasEditedAmount: boolean;
|
786
|
-
setHasEditedAmount: (hasEdited: boolean) => void;
|
787
|
-
enabledPaymentMethods: PaymentMethods;
|
788
|
-
}) {
|
789
|
-
const {
|
790
|
-
setTokenAmount,
|
791
|
-
setToChain,
|
792
|
-
setToToken,
|
793
|
-
setFromChain,
|
794
|
-
setFromToken,
|
795
|
-
payerAccount,
|
796
|
-
client,
|
797
|
-
tokenAmount,
|
798
|
-
payOptions,
|
799
|
-
toToken,
|
800
|
-
toChain,
|
801
|
-
supportedDestinations,
|
802
|
-
enabledPaymentMethods,
|
803
|
-
} = props;
|
804
|
-
|
805
|
-
const { buyWithCryptoEnabled, buyWithFiatEnabled } = enabledPaymentMethods;
|
806
|
-
const disableContinue = !tokenAmount;
|
807
|
-
|
808
|
-
switch (payOptions.mode) {
|
809
|
-
case "transaction": {
|
810
|
-
return (
|
811
|
-
<TransactionModeScreen
|
812
|
-
client={client}
|
813
|
-
connectOptions={props.connectOptions}
|
814
|
-
onContinue={(tokenAmount, toChain, toToken) => {
|
815
|
-
setTokenAmount(tokenAmount);
|
816
|
-
setToChain(toChain);
|
817
|
-
setFromChain(toChain);
|
818
|
-
setFromToken(toToken);
|
819
|
-
setToToken(toToken);
|
820
|
-
if (buyWithFiatEnabled && !buyWithCryptoEnabled) {
|
821
|
-
props.setScreen({ id: "buy-with-fiat" });
|
822
|
-
} else {
|
823
|
-
props.setScreen({
|
824
|
-
backScreen: { id: "main" },
|
825
|
-
id: "select-from-token",
|
826
|
-
});
|
827
|
-
}
|
828
|
-
}}
|
829
|
-
payerAccount={payerAccount}
|
830
|
-
payUiOptions={payOptions}
|
831
|
-
supportedDestinations={supportedDestinations}
|
832
|
-
/>
|
833
|
-
);
|
834
|
-
}
|
835
|
-
case "direct_payment": {
|
836
|
-
return (
|
837
|
-
<DirectPaymentModeScreen
|
838
|
-
client={client}
|
839
|
-
connectOptions={props.connectOptions}
|
840
|
-
onContinue={(tokenAmount, toChain, toToken) => {
|
841
|
-
setTokenAmount(tokenAmount);
|
842
|
-
setToChain(toChain);
|
843
|
-
setFromChain(toChain);
|
844
|
-
setFromToken(toToken);
|
845
|
-
setToToken(toToken);
|
846
|
-
if (buyWithFiatEnabled && !buyWithCryptoEnabled) {
|
847
|
-
props.setScreen({ id: "buy-with-fiat" });
|
848
|
-
} else {
|
849
|
-
props.setScreen({
|
850
|
-
backScreen: { id: "main" },
|
851
|
-
id: "select-from-token",
|
852
|
-
});
|
853
|
-
}
|
854
|
-
}}
|
855
|
-
payerAccount={payerAccount}
|
856
|
-
payUiOptions={payOptions}
|
857
|
-
supportedDestinations={supportedDestinations}
|
858
|
-
/>
|
859
|
-
);
|
860
|
-
}
|
861
|
-
default: {
|
862
|
-
return (
|
863
|
-
<Container px="lg">
|
864
|
-
<Spacer y="lg" />
|
865
|
-
<ModalHeader onBack={props.onBack} title={props.title} />
|
866
|
-
|
867
|
-
<Spacer y="xl" />
|
868
|
-
|
869
|
-
{/* To */}
|
870
|
-
<BuyTokenInput
|
871
|
-
chain={toChain}
|
872
|
-
client={props.client}
|
873
|
-
freezeAmount={payOptions.prefillBuy?.allowEdits?.amount === false}
|
874
|
-
freezeChainAndToken={
|
875
|
-
(payOptions.prefillBuy?.allowEdits?.chain === false &&
|
876
|
-
payOptions.prefillBuy?.allowEdits?.token === false) ||
|
877
|
-
(payOptions.buyWithCrypto !== false &&
|
878
|
-
payOptions.buyWithCrypto?.prefillSource?.allowEdits?.token ===
|
879
|
-
false &&
|
880
|
-
payOptions.buyWithCrypto?.prefillSource?.allowEdits?.chain ===
|
881
|
-
false)
|
882
|
-
}
|
883
|
-
onChange={async (value) => {
|
884
|
-
props.setHasEditedAmount(true);
|
885
|
-
setTokenAmount(value);
|
886
|
-
}}
|
887
|
-
onSelectToken={props.onSelectBuyToken}
|
888
|
-
token={toToken}
|
889
|
-
value={tokenAmount}
|
890
|
-
/>
|
891
|
-
|
892
|
-
<Spacer y="md" />
|
893
|
-
|
894
|
-
{/* Continue */}
|
895
|
-
<Container flex="column" gap="sm">
|
896
|
-
{!payerAccount ? (
|
897
|
-
<div>
|
898
|
-
<ConnectButton
|
899
|
-
{...props.connectOptions}
|
900
|
-
client={props.client}
|
901
|
-
connectButton={{
|
902
|
-
style: {
|
903
|
-
width: "100%",
|
904
|
-
},
|
905
|
-
}}
|
906
|
-
theme={props.theme}
|
907
|
-
/>
|
908
|
-
</div>
|
909
|
-
) : (
|
910
|
-
<Button
|
911
|
-
data-disabled={disableContinue}
|
912
|
-
disabled={disableContinue}
|
913
|
-
fullWidth
|
914
|
-
onClick={() => {
|
915
|
-
if (buyWithFiatEnabled && !buyWithCryptoEnabled) {
|
916
|
-
props.setScreen({ id: "buy-with-fiat" });
|
917
|
-
} else {
|
918
|
-
props.setScreen({
|
919
|
-
backScreen: { id: "main" },
|
920
|
-
id: "select-from-token",
|
921
|
-
});
|
922
|
-
}
|
923
|
-
trackPayEvent({
|
924
|
-
client,
|
925
|
-
event: "choose_payment_method_fund_wallet_mode",
|
926
|
-
toChainId: toChain.id,
|
927
|
-
toToken: isNativeToken(toToken)
|
928
|
-
? undefined
|
929
|
-
: toToken.address,
|
930
|
-
walletAddress: payerAccount.address,
|
931
|
-
});
|
932
|
-
}}
|
933
|
-
variant="accent"
|
934
|
-
>
|
935
|
-
Continue
|
936
|
-
</Button>
|
937
|
-
)}
|
938
|
-
</Container>
|
939
|
-
<Spacer y="lg" />
|
940
|
-
{payOptions.showThirdwebBranding !== false && (
|
941
|
-
<>
|
942
|
-
<PoweredByThirdweb link="https://playground.thirdweb.com/connect/pay?utm_source=ub_text" />
|
943
|
-
<Spacer y="sm" />
|
944
|
-
</>
|
945
|
-
)}
|
946
|
-
</Container>
|
947
|
-
);
|
948
|
-
}
|
949
|
-
}
|
950
|
-
}
|
951
|
-
|
952
|
-
function TokenSelectedLayout(props: {
|
953
|
-
title: string;
|
954
|
-
children: React.ReactNode;
|
955
|
-
tokenAmount: string;
|
956
|
-
setTokenAmount: (amount: string) => void;
|
957
|
-
selectedToken: ERC20OrNativeToken;
|
958
|
-
selectedChain: Chain;
|
959
|
-
client: ThirdwebClient;
|
960
|
-
onBack: () => void;
|
961
|
-
disabled?: boolean;
|
962
|
-
}) {
|
963
|
-
return (
|
964
|
-
<Container>
|
965
|
-
<Container p="lg">
|
966
|
-
<ModalHeader onBack={props.onBack} title={props.title} />
|
967
|
-
</Container>
|
968
|
-
|
969
|
-
<Container
|
970
|
-
px="lg"
|
971
|
-
style={{
|
972
|
-
paddingBottom: spacing.lg,
|
973
|
-
}}
|
974
|
-
>
|
975
|
-
<Spacer y="xs" />
|
976
|
-
<SelectedTokenInfo
|
977
|
-
client={props.client}
|
978
|
-
disabled={props.disabled}
|
979
|
-
selectedChain={props.selectedChain}
|
980
|
-
selectedToken={props.selectedToken}
|
981
|
-
setTokenAmount={props.setTokenAmount}
|
982
|
-
tokenAmount={props.tokenAmount}
|
983
|
-
/>
|
984
|
-
|
985
|
-
<Spacer y="sm" />
|
986
|
-
<Line />
|
987
|
-
<Spacer y="sm" />
|
988
|
-
{props.children}
|
989
|
-
</Container>
|
990
|
-
</Container>
|
991
|
-
);
|
992
|
-
}
|
993
|
-
|
994
|
-
function createSupportedTokens(
|
995
|
-
data: SupportedChainAndTokens,
|
996
|
-
payOptions: PayUIOptions,
|
997
|
-
supportedTokensOverrides?: SupportedTokens,
|
998
|
-
): SupportedTokens {
|
999
|
-
// dev override
|
1000
|
-
if (supportedTokensOverrides) {
|
1001
|
-
return supportedTokensOverrides;
|
1002
|
-
}
|
1003
|
-
|
1004
|
-
const tokens: SupportedTokens = {};
|
1005
|
-
const isBuyWithFiatDisabled = payOptions.buyWithFiat === false;
|
1006
|
-
const isBuyWithCryptoDisabled = payOptions.buyWithCrypto === false;
|
1007
|
-
|
1008
|
-
for (const x of data) {
|
1009
|
-
tokens[x.chain.id] = x.tokens.filter((t) => {
|
1010
|
-
if (t.address === ZERO_ADDRESS) {
|
1011
|
-
return false;
|
1012
|
-
}
|
1013
|
-
// for source tokens, data is not provided, so we include all of them
|
1014
|
-
if (
|
1015
|
-
t.buyWithCryptoEnabled === undefined &&
|
1016
|
-
t.buyWithFiatEnabled === undefined
|
1017
|
-
) {
|
1018
|
-
return true;
|
1019
|
-
}
|
1020
|
-
// it token supports both - include it
|
1021
|
-
if (t.buyWithCryptoEnabled && t.buyWithFiatEnabled) {
|
1022
|
-
return true;
|
1023
|
-
}
|
1024
|
-
|
1025
|
-
// if buyWithFiat is disabled, and buyWithCrypto is not supported by token - exclude the token
|
1026
|
-
if (!t.buyWithCryptoEnabled && isBuyWithFiatDisabled) {
|
1027
|
-
return false;
|
1028
|
-
}
|
1029
|
-
|
1030
|
-
// if buyWithCrypto is disabled, and buyWithFiat is not supported by token - exclude the token
|
1031
|
-
if (!t.buyWithFiatEnabled && isBuyWithCryptoDisabled) {
|
1032
|
-
return false;
|
1033
|
-
}
|
1034
|
-
|
1035
|
-
return true; // include the token
|
1036
|
-
});
|
1037
|
-
}
|
1038
|
-
return tokens;
|
1039
|
-
}
|
1040
|
-
|
1041
|
-
function ChainSelectionScreen(props: {
|
1042
|
-
goBack: () => void;
|
1043
|
-
chains: Chain[];
|
1044
|
-
client: ThirdwebClient;
|
1045
|
-
connectLocale: ConnectLocale;
|
1046
|
-
setChain: (chain: Chain) => void;
|
1047
|
-
}) {
|
1048
|
-
return (
|
1049
|
-
<NetworkSelectorContent
|
1050
|
-
chains={props.chains}
|
1051
|
-
client={props.client}
|
1052
|
-
closeModal={props.goBack}
|
1053
|
-
connectLocale={props.connectLocale}
|
1054
|
-
networkSelector={{
|
1055
|
-
renderChain(renderChainProps) {
|
1056
|
-
return (
|
1057
|
-
<ChainButton
|
1058
|
-
chain={renderChainProps.chain}
|
1059
|
-
client={props.client}
|
1060
|
-
confirming={false}
|
1061
|
-
connectLocale={props.connectLocale}
|
1062
|
-
onClick={() => {
|
1063
|
-
props.setChain(renderChainProps.chain);
|
1064
|
-
props.goBack();
|
1065
|
-
}}
|
1066
|
-
switchingFailed={false}
|
1067
|
-
/>
|
1068
|
-
);
|
1069
|
-
},
|
1070
|
-
}}
|
1071
|
-
onBack={props.goBack}
|
1072
|
-
showTabs={false}
|
1073
|
-
/>
|
1074
|
-
);
|
1075
|
-
}
|