thirdweb 5.102.7-nightly-3f747601135809eedf86a150752f4b5f12c99776-20250617000426 → 5.103.0
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/Routes.js +4 -1
- package/dist/cjs/bridge/Routes.js.map +1 -1
- package/dist/cjs/bridge/Token.js +57 -0
- package/dist/cjs/bridge/Token.js.map +1 -1
- package/dist/cjs/bridge/types/Errors.js +9 -0
- package/dist/cjs/bridge/types/Errors.js.map +1 -1
- package/dist/cjs/exports/react.js +9 -1
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js +2 -2
- package/dist/cjs/pay/convert/cryptoToFiat.js +3 -3
- package/dist/cjs/pay/convert/cryptoToFiat.js.map +1 -1
- package/dist/cjs/pay/convert/fiatToCrypto.js +3 -3
- package/dist/cjs/pay/convert/fiatToCrypto.js.map +1 -1
- package/dist/cjs/pay/convert/get-token.js +15 -3
- package/dist/cjs/pay/convert/get-token.js.map +1 -1
- package/dist/cjs/pay/utils/commonTypes.js +1 -1
- package/dist/cjs/react/core/adapters/WindowAdapter.js +3 -0
- package/dist/cjs/react/core/adapters/WindowAdapter.js.map +1 -0
- package/dist/cjs/react/core/errors/mapBridgeError.js +27 -0
- package/dist/cjs/react/core/errors/mapBridgeError.js.map +1 -0
- package/dist/cjs/react/core/hooks/others/useChainQuery.js +1 -1
- package/dist/cjs/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js +40 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js.map +1 -0
- package/dist/cjs/react/core/hooks/useBridgeError.js +94 -0
- package/dist/cjs/react/core/hooks/useBridgeError.js.map +1 -0
- package/dist/cjs/react/core/hooks/useBridgePrepare.js +90 -0
- package/dist/cjs/react/core/hooks/useBridgePrepare.js.map +1 -0
- package/dist/cjs/react/core/hooks/useBridgeQuote.js +50 -0
- package/dist/cjs/react/core/hooks/useBridgeQuote.js.map +1 -0
- package/dist/cjs/react/core/hooks/useBridgeRoutes.js +61 -0
- package/dist/cjs/react/core/hooks/useBridgeRoutes.js.map +1 -0
- package/dist/cjs/react/core/hooks/usePaymentMethods.js +154 -0
- package/dist/cjs/react/core/hooks/usePaymentMethods.js.map +1 -0
- package/dist/cjs/react/core/hooks/useStepExecutor.js +408 -0
- package/dist/cjs/react/core/hooks/useStepExecutor.js.map +1 -0
- package/dist/cjs/react/core/hooks/useTransactionDetails.js +126 -0
- package/dist/cjs/react/core/hooks/useTransactionDetails.js.map +1 -0
- package/dist/cjs/react/core/machines/paymentMachine.js +189 -0
- package/dist/cjs/react/core/machines/paymentMachine.js.map +1 -0
- package/dist/cjs/react/web/adapters/WindowAdapter.js +25 -0
- package/dist/cjs/react/web/adapters/WindowAdapter.js.map +1 -0
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +5 -0
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js +107 -0
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/BuyWidget.js +177 -0
- package/dist/cjs/react/web/ui/Bridge/BuyWidget.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js +154 -0
- package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/DirectPayment.js +62 -0
- package/dist/cjs/react/web/ui/Bridge/DirectPayment.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/ErrorBanner.js +26 -0
- package/dist/cjs/react/web/ui/Bridge/ErrorBanner.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/FundWallet.js +122 -0
- package/dist/cjs/react/web/ui/Bridge/FundWallet.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/QuoteLoader.js +99 -0
- package/dist/cjs/react/web/ui/Bridge/QuoteLoader.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/StepRunner.js +179 -0
- package/dist/cjs/react/web/ui/Bridge/StepRunner.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js +117 -0
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js +179 -0
- package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/UnsupportedTokenScreen.js +23 -0
- package/dist/cjs/react/web/ui/Bridge/UnsupportedTokenScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/common/TokenAndChain.js +101 -0
- package/dist/cjs/react/web/ui/Bridge/common/TokenAndChain.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/common/TokenBalanceRow.js +57 -0
- package/dist/cjs/react/web/ui/Bridge/common/TokenBalanceRow.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/common/WithHeader.js +27 -0
- package/dist/cjs/react/web/ui/Bridge/common/WithHeader.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js +121 -0
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js +80 -0
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js +83 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js +111 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js +71 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +54 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-success/PaymentReceipt.js +140 -0
- package/dist/cjs/react/web/ui/Bridge/payment-success/PaymentReceipt.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js +61 -0
- package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/constants.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/icons/CreditCardIcon.js +12 -0
- package/dist/cjs/react/web/ui/ConnectWallet/icons/CreditCardIcon.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +3 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +4 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.js +4 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +11 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/cjs/react/web/ui/PayEmbed.js +2 -1
- package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js +6 -5
- package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +43 -4
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +8 -4
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
- package/dist/cjs/react/web/ui/components/ChainName.js +2 -1
- package/dist/cjs/react/web/ui/components/ChainName.js.map +1 -1
- package/dist/cjs/react/web/ui/components/TokenIcon.js +6 -3
- package/dist/cjs/react/web/ui/components/TokenIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/components/buttons.js +1 -5
- package/dist/cjs/react/web/ui/components/buttons.js.map +1 -1
- package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js +228 -0
- package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/DirectPayment.stories.js +194 -0
- package/dist/cjs/stories/Bridge/DirectPayment.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/ErrorBanner.stories.js +153 -0
- package/dist/cjs/stories/Bridge/ErrorBanner.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/FundWallet.stories.js +173 -0
- package/dist/cjs/stories/Bridge/FundWallet.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/PaymentDetails.stories.js +430 -0
- package/dist/cjs/stories/Bridge/PaymentDetails.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/PaymentSelection.stories.js +151 -0
- package/dist/cjs/stories/Bridge/PaymentSelection.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/StepRunner.stories.js +82 -0
- package/dist/cjs/stories/Bridge/StepRunner.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/SuccessScreen.stories.js +180 -0
- package/dist/cjs/stories/Bridge/SuccessScreen.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/TransactionPayment.stories.js +139 -0
- package/dist/cjs/stories/Bridge/TransactionPayment.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js +94 -0
- package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/fixtures.js +731 -0
- package/dist/cjs/stories/Bridge/fixtures.js.map +1 -0
- package/dist/cjs/stories/TokenBalanceRow.stories.js +81 -0
- package/dist/cjs/stories/TokenBalanceRow.stories.js.map +1 -0
- package/dist/cjs/stories/WalletRow.stories.js +120 -0
- package/dist/cjs/stories/WalletRow.stories.js.map +1 -0
- package/dist/cjs/stories/utils.js +19 -1
- package/dist/cjs/stories/utils.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/bridge/Routes.js +4 -1
- package/dist/esm/bridge/Routes.js.map +1 -1
- package/dist/esm/bridge/Token.js +56 -0
- package/dist/esm/bridge/Token.js.map +1 -1
- package/dist/esm/bridge/types/Errors.js +9 -0
- package/dist/esm/bridge/types/Errors.js.map +1 -1
- package/dist/esm/exports/react.js +4 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js +2 -2
- package/dist/esm/pay/convert/cryptoToFiat.js +4 -4
- package/dist/esm/pay/convert/cryptoToFiat.js.map +1 -1
- package/dist/esm/pay/convert/fiatToCrypto.js +4 -4
- package/dist/esm/pay/convert/fiatToCrypto.js.map +1 -1
- package/dist/esm/pay/convert/get-token.js +15 -3
- package/dist/esm/pay/convert/get-token.js.map +1 -1
- package/dist/esm/pay/utils/commonTypes.js +1 -1
- package/dist/esm/react/core/adapters/WindowAdapter.js +2 -0
- package/dist/esm/react/core/adapters/WindowAdapter.js.map +1 -0
- package/dist/esm/react/core/errors/mapBridgeError.js +23 -0
- package/dist/esm/react/core/errors/mapBridgeError.js.map +1 -0
- package/dist/esm/react/core/hooks/others/useChainQuery.js +1 -1
- package/dist/esm/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js +37 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js.map +1 -0
- package/dist/esm/react/core/hooks/useBridgeError.js +91 -0
- package/dist/esm/react/core/hooks/useBridgeError.js.map +1 -0
- package/dist/esm/react/core/hooks/useBridgePrepare.js +87 -0
- package/dist/esm/react/core/hooks/useBridgePrepare.js.map +1 -0
- package/dist/esm/react/core/hooks/useBridgeQuote.js +47 -0
- package/dist/esm/react/core/hooks/useBridgeQuote.js.map +1 -0
- package/dist/esm/react/core/hooks/useBridgeRoutes.js +58 -0
- package/dist/esm/react/core/hooks/useBridgeRoutes.js.map +1 -0
- package/dist/esm/react/core/hooks/usePaymentMethods.js +151 -0
- package/dist/esm/react/core/hooks/usePaymentMethods.js.map +1 -0
- package/dist/esm/react/core/hooks/useStepExecutor.js +405 -0
- package/dist/esm/react/core/hooks/useStepExecutor.js.map +1 -0
- package/dist/esm/react/core/hooks/useTransactionDetails.js +123 -0
- package/dist/esm/react/core/hooks/useTransactionDetails.js.map +1 -0
- package/dist/esm/react/core/machines/paymentMachine.js +186 -0
- package/dist/esm/react/core/machines/paymentMachine.js.map +1 -0
- package/dist/esm/react/web/adapters/WindowAdapter.js +21 -0
- package/dist/esm/react/web/adapters/WindowAdapter.js.map +1 -0
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +5 -0
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js +104 -0
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/BuyWidget.js +174 -0
- package/dist/esm/react/web/ui/Bridge/BuyWidget.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js +151 -0
- package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/DirectPayment.js +59 -0
- package/dist/esm/react/web/ui/Bridge/DirectPayment.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/ErrorBanner.js +23 -0
- package/dist/esm/react/web/ui/Bridge/ErrorBanner.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/FundWallet.js +119 -0
- package/dist/esm/react/web/ui/Bridge/FundWallet.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/QuoteLoader.js +96 -0
- package/dist/esm/react/web/ui/Bridge/QuoteLoader.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/StepRunner.js +176 -0
- package/dist/esm/react/web/ui/Bridge/StepRunner.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js +114 -0
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/TransactionWidget.js +176 -0
- package/dist/esm/react/web/ui/Bridge/TransactionWidget.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/UnsupportedTokenScreen.js +20 -0
- package/dist/esm/react/web/ui/Bridge/UnsupportedTokenScreen.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/common/TokenAndChain.js +96 -0
- package/dist/esm/react/web/ui/Bridge/common/TokenAndChain.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/common/TokenBalanceRow.js +54 -0
- package/dist/esm/react/web/ui/Bridge/common/TokenBalanceRow.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/common/WithHeader.js +24 -0
- package/dist/esm/react/web/ui/Bridge/common/WithHeader.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js +119 -0
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js +77 -0
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js +80 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js +108 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js +68 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +51 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-success/PaymentReceipt.js +137 -0
- package/dist/esm/react/web/ui/Bridge/payment-success/PaymentReceipt.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js +58 -0
- package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/constants.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/icons/CreditCardIcon.js +8 -0
- package/dist/esm/react/web/ui/ConnectWallet/icons/CreditCardIcon.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +3 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +3 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.js +4 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +9 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/esm/react/web/ui/PayEmbed.js +2 -1
- package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js +6 -5
- package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +45 -6
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +8 -4
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
- package/dist/esm/react/web/ui/components/ChainName.js +2 -2
- package/dist/esm/react/web/ui/components/ChainName.js.map +1 -1
- package/dist/esm/react/web/ui/components/TokenIcon.js +7 -4
- package/dist/esm/react/web/ui/components/TokenIcon.js.map +1 -1
- package/dist/esm/react/web/ui/components/buttons.js +1 -5
- package/dist/esm/react/web/ui/components/buttons.js.map +1 -1
- package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js +226 -0
- package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/DirectPayment.stories.js +191 -0
- package/dist/esm/stories/Bridge/DirectPayment.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/ErrorBanner.stories.js +150 -0
- package/dist/esm/stories/Bridge/ErrorBanner.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/FundWallet.stories.js +170 -0
- package/dist/esm/stories/Bridge/FundWallet.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/PaymentDetails.stories.js +427 -0
- package/dist/esm/stories/Bridge/PaymentDetails.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/PaymentSelection.stories.js +148 -0
- package/dist/esm/stories/Bridge/PaymentSelection.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/StepRunner.stories.js +79 -0
- package/dist/esm/stories/Bridge/StepRunner.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/SuccessScreen.stories.js +177 -0
- package/dist/esm/stories/Bridge/SuccessScreen.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/TransactionPayment.stories.js +136 -0
- package/dist/esm/stories/Bridge/TransactionPayment.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js +91 -0
- package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/fixtures.js +728 -0
- package/dist/esm/stories/Bridge/fixtures.js.map +1 -0
- package/dist/esm/stories/TokenBalanceRow.stories.js +78 -0
- package/dist/esm/stories/TokenBalanceRow.stories.js.map +1 -0
- package/dist/esm/stories/WalletRow.stories.js +117 -0
- package/dist/esm/stories/WalletRow.stories.js.map +1 -0
- package/dist/esm/stories/utils.js +17 -0
- package/dist/esm/stories/utils.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/bridge/Routes.d.ts +1 -0
- package/dist/types/bridge/Routes.d.ts.map +1 -1
- package/dist/types/bridge/Token.d.ts +48 -1
- package/dist/types/bridge/Token.d.ts.map +1 -1
- package/dist/types/bridge/types/BridgeAction.d.ts +1 -1
- package/dist/types/bridge/types/BridgeAction.d.ts.map +1 -1
- package/dist/types/bridge/types/Errors.d.ts +1 -0
- package/dist/types/bridge/types/Errors.d.ts.map +1 -1
- package/dist/types/exports/react.d.ts +4 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/pay/convert/get-token.d.ts +2 -1
- package/dist/types/pay/convert/get-token.d.ts.map +1 -1
- package/dist/types/pay/utils/commonTypes.d.ts +1 -1
- package/dist/types/react/core/adapters/WindowAdapter.d.ts +14 -0
- package/dist/types/react/core/adapters/WindowAdapter.d.ts.map +1 -0
- package/dist/types/react/core/errors/mapBridgeError.d.ts +17 -0
- package/dist/types/react/core/errors/mapBridgeError.d.ts.map +1 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +14 -6
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.d.ts +54 -0
- package/dist/types/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.d.ts.map +1 -0
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/core/hooks/useBridgeError.d.ts +72 -0
- package/dist/types/react/core/hooks/useBridgeError.d.ts.map +1 -0
- package/dist/types/react/core/hooks/useBridgePrepare.d.ts +75 -0
- package/dist/types/react/core/hooks/useBridgePrepare.d.ts.map +1 -0
- package/dist/types/react/core/hooks/useBridgeQuote.d.ts +14 -0
- package/dist/types/react/core/hooks/useBridgeQuote.d.ts.map +1 -0
- package/dist/types/react/core/hooks/useBridgeRoutes.d.ts +30 -0
- package/dist/types/react/core/hooks/useBridgeRoutes.d.ts.map +1 -0
- package/dist/types/react/core/hooks/usePaymentMethods.d.ts +36 -0
- package/dist/types/react/core/hooks/usePaymentMethods.d.ts.map +1 -0
- package/dist/types/react/core/hooks/useStepExecutor.d.ts +67 -0
- package/dist/types/react/core/hooks/useStepExecutor.d.ts.map +1 -0
- package/dist/types/react/core/hooks/useTransactionDetails.d.ts +31 -0
- package/dist/types/react/core/hooks/useTransactionDetails.d.ts.map +1 -0
- package/dist/types/react/core/machines/paymentMachine.d.ts +86 -0
- package/dist/types/react/core/machines/paymentMachine.d.ts.map +1 -0
- package/dist/types/react/web/adapters/WindowAdapter.d.ts +19 -0
- package/dist/types/react/web/adapters/WindowAdapter.d.ts.map +1 -0
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts +5 -0
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts +78 -0
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts +325 -0
- package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts +328 -0
- package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts +27 -0
- package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/ErrorBanner.d.ts +17 -0
- package/dist/types/react/web/ui/Bridge/ErrorBanner.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/FundWallet.d.ts +35 -0
- package/dist/types/react/web/ui/Bridge/FundWallet.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/QuoteLoader.d.ts +57 -0
- package/dist/types/react/web/ui/Bridge/QuoteLoader.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/StepRunner.d.ts +39 -0
- package/dist/types/react/web/ui/Bridge/StepRunner.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts +27 -0
- package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts +355 -0
- package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/UnsupportedTokenScreen.d.ts +13 -0
- package/dist/types/react/web/ui/Bridge/UnsupportedTokenScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/common/TokenAndChain.d.ts +16 -0
- package/dist/types/react/web/ui/Bridge/common/TokenAndChain.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/common/TokenBalanceRow.d.ts +10 -0
- package/dist/types/react/web/ui/Bridge/common/TokenBalanceRow.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/common/WithHeader.d.ts +9 -0
- package/dist/types/react/web/ui/Bridge/common/WithHeader.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts +36 -0
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts +15 -0
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-selection/FiatProviderSelection.d.ts +12 -0
- package/dist/types/react/web/ui/Bridge/payment-selection/FiatProviderSelection.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts +50 -0
- package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts +15 -0
- package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-selection/WalletFiatSelection.d.ts +12 -0
- package/dist/types/react/web/ui/Bridge/payment-selection/WalletFiatSelection.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-success/PaymentReceipt.d.ts +24 -0
- package/dist/types/react/web/ui/Bridge/payment-success/PaymentReceipt.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts +28 -0
- package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/constants.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/icons/CreditCardIcon.d.ts +6 -0
- package/dist/types/react/web/ui/ConnectWallet/icons/CreditCardIcon.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +4 -0
- 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/useUISelectionStates.d.ts +4 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts +2 -0
- package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/ChainName.d.ts +3 -0
- package/dist/types/react/web/ui/components/ChainName.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/TokenIcon.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/buttons.d.ts.map +1 -1
- package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts +90 -0
- package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/DirectPayment.stories.d.ts +65 -0
- package/dist/types/stories/Bridge/DirectPayment.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/ErrorBanner.stories.d.ts +55 -0
- package/dist/types/stories/Bridge/ErrorBanner.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/FundWallet.stories.d.ts +63 -0
- package/dist/types/stories/Bridge/FundWallet.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts +70 -0
- package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts +65 -0
- package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/StepRunner.stories.d.ts +61 -0
- package/dist/types/stories/Bridge/StepRunner.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts +58 -0
- package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts +55 -0
- package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/UnsupportedTokenScreen.stories.d.ts +39 -0
- package/dist/types/stories/Bridge/UnsupportedTokenScreen.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/fixtures.d.ts +37 -0
- package/dist/types/stories/Bridge/fixtures.d.ts.map +1 -0
- package/dist/types/stories/TokenBalanceRow.stories.d.ts +53 -0
- package/dist/types/stories/TokenBalanceRow.stories.d.ts.map +1 -0
- package/dist/types/stories/WalletRow.stories.d.ts +63 -0
- package/dist/types/stories/WalletRow.stories.d.ts.map +1 -0
- package/dist/types/stories/utils.d.ts +5 -0
- package/dist/types/stories/utils.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 -1
- package/src/bridge/Routes.ts +5 -0
- package/src/bridge/Token.ts +82 -1
- package/src/bridge/types/BridgeAction.ts +1 -1
- package/src/bridge/types/Errors.ts +11 -0
- package/src/exports/react.ts +16 -0
- package/src/pay/buyWithFiat/getQuote.ts +2 -2
- package/src/pay/convert/cryptoToFiat.ts +4 -4
- package/src/pay/convert/fiatToCrypto.ts +4 -4
- package/src/pay/convert/get-token.ts +17 -4
- package/src/pay/utils/commonTypes.ts +1 -1
- package/src/react/components.md +134 -0
- package/src/react/core/adapters/.keep +2 -0
- package/src/react/core/adapters/WindowAdapter.ts +13 -0
- package/src/react/core/errors/.keep +2 -0
- package/src/react/core/errors/mapBridgeError.test.ts +98 -0
- package/src/react/core/errors/mapBridgeError.ts +25 -0
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +42 -37
- package/src/react/core/hooks/others/useChainQuery.ts +1 -1
- package/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.ts +100 -0
- package/src/react/core/hooks/transaction/useSendTransaction.ts +1 -1
- package/src/react/core/hooks/useBridgeError.test.ts +172 -0
- package/src/react/core/hooks/useBridgeError.ts +149 -0
- package/src/react/core/hooks/useBridgePrepare.test.ts +161 -0
- package/src/react/core/hooks/useBridgePrepare.ts +133 -0
- package/src/react/core/hooks/useBridgeQuote.ts +67 -0
- package/src/react/core/hooks/useBridgeRoutes.test.ts +137 -0
- package/src/react/core/hooks/useBridgeRoutes.ts +75 -0
- package/src/react/core/hooks/usePaymentMethods.test.ts +336 -0
- package/src/react/core/hooks/usePaymentMethods.ts +203 -0
- package/src/react/core/hooks/useStepExecutor.ts +606 -0
- package/src/react/core/hooks/useTransactionDetails.ts +177 -0
- package/src/react/core/hooks/wallets/useAutoConnectCore.test.tsx +1 -57
- package/src/react/core/machines/.keep +2 -0
- package/src/react/core/machines/paymentMachine.test.ts +691 -0
- package/src/react/core/machines/paymentMachine.ts +290 -0
- package/src/react/core/types/.keep +2 -0
- package/src/react/core/utils/wallet.test.ts +77 -0
- package/src/react/native/flows/.keep +2 -0
- package/src/react/web/adapters/WindowAdapter.ts +23 -0
- package/src/react/web/adapters/adapters.test.ts +38 -0
- package/src/react/web/flows/.keep +2 -0
- package/src/react/web/hooks/transaction/useSendTransaction.tsx +5 -0
- package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +357 -0
- package/src/react/web/ui/Bridge/BuyWidget.tsx +494 -0
- package/src/react/web/ui/Bridge/CheckoutWidget.tsx +484 -0
- package/src/react/web/ui/Bridge/DirectPayment.tsx +234 -0
- package/src/react/web/ui/Bridge/ErrorBanner.tsx +86 -0
- package/src/react/web/ui/Bridge/FundWallet.tsx +341 -0
- package/src/react/web/ui/Bridge/QuoteLoader.tsx +219 -0
- package/src/react/web/ui/Bridge/StepRunner.tsx +417 -0
- package/src/react/web/ui/Bridge/TransactionPayment.tsx +403 -0
- package/src/react/web/ui/Bridge/TransactionWidget.tsx +502 -0
- package/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx +84 -0
- package/src/react/web/ui/Bridge/common/TokenAndChain.tsx +203 -0
- package/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx +112 -0
- package/src/react/web/ui/Bridge/common/WithHeader.tsx +65 -0
- package/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx +318 -0
- package/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx +301 -0
- package/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx +186 -0
- package/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx +268 -0
- package/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx +282 -0
- package/src/react/web/ui/Bridge/payment-selection/WalletFiatSelection.tsx +172 -0
- package/src/react/web/ui/Bridge/payment-success/PaymentReceipt.tsx +392 -0
- package/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx +155 -0
- package/src/react/web/ui/ConnectWallet/Details.test.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/WalletSelector.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/constants.ts +1 -1
- package/src/react/web/ui/ConnectWallet/icons/CreditCardIcon.tsx +24 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +5 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +3 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +8 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +3 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx +7 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx +1 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +7 -3
- package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +22 -0
- package/src/react/web/ui/PayEmbed.tsx +2 -0
- package/src/react/web/ui/TransactionButton/DepositScreen.tsx +10 -5
- package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +78 -25
- package/src/react/web/ui/TransactionButton/TransactionModal.tsx +15 -9
- package/src/react/web/ui/components/ChainName.tsx +4 -2
- package/src/react/web/ui/components/TokenIcon.tsx +7 -4
- package/src/react/web/ui/components/buttons.tsx +1 -5
- package/src/stories/Bridge/BridgeOrchestrator.stories.tsx +267 -0
- package/src/stories/Bridge/DirectPayment.stories.tsx +225 -0
- package/src/stories/Bridge/ErrorBanner.stories.tsx +184 -0
- package/src/stories/Bridge/FundWallet.stories.tsx +196 -0
- package/src/stories/Bridge/PaymentDetails.stories.tsx +501 -0
- package/src/stories/Bridge/PaymentSelection.stories.tsx +177 -0
- package/src/stories/Bridge/StepRunner.stories.tsx +109 -0
- package/src/stories/Bridge/SuccessScreen.stories.tsx +217 -0
- package/src/stories/Bridge/TransactionPayment.stories.tsx +170 -0
- package/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx +119 -0
- package/src/stories/Bridge/fixtures.ts +802 -0
- package/src/stories/TokenBalanceRow.stories.tsx +169 -0
- package/src/stories/WalletRow.stories.tsx +166 -0
- package/src/stories/utils.tsx +35 -0
- package/src/version.ts +1 -1
- package/src/wallets/connection/autoConnectCore.test.ts +0 -53
@@ -0,0 +1,268 @@
|
|
1
|
+
"use client";
|
2
|
+
import { useEffect, useState } from "react";
|
3
|
+
import type { Token } from "../../../../../bridge/types/Token.js";
|
4
|
+
import { defineChain } from "../../../../../chains/utils.js";
|
5
|
+
import type { ThirdwebClient } from "../../../../../client/client.js";
|
6
|
+
import type { Address } from "../../../../../utils/address.js";
|
7
|
+
import { toUnits } from "../../../../../utils/units.js";
|
8
|
+
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
|
9
|
+
import { usePaymentMethods } from "../../../../core/hooks/usePaymentMethods.js";
|
10
|
+
import { useActiveWallet } from "../../../../core/hooks/wallets/useActiveWallet.js";
|
11
|
+
import { useConnectedWallets } from "../../../../core/hooks/wallets/useConnectedWallets.js";
|
12
|
+
import type { PaymentMethod } from "../../../../core/machines/paymentMachine.js";
|
13
|
+
import type { ConnectLocale } from "../../ConnectWallet/locale/types.js";
|
14
|
+
import { WalletSwitcherConnectionScreen } from "../../ConnectWallet/screens/WalletSwitcherConnectionScreen.js";
|
15
|
+
import type { PayEmbedConnectOptions } from "../../PayEmbed.js";
|
16
|
+
import { Spacer } from "../../components/Spacer.js";
|
17
|
+
import { Container, ModalHeader } from "../../components/basic.js";
|
18
|
+
import { FiatProviderSelection } from "./FiatProviderSelection.js";
|
19
|
+
import { TokenSelection } from "./TokenSelection.js";
|
20
|
+
import { WalletFiatSelection } from "./WalletFiatSelection.js";
|
21
|
+
|
22
|
+
export interface PaymentSelectionProps {
|
23
|
+
/**
|
24
|
+
* The destination token to bridge to
|
25
|
+
*/
|
26
|
+
destinationToken: Token;
|
27
|
+
|
28
|
+
/**
|
29
|
+
* The destination amount to bridge
|
30
|
+
*/
|
31
|
+
destinationAmount: string;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* The receiver address
|
35
|
+
*/
|
36
|
+
receiverAddress?: Address;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* ThirdwebClient for API calls
|
40
|
+
*/
|
41
|
+
client: ThirdwebClient;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Called when user selects a payment method
|
45
|
+
*/
|
46
|
+
onPaymentMethodSelected: (paymentMethod: PaymentMethod) => void;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Called when an error occurs
|
50
|
+
*/
|
51
|
+
onError: (error: Error) => void;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Called when user wants to go back
|
55
|
+
*/
|
56
|
+
onBack?: () => void;
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Connect options for wallet connection
|
60
|
+
*/
|
61
|
+
connectOptions?: PayEmbedConnectOptions;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Locale for connect UI
|
65
|
+
*/
|
66
|
+
connectLocale: ConnectLocale;
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Whether to include the destination token in the payment methods
|
70
|
+
*/
|
71
|
+
includeDestinationToken?: boolean;
|
72
|
+
}
|
73
|
+
|
74
|
+
type Step =
|
75
|
+
| { type: "walletSelection" }
|
76
|
+
| { type: "tokenSelection"; selectedWallet: Wallet }
|
77
|
+
| { type: "fiatProviderSelection" }
|
78
|
+
| { type: "walletConnection" };
|
79
|
+
|
80
|
+
export function PaymentSelection({
|
81
|
+
destinationToken,
|
82
|
+
client,
|
83
|
+
destinationAmount,
|
84
|
+
receiverAddress,
|
85
|
+
onPaymentMethodSelected,
|
86
|
+
onError,
|
87
|
+
onBack,
|
88
|
+
connectOptions,
|
89
|
+
connectLocale,
|
90
|
+
includeDestinationToken,
|
91
|
+
}: PaymentSelectionProps) {
|
92
|
+
const connectedWallets = useConnectedWallets();
|
93
|
+
const activeWallet = useActiveWallet();
|
94
|
+
|
95
|
+
const [currentStep, setCurrentStep] = useState<Step>({
|
96
|
+
type: "walletSelection",
|
97
|
+
});
|
98
|
+
|
99
|
+
const payerWallet =
|
100
|
+
currentStep.type === "tokenSelection"
|
101
|
+
? currentStep.selectedWallet
|
102
|
+
: activeWallet;
|
103
|
+
const {
|
104
|
+
data: paymentMethods,
|
105
|
+
isLoading: paymentMethodsLoading,
|
106
|
+
error: paymentMethodsError,
|
107
|
+
} = usePaymentMethods({
|
108
|
+
destinationToken,
|
109
|
+
destinationAmount,
|
110
|
+
client,
|
111
|
+
includeDestinationToken:
|
112
|
+
includeDestinationToken ||
|
113
|
+
receiverAddress?.toLowerCase() !==
|
114
|
+
payerWallet?.getAccount()?.address?.toLowerCase(),
|
115
|
+
payerWallet,
|
116
|
+
});
|
117
|
+
|
118
|
+
// Handle error from usePaymentMethods
|
119
|
+
useEffect(() => {
|
120
|
+
if (paymentMethodsError) {
|
121
|
+
onError(paymentMethodsError as Error);
|
122
|
+
}
|
123
|
+
}, [paymentMethodsError, onError]);
|
124
|
+
|
125
|
+
const handlePaymentMethodSelected = (paymentMethod: PaymentMethod) => {
|
126
|
+
try {
|
127
|
+
onPaymentMethodSelected(paymentMethod);
|
128
|
+
} catch (error) {
|
129
|
+
onError(error as Error);
|
130
|
+
}
|
131
|
+
};
|
132
|
+
|
133
|
+
const handleWalletSelected = (wallet: Wallet) => {
|
134
|
+
setCurrentStep({ type: "tokenSelection", selectedWallet: wallet });
|
135
|
+
};
|
136
|
+
|
137
|
+
const handleConnectWallet = async () => {
|
138
|
+
setCurrentStep({ type: "walletConnection" });
|
139
|
+
};
|
140
|
+
|
141
|
+
const handleFiatSelected = () => {
|
142
|
+
setCurrentStep({ type: "fiatProviderSelection" });
|
143
|
+
};
|
144
|
+
|
145
|
+
const handleBackToWalletSelection = () => {
|
146
|
+
setCurrentStep({ type: "walletSelection" });
|
147
|
+
};
|
148
|
+
|
149
|
+
const handleOnrampProviderSelected = (
|
150
|
+
provider: "coinbase" | "stripe" | "transak",
|
151
|
+
) => {
|
152
|
+
if (!payerWallet) {
|
153
|
+
onError(new Error("No wallet available for fiat payment"));
|
154
|
+
return;
|
155
|
+
}
|
156
|
+
|
157
|
+
const fiatPaymentMethod: PaymentMethod = {
|
158
|
+
type: "fiat",
|
159
|
+
payerWallet,
|
160
|
+
currency: "USD", // Default to USD for now
|
161
|
+
onramp: provider,
|
162
|
+
};
|
163
|
+
handlePaymentMethodSelected(fiatPaymentMethod);
|
164
|
+
};
|
165
|
+
|
166
|
+
const getStepTitle = () => {
|
167
|
+
switch (currentStep.type) {
|
168
|
+
case "walletSelection":
|
169
|
+
return "Choose Payment Method";
|
170
|
+
case "tokenSelection":
|
171
|
+
return "Select Token";
|
172
|
+
case "fiatProviderSelection":
|
173
|
+
return "Select Payment Provider";
|
174
|
+
case "walletConnection":
|
175
|
+
return "Connect Wallet";
|
176
|
+
}
|
177
|
+
};
|
178
|
+
|
179
|
+
const getBackHandler = () => {
|
180
|
+
switch (currentStep.type) {
|
181
|
+
case "walletSelection":
|
182
|
+
return onBack;
|
183
|
+
case "tokenSelection":
|
184
|
+
case "fiatProviderSelection":
|
185
|
+
case "walletConnection":
|
186
|
+
return handleBackToWalletSelection;
|
187
|
+
}
|
188
|
+
};
|
189
|
+
|
190
|
+
// Handle rendering WalletSwitcherConnectionScreen
|
191
|
+
if (currentStep.type === "walletConnection") {
|
192
|
+
const destinationChain = destinationToken
|
193
|
+
? defineChain(destinationToken.chainId)
|
194
|
+
: undefined;
|
195
|
+
const chains = destinationChain
|
196
|
+
? [destinationChain, ...(connectOptions?.chains || [])]
|
197
|
+
: connectOptions?.chains;
|
198
|
+
|
199
|
+
return (
|
200
|
+
<WalletSwitcherConnectionScreen
|
201
|
+
accountAbstraction={connectOptions?.accountAbstraction}
|
202
|
+
appMetadata={connectOptions?.appMetadata}
|
203
|
+
chain={destinationChain || connectOptions?.chain}
|
204
|
+
chains={chains}
|
205
|
+
client={client}
|
206
|
+
connectLocale={connectLocale}
|
207
|
+
isEmbed={false}
|
208
|
+
onBack={handleBackToWalletSelection}
|
209
|
+
onSelect={handleWalletSelected}
|
210
|
+
hiddenWallets={[]}
|
211
|
+
recommendedWallets={connectOptions?.recommendedWallets}
|
212
|
+
showAllWallets={
|
213
|
+
connectOptions?.showAllWallets === undefined
|
214
|
+
? true
|
215
|
+
: connectOptions?.showAllWallets
|
216
|
+
}
|
217
|
+
walletConnect={connectOptions?.walletConnect}
|
218
|
+
wallets={connectOptions?.wallets?.filter((w) => w.id !== "inApp")}
|
219
|
+
/>
|
220
|
+
);
|
221
|
+
}
|
222
|
+
|
223
|
+
return (
|
224
|
+
<Container flex="column" p="lg">
|
225
|
+
<ModalHeader title={getStepTitle()} onBack={getBackHandler()} />
|
226
|
+
|
227
|
+
<Spacer y="xl" />
|
228
|
+
|
229
|
+
<Container flex="column">
|
230
|
+
{currentStep.type === "walletSelection" && (
|
231
|
+
<WalletFiatSelection
|
232
|
+
connectedWallets={connectedWallets}
|
233
|
+
client={client}
|
234
|
+
onWalletSelected={handleWalletSelected}
|
235
|
+
onFiatSelected={handleFiatSelected}
|
236
|
+
onConnectWallet={handleConnectWallet}
|
237
|
+
/>
|
238
|
+
)}
|
239
|
+
|
240
|
+
{currentStep.type === "tokenSelection" && (
|
241
|
+
<TokenSelection
|
242
|
+
paymentMethods={paymentMethods}
|
243
|
+
paymentMethodsLoading={paymentMethodsLoading}
|
244
|
+
client={client}
|
245
|
+
onPaymentMethodSelected={handlePaymentMethodSelected}
|
246
|
+
onBack={handleBackToWalletSelection}
|
247
|
+
destinationToken={destinationToken}
|
248
|
+
destinationAmount={toUnits(
|
249
|
+
destinationAmount,
|
250
|
+
destinationToken.decimals,
|
251
|
+
)}
|
252
|
+
/>
|
253
|
+
)}
|
254
|
+
|
255
|
+
{currentStep.type === "fiatProviderSelection" && (
|
256
|
+
<FiatProviderSelection
|
257
|
+
client={client}
|
258
|
+
onProviderSelected={handleOnrampProviderSelected}
|
259
|
+
toChainId={destinationToken.chainId}
|
260
|
+
toTokenAddress={destinationToken.address}
|
261
|
+
toAddress={receiverAddress || ""}
|
262
|
+
toAmount={destinationAmount}
|
263
|
+
/>
|
264
|
+
)}
|
265
|
+
</Container>
|
266
|
+
</Container>
|
267
|
+
);
|
268
|
+
}
|
@@ -0,0 +1,282 @@
|
|
1
|
+
"use client";
|
2
|
+
import type { Token } from "../../../../../bridge/types/Token.js";
|
3
|
+
import type { ThirdwebClient } from "../../../../../client/client.js";
|
4
|
+
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
|
5
|
+
import { radius, spacing } from "../../../../core/design-system/index.js";
|
6
|
+
import { useBridgeQuote } from "../../../../core/hooks/useBridgeQuote.js";
|
7
|
+
import type { PaymentMethod } from "../../../../core/machines/paymentMachine.js";
|
8
|
+
import { formatTokenAmount } from "../../ConnectWallet/screens/formatTokenBalance.js";
|
9
|
+
import { Skeleton } from "../../components/Skeleton.js";
|
10
|
+
import { Spacer } from "../../components/Spacer.js";
|
11
|
+
import { Container } from "../../components/basic.js";
|
12
|
+
import { Button } from "../../components/buttons.js";
|
13
|
+
import { Text } from "../../components/text.js";
|
14
|
+
import { TokenAndChain } from "../common/TokenAndChain.js";
|
15
|
+
|
16
|
+
interface TokenSelectionProps {
|
17
|
+
paymentMethods: PaymentMethod[];
|
18
|
+
paymentMethodsLoading: boolean;
|
19
|
+
client: ThirdwebClient;
|
20
|
+
onPaymentMethodSelected: (paymentMethod: PaymentMethod) => void;
|
21
|
+
onBack: () => void;
|
22
|
+
destinationToken: Token;
|
23
|
+
destinationAmount: bigint;
|
24
|
+
}
|
25
|
+
|
26
|
+
// Individual payment method token row component
|
27
|
+
interface PaymentMethodTokenRowProps {
|
28
|
+
paymentMethod: PaymentMethod & { type: "wallet" };
|
29
|
+
destinationToken: Token;
|
30
|
+
destinationAmount: bigint;
|
31
|
+
client: ThirdwebClient;
|
32
|
+
onPaymentMethodSelected: (paymentMethod: PaymentMethod) => void;
|
33
|
+
}
|
34
|
+
|
35
|
+
function PaymentMethodTokenRow({
|
36
|
+
paymentMethod,
|
37
|
+
destinationToken,
|
38
|
+
destinationAmount,
|
39
|
+
client,
|
40
|
+
onPaymentMethodSelected,
|
41
|
+
}: PaymentMethodTokenRowProps) {
|
42
|
+
const theme = useCustomTheme();
|
43
|
+
|
44
|
+
// Fetch individual quote for this specific token pair
|
45
|
+
const {
|
46
|
+
data: quote,
|
47
|
+
isLoading: quoteLoading,
|
48
|
+
error: quoteError,
|
49
|
+
} = useBridgeQuote({
|
50
|
+
originToken: paymentMethod.originToken,
|
51
|
+
destinationToken,
|
52
|
+
destinationAmount,
|
53
|
+
client,
|
54
|
+
});
|
55
|
+
|
56
|
+
// Use the fetched originAmount if available, otherwise fall back to the one from paymentMethod
|
57
|
+
const displayOriginAmount = quote?.originAmount;
|
58
|
+
const hasEnoughBalance = displayOriginAmount
|
59
|
+
? paymentMethod.balance >= displayOriginAmount
|
60
|
+
: false;
|
61
|
+
|
62
|
+
return (
|
63
|
+
<Button
|
64
|
+
key={`${paymentMethod.originToken.address}-${paymentMethod.originToken.chainId}`}
|
65
|
+
variant="secondary"
|
66
|
+
fullWidth
|
67
|
+
onClick={() => onPaymentMethodSelected(paymentMethod)}
|
68
|
+
disabled={!hasEnoughBalance}
|
69
|
+
style={{
|
70
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
71
|
+
borderRadius: radius.md,
|
72
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
73
|
+
backgroundColor: theme.colors.tertiaryBg,
|
74
|
+
opacity: hasEnoughBalance ? 1 : 0.5,
|
75
|
+
textAlign: "left",
|
76
|
+
}}
|
77
|
+
>
|
78
|
+
<Container
|
79
|
+
flex="row"
|
80
|
+
gap="md"
|
81
|
+
style={{ width: "100%", alignItems: "center" }}
|
82
|
+
>
|
83
|
+
<TokenAndChain
|
84
|
+
token={paymentMethod.originToken}
|
85
|
+
client={client}
|
86
|
+
size="lg"
|
87
|
+
style={{
|
88
|
+
maxWidth: "50%",
|
89
|
+
}}
|
90
|
+
/>
|
91
|
+
<Container
|
92
|
+
flex="column"
|
93
|
+
gap="3xs"
|
94
|
+
style={{ flex: 1, alignItems: "flex-end" }}
|
95
|
+
>
|
96
|
+
{quoteLoading ? (
|
97
|
+
<>
|
98
|
+
{/* Price amount skeleton */}
|
99
|
+
<Skeleton width="80px" height="16px" />
|
100
|
+
{/* Balance skeleton */}
|
101
|
+
<Container flex="row" gap="3xs">
|
102
|
+
<Skeleton width="50px" height="12px" />
|
103
|
+
<Skeleton width="40px" height="12px" />
|
104
|
+
</Container>
|
105
|
+
</>
|
106
|
+
) : quoteError ? (
|
107
|
+
<Text size="sm" color="danger" style={{ fontWeight: 600 }}>
|
108
|
+
Quote failed
|
109
|
+
</Text>
|
110
|
+
) : displayOriginAmount ? (
|
111
|
+
<Text
|
112
|
+
size="sm"
|
113
|
+
color="primaryText"
|
114
|
+
style={{ fontWeight: 600, textWrap: "nowrap" }}
|
115
|
+
>
|
116
|
+
{formatTokenAmount(
|
117
|
+
displayOriginAmount,
|
118
|
+
paymentMethod.originToken.decimals,
|
119
|
+
)}{" "}
|
120
|
+
{paymentMethod.originToken.symbol}
|
121
|
+
</Text>
|
122
|
+
) : (
|
123
|
+
"--.--"
|
124
|
+
)}
|
125
|
+
{!quoteLoading && (
|
126
|
+
<Container flex="row" gap="3xs">
|
127
|
+
<Text size="xs" color="secondaryText">
|
128
|
+
Balance:{" "}
|
129
|
+
</Text>
|
130
|
+
<Text
|
131
|
+
size="xs"
|
132
|
+
color={
|
133
|
+
!quoteLoading
|
134
|
+
? hasEnoughBalance
|
135
|
+
? "success"
|
136
|
+
: "danger"
|
137
|
+
: "secondaryText"
|
138
|
+
}
|
139
|
+
>
|
140
|
+
{formatTokenAmount(
|
141
|
+
paymentMethod.balance,
|
142
|
+
paymentMethod.originToken.decimals,
|
143
|
+
)}
|
144
|
+
</Text>
|
145
|
+
</Container>
|
146
|
+
)}
|
147
|
+
</Container>
|
148
|
+
</Container>
|
149
|
+
</Button>
|
150
|
+
);
|
151
|
+
}
|
152
|
+
|
153
|
+
export function TokenSelection({
|
154
|
+
paymentMethods,
|
155
|
+
paymentMethodsLoading,
|
156
|
+
client,
|
157
|
+
onPaymentMethodSelected,
|
158
|
+
onBack,
|
159
|
+
destinationToken,
|
160
|
+
destinationAmount,
|
161
|
+
}: TokenSelectionProps) {
|
162
|
+
const theme = useCustomTheme();
|
163
|
+
|
164
|
+
if (paymentMethodsLoading) {
|
165
|
+
return (
|
166
|
+
<>
|
167
|
+
<Text size="md" color="primaryText">
|
168
|
+
Loading your tokens
|
169
|
+
</Text>
|
170
|
+
<Spacer y="sm" />
|
171
|
+
<Container flex="column" gap="sm">
|
172
|
+
{/* Skeleton rows matching PaymentMethodTokenRow structure */}
|
173
|
+
{[1, 2, 3].map((i) => (
|
174
|
+
<Container
|
175
|
+
key={i}
|
176
|
+
style={{
|
177
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
178
|
+
borderRadius: radius.md,
|
179
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
180
|
+
backgroundColor: theme.colors.tertiaryBg,
|
181
|
+
}}
|
182
|
+
>
|
183
|
+
<Container
|
184
|
+
flex="row"
|
185
|
+
gap="md"
|
186
|
+
style={{ width: "100%", alignItems: "center" }}
|
187
|
+
>
|
188
|
+
{/* Left side: Token icon and name skeleton */}
|
189
|
+
<Container
|
190
|
+
flex="row"
|
191
|
+
gap="sm"
|
192
|
+
center="y"
|
193
|
+
style={{ maxWidth: "50%" }}
|
194
|
+
>
|
195
|
+
{/* Token icon skeleton */}
|
196
|
+
<div
|
197
|
+
style={{
|
198
|
+
width: "32px",
|
199
|
+
height: "32px",
|
200
|
+
backgroundColor: theme.colors.skeletonBg,
|
201
|
+
borderRadius: "50%",
|
202
|
+
}}
|
203
|
+
/>
|
204
|
+
<Container flex="column" gap="3xs">
|
205
|
+
{/* Token name skeleton */}
|
206
|
+
<Skeleton width="60px" height="14px" />
|
207
|
+
{/* Chain name skeleton */}
|
208
|
+
<Skeleton width="40px" height="12px" />
|
209
|
+
</Container>
|
210
|
+
</Container>
|
211
|
+
|
212
|
+
{/* Right side: Price and balance skeleton */}
|
213
|
+
<Container
|
214
|
+
flex="column"
|
215
|
+
gap="3xs"
|
216
|
+
style={{ flex: 1, alignItems: "flex-end" }}
|
217
|
+
>
|
218
|
+
{/* Price amount skeleton */}
|
219
|
+
<Skeleton width="80px" height="16px" />
|
220
|
+
{/* Balance skeleton */}
|
221
|
+
<Container flex="row" gap="3xs">
|
222
|
+
<Skeleton width="50px" height="12px" />
|
223
|
+
<Skeleton width="40px" height="12px" />
|
224
|
+
</Container>
|
225
|
+
</Container>
|
226
|
+
</Container>
|
227
|
+
</Container>
|
228
|
+
))}
|
229
|
+
</Container>
|
230
|
+
</>
|
231
|
+
);
|
232
|
+
}
|
233
|
+
|
234
|
+
if (paymentMethods.length === 0) {
|
235
|
+
return (
|
236
|
+
<Container flex="column" center="both" style={{ minHeight: "250px" }}>
|
237
|
+
<Text size="md" color="primaryText" center>
|
238
|
+
No available tokens found for this wallet
|
239
|
+
</Text>
|
240
|
+
<Spacer y="sm" />
|
241
|
+
<Text size="sm" color="secondaryText" center>
|
242
|
+
Try connecting a different wallet or pay with card
|
243
|
+
</Text>
|
244
|
+
<Spacer y="lg" />
|
245
|
+
<Button variant="primary" onClick={onBack}>
|
246
|
+
Select another payment method
|
247
|
+
</Button>
|
248
|
+
</Container>
|
249
|
+
);
|
250
|
+
}
|
251
|
+
|
252
|
+
return (
|
253
|
+
<>
|
254
|
+
<Text size="md" color="primaryText">
|
255
|
+
Select payment token
|
256
|
+
</Text>
|
257
|
+
<Spacer y="sm" />
|
258
|
+
<Container
|
259
|
+
flex="column"
|
260
|
+
gap="sm"
|
261
|
+
style={{
|
262
|
+
maxHeight: "400px",
|
263
|
+
overflowY: "auto",
|
264
|
+
scrollbarWidth: "none",
|
265
|
+
}}
|
266
|
+
>
|
267
|
+
{paymentMethods
|
268
|
+
.filter((method) => method.type === "wallet")
|
269
|
+
.map((method) => (
|
270
|
+
<PaymentMethodTokenRow
|
271
|
+
key={`${method.originToken.address}-${method.originToken.chainId}`}
|
272
|
+
paymentMethod={method}
|
273
|
+
destinationToken={destinationToken}
|
274
|
+
destinationAmount={destinationAmount}
|
275
|
+
client={client}
|
276
|
+
onPaymentMethodSelected={onPaymentMethodSelected}
|
277
|
+
/>
|
278
|
+
))}
|
279
|
+
</Container>
|
280
|
+
</>
|
281
|
+
);
|
282
|
+
}
|