thirdweb 5.102.7-nightly-3f747601135809eedf86a150752f4b5f12c99776-20250617000426 → 5.103.1-nightly-bb09e20bcb1662c088bf8b61486df7d0d92da8d0-20250618000421
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/cli/bin.js +2 -2
- package/dist/cjs/cli/bin.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/hooks/wallets/useSendToken.js +17 -2
- package/dist/cjs/react/core/hooks/wallets/useSendToken.js.map +1 -1
- 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 +143 -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 +162 -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/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/cli/bin.js +2 -2
- package/dist/esm/cli/bin.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/hooks/wallets/useSendToken.js +17 -2
- package/dist/esm/react/core/hooks/wallets/useSendToken.js.map +1 -1
- 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 +140 -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 +159 -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/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/hooks/wallets/useSendToken.d.ts.map +1 -1
- 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 +317 -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 +338 -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/wallets/utils/getWalletBalance.d.ts +1 -1
- package/dist/types/wallets/utils/getWalletBalance.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/bridge/Routes.ts +5 -0
- package/src/bridge/Status.test.ts +1 -1
- 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/cli/bin.ts +2 -2
- 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.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.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/hooks/wallets/useSendToken.ts +17 -3
- package/src/react/core/machines/.keep +2 -0
- package/src/react/core/machines/paymentMachine.test.ts +519 -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 +30 -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 +473 -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 +485 -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
- package/src/wallets/utils/getWalletBalance.ts +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import type { Token } from "../../../../../bridge/index.js";
|
|
3
|
+
import type { Chain } from "../../../../../chains/types.js";
|
|
4
|
+
import { getCachedChain } from "../../../../../chains/utils.js";
|
|
5
|
+
import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
6
|
+
import { NATIVE_TOKEN_ADDRESS } from "../../../../../constants/addresses.js";
|
|
7
|
+
import { resolveScheme } from "../../../../../utils/ipfs.js";
|
|
8
|
+
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
|
|
9
|
+
import { iconSize, spacing } from "../../../../core/design-system/index.js";
|
|
10
|
+
import {
|
|
11
|
+
useChainIconUrl,
|
|
12
|
+
useChainMetadata,
|
|
13
|
+
} from "../../../../core/hooks/others/useChainQuery.js";
|
|
14
|
+
import { genericTokenIcon } from "../../../../core/utils/walletIcon.js";
|
|
15
|
+
import { isNativeToken } from "../../ConnectWallet/screens/nativeToken.js";
|
|
16
|
+
import { ChainName } from "../../components/ChainName.js";
|
|
17
|
+
import { Img } from "../../components/Img.js";
|
|
18
|
+
import { Container } from "../../components/basic.js";
|
|
19
|
+
import { fallbackChainIcon } from "../../components/fallbackChainIcon.js";
|
|
20
|
+
import { Text } from "../../components/text.js";
|
|
21
|
+
|
|
22
|
+
export function TokenAndChain({
|
|
23
|
+
token,
|
|
24
|
+
client,
|
|
25
|
+
size,
|
|
26
|
+
style,
|
|
27
|
+
}: {
|
|
28
|
+
token: Omit<Token, "priceUsd">;
|
|
29
|
+
client: ThirdwebClient;
|
|
30
|
+
size: keyof typeof iconSize;
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
}) {
|
|
33
|
+
const theme = useCustomTheme();
|
|
34
|
+
const chain = getCachedChain(token.chainId);
|
|
35
|
+
return (
|
|
36
|
+
<Container
|
|
37
|
+
flex="row"
|
|
38
|
+
center="y"
|
|
39
|
+
gap="sm"
|
|
40
|
+
style={{
|
|
41
|
+
flexWrap: "nowrap",
|
|
42
|
+
...style,
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<Container
|
|
46
|
+
style={{
|
|
47
|
+
position: "relative",
|
|
48
|
+
width: iconSize[size],
|
|
49
|
+
height: iconSize[size],
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<TokenIconWithFallback token={token} size={size} client={client} />
|
|
53
|
+
{chain.id !== 1 && (
|
|
54
|
+
<Container
|
|
55
|
+
style={{
|
|
56
|
+
position: "absolute",
|
|
57
|
+
bottom: "-2px",
|
|
58
|
+
right: "-6px",
|
|
59
|
+
width: size === "lg" || size === "xl" ? iconSize.sm : iconSize.xs,
|
|
60
|
+
height:
|
|
61
|
+
size === "lg" || size === "xl" ? iconSize.sm : iconSize.xs,
|
|
62
|
+
borderRadius: "50%",
|
|
63
|
+
background: theme.colors.borderColor,
|
|
64
|
+
border: `1.5px solid ${theme.colors.modalBg}`,
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<ChainIcon
|
|
68
|
+
chain={chain}
|
|
69
|
+
size={size === "xl" || size === "lg" ? "sm" : "xs"}
|
|
70
|
+
client={client}
|
|
71
|
+
/>
|
|
72
|
+
</Container>
|
|
73
|
+
)}
|
|
74
|
+
</Container>
|
|
75
|
+
|
|
76
|
+
<Container flex="column" gap="3xs" style={{ minWidth: 0 }}>
|
|
77
|
+
<Text
|
|
78
|
+
size={size === "xl" ? "lg" : "sm"}
|
|
79
|
+
color="primaryText"
|
|
80
|
+
weight={600}
|
|
81
|
+
style={{
|
|
82
|
+
overflow: "hidden",
|
|
83
|
+
textOverflow: "ellipsis",
|
|
84
|
+
whiteSpace: "nowrap",
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
{token.name}
|
|
88
|
+
</Text>
|
|
89
|
+
<ChainName
|
|
90
|
+
chain={chain}
|
|
91
|
+
size={size === "xl" ? "sm" : "xs"}
|
|
92
|
+
client={client}
|
|
93
|
+
short
|
|
94
|
+
/>
|
|
95
|
+
</Container>
|
|
96
|
+
</Container>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function TokenIconWithFallback(props: {
|
|
101
|
+
token: Omit<Token, "priceUsd">;
|
|
102
|
+
size: keyof typeof iconSize;
|
|
103
|
+
client: ThirdwebClient;
|
|
104
|
+
}) {
|
|
105
|
+
const chain = getCachedChain(props.token.chainId);
|
|
106
|
+
const chainMeta = useChainMetadata(chain).data;
|
|
107
|
+
const theme = useCustomTheme();
|
|
108
|
+
|
|
109
|
+
const tokenImage = useMemo(() => {
|
|
110
|
+
if (
|
|
111
|
+
isNativeToken(props.token) ||
|
|
112
|
+
props.token.address === NATIVE_TOKEN_ADDRESS
|
|
113
|
+
) {
|
|
114
|
+
if (chainMeta?.nativeCurrency.symbol === "ETH") {
|
|
115
|
+
return "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png"; // ETH icon
|
|
116
|
+
}
|
|
117
|
+
return chainMeta?.icon?.url;
|
|
118
|
+
}
|
|
119
|
+
return props.token.iconUri;
|
|
120
|
+
}, [props.token, chainMeta?.icon?.url, chainMeta?.nativeCurrency.symbol]);
|
|
121
|
+
|
|
122
|
+
return tokenImage ? (
|
|
123
|
+
<Img
|
|
124
|
+
src={tokenImage}
|
|
125
|
+
style={{
|
|
126
|
+
borderRadius: "50%",
|
|
127
|
+
}}
|
|
128
|
+
width={iconSize[props.size]}
|
|
129
|
+
height={iconSize[props.size]}
|
|
130
|
+
fallbackImage={genericTokenIcon}
|
|
131
|
+
client={props.client}
|
|
132
|
+
/>
|
|
133
|
+
) : (
|
|
134
|
+
<Container
|
|
135
|
+
style={{
|
|
136
|
+
width: `${iconSize.md}px`,
|
|
137
|
+
height: `${iconSize.md}px`,
|
|
138
|
+
borderRadius: "50%",
|
|
139
|
+
backgroundColor: theme.colors.secondaryButtonBg,
|
|
140
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
|
141
|
+
display: "flex",
|
|
142
|
+
alignItems: "center",
|
|
143
|
+
justifyContent: "center",
|
|
144
|
+
padding: spacing.xs,
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
<Text
|
|
148
|
+
size={props.size === "xl" ? "sm" : "xs"}
|
|
149
|
+
color="secondaryText"
|
|
150
|
+
style={{ fontWeight: 600 }}
|
|
151
|
+
>
|
|
152
|
+
{props.token.symbol.slice(0, 1)}
|
|
153
|
+
</Text>
|
|
154
|
+
</Container>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const ChainIcon: React.FC<{
|
|
159
|
+
chain: Chain;
|
|
160
|
+
size: keyof typeof iconSize;
|
|
161
|
+
client: ThirdwebClient;
|
|
162
|
+
}> = (props) => {
|
|
163
|
+
const { url } = useChainIconUrl(props.chain);
|
|
164
|
+
return (
|
|
165
|
+
<Container
|
|
166
|
+
style={{
|
|
167
|
+
position: "relative",
|
|
168
|
+
display: "flex",
|
|
169
|
+
flexShrink: 0,
|
|
170
|
+
alignItems: "center",
|
|
171
|
+
}}
|
|
172
|
+
>
|
|
173
|
+
<Img
|
|
174
|
+
src={getSrcChainIcon({
|
|
175
|
+
client: props.client,
|
|
176
|
+
chainIconUrl: url,
|
|
177
|
+
})}
|
|
178
|
+
width={iconSize[props.size]}
|
|
179
|
+
height={iconSize[props.size]}
|
|
180
|
+
fallbackImage={fallbackChainIcon}
|
|
181
|
+
client={props.client}
|
|
182
|
+
/>
|
|
183
|
+
</Container>
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const getSrcChainIcon = (props: {
|
|
188
|
+
client: ThirdwebClient;
|
|
189
|
+
chainIconUrl?: string;
|
|
190
|
+
}) => {
|
|
191
|
+
const url = props.chainIconUrl;
|
|
192
|
+
if (!url) {
|
|
193
|
+
return fallbackChainIcon;
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
return resolveScheme({
|
|
197
|
+
uri: url,
|
|
198
|
+
client: props.client,
|
|
199
|
+
});
|
|
200
|
+
} catch {
|
|
201
|
+
return fallbackChainIcon;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import type { Token } from "../../../../../bridge/index.js";
|
|
3
|
+
import { getCachedChain } from "../../../../../chains/utils.js";
|
|
4
|
+
import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
5
|
+
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
|
|
6
|
+
import { spacing } from "../../../../core/design-system/index.js";
|
|
7
|
+
import { FiatValue } from "../../ConnectWallet/screens/Buy/swap/FiatValue.js";
|
|
8
|
+
import { Container } from "../../components/basic.js";
|
|
9
|
+
import { Button } from "../../components/buttons.js";
|
|
10
|
+
import { Text } from "../../components/text.js";
|
|
11
|
+
import { TokenAndChain } from "./TokenAndChain.js";
|
|
12
|
+
|
|
13
|
+
export function TokenBalanceRow({
|
|
14
|
+
client,
|
|
15
|
+
token,
|
|
16
|
+
amount,
|
|
17
|
+
onClick,
|
|
18
|
+
style,
|
|
19
|
+
}: {
|
|
20
|
+
client: ThirdwebClient;
|
|
21
|
+
token: Token;
|
|
22
|
+
amount: string;
|
|
23
|
+
onClick: (token: Token) => void;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
}) {
|
|
26
|
+
const chain = getCachedChain(token.chainId);
|
|
27
|
+
return (
|
|
28
|
+
<StyledButton
|
|
29
|
+
onClick={() => onClick(token)}
|
|
30
|
+
variant="secondary"
|
|
31
|
+
style={{
|
|
32
|
+
display: "flex",
|
|
33
|
+
justifyContent: "space-between",
|
|
34
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
|
35
|
+
...style,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<TokenAndChain
|
|
39
|
+
token={token}
|
|
40
|
+
client={client}
|
|
41
|
+
size="lg"
|
|
42
|
+
style={{ maxWidth: "50%", flex: 1 }}
|
|
43
|
+
/>
|
|
44
|
+
|
|
45
|
+
<Container
|
|
46
|
+
flex="row"
|
|
47
|
+
center="y"
|
|
48
|
+
gap="4xs"
|
|
49
|
+
color="secondaryText"
|
|
50
|
+
style={{
|
|
51
|
+
flex: "1",
|
|
52
|
+
maxWidth: "50%",
|
|
53
|
+
minWidth: 0,
|
|
54
|
+
justifyContent: "flex-end",
|
|
55
|
+
flexWrap: "nowrap",
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<Container
|
|
59
|
+
flex="column"
|
|
60
|
+
color="secondaryText"
|
|
61
|
+
gap="3xs"
|
|
62
|
+
style={{
|
|
63
|
+
alignItems: "flex-end",
|
|
64
|
+
minWidth: 0,
|
|
65
|
+
overflow: "hidden",
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<FiatValue
|
|
69
|
+
tokenAmount={amount}
|
|
70
|
+
token={token}
|
|
71
|
+
chain={chain}
|
|
72
|
+
client={client}
|
|
73
|
+
color="primaryText"
|
|
74
|
+
size="sm"
|
|
75
|
+
/>
|
|
76
|
+
<Text
|
|
77
|
+
size="xs"
|
|
78
|
+
color="secondaryText"
|
|
79
|
+
style={{
|
|
80
|
+
overflow: "hidden",
|
|
81
|
+
textOverflow: "ellipsis",
|
|
82
|
+
whiteSpace: "nowrap",
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{`${Number(amount).toLocaleString(undefined, {
|
|
86
|
+
maximumFractionDigits: 6,
|
|
87
|
+
minimumFractionDigits: 0,
|
|
88
|
+
})} ${token.symbol}`}
|
|
89
|
+
</Text>
|
|
90
|
+
</Container>
|
|
91
|
+
</Container>
|
|
92
|
+
</StyledButton>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const StyledButton = /* @__PURE__ */ styled(Button)((props) => {
|
|
97
|
+
const theme = useCustomTheme();
|
|
98
|
+
return {
|
|
99
|
+
background: "transparent",
|
|
100
|
+
justifyContent: "space-between",
|
|
101
|
+
flexWrap: "nowrap",
|
|
102
|
+
flexDirection: "row",
|
|
103
|
+
padding: spacing.sm,
|
|
104
|
+
paddingRight: spacing.xs,
|
|
105
|
+
gap: spacing.sm,
|
|
106
|
+
"&:hover": {
|
|
107
|
+
background: theme.colors.secondaryButtonBg,
|
|
108
|
+
},
|
|
109
|
+
transition: "background 200ms ease, transform 150ms ease",
|
|
110
|
+
...props.style,
|
|
111
|
+
};
|
|
112
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
2
|
+
import { resolveScheme } from "../../../../../utils/ipfs.js";
|
|
3
|
+
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
|
|
4
|
+
import { radius } from "../../../../core/design-system/index.js";
|
|
5
|
+
import { Spacer } from "../../components/Spacer.js";
|
|
6
|
+
import { Container } from "../../components/basic.js";
|
|
7
|
+
import { Text } from "../../components/text.js";
|
|
8
|
+
import type { UIOptions } from "../BridgeOrchestrator.js";
|
|
9
|
+
|
|
10
|
+
export function WithHeader({
|
|
11
|
+
children,
|
|
12
|
+
uiOptions,
|
|
13
|
+
defaultTitle,
|
|
14
|
+
client,
|
|
15
|
+
}: {
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
uiOptions: UIOptions;
|
|
18
|
+
defaultTitle: string;
|
|
19
|
+
client: ThirdwebClient;
|
|
20
|
+
}) {
|
|
21
|
+
const theme = useCustomTheme();
|
|
22
|
+
return (
|
|
23
|
+
<Container flex="column">
|
|
24
|
+
{/* image */}
|
|
25
|
+
{uiOptions.metadata?.image && (
|
|
26
|
+
<div
|
|
27
|
+
style={{
|
|
28
|
+
width: "100%",
|
|
29
|
+
borderRadius: `${radius.md} ${radius.md} 0 0`,
|
|
30
|
+
overflow: "hidden",
|
|
31
|
+
aspectRatio: "16/9",
|
|
32
|
+
backgroundColor: theme.colors.tertiaryBg,
|
|
33
|
+
backgroundImage: `url(${resolveScheme({
|
|
34
|
+
client,
|
|
35
|
+
uri: uiOptions.metadata.image,
|
|
36
|
+
})})`,
|
|
37
|
+
backgroundSize: "cover",
|
|
38
|
+
backgroundPosition: "center",
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
<Container flex="column" px="lg">
|
|
43
|
+
<Spacer y="lg" />
|
|
44
|
+
|
|
45
|
+
{/* title */}
|
|
46
|
+
<Text size="lg" color="primaryText" weight={700}>
|
|
47
|
+
{uiOptions.metadata?.title || defaultTitle}
|
|
48
|
+
</Text>
|
|
49
|
+
|
|
50
|
+
{/* Description */}
|
|
51
|
+
{uiOptions.metadata?.description && (
|
|
52
|
+
<>
|
|
53
|
+
<Spacer y="xs" />
|
|
54
|
+
<Text size="sm" color="secondaryText">
|
|
55
|
+
{uiOptions.metadata?.description}
|
|
56
|
+
</Text>
|
|
57
|
+
</>
|
|
58
|
+
)}
|
|
59
|
+
|
|
60
|
+
<Spacer y="lg" />
|
|
61
|
+
{children}
|
|
62
|
+
</Container>
|
|
63
|
+
</Container>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
3
|
+
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
|
|
4
|
+
import { radius, spacing } from "../../../../core/design-system/index.js";
|
|
5
|
+
import type { BridgePrepareResult } from "../../../../core/hooks/useBridgePrepare.js";
|
|
6
|
+
import type { PaymentMethod } from "../../../../core/machines/paymentMachine.js";
|
|
7
|
+
import {} from "../../ConnectWallet/screens/Buy/fiat/currencies.js";
|
|
8
|
+
import {
|
|
9
|
+
formatCurrencyAmount,
|
|
10
|
+
formatTokenAmount,
|
|
11
|
+
} from "../../ConnectWallet/screens/formatTokenBalance.js";
|
|
12
|
+
import { Spacer } from "../../components/Spacer.js";
|
|
13
|
+
import { Container, ModalHeader } from "../../components/basic.js";
|
|
14
|
+
import { Button } from "../../components/buttons.js";
|
|
15
|
+
import { Text } from "../../components/text.js";
|
|
16
|
+
import type { UIOptions } from "../BridgeOrchestrator.js";
|
|
17
|
+
import { PaymentOverview } from "./PaymentOverview.js";
|
|
18
|
+
|
|
19
|
+
export interface PaymentDetailsProps {
|
|
20
|
+
/**
|
|
21
|
+
* The UI mode to use
|
|
22
|
+
*/
|
|
23
|
+
uiOptions: UIOptions;
|
|
24
|
+
/**
|
|
25
|
+
* The client to use
|
|
26
|
+
*/
|
|
27
|
+
client: ThirdwebClient;
|
|
28
|
+
/**
|
|
29
|
+
* The payment method to use
|
|
30
|
+
*/
|
|
31
|
+
paymentMethod: PaymentMethod;
|
|
32
|
+
/**
|
|
33
|
+
* The prepared quote to preview
|
|
34
|
+
*/
|
|
35
|
+
preparedQuote: BridgePrepareResult;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Called when user confirms the route
|
|
39
|
+
*/
|
|
40
|
+
onConfirm: () => void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Called when user wants to go back
|
|
44
|
+
*/
|
|
45
|
+
onBack: () => void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Called when an error occurs
|
|
49
|
+
*/
|
|
50
|
+
onError: (error: Error) => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function PaymentDetails({
|
|
54
|
+
uiOptions,
|
|
55
|
+
client,
|
|
56
|
+
paymentMethod,
|
|
57
|
+
preparedQuote,
|
|
58
|
+
onConfirm,
|
|
59
|
+
onBack,
|
|
60
|
+
onError,
|
|
61
|
+
}: PaymentDetailsProps) {
|
|
62
|
+
const theme = useCustomTheme();
|
|
63
|
+
|
|
64
|
+
const handleConfirm = () => {
|
|
65
|
+
try {
|
|
66
|
+
onConfirm();
|
|
67
|
+
} catch (error) {
|
|
68
|
+
onError(error as Error);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Extract common data based on quote type
|
|
73
|
+
const getDisplayData = () => {
|
|
74
|
+
switch (preparedQuote.type) {
|
|
75
|
+
case "transfer": {
|
|
76
|
+
const token =
|
|
77
|
+
paymentMethod.type === "wallet"
|
|
78
|
+
? paymentMethod.originToken
|
|
79
|
+
: undefined;
|
|
80
|
+
if (!token) {
|
|
81
|
+
// can never happen
|
|
82
|
+
onError(new Error("Invalid payment method"));
|
|
83
|
+
return {
|
|
84
|
+
originToken: undefined,
|
|
85
|
+
destinationToken: undefined,
|
|
86
|
+
originAmount: "0",
|
|
87
|
+
destinationAmount: "0",
|
|
88
|
+
estimatedTime: 0,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
originToken: token,
|
|
93
|
+
destinationToken: token,
|
|
94
|
+
originAmount: formatTokenAmount(
|
|
95
|
+
preparedQuote.originAmount,
|
|
96
|
+
token.decimals,
|
|
97
|
+
),
|
|
98
|
+
destinationAmount: formatTokenAmount(
|
|
99
|
+
preparedQuote.destinationAmount,
|
|
100
|
+
token.decimals,
|
|
101
|
+
),
|
|
102
|
+
estimatedTime: preparedQuote.estimatedExecutionTimeMs,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
case "buy": {
|
|
106
|
+
const method =
|
|
107
|
+
paymentMethod.type === "wallet" ? paymentMethod : undefined;
|
|
108
|
+
if (!method) {
|
|
109
|
+
// can never happen
|
|
110
|
+
onError(new Error("Invalid payment method"));
|
|
111
|
+
return {
|
|
112
|
+
originToken: undefined,
|
|
113
|
+
destinationToken: undefined,
|
|
114
|
+
originAmount: "0",
|
|
115
|
+
destinationAmount: "0",
|
|
116
|
+
estimatedTime: 0,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
originToken:
|
|
121
|
+
paymentMethod.type === "wallet"
|
|
122
|
+
? paymentMethod.originToken
|
|
123
|
+
: undefined,
|
|
124
|
+
destinationToken:
|
|
125
|
+
preparedQuote.steps[preparedQuote.steps.length - 1]
|
|
126
|
+
?.destinationToken,
|
|
127
|
+
originAmount: formatTokenAmount(
|
|
128
|
+
preparedQuote.originAmount,
|
|
129
|
+
method.originToken.decimals,
|
|
130
|
+
),
|
|
131
|
+
destinationAmount: formatTokenAmount(
|
|
132
|
+
preparedQuote.destinationAmount,
|
|
133
|
+
preparedQuote.steps[preparedQuote.steps.length - 1]
|
|
134
|
+
?.destinationToken?.decimals ?? 18,
|
|
135
|
+
),
|
|
136
|
+
estimatedTime: preparedQuote.estimatedExecutionTimeMs,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
case "onramp": {
|
|
140
|
+
const method =
|
|
141
|
+
paymentMethod.type === "fiat" ? paymentMethod : undefined;
|
|
142
|
+
if (!method) {
|
|
143
|
+
// can never happen
|
|
144
|
+
onError(new Error("Invalid payment method"));
|
|
145
|
+
return {
|
|
146
|
+
originToken: undefined,
|
|
147
|
+
destinationToken: undefined,
|
|
148
|
+
originAmount: "0",
|
|
149
|
+
destinationAmount: "0",
|
|
150
|
+
estimatedTime: 0,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
originToken: undefined, // Onramp starts with fiat
|
|
155
|
+
destinationToken: preparedQuote.destinationToken,
|
|
156
|
+
originAmount: formatCurrencyAmount(
|
|
157
|
+
method.currency,
|
|
158
|
+
Number(preparedQuote.currencyAmount),
|
|
159
|
+
),
|
|
160
|
+
destinationAmount: formatTokenAmount(
|
|
161
|
+
preparedQuote.destinationAmount,
|
|
162
|
+
preparedQuote.destinationToken.decimals,
|
|
163
|
+
),
|
|
164
|
+
estimatedTime: undefined,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
default: {
|
|
168
|
+
throw new Error(
|
|
169
|
+
`Unsupported bridge prepare type: ${preparedQuote.type}`,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const displayData = getDisplayData();
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<Container flex="column" fullHeight p="lg">
|
|
179
|
+
<ModalHeader title="Payment Details" onBack={onBack} />
|
|
180
|
+
|
|
181
|
+
<Spacer y="xl" />
|
|
182
|
+
|
|
183
|
+
<Container flex="column">
|
|
184
|
+
{/* Quote Summary */}
|
|
185
|
+
<Container flex="column">
|
|
186
|
+
{displayData.destinationToken && (
|
|
187
|
+
<PaymentOverview
|
|
188
|
+
uiOptions={uiOptions}
|
|
189
|
+
sender={
|
|
190
|
+
preparedQuote.intent.sender ||
|
|
191
|
+
paymentMethod.payerWallet.getAccount()?.address
|
|
192
|
+
}
|
|
193
|
+
client={client}
|
|
194
|
+
paymentMethod={paymentMethod}
|
|
195
|
+
toToken={displayData.destinationToken}
|
|
196
|
+
receiver={preparedQuote.intent.receiver}
|
|
197
|
+
fromAmount={displayData.originAmount}
|
|
198
|
+
toAmount={displayData.destinationAmount}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
201
|
+
|
|
202
|
+
<Spacer y="md" />
|
|
203
|
+
<Container flex="row" gap="sm">
|
|
204
|
+
<Container
|
|
205
|
+
flex="row"
|
|
206
|
+
gap="xs"
|
|
207
|
+
style={{ justifyContent: "center", flex: 1 }}
|
|
208
|
+
>
|
|
209
|
+
<Text size="sm" color="secondaryText">
|
|
210
|
+
Estimated Time
|
|
211
|
+
</Text>
|
|
212
|
+
<Text size="sm" color="primaryText">
|
|
213
|
+
{displayData.estimatedTime
|
|
214
|
+
? `~${Math.ceil(displayData.estimatedTime / 60000)} min`
|
|
215
|
+
: "~2 min"}
|
|
216
|
+
</Text>
|
|
217
|
+
</Container>
|
|
218
|
+
|
|
219
|
+
{preparedQuote.steps.length > 1 ? (
|
|
220
|
+
<Container
|
|
221
|
+
flex="row"
|
|
222
|
+
gap="xs"
|
|
223
|
+
style={{ justifyContent: "center", flex: 1 }}
|
|
224
|
+
>
|
|
225
|
+
<Text size="sm" color="secondaryText">
|
|
226
|
+
Route Length
|
|
227
|
+
</Text>
|
|
228
|
+
<Text size="sm" color="primaryText">
|
|
229
|
+
{preparedQuote.steps.length} step
|
|
230
|
+
{preparedQuote.steps.length !== 1 ? "s" : ""}
|
|
231
|
+
</Text>
|
|
232
|
+
</Container>
|
|
233
|
+
) : null}
|
|
234
|
+
</Container>
|
|
235
|
+
</Container>
|
|
236
|
+
|
|
237
|
+
{/* Route Steps */}
|
|
238
|
+
{preparedQuote.steps.length > 1 && (
|
|
239
|
+
<Container flex="column">
|
|
240
|
+
<Spacer y="sm" />
|
|
241
|
+
|
|
242
|
+
<Container
|
|
243
|
+
flex="column"
|
|
244
|
+
gap="sm"
|
|
245
|
+
style={{
|
|
246
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
|
247
|
+
borderRadius: radius.md,
|
|
248
|
+
backgroundColor: theme.colors.tertiaryBg,
|
|
249
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
{preparedQuote.steps.map((step, stepIndex) => (
|
|
253
|
+
<Container
|
|
254
|
+
key={`step-${stepIndex}-${step.originToken.address}-${step.destinationToken.address}`}
|
|
255
|
+
flex="column"
|
|
256
|
+
gap="sm"
|
|
257
|
+
>
|
|
258
|
+
{/* Step Header */}
|
|
259
|
+
<Container
|
|
260
|
+
flex="row"
|
|
261
|
+
gap="md"
|
|
262
|
+
style={{ alignItems: "center" }}
|
|
263
|
+
>
|
|
264
|
+
<Container
|
|
265
|
+
center="both"
|
|
266
|
+
flex="row"
|
|
267
|
+
style={{
|
|
268
|
+
width: "24px",
|
|
269
|
+
height: "24px",
|
|
270
|
+
borderRadius: "50%",
|
|
271
|
+
backgroundColor: theme.colors.accentButtonBg,
|
|
272
|
+
color: theme.colors.accentButtonText,
|
|
273
|
+
fontSize: "12px",
|
|
274
|
+
fontWeight: "bold",
|
|
275
|
+
flexShrink: 0,
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
<Text size="xs" color="accentButtonText">
|
|
279
|
+
{stepIndex + 1}
|
|
280
|
+
</Text>
|
|
281
|
+
</Container>
|
|
282
|
+
|
|
283
|
+
<Container
|
|
284
|
+
flex="row"
|
|
285
|
+
center="y"
|
|
286
|
+
gap="sm"
|
|
287
|
+
style={{ flex: 1 }}
|
|
288
|
+
>
|
|
289
|
+
<Container flex="column" gap="3xs" style={{ flex: 1 }}>
|
|
290
|
+
<Text size="sm" color="primaryText">
|
|
291
|
+
{step.originToken.symbol} →{" "}
|
|
292
|
+
{step.destinationToken.symbol}
|
|
293
|
+
</Text>
|
|
294
|
+
<Text size="xs" color="secondaryText">
|
|
295
|
+
{step.originToken.name} to{" "}
|
|
296
|
+
{step.destinationToken.name}
|
|
297
|
+
</Text>
|
|
298
|
+
</Container>
|
|
299
|
+
</Container>
|
|
300
|
+
</Container>
|
|
301
|
+
</Container>
|
|
302
|
+
))}
|
|
303
|
+
</Container>
|
|
304
|
+
</Container>
|
|
305
|
+
)}
|
|
306
|
+
|
|
307
|
+
<Spacer y="lg" />
|
|
308
|
+
|
|
309
|
+
{/* Action Buttons */}
|
|
310
|
+
<Container flex="column" gap="sm">
|
|
311
|
+
<Button variant="accent" fullWidth onClick={handleConfirm}>
|
|
312
|
+
Confirm Payment
|
|
313
|
+
</Button>
|
|
314
|
+
</Container>
|
|
315
|
+
</Container>
|
|
316
|
+
</Container>
|
|
317
|
+
);
|
|
318
|
+
}
|