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,109 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import type { ThirdwebClient } from "../../client/client.js";
|
|
3
|
+
import type { WindowAdapter } from "../../react/core/adapters/WindowAdapter.js";
|
|
4
|
+
import type { Theme } from "../../react/core/design-system/index.js";
|
|
5
|
+
import type { BridgePrepareRequest } from "../../react/core/hooks/useBridgePrepare.js";
|
|
6
|
+
import type { CompletedStatusResult } from "../../react/core/hooks/useStepExecutor.js";
|
|
7
|
+
import { StepRunner } from "../../react/web/ui/Bridge/StepRunner.js";
|
|
8
|
+
import type { Wallet } from "../../wallets/interfaces/wallet.js";
|
|
9
|
+
import { ModalThemeWrapper, storyClient } from "../utils.js";
|
|
10
|
+
import { STORY_MOCK_WALLET, simpleBuyRequest } from "./fixtures.js";
|
|
11
|
+
|
|
12
|
+
// Mock window adapter
|
|
13
|
+
const mockWindowAdapter: WindowAdapter = {
|
|
14
|
+
open: async (_url: string) => {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Props interface for the wrapper component
|
|
18
|
+
interface StepRunnerWithThemeProps {
|
|
19
|
+
request: BridgePrepareRequest;
|
|
20
|
+
wallet: Wallet;
|
|
21
|
+
client: ThirdwebClient;
|
|
22
|
+
windowAdapter: WindowAdapter;
|
|
23
|
+
onComplete: (completedStatuses: CompletedStatusResult[]) => void;
|
|
24
|
+
onError: (error: Error) => void;
|
|
25
|
+
onCancel?: () => void;
|
|
26
|
+
onBack?: () => void;
|
|
27
|
+
theme: "light" | "dark" | Theme;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Wrapper component to provide theme context
|
|
31
|
+
const StepRunnerWithTheme = (props: StepRunnerWithThemeProps) => {
|
|
32
|
+
const { theme, ...componentProps } = props;
|
|
33
|
+
return (
|
|
34
|
+
<ModalThemeWrapper theme={theme}>
|
|
35
|
+
<StepRunner {...componentProps} />
|
|
36
|
+
</ModalThemeWrapper>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const meta = {
|
|
41
|
+
title: "Bridge/StepRunner",
|
|
42
|
+
component: StepRunnerWithTheme,
|
|
43
|
+
parameters: {
|
|
44
|
+
layout: "centered",
|
|
45
|
+
docs: {
|
|
46
|
+
description: {
|
|
47
|
+
component:
|
|
48
|
+
"**StepRunner** executes prepared route steps sequentially, showing real-time progress and transaction status.\n\n" +
|
|
49
|
+
"## Features\n" +
|
|
50
|
+
"- **Real Execution**: Uses useStepExecutor hook for actual transaction processing\n" +
|
|
51
|
+
"- **Progress Tracking**: Visual progress bar and step-by-step status updates\n" +
|
|
52
|
+
"- **Error Handling**: Retry functionality for failed transactions\n" +
|
|
53
|
+
"- **Transaction Batching**: Optimizes multiple transactions when possible\n" +
|
|
54
|
+
"- **Onramp Support**: Handles fiat-to-crypto onramp flows\n\n" +
|
|
55
|
+
"## Props\n" +
|
|
56
|
+
"- `steps`: Array of RouteStep objects from Bridge.prepare()\n" +
|
|
57
|
+
"- `wallet`: Connected wallet for transaction signing\n" +
|
|
58
|
+
"- `client`: ThirdwebClient instance\n" +
|
|
59
|
+
"- `windowAdapter`: Platform-specific window/URL handler\n" +
|
|
60
|
+
"- `onramp`: Optional onramp configuration\n\n" +
|
|
61
|
+
"## Integration\n" +
|
|
62
|
+
"This component is typically used within the BridgeOrchestrator after route preparation.",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
tags: ["autodocs"],
|
|
67
|
+
args: {
|
|
68
|
+
wallet: STORY_MOCK_WALLET,
|
|
69
|
+
client: storyClient,
|
|
70
|
+
windowAdapter: mockWindowAdapter,
|
|
71
|
+
onComplete: (_completedStatuses: CompletedStatusResult[]) => {},
|
|
72
|
+
onError: (error: Error) => console.error("Error:", error),
|
|
73
|
+
onCancel: () => {},
|
|
74
|
+
theme: "dark",
|
|
75
|
+
},
|
|
76
|
+
argTypes: {
|
|
77
|
+
theme: {
|
|
78
|
+
control: "select",
|
|
79
|
+
options: ["light", "dark"],
|
|
80
|
+
description: "Theme for the component",
|
|
81
|
+
},
|
|
82
|
+
onComplete: { action: "execution completed" },
|
|
83
|
+
onError: { action: "error occurred" },
|
|
84
|
+
onCancel: { action: "execution cancelled" },
|
|
85
|
+
},
|
|
86
|
+
} satisfies Meta<typeof StepRunnerWithTheme>;
|
|
87
|
+
|
|
88
|
+
export default meta;
|
|
89
|
+
type Story = StoryObj<typeof meta>;
|
|
90
|
+
|
|
91
|
+
export const Light: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
theme: "light",
|
|
94
|
+
request: simpleBuyRequest,
|
|
95
|
+
},
|
|
96
|
+
parameters: {
|
|
97
|
+
backgrounds: { default: "light" },
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const Dark: Story = {
|
|
102
|
+
args: {
|
|
103
|
+
theme: "dark",
|
|
104
|
+
request: simpleBuyRequest,
|
|
105
|
+
},
|
|
106
|
+
parameters: {
|
|
107
|
+
backgrounds: { default: "dark" },
|
|
108
|
+
},
|
|
109
|
+
};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { stringify } from "viem";
|
|
3
|
+
import type { Theme } from "../../react/core/design-system/index.js";
|
|
4
|
+
import type { CompletedStatusResult } from "../../react/core/hooks/useStepExecutor.js";
|
|
5
|
+
import { webWindowAdapter } from "../../react/web/adapters/WindowAdapter.js";
|
|
6
|
+
import {
|
|
7
|
+
SuccessScreen,
|
|
8
|
+
type SuccessScreenProps,
|
|
9
|
+
} from "../../react/web/ui/Bridge/payment-success/SuccessScreen.js";
|
|
10
|
+
import { ModalThemeWrapper } from "../utils.js";
|
|
11
|
+
import {
|
|
12
|
+
FUND_WALLET_UI_OPTIONS,
|
|
13
|
+
TRANSACTION_UI_OPTIONS,
|
|
14
|
+
simpleBuyQuote,
|
|
15
|
+
simpleOnrampQuote,
|
|
16
|
+
} from "./fixtures.js";
|
|
17
|
+
|
|
18
|
+
const mockBuyCompletedStatuses: CompletedStatusResult[] = JSON.parse(
|
|
19
|
+
stringify([
|
|
20
|
+
{
|
|
21
|
+
type: "buy",
|
|
22
|
+
status: "COMPLETED",
|
|
23
|
+
paymentId: "payment-12345",
|
|
24
|
+
originAmount: 1000000000000000000n,
|
|
25
|
+
destinationAmount: 100000000n,
|
|
26
|
+
originChainId: 1,
|
|
27
|
+
destinationChainId: 1,
|
|
28
|
+
originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
29
|
+
destinationTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
30
|
+
originToken: {
|
|
31
|
+
chainId: 1,
|
|
32
|
+
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
33
|
+
symbol: "ETH",
|
|
34
|
+
name: "Ethereum",
|
|
35
|
+
decimals: 18,
|
|
36
|
+
priceUsd: 2500,
|
|
37
|
+
},
|
|
38
|
+
destinationToken: {
|
|
39
|
+
chainId: 1,
|
|
40
|
+
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
41
|
+
symbol: "USDC",
|
|
42
|
+
name: "USD Coin",
|
|
43
|
+
decimals: 6,
|
|
44
|
+
priceUsd: 1,
|
|
45
|
+
},
|
|
46
|
+
sender: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
|
|
47
|
+
receiver: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
|
|
48
|
+
transactions: [
|
|
49
|
+
{
|
|
50
|
+
chainId: 1,
|
|
51
|
+
transactionHash:
|
|
52
|
+
"0x1234567890abcdef1234567890abcdef12345678901234567890abcdef123456",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
]),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const mockOnrampCompletedStatuses: CompletedStatusResult[] = JSON.parse(
|
|
60
|
+
stringify([
|
|
61
|
+
{
|
|
62
|
+
type: "onramp",
|
|
63
|
+
status: "COMPLETED",
|
|
64
|
+
transactions: [
|
|
65
|
+
{
|
|
66
|
+
chainId: 137,
|
|
67
|
+
transactionHash:
|
|
68
|
+
"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
purchaseData: {
|
|
72
|
+
orderId: "stripe-order-abc123",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
]),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// Props interface for the wrapper component
|
|
79
|
+
interface SuccessScreenWithThemeProps extends SuccessScreenProps {
|
|
80
|
+
theme: "light" | "dark" | Theme;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Wrapper component to provide theme context
|
|
84
|
+
const SuccessScreenWithTheme = (props: SuccessScreenWithThemeProps) => {
|
|
85
|
+
const { theme, ...componentProps } = props;
|
|
86
|
+
return (
|
|
87
|
+
<ModalThemeWrapper theme={theme}>
|
|
88
|
+
<SuccessScreen {...componentProps} />
|
|
89
|
+
</ModalThemeWrapper>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const meta = {
|
|
94
|
+
title: "Bridge/SuccessScreen",
|
|
95
|
+
component: SuccessScreenWithTheme,
|
|
96
|
+
parameters: {
|
|
97
|
+
layout: "centered",
|
|
98
|
+
docs: {
|
|
99
|
+
description: {
|
|
100
|
+
component:
|
|
101
|
+
"Success screen that displays completion confirmation with transaction summary, payment details, and action buttons for next steps. Includes animated success icon and detailed transaction view.",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
tags: ["autodocs"],
|
|
106
|
+
args: {
|
|
107
|
+
preparedQuote: simpleBuyQuote,
|
|
108
|
+
completedStatuses: mockBuyCompletedStatuses,
|
|
109
|
+
onDone: () => {},
|
|
110
|
+
theme: "dark",
|
|
111
|
+
windowAdapter: webWindowAdapter,
|
|
112
|
+
uiOptions: FUND_WALLET_UI_OPTIONS.ethDefault,
|
|
113
|
+
},
|
|
114
|
+
argTypes: {
|
|
115
|
+
theme: {
|
|
116
|
+
control: "select",
|
|
117
|
+
options: ["light", "dark"],
|
|
118
|
+
description: "Theme for the component",
|
|
119
|
+
},
|
|
120
|
+
onDone: { action: "success screen closed" },
|
|
121
|
+
},
|
|
122
|
+
} satisfies Meta<typeof SuccessScreenWithTheme>;
|
|
123
|
+
|
|
124
|
+
export default meta;
|
|
125
|
+
type Story = StoryObj<typeof meta>;
|
|
126
|
+
|
|
127
|
+
export const Default: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
theme: "dark",
|
|
130
|
+
},
|
|
131
|
+
parameters: {
|
|
132
|
+
backgrounds: { default: "dark" },
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const DefaultLight: Story = {
|
|
137
|
+
args: {
|
|
138
|
+
theme: "light",
|
|
139
|
+
},
|
|
140
|
+
parameters: {
|
|
141
|
+
backgrounds: { default: "light" },
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const OnrampPayment: Story = {
|
|
146
|
+
args: {
|
|
147
|
+
theme: "dark",
|
|
148
|
+
preparedQuote: simpleOnrampQuote,
|
|
149
|
+
completedStatuses: mockOnrampCompletedStatuses,
|
|
150
|
+
},
|
|
151
|
+
parameters: {
|
|
152
|
+
backgrounds: { default: "dark" },
|
|
153
|
+
docs: {
|
|
154
|
+
description: {
|
|
155
|
+
story:
|
|
156
|
+
"Success screen for onramp payments showing payment ID that can be copied to clipboard.",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export const OnrampPaymentLight: Story = {
|
|
163
|
+
args: {
|
|
164
|
+
theme: "light",
|
|
165
|
+
preparedQuote: simpleOnrampQuote,
|
|
166
|
+
completedStatuses: mockOnrampCompletedStatuses,
|
|
167
|
+
},
|
|
168
|
+
parameters: {
|
|
169
|
+
backgrounds: { default: "light" },
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const ComplexPayment: Story = {
|
|
174
|
+
args: {
|
|
175
|
+
theme: "dark",
|
|
176
|
+
preparedQuote: simpleOnrampQuote,
|
|
177
|
+
completedStatuses: [
|
|
178
|
+
...mockOnrampCompletedStatuses,
|
|
179
|
+
...mockBuyCompletedStatuses,
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
parameters: {
|
|
183
|
+
backgrounds: { default: "dark" },
|
|
184
|
+
docs: {
|
|
185
|
+
description: {
|
|
186
|
+
story:
|
|
187
|
+
"Success screen for onramp payments showing payment ID that can be copied to clipboard.",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export const ComplexPaymentLight: Story = {
|
|
194
|
+
args: {
|
|
195
|
+
theme: "light",
|
|
196
|
+
preparedQuote: simpleOnrampQuote,
|
|
197
|
+
completedStatuses: [
|
|
198
|
+
...mockOnrampCompletedStatuses,
|
|
199
|
+
...mockBuyCompletedStatuses,
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
parameters: {
|
|
203
|
+
backgrounds: { default: "light" },
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const TransactionPayment: Story = {
|
|
208
|
+
args: {
|
|
209
|
+
theme: "light",
|
|
210
|
+
preparedQuote: simpleBuyQuote,
|
|
211
|
+
completedStatuses: mockBuyCompletedStatuses,
|
|
212
|
+
uiOptions: TRANSACTION_UI_OPTIONS.contractInteraction,
|
|
213
|
+
},
|
|
214
|
+
parameters: {
|
|
215
|
+
backgrounds: { default: "light" },
|
|
216
|
+
},
|
|
217
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
TransactionPayment,
|
|
4
|
+
type TransactionPaymentProps,
|
|
5
|
+
} from "../../react/web/ui/Bridge/TransactionPayment.js";
|
|
6
|
+
import { ModalThemeWrapper, storyClient } from "../utils.js";
|
|
7
|
+
import { TRANSACTION_UI_OPTIONS } from "./fixtures.js";
|
|
8
|
+
|
|
9
|
+
// Props interface for the wrapper component
|
|
10
|
+
interface TransactionPaymentWithThemeProps extends TransactionPaymentProps {
|
|
11
|
+
theme: "light" | "dark";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Wrapper component to provide theme context
|
|
15
|
+
const TransactionPaymentWithTheme = (
|
|
16
|
+
props: TransactionPaymentWithThemeProps,
|
|
17
|
+
) => {
|
|
18
|
+
const { theme, ...componentProps } = props;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<ModalThemeWrapper theme={theme}>
|
|
22
|
+
<div style={{ width: "400px" }}>
|
|
23
|
+
<TransactionPayment {...componentProps} />
|
|
24
|
+
</div>
|
|
25
|
+
</ModalThemeWrapper>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const meta = {
|
|
30
|
+
title: "Bridge/TransactionPayment",
|
|
31
|
+
component: TransactionPaymentWithTheme,
|
|
32
|
+
parameters: {
|
|
33
|
+
layout: "centered",
|
|
34
|
+
docs: {
|
|
35
|
+
description: {
|
|
36
|
+
component:
|
|
37
|
+
"Transaction payment component that displays detailed transaction information including contract details, function names, transaction costs, and network fees.\n\n" +
|
|
38
|
+
"## Features\n" +
|
|
39
|
+
"- **Contract Information**: Shows contract name and clickable address\n" +
|
|
40
|
+
"- **Function Detection**: Extracts function names from transaction data using ABI\n" +
|
|
41
|
+
"- **Cost Calculation**: Displays transaction value and USD equivalent\n" +
|
|
42
|
+
"- **Network Fees**: Shows estimated gas costs with token amounts\n" +
|
|
43
|
+
"- **Chain Details**: Network name and logo with proper formatting\n" +
|
|
44
|
+
"- **Skeleton Loading**: Comprehensive loading states matching final layout\n\n" +
|
|
45
|
+
"This component now accepts uiOptions directly to configure the transaction and metadata. Supports both native token and ERC20 token transactions with proper function name extraction.",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
tags: ["autodocs"],
|
|
50
|
+
args: {
|
|
51
|
+
uiOptions: TRANSACTION_UI_OPTIONS.ethTransfer,
|
|
52
|
+
client: storyClient,
|
|
53
|
+
onContinue: (_amount, _token, _receiverAddress) => {},
|
|
54
|
+
theme: "dark",
|
|
55
|
+
},
|
|
56
|
+
argTypes: {
|
|
57
|
+
theme: {
|
|
58
|
+
control: "select",
|
|
59
|
+
options: ["light", "dark"],
|
|
60
|
+
description: "Theme for the component",
|
|
61
|
+
},
|
|
62
|
+
onContinue: {
|
|
63
|
+
action: "continue clicked",
|
|
64
|
+
description: "Called when user continues with the transaction",
|
|
65
|
+
},
|
|
66
|
+
uiOptions: {
|
|
67
|
+
description:
|
|
68
|
+
"UI configuration for transaction mode including prepared transaction",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
} satisfies Meta<typeof TransactionPaymentWithTheme>;
|
|
72
|
+
|
|
73
|
+
export default meta;
|
|
74
|
+
type Story = StoryObj<typeof meta>;
|
|
75
|
+
|
|
76
|
+
export const EthereumTransfer: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
uiOptions: TRANSACTION_UI_OPTIONS.ethTransfer,
|
|
79
|
+
theme: "dark",
|
|
80
|
+
},
|
|
81
|
+
parameters: {
|
|
82
|
+
backgrounds: { default: "dark" },
|
|
83
|
+
docs: {
|
|
84
|
+
description: {
|
|
85
|
+
story:
|
|
86
|
+
"Simple ETH transfer transaction showing native token value and network fees with USD conversion. Demonstrates function name extraction from contract ABI.",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const EthereumTransferLight: Story = {
|
|
93
|
+
args: {
|
|
94
|
+
uiOptions: TRANSACTION_UI_OPTIONS.ethTransfer,
|
|
95
|
+
theme: "light",
|
|
96
|
+
},
|
|
97
|
+
parameters: {
|
|
98
|
+
backgrounds: { default: "light" },
|
|
99
|
+
docs: {
|
|
100
|
+
description: {
|
|
101
|
+
story:
|
|
102
|
+
"Simple ETH transfer transaction in light theme with skeleton loading support.",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const ERC20TokenTransfer: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
uiOptions: TRANSACTION_UI_OPTIONS.erc20Transfer,
|
|
111
|
+
theme: "dark",
|
|
112
|
+
},
|
|
113
|
+
parameters: {
|
|
114
|
+
backgrounds: { default: "dark" },
|
|
115
|
+
docs: {
|
|
116
|
+
description: {
|
|
117
|
+
story:
|
|
118
|
+
"ERC20 token transaction showing token amount, USD value, and proper formatting using real token data. Displays transfer function details.",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const ERC20TokenTransferLight: Story = {
|
|
125
|
+
args: {
|
|
126
|
+
uiOptions: TRANSACTION_UI_OPTIONS.erc20Transfer,
|
|
127
|
+
theme: "light",
|
|
128
|
+
},
|
|
129
|
+
parameters: {
|
|
130
|
+
backgrounds: { default: "light" },
|
|
131
|
+
docs: {
|
|
132
|
+
description: {
|
|
133
|
+
story:
|
|
134
|
+
"ERC20 token transaction in light theme with enhanced formatting.",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const ContractInteraction: Story = {
|
|
141
|
+
args: {
|
|
142
|
+
uiOptions: TRANSACTION_UI_OPTIONS.contractInteraction,
|
|
143
|
+
theme: "dark",
|
|
144
|
+
},
|
|
145
|
+
parameters: {
|
|
146
|
+
backgrounds: { default: "dark" },
|
|
147
|
+
docs: {
|
|
148
|
+
description: {
|
|
149
|
+
story:
|
|
150
|
+
"Complex contract interaction showing function name extraction from ABI (claimTo), cost calculation, and network details with proper currency formatting.",
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const ContractInteractionLight: Story = {
|
|
157
|
+
args: {
|
|
158
|
+
uiOptions: TRANSACTION_UI_OPTIONS.contractInteraction,
|
|
159
|
+
theme: "light",
|
|
160
|
+
},
|
|
161
|
+
parameters: {
|
|
162
|
+
backgrounds: { default: "light" },
|
|
163
|
+
docs: {
|
|
164
|
+
description: {
|
|
165
|
+
story:
|
|
166
|
+
"Contract interaction transaction in light theme with enhanced UX and skeleton loading.",
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { defineChain } from "../../chains/utils.js";
|
|
3
|
+
import type { Theme } from "../../react/core/design-system/index.js";
|
|
4
|
+
import {
|
|
5
|
+
UnsupportedTokenScreen,
|
|
6
|
+
type UnsupportedTokenScreenProps,
|
|
7
|
+
} from "../../react/web/ui/Bridge/UnsupportedTokenScreen.js";
|
|
8
|
+
import { ModalThemeWrapper } from "../utils.js";
|
|
9
|
+
|
|
10
|
+
// Props interface for the wrapper component
|
|
11
|
+
interface UnsupportedTokenScreenWithThemeProps
|
|
12
|
+
extends UnsupportedTokenScreenProps {
|
|
13
|
+
theme: "light" | "dark" | Theme;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Wrapper component to provide theme context
|
|
17
|
+
const UnsupportedTokenScreenWithTheme = (
|
|
18
|
+
props: UnsupportedTokenScreenWithThemeProps,
|
|
19
|
+
) => {
|
|
20
|
+
const { theme, ...componentProps } = props;
|
|
21
|
+
return (
|
|
22
|
+
<ModalThemeWrapper theme={theme}>
|
|
23
|
+
<UnsupportedTokenScreen {...componentProps} />
|
|
24
|
+
</ModalThemeWrapper>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const meta = {
|
|
29
|
+
title: "Bridge/UnsupportedTokenScreen",
|
|
30
|
+
component: UnsupportedTokenScreenWithTheme,
|
|
31
|
+
parameters: {
|
|
32
|
+
layout: "centered",
|
|
33
|
+
docs: {
|
|
34
|
+
description: {
|
|
35
|
+
component:
|
|
36
|
+
"Screen displayed when a token is being indexed or when using an unsupported testnet. Shows loading state for indexing tokens or error state for testnets.",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
tags: ["autodocs"],
|
|
41
|
+
args: {
|
|
42
|
+
chain: defineChain(1), // Ethereum mainnet
|
|
43
|
+
theme: "dark",
|
|
44
|
+
},
|
|
45
|
+
argTypes: {
|
|
46
|
+
theme: {
|
|
47
|
+
control: "select",
|
|
48
|
+
options: ["light", "dark"],
|
|
49
|
+
description: "Theme for the component",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
} satisfies Meta<typeof UnsupportedTokenScreenWithTheme>;
|
|
53
|
+
|
|
54
|
+
export default meta;
|
|
55
|
+
type Story = StoryObj<typeof meta>;
|
|
56
|
+
|
|
57
|
+
export const TokenNotSupported: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
theme: "dark",
|
|
60
|
+
chain: defineChain(1), // Ethereum mainnet - will show indexing spinner
|
|
61
|
+
},
|
|
62
|
+
parameters: {
|
|
63
|
+
backgrounds: { default: "dark" },
|
|
64
|
+
docs: {
|
|
65
|
+
description: {
|
|
66
|
+
story:
|
|
67
|
+
"Shows the loading state when a token is being indexed by the Universal Bridge on a mainnet chain.",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const TokenNotSupportedLight: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
theme: "light",
|
|
76
|
+
chain: defineChain(1), // Ethereum mainnet - will show indexing spinner
|
|
77
|
+
},
|
|
78
|
+
parameters: {
|
|
79
|
+
backgrounds: { default: "light" },
|
|
80
|
+
docs: {
|
|
81
|
+
description: {
|
|
82
|
+
story:
|
|
83
|
+
"Shows the loading state when a token is being indexed by the Universal Bridge on a mainnet chain (light theme).",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const TestnetNotSupported: Story = {
|
|
90
|
+
args: {
|
|
91
|
+
theme: "dark",
|
|
92
|
+
chain: defineChain(11155111), // Sepolia testnet - will show error state
|
|
93
|
+
},
|
|
94
|
+
parameters: {
|
|
95
|
+
backgrounds: { default: "dark" },
|
|
96
|
+
docs: {
|
|
97
|
+
description: {
|
|
98
|
+
story:
|
|
99
|
+
"Shows the error state when trying to use the Universal Bridge on a testnet chain (Sepolia in this example).",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const TestnetNotSupportedLight: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
theme: "light",
|
|
108
|
+
chain: defineChain(11155111), // Sepolia testnet - will show error state
|
|
109
|
+
},
|
|
110
|
+
parameters: {
|
|
111
|
+
backgrounds: { default: "light" },
|
|
112
|
+
docs: {
|
|
113
|
+
description: {
|
|
114
|
+
story:
|
|
115
|
+
"Shows the error state when trying to use the Universal Bridge on a testnet chain (Sepolia in this example, light theme).",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
};
|