thirdweb 5.108.6 → 5.108.7
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/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/core/hooks/usePaymentMethods.js +1 -2
- package/dist/cjs/react/core/hooks/usePaymentMethods.js.map +1 -1
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +1 -1
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/BuyWidget.js +185 -99
- package/dist/cjs/react/web/ui/Bridge/BuyWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js +210 -56
- package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/DirectPayment.js +7 -7
- package/dist/cjs/react/web/ui/Bridge/DirectPayment.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/FundWallet.js +233 -105
- package/dist/cjs/react/web/ui/Bridge/FundWallet.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/QuoteLoader.js +1 -7
- package/dist/cjs/react/web/ui/Bridge/QuoteLoader.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js +16 -12
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js +199 -36
- package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/bridge-widget/bridge-widget.js +2 -2
- package/dist/cjs/react/web/ui/Bridge/bridge-widget/bridge-widget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/common/WithHeader.js +4 -5
- package/dist/cjs/react/web/ui/Bridge/common/WithHeader.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/common/active-wallet-details.js +52 -0
- package/dist/cjs/react/web/ui/Bridge/common/active-wallet-details.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/common/decimal-input.js +36 -0
- package/dist/cjs/react/web/ui/Bridge/common/decimal-input.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/common/selected-token-button.js +58 -0
- package/dist/cjs/react/web/ui/Bridge/common/selected-token-button.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/common/token-balance.js +20 -0
- package/dist/cjs/react/web/ui/Bridge/common/token-balance.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/common/token-query.js +34 -0
- package/dist/cjs/react/web/ui/Bridge/common/token-query.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js +3 -3
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js +7 -7
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js +1 -4
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js +3 -3
- package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/swap-widget/SwapWidget.js +8 -11
- package/dist/cjs/react/web/ui/Bridge/swap-widget/SwapWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/swap-widget/swap-ui.js +19 -147
- package/dist/cjs/react/web/ui/Bridge/swap-widget/swap-ui.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/types.js +3 -0
- package/dist/cjs/react/web/ui/Bridge/types.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +4 -2
- package/dist/cjs/react/web/ui/ConnectWallet/Details.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.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +17 -10
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
- package/dist/cjs/react/web/ui/components/CopyIcon.js +1 -1
- package/dist/cjs/react/web/ui/components/CopyIcon.js.map +1 -1
- package/dist/cjs/stories/Bridge/CheckoutWidget.stories.js +115 -0
- package/dist/cjs/stories/Bridge/CheckoutWidget.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/ErrorBanner.stories.js +7 -111
- package/dist/cjs/stories/Bridge/ErrorBanner.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/PaymentDetails.stories.js +27 -306
- package/dist/cjs/stories/Bridge/PaymentDetails.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/PaymentSelection.stories.js +21 -128
- package/dist/cjs/stories/Bridge/PaymentSelection.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/StepRunner.stories.js +13 -39
- package/dist/cjs/stories/Bridge/StepRunner.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/SuccessScreen.stories.js +13 -101
- package/dist/cjs/stories/Bridge/SuccessScreen.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/Transaction/TransactionWidget.stories.js +49 -0
- package/dist/cjs/stories/Bridge/Transaction/TransactionWidget.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/Transaction/useSendTransactionModal.stories.js +53 -0
- package/dist/cjs/stories/Bridge/Transaction/useSendTransactionModal.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js +11 -79
- package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/fixtures.js +21 -62
- package/dist/cjs/stories/Bridge/fixtures.js.map +1 -1
- package/dist/cjs/stories/BuyWidget.stories.js +44 -8
- package/dist/cjs/stories/BuyWidget.stories.js.map +1 -1
- package/dist/cjs/stories/utils.js +5 -2
- package/dist/cjs/stories/utils.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/x402/common.js +3 -5
- package/dist/cjs/x402/common.js.map +1 -1
- package/dist/cjs/x402/facilitator.js +0 -1
- package/dist/cjs/x402/facilitator.js.map +1 -1
- package/dist/cjs/x402/schemas.js +4 -0
- package/dist/cjs/x402/schemas.js.map +1 -1
- package/dist/cjs/x402/settle-payment.js +6 -5
- package/dist/cjs/x402/settle-payment.js.map +1 -1
- package/dist/cjs/x402/sign.js +2 -6
- package/dist/cjs/x402/sign.js.map +1 -1
- package/dist/cjs/x402/types.js.map +1 -1
- package/dist/cjs/x402/verify-payment.js +6 -5
- package/dist/cjs/x402/verify-payment.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/core/hooks/usePaymentMethods.js +1 -2
- package/dist/esm/react/core/hooks/usePaymentMethods.js.map +1 -1
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +1 -1
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/BuyWidget.js +185 -99
- package/dist/esm/react/web/ui/Bridge/BuyWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js +211 -57
- package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/DirectPayment.js +7 -7
- package/dist/esm/react/web/ui/Bridge/DirectPayment.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/FundWallet.js +237 -109
- package/dist/esm/react/web/ui/Bridge/FundWallet.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/QuoteLoader.js +1 -7
- package/dist/esm/react/web/ui/Bridge/QuoteLoader.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js +16 -12
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/TransactionWidget.js +198 -36
- package/dist/esm/react/web/ui/Bridge/TransactionWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/bridge-widget/bridge-widget.js +2 -2
- package/dist/esm/react/web/ui/Bridge/bridge-widget/bridge-widget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/common/WithHeader.js +4 -5
- package/dist/esm/react/web/ui/Bridge/common/WithHeader.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/common/active-wallet-details.js +49 -0
- package/dist/esm/react/web/ui/Bridge/common/active-wallet-details.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/common/decimal-input.js +33 -0
- package/dist/esm/react/web/ui/Bridge/common/decimal-input.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/common/selected-token-button.js +55 -0
- package/dist/esm/react/web/ui/Bridge/common/selected-token-button.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/common/token-balance.js +17 -0
- package/dist/esm/react/web/ui/Bridge/common/token-balance.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/common/token-query.js +31 -0
- package/dist/esm/react/web/ui/Bridge/common/token-query.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js +3 -3
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js +7 -7
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js +1 -4
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js +3 -3
- package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/swap-widget/SwapWidget.js +8 -11
- package/dist/esm/react/web/ui/Bridge/swap-widget/SwapWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/swap-widget/swap-ui.js +16 -144
- package/dist/esm/react/web/ui/Bridge/swap-widget/swap-ui.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/types.js +2 -0
- package/dist/esm/react/web/ui/Bridge/types.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +4 -2
- package/dist/esm/react/web/ui/ConnectWallet/Details.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.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js +1 -1
- package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +17 -10
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
- package/dist/esm/react/web/ui/components/CopyIcon.js +1 -1
- package/dist/esm/react/web/ui/components/CopyIcon.js.map +1 -1
- package/dist/esm/stories/Bridge/CheckoutWidget.stories.js +112 -0
- package/dist/esm/stories/Bridge/CheckoutWidget.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/ErrorBanner.stories.js +7 -111
- package/dist/esm/stories/Bridge/ErrorBanner.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/PaymentDetails.stories.js +28 -307
- package/dist/esm/stories/Bridge/PaymentDetails.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/PaymentSelection.stories.js +22 -129
- package/dist/esm/stories/Bridge/PaymentSelection.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/StepRunner.stories.js +12 -38
- package/dist/esm/stories/Bridge/StepRunner.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/SuccessScreen.stories.js +14 -102
- package/dist/esm/stories/Bridge/SuccessScreen.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/Transaction/TransactionWidget.stories.js +46 -0
- package/dist/esm/stories/Bridge/Transaction/TransactionWidget.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/Transaction/useSendTransactionModal.stories.js +50 -0
- package/dist/esm/stories/Bridge/Transaction/useSendTransactionModal.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js +12 -80
- package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/fixtures.js +15 -56
- package/dist/esm/stories/Bridge/fixtures.js.map +1 -1
- package/dist/esm/stories/BuyWidget.stories.js +37 -9
- package/dist/esm/stories/BuyWidget.stories.js.map +1 -1
- package/dist/esm/stories/utils.js +6 -3
- package/dist/esm/stories/utils.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/x402/common.js +3 -5
- package/dist/esm/x402/common.js.map +1 -1
- package/dist/esm/x402/facilitator.js +0 -1
- package/dist/esm/x402/facilitator.js.map +1 -1
- package/dist/esm/x402/schemas.js +5 -1
- package/dist/esm/x402/schemas.js.map +1 -1
- package/dist/esm/x402/settle-payment.js +6 -5
- package/dist/esm/x402/settle-payment.js.map +1 -1
- package/dist/esm/x402/sign.js +2 -6
- package/dist/esm/x402/sign.js.map +1 -1
- package/dist/esm/x402/types.js.map +1 -1
- package/dist/esm/x402/verify-payment.js +6 -5
- package/dist/esm/x402/verify-payment.js.map +1 -1
- package/dist/scripts/bridge-widget.d.ts +3 -3
- package/dist/scripts/bridge-widget.js +113 -150
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +6 -0
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/core/hooks/usePaymentMethods.d.ts +1 -2
- package/dist/types/react/core/hooks/usePaymentMethods.d.ts.map +1 -1
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts +7 -12
- package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts +5 -8
- package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts +15 -12
- package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/FundWallet.d.ts +33 -15
- package/dist/types/react/web/ui/Bridge/FundWallet.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/QuoteLoader.d.ts +9 -12
- package/dist/types/react/web/ui/Bridge/QuoteLoader.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/StepRunner.d.ts +7 -7
- package/dist/types/react/web/ui/Bridge/StepRunner.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts +14 -7
- package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts +3 -5
- package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/UnsupportedTokenScreen.d.ts +4 -3
- package/dist/types/react/web/ui/Bridge/UnsupportedTokenScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/bridge-widget/bridge-widget.d.ts +3 -3
- package/dist/types/react/web/ui/Bridge/bridge-widget/bridge-widget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/common/WithHeader.d.ts +4 -4
- package/dist/types/react/web/ui/Bridge/common/WithHeader.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/common/active-wallet-details.d.ts +8 -0
- package/dist/types/react/web/ui/Bridge/common/active-wallet-details.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/common/decimal-input.d.ts +6 -0
- package/dist/types/react/web/ui/Bridge/common/decimal-input.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/common/selected-token-button.d.ts +13 -0
- package/dist/types/react/web/ui/Bridge/common/selected-token-button.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/common/token-balance.d.ts +8 -0
- package/dist/types/react/web/ui/Bridge/common/token-balance.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/common/token-query.d.ts +15 -0
- package/dist/types/react/web/ui/Bridge/common/token-query.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts +13 -11
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts +8 -3
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts +12 -16
- package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts +6 -6
- package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/swap-widget/swap-ui.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/types.d.ts +39 -0
- package/dist/types/react/web/ui/Bridge/types.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/Details.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 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts +0 -1
- package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +3 -1
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/CopyIcon.d.ts +1 -0
- package/dist/types/react/web/ui/components/CopyIcon.d.ts.map +1 -1
- package/dist/types/script-exports/bridge-widget-script.d.ts +3 -3
- package/dist/types/script-exports/bridge-widget-script.d.ts.map +1 -1
- package/dist/types/stories/Bridge/CheckoutWidget.stories.d.ts +25 -0
- package/dist/types/stories/Bridge/CheckoutWidget.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/ErrorBanner.stories.d.ts +3 -47
- package/dist/types/stories/Bridge/ErrorBanner.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts +3 -56
- package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts +5 -63
- package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/StepRunner.stories.d.ts +4 -52
- package/dist/types/stories/Bridge/StepRunner.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts +4 -54
- package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/Transaction/TransactionWidget.stories.d.ts +11 -0
- package/dist/types/stories/Bridge/Transaction/TransactionWidget.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/Transaction/useSendTransactionModal.stories.d.ts +18 -0
- package/dist/types/stories/Bridge/Transaction/useSendTransactionModal.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/UnsupportedTokenScreen.stories.d.ts +3 -34
- package/dist/types/stories/Bridge/UnsupportedTokenScreen.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/fixtures.d.ts +19 -17
- package/dist/types/stories/Bridge/fixtures.d.ts.map +1 -1
- package/dist/types/stories/BuyWidget.stories.d.ts +9 -1
- package/dist/types/stories/BuyWidget.stories.d.ts.map +1 -1
- package/dist/types/stories/utils.d.ts +0 -2
- package/dist/types/stories/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/x402/common.d.ts.map +1 -1
- package/dist/types/x402/facilitator.d.ts +2 -3
- package/dist/types/x402/facilitator.d.ts.map +1 -1
- package/dist/types/x402/schemas.d.ts +21 -0
- package/dist/types/x402/schemas.d.ts.map +1 -1
- package/dist/types/x402/settle-payment.d.ts.map +1 -1
- package/dist/types/x402/types.d.ts +5 -4
- package/dist/types/x402/types.d.ts.map +1 -1
- package/dist/types/x402/verify-payment.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/react/core/hooks/transaction/useSendTransaction.ts +6 -0
- package/src/react/core/hooks/usePaymentMethods.ts +1 -4
- package/src/react/web/hooks/transaction/useSendTransaction.tsx +1 -0
- package/src/react/web/ui/Bridge/BuyWidget.tsx +355 -160
- package/src/react/web/ui/Bridge/CheckoutWidget.tsx +384 -107
- package/src/react/web/ui/Bridge/DirectPayment.tsx +34 -26
- package/src/react/web/ui/Bridge/FundWallet.tsx +610 -266
- package/src/react/web/ui/Bridge/QuoteLoader.tsx +10 -20
- package/src/react/web/ui/Bridge/StepRunner.tsx +7 -7
- package/src/react/web/ui/Bridge/TransactionPayment.tsx +35 -25
- package/src/react/web/ui/Bridge/TransactionWidget.tsx +395 -71
- package/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx +3 -3
- package/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx +16 -14
- package/src/react/web/ui/Bridge/common/WithHeader.tsx +13 -19
- package/src/react/web/ui/Bridge/common/active-wallet-details.tsx +103 -0
- package/src/react/web/ui/Bridge/common/decimal-input.tsx +61 -0
- package/src/react/web/ui/Bridge/common/selected-token-button.tsx +168 -0
- package/src/react/web/ui/Bridge/common/token-balance.tsx +23 -0
- package/src/react/web/ui/Bridge/common/token-query.ts +49 -0
- package/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx +23 -14
- package/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx +36 -22
- package/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx +11 -22
- package/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx +1 -1
- package/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx +7 -8
- package/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx +14 -12
- package/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx +19 -332
- package/src/react/web/ui/Bridge/types.ts +47 -0
- package/src/react/web/ui/ConnectWallet/Details.tsx +3 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +1 -5
- package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +5 -1
- package/src/react/web/ui/TransactionButton/DepositScreen.tsx +1 -2
- package/src/react/web/ui/TransactionButton/TransactionModal.tsx +44 -27
- package/src/react/web/ui/components/CopyIcon.tsx +11 -2
- package/src/script-exports/bridge-widget-script.tsx +3 -3
- package/src/script-exports/readme.md +1 -8
- package/src/stories/Bridge/CheckoutWidget.stories.tsx +147 -0
- package/src/stories/Bridge/ErrorBanner.stories.tsx +13 -138
- package/src/stories/Bridge/PaymentDetails.stories.tsx +34 -349
- package/src/stories/Bridge/PaymentSelection.stories.tsx +28 -156
- package/src/stories/Bridge/StepRunner.stories.tsx +18 -65
- package/src/stories/Bridge/SuccessScreen.stories.tsx +21 -130
- package/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx +63 -0
- package/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx +68 -0
- package/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx +19 -108
- package/src/stories/Bridge/fixtures.ts +36 -63
- package/src/stories/BuyWidget.stories.tsx +103 -8
- package/src/stories/utils.tsx +16 -9
- package/src/version.ts +1 -1
- package/src/x402/common.ts +2 -5
- package/src/x402/facilitator.ts +3 -3
- package/src/x402/schemas.ts +10 -0
- package/src/x402/settle-payment.ts +7 -6
- package/src/x402/sign.ts +3 -8
- package/src/x402/types.ts +5 -4
- package/src/x402/verify-payment.ts +7 -6
- package/dist/cjs/react/core/machines/paymentMachine.js +0 -191
- package/dist/cjs/react/core/machines/paymentMachine.js.map +0 -1
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js +0 -129
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js.map +0 -1
- package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js +0 -258
- package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js.map +0 -1
- package/dist/cjs/stories/Bridge/DirectPayment.stories.js +0 -222
- package/dist/cjs/stories/Bridge/DirectPayment.stories.js.map +0 -1
- package/dist/cjs/stories/Bridge/FundWallet.stories.js +0 -201
- package/dist/cjs/stories/Bridge/FundWallet.stories.js.map +0 -1
- package/dist/cjs/stories/Bridge/TransactionPayment.stories.js +0 -168
- package/dist/cjs/stories/Bridge/TransactionPayment.stories.js.map +0 -1
- package/dist/esm/react/core/machines/paymentMachine.js +0 -188
- package/dist/esm/react/core/machines/paymentMachine.js.map +0 -1
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js +0 -126
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js.map +0 -1
- package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js +0 -255
- package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js.map +0 -1
- package/dist/esm/stories/Bridge/DirectPayment.stories.js +0 -219
- package/dist/esm/stories/Bridge/DirectPayment.stories.js.map +0 -1
- package/dist/esm/stories/Bridge/FundWallet.stories.js +0 -198
- package/dist/esm/stories/Bridge/FundWallet.stories.js.map +0 -1
- package/dist/esm/stories/Bridge/TransactionPayment.stories.js +0 -165
- package/dist/esm/stories/Bridge/TransactionPayment.stories.js.map +0 -1
- package/dist/types/react/core/machines/paymentMachine.d.ts +0 -89
- package/dist/types/react/core/machines/paymentMachine.d.ts.map +0 -1
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts +0 -99
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +0 -1
- package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts +0 -97
- package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts.map +0 -1
- package/dist/types/stories/Bridge/DirectPayment.stories.d.ts +0 -69
- package/dist/types/stories/Bridge/DirectPayment.stories.d.ts.map +0 -1
- package/dist/types/stories/Bridge/FundWallet.stories.d.ts +0 -67
- package/dist/types/stories/Bridge/FundWallet.stories.d.ts.map +0 -1
- package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts +0 -60
- package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts.map +0 -1
- package/src/react/core/machines/paymentMachine.test.ts +0 -519
- package/src/react/core/machines/paymentMachine.ts +0 -295
- package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +0 -425
- package/src/stories/Bridge/BridgeOrchestrator.stories.tsx +0 -298
- package/src/stories/Bridge/DirectPayment.stories.tsx +0 -256
- package/src/stories/Bridge/FundWallet.stories.tsx +0 -227
- package/src/stories/Bridge/TransactionPayment.stories.tsx +0 -202
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
5
|
import { trackPayEvent } from "../../../../analytics/track/pay.js";
|
|
5
|
-
import type {
|
|
6
|
+
import type { TokenWithPrices } from "../../../../bridge/index.js";
|
|
6
7
|
import type { Chain } from "../../../../chains/types.js";
|
|
7
8
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
|
8
|
-
import { NATIVE_TOKEN_ADDRESS } from "../../../../constants/addresses.js";
|
|
9
|
-
import { getToken } from "../../../../pay/convert/get-token.js";
|
|
10
9
|
import type { SupportedFiatCurrency } from "../../../../pay/convert/type.js";
|
|
11
10
|
import type { PurchaseData } from "../../../../pay/types.js";
|
|
12
|
-
import {
|
|
13
|
-
type Address,
|
|
14
|
-
checksumAddress,
|
|
15
|
-
isAddress,
|
|
16
|
-
} from "../../../../utils/address.js";
|
|
17
|
-
import { stringify } from "../../../../utils/json.js";
|
|
11
|
+
import type { Address } from "../../../../utils/address.js";
|
|
18
12
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
|
19
13
|
import type { SmartWalletOptions } from "../../../../wallets/smart/types.js";
|
|
20
14
|
import type { AppMetadata } from "../../../../wallets/types.js";
|
|
@@ -23,15 +17,25 @@ import { CustomThemeProvider } from "../../../core/design-system/CustomThemeProv
|
|
|
23
17
|
import type { Theme } from "../../../core/design-system/index.js";
|
|
24
18
|
import type { SiweAuthOptions } from "../../../core/hooks/auth/useSiweAuth.js";
|
|
25
19
|
import type { ConnectButton_connectModalOptions } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
|
26
|
-
import type {
|
|
20
|
+
import type {
|
|
21
|
+
BridgePrepareRequest,
|
|
22
|
+
BridgePrepareResult,
|
|
23
|
+
} from "../../../core/hooks/useBridgePrepare.js";
|
|
24
|
+
import type { CompletedStatusResult } from "../../../core/hooks/useStepExecutor.js";
|
|
27
25
|
import type { SupportedTokens } from "../../../core/utils/defaultTokens.js";
|
|
28
|
-
import {
|
|
26
|
+
import { webWindowAdapter } from "../../adapters/WindowAdapter.js";
|
|
27
|
+
import connectLocaleEn from "../ConnectWallet/locale/en.js";
|
|
29
28
|
import { EmbedContainer } from "../ConnectWallet/Modal/ConnectEmbed.js";
|
|
30
29
|
import { DynamicHeight } from "../components/DynamicHeight.js";
|
|
31
|
-
import {
|
|
32
|
-
import
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
30
|
+
import { ErrorBanner } from "./ErrorBanner.js";
|
|
31
|
+
import { FundWallet } from "./FundWallet.js";
|
|
32
|
+
import { PaymentDetails } from "./payment-details/PaymentDetails.js";
|
|
33
|
+
import { PaymentSelection } from "./payment-selection/PaymentSelection.js";
|
|
34
|
+
import { SuccessScreen } from "./payment-success/SuccessScreen.js";
|
|
35
|
+
import { QuoteLoader } from "./QuoteLoader.js";
|
|
36
|
+
import { StepRunner } from "./StepRunner.js";
|
|
37
|
+
import { useActiveWalletInfo } from "./swap-widget/hooks.js";
|
|
38
|
+
import type { PaymentMethod, RequiredParams } from "./types.js";
|
|
35
39
|
|
|
36
40
|
export type BuyOrOnrampPrepareResult = Extract<
|
|
37
41
|
BridgePrepareResult,
|
|
@@ -59,14 +63,7 @@ export type BuyWidgetProps = {
|
|
|
59
63
|
* ```
|
|
60
64
|
*/
|
|
61
65
|
client: ThirdwebClient;
|
|
62
|
-
|
|
63
|
-
* By default - ConnectButton UI uses the `en-US` locale for english language users.
|
|
64
|
-
*
|
|
65
|
-
* You can customize the language used in the ConnectButton UI by setting the `locale` prop.
|
|
66
|
-
*
|
|
67
|
-
* Refer to the [`LocaleId`](https://portal.thirdweb.com/references/typescript/v5/LocaleId) type for supported locales.
|
|
68
|
-
*/
|
|
69
|
-
locale?: LocaleId;
|
|
66
|
+
|
|
70
67
|
/**
|
|
71
68
|
* Set the theme for the `BuyWidget` component. By default it is set to `"dark"`
|
|
72
69
|
*
|
|
@@ -121,7 +118,7 @@ export type BuyWidgetProps = {
|
|
|
121
118
|
/**
|
|
122
119
|
* The chain the accepted token is on.
|
|
123
120
|
*/
|
|
124
|
-
chain
|
|
121
|
+
chain?: Chain;
|
|
125
122
|
|
|
126
123
|
/**
|
|
127
124
|
* Address of the token to buy. Leave undefined for the native token, or use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.
|
|
@@ -131,7 +128,7 @@ export type BuyWidgetProps = {
|
|
|
131
128
|
/**
|
|
132
129
|
* The amount to buy **(as a decimal string)**, e.g. "1.5" for 1.5 tokens.
|
|
133
130
|
*/
|
|
134
|
-
amount
|
|
131
|
+
amount?: string;
|
|
135
132
|
|
|
136
133
|
/**
|
|
137
134
|
* The title to display in the widget. If `title` is explicity set to an empty string, the title will not be displayed.
|
|
@@ -204,21 +201,12 @@ export type BuyWidgetProps = {
|
|
|
204
201
|
* The receiver address for the purchased funds.
|
|
205
202
|
*/
|
|
206
203
|
receiverAddress?: Address;
|
|
207
|
-
};
|
|
208
204
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
token: Token;
|
|
215
|
-
chain: Chain;
|
|
216
|
-
}
|
|
217
|
-
| {
|
|
218
|
-
type: "unsupported_token";
|
|
219
|
-
tokenAddress: Address;
|
|
220
|
-
chain: Chain;
|
|
221
|
-
};
|
|
205
|
+
/**
|
|
206
|
+
* Callback to be called when the user disconnects the active wallet.
|
|
207
|
+
*/
|
|
208
|
+
onDisconnect?: () => void;
|
|
209
|
+
};
|
|
222
210
|
|
|
223
211
|
/**
|
|
224
212
|
* Widget is a prebuilt UI for purchasing a specific token.
|
|
@@ -331,15 +319,12 @@ type UIOptionsResult =
|
|
|
331
319
|
* @bridge
|
|
332
320
|
*/
|
|
333
321
|
export function BuyWidget(props: BuyWidgetProps) {
|
|
334
|
-
const localeQuery = useConnectLocale(props.locale || "en_US");
|
|
335
|
-
const theme = props.theme || "dark";
|
|
336
|
-
|
|
337
322
|
useQuery({
|
|
338
323
|
queryFn: () => {
|
|
339
324
|
trackPayEvent({
|
|
340
325
|
client: props.client,
|
|
341
326
|
event: "ub:ui:buy_widget:render",
|
|
342
|
-
toChainId: props.chain
|
|
327
|
+
toChainId: props.chain?.id,
|
|
343
328
|
toToken: props.tokenAddress,
|
|
344
329
|
});
|
|
345
330
|
return true;
|
|
@@ -347,149 +332,359 @@ export function BuyWidget(props: BuyWidgetProps) {
|
|
|
347
332
|
queryKey: ["buy_widget:render"],
|
|
348
333
|
});
|
|
349
334
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
335
|
+
// if branding is disabled for widget, disable it for connect options too
|
|
336
|
+
const connectOptions = useMemo(() => {
|
|
337
|
+
if (props.showThirdwebBranding === false) {
|
|
338
|
+
return {
|
|
339
|
+
...props.connectOptions,
|
|
340
|
+
connectModal: {
|
|
341
|
+
...props.connectOptions?.connectModal,
|
|
342
|
+
showThirdwebBranding: false,
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
return props.connectOptions;
|
|
347
|
+
}, [props.connectOptions, props.showThirdwebBranding]);
|
|
348
|
+
|
|
349
|
+
return (
|
|
350
|
+
<BridgeWidgetContainer
|
|
351
|
+
theme={props.theme}
|
|
352
|
+
className={props.className}
|
|
353
|
+
style={props.style}
|
|
354
|
+
>
|
|
355
|
+
<BridgeWidgetContent
|
|
356
|
+
{...props}
|
|
357
|
+
theme={props.theme || "dark"}
|
|
358
|
+
currency={props.currency || "USD"}
|
|
359
|
+
paymentMethods={props.paymentMethods || ["crypto", "card"]}
|
|
360
|
+
presetOptions={props.presetOptions || [5, 10, 20]}
|
|
361
|
+
connectOptions={connectOptions}
|
|
362
|
+
showThirdwebBranding={
|
|
363
|
+
props.showThirdwebBranding === undefined
|
|
364
|
+
? true
|
|
365
|
+
: props.showThirdwebBranding
|
|
373
366
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
367
|
+
/>
|
|
368
|
+
</BridgeWidgetContainer>
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
type BuyWidgetScreen =
|
|
373
|
+
| { id: "1:buy-ui" }
|
|
374
|
+
| {
|
|
375
|
+
id: "2:methodSelection";
|
|
376
|
+
destinationAmount: string;
|
|
377
|
+
destinationToken: TokenWithPrices;
|
|
378
|
+
receiverAddress: Address;
|
|
379
|
+
}
|
|
380
|
+
| {
|
|
381
|
+
id: "3:load-quote";
|
|
382
|
+
destinationAmount: string;
|
|
383
|
+
destinationToken: TokenWithPrices;
|
|
384
|
+
receiverAddress: Address;
|
|
385
|
+
paymentMethod: PaymentMethod;
|
|
386
|
+
}
|
|
387
|
+
| {
|
|
388
|
+
id: "4:preview";
|
|
389
|
+
preparedQuote: BridgePrepareResult;
|
|
390
|
+
request: BridgePrepareRequest;
|
|
391
|
+
destinationAmount: string;
|
|
392
|
+
destinationToken: TokenWithPrices;
|
|
393
|
+
paymentMethod: PaymentMethod;
|
|
394
|
+
receiverAddress: Address;
|
|
395
|
+
}
|
|
396
|
+
| {
|
|
397
|
+
id: "5:execute";
|
|
398
|
+
preparedQuote: BridgePrepareResult;
|
|
399
|
+
request: BridgePrepareRequest;
|
|
400
|
+
destinationAmount: string;
|
|
401
|
+
destinationToken: TokenWithPrices;
|
|
402
|
+
paymentMethod: PaymentMethod;
|
|
403
|
+
receiverAddress: Address;
|
|
404
|
+
}
|
|
405
|
+
| {
|
|
406
|
+
id: "6:success";
|
|
407
|
+
completedStatuses: CompletedStatusResult[];
|
|
408
|
+
preparedQuote: BridgePrepareResult;
|
|
409
|
+
}
|
|
410
|
+
| {
|
|
411
|
+
id: "error";
|
|
412
|
+
error: Error;
|
|
413
|
+
preparedQuote: BridgePrepareResult | undefined;
|
|
414
|
+
};
|
|
390
415
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
416
|
+
function BridgeWidgetContent(
|
|
417
|
+
props: RequiredParams<
|
|
418
|
+
BuyWidgetProps,
|
|
419
|
+
| "currency"
|
|
420
|
+
| "presetOptions"
|
|
421
|
+
| "showThirdwebBranding"
|
|
422
|
+
| "paymentMethods"
|
|
423
|
+
| "theme"
|
|
424
|
+
>,
|
|
425
|
+
) {
|
|
426
|
+
const [screen, setScreen] = useState<BuyWidgetScreen>({ id: "1:buy-ui" });
|
|
427
|
+
const activeWalletInfo = useActiveWalletInfo();
|
|
428
|
+
|
|
429
|
+
const handleError = useCallback(
|
|
430
|
+
(error: Error, quote: BridgePrepareResult | undefined) => {
|
|
431
|
+
console.error(error);
|
|
432
|
+
if (quote?.type === "buy" || quote?.type === "onramp") {
|
|
433
|
+
props.onError?.(error, quote);
|
|
434
|
+
} else {
|
|
435
|
+
props.onError?.(error, undefined);
|
|
436
|
+
}
|
|
437
|
+
setScreen({
|
|
438
|
+
id: "error",
|
|
439
|
+
preparedQuote: quote,
|
|
440
|
+
error,
|
|
397
441
|
});
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
442
|
+
},
|
|
443
|
+
[props.onError],
|
|
444
|
+
);
|
|
445
|
+
|
|
446
|
+
const handleCancel = useCallback(
|
|
447
|
+
(preparedQuote: BridgePrepareResult | undefined) => {
|
|
448
|
+
if (preparedQuote?.type === "buy" || preparedQuote?.type === "onramp") {
|
|
449
|
+
props.onCancel?.(preparedQuote);
|
|
450
|
+
} else {
|
|
451
|
+
props.onCancel?.(undefined);
|
|
404
452
|
}
|
|
405
|
-
return {
|
|
406
|
-
data: {
|
|
407
|
-
destinationToken: token,
|
|
408
|
-
initialAmount: props.amount,
|
|
409
|
-
metadata: {
|
|
410
|
-
description: props.description,
|
|
411
|
-
image: props.image,
|
|
412
|
-
title: props.title,
|
|
413
|
-
},
|
|
414
|
-
mode: "fund_wallet",
|
|
415
|
-
currency: props.currency || "USD",
|
|
416
|
-
buttonLabel: props.buttonLabel,
|
|
417
|
-
},
|
|
418
|
-
type: "success",
|
|
419
|
-
};
|
|
420
453
|
},
|
|
421
|
-
|
|
422
|
-
|
|
454
|
+
[props.onCancel],
|
|
455
|
+
);
|
|
423
456
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
alignItems: "center",
|
|
430
|
-
display: "flex",
|
|
431
|
-
justifyContent: "center",
|
|
432
|
-
minHeight: "350px",
|
|
433
|
-
}}
|
|
434
|
-
>
|
|
435
|
-
<Spinner color="secondaryText" size="xl" />
|
|
436
|
-
</div>
|
|
437
|
-
);
|
|
438
|
-
} else if (bridgeDataQuery.data?.type === "unsupported_token") {
|
|
439
|
-
// Show unsupported token screen
|
|
440
|
-
content = (
|
|
441
|
-
<UnsupportedTokenScreen
|
|
442
|
-
chain={bridgeDataQuery.data.chain}
|
|
457
|
+
if (screen.id === "1:buy-ui" || !activeWalletInfo) {
|
|
458
|
+
return (
|
|
459
|
+
<FundWallet
|
|
460
|
+
theme={props.theme}
|
|
461
|
+
onDisconnect={props.onDisconnect}
|
|
443
462
|
client={props.client}
|
|
444
|
-
|
|
463
|
+
connectOptions={props.connectOptions}
|
|
464
|
+
onContinue={(destinationAmount, destinationToken, receiverAddress) => {
|
|
465
|
+
setScreen({
|
|
466
|
+
id: "2:methodSelection",
|
|
467
|
+
destinationAmount,
|
|
468
|
+
destinationToken,
|
|
469
|
+
receiverAddress,
|
|
470
|
+
});
|
|
471
|
+
}}
|
|
472
|
+
presetOptions={props.presetOptions}
|
|
473
|
+
receiverAddress={props.receiverAddress}
|
|
474
|
+
showThirdwebBranding={props.showThirdwebBranding}
|
|
475
|
+
metadata={{
|
|
476
|
+
title: props.title,
|
|
477
|
+
description: props.description,
|
|
478
|
+
image: props.image,
|
|
479
|
+
}}
|
|
480
|
+
buttonLabel={props.buttonLabel}
|
|
481
|
+
currency={props.currency}
|
|
482
|
+
initialSelection={{
|
|
483
|
+
tokenAddress: props.tokenAddress,
|
|
484
|
+
chainId: props.chain?.id,
|
|
485
|
+
amount: props.amount,
|
|
486
|
+
}}
|
|
445
487
|
/>
|
|
446
488
|
);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (screen.id === "2:methodSelection") {
|
|
492
|
+
return (
|
|
493
|
+
<PaymentSelection
|
|
494
|
+
// from props
|
|
453
495
|
client={props.client}
|
|
454
|
-
connectLocale={
|
|
496
|
+
connectLocale={connectLocaleEn}
|
|
455
497
|
connectOptions={props.connectOptions}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
498
|
+
paymentMethods={props.paymentMethods}
|
|
499
|
+
currency={props.currency}
|
|
500
|
+
supportedTokens={props.supportedTokens}
|
|
501
|
+
country={props.country}
|
|
502
|
+
// others
|
|
503
|
+
destinationToken={screen.destinationToken}
|
|
504
|
+
destinationAmount={screen.destinationAmount}
|
|
505
|
+
receiverAddress={screen.receiverAddress}
|
|
506
|
+
feePayer={undefined}
|
|
507
|
+
onBack={() => {
|
|
508
|
+
setScreen({ id: "1:buy-ui" });
|
|
461
509
|
}}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
if (quote?.type === "buy" || quote?.type === "onramp") {
|
|
465
|
-
props.onSuccess?.(quote);
|
|
466
|
-
}
|
|
510
|
+
onError={(error) => {
|
|
511
|
+
handleError(error, undefined);
|
|
467
512
|
}}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
513
|
+
onPaymentMethodSelected={(paymentMethod) => {
|
|
514
|
+
setScreen({
|
|
515
|
+
...screen,
|
|
516
|
+
id: "3:load-quote",
|
|
517
|
+
paymentMethod,
|
|
518
|
+
});
|
|
473
519
|
}}
|
|
520
|
+
/>
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (screen.id === "3:load-quote") {
|
|
525
|
+
return (
|
|
526
|
+
<QuoteLoader
|
|
527
|
+
// from props
|
|
474
528
|
paymentLinkId={props.paymentLinkId}
|
|
475
|
-
paymentMethods={props.paymentMethods}
|
|
476
|
-
presetOptions={props.presetOptions}
|
|
477
529
|
purchaseData={props.purchaseData}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
530
|
+
client={props.client}
|
|
531
|
+
// others
|
|
532
|
+
sender={undefined}
|
|
533
|
+
mode="fund_wallet"
|
|
534
|
+
feePayer={undefined}
|
|
535
|
+
amount={screen.destinationAmount}
|
|
536
|
+
destinationToken={screen.destinationToken}
|
|
537
|
+
onBack={() => {
|
|
538
|
+
setScreen({
|
|
539
|
+
...screen,
|
|
540
|
+
id: "2:methodSelection",
|
|
541
|
+
});
|
|
542
|
+
}}
|
|
543
|
+
onError={(error) => {
|
|
544
|
+
handleError(error, undefined);
|
|
545
|
+
}}
|
|
546
|
+
onQuoteReceived={(preparedQuote, request) => {
|
|
547
|
+
setScreen({
|
|
548
|
+
...screen,
|
|
549
|
+
id: "4:preview",
|
|
550
|
+
preparedQuote,
|
|
551
|
+
request,
|
|
552
|
+
});
|
|
553
|
+
}}
|
|
554
|
+
paymentMethod={screen.paymentMethod}
|
|
555
|
+
receiver={screen.receiverAddress}
|
|
556
|
+
/>
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (screen.id === "4:preview") {
|
|
561
|
+
return (
|
|
562
|
+
<PaymentDetails
|
|
563
|
+
// from props
|
|
564
|
+
client={props.client}
|
|
565
|
+
currency={props.currency}
|
|
566
|
+
metadata={{
|
|
567
|
+
title: props.title,
|
|
568
|
+
description: props.description,
|
|
569
|
+
}}
|
|
570
|
+
// others
|
|
571
|
+
confirmButtonLabel={undefined}
|
|
572
|
+
onBack={() => {
|
|
573
|
+
setScreen({
|
|
574
|
+
...screen,
|
|
575
|
+
id: "2:methodSelection",
|
|
576
|
+
});
|
|
577
|
+
}}
|
|
578
|
+
onConfirm={() => {
|
|
579
|
+
setScreen({
|
|
580
|
+
...screen,
|
|
581
|
+
id: "5:execute",
|
|
582
|
+
});
|
|
583
|
+
}}
|
|
584
|
+
onError={(error) => {
|
|
585
|
+
handleError(error, screen.preparedQuote);
|
|
586
|
+
}}
|
|
587
|
+
paymentMethod={screen.paymentMethod}
|
|
588
|
+
preparedQuote={screen.preparedQuote}
|
|
589
|
+
modeInfo={{
|
|
590
|
+
mode: "fund_wallet",
|
|
591
|
+
}}
|
|
592
|
+
/>
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
if (screen.id === "5:execute") {
|
|
597
|
+
return (
|
|
598
|
+
<StepRunner
|
|
599
|
+
// from props
|
|
600
|
+
client={props.client}
|
|
601
|
+
// others
|
|
602
|
+
title={undefined}
|
|
603
|
+
preparedQuote={screen.preparedQuote}
|
|
604
|
+
autoStart={true}
|
|
605
|
+
onBack={() => {
|
|
606
|
+
setScreen({
|
|
607
|
+
...screen,
|
|
608
|
+
id: "4:preview",
|
|
609
|
+
});
|
|
610
|
+
}}
|
|
611
|
+
onCancel={() => {
|
|
612
|
+
handleCancel(screen.preparedQuote);
|
|
613
|
+
}}
|
|
614
|
+
onComplete={(completedStatuses) => {
|
|
615
|
+
if (
|
|
616
|
+
screen.preparedQuote.type === "buy" ||
|
|
617
|
+
screen.preparedQuote.type === "onramp"
|
|
618
|
+
) {
|
|
619
|
+
props.onSuccess?.(screen.preparedQuote);
|
|
620
|
+
}
|
|
621
|
+
setScreen({
|
|
622
|
+
id: "6:success",
|
|
623
|
+
preparedQuote: screen.preparedQuote,
|
|
624
|
+
completedStatuses,
|
|
625
|
+
});
|
|
626
|
+
}}
|
|
627
|
+
request={screen.request}
|
|
628
|
+
wallet={screen.paymentMethod.payerWallet}
|
|
629
|
+
windowAdapter={webWindowAdapter}
|
|
630
|
+
/>
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
if (screen.id === "6:success") {
|
|
635
|
+
return (
|
|
636
|
+
<SuccessScreen
|
|
637
|
+
// from props
|
|
638
|
+
client={props.client}
|
|
639
|
+
hasPaymentId={!!props.paymentLinkId}
|
|
640
|
+
completedStatuses={screen.completedStatuses}
|
|
641
|
+
// others
|
|
642
|
+
onDone={() => {
|
|
643
|
+
setScreen({ id: "1:buy-ui" });
|
|
644
|
+
}}
|
|
645
|
+
preparedQuote={screen.preparedQuote}
|
|
646
|
+
showContinueWithTx={false}
|
|
647
|
+
windowAdapter={webWindowAdapter}
|
|
481
648
|
/>
|
|
482
649
|
);
|
|
483
650
|
}
|
|
484
651
|
|
|
652
|
+
if (screen.id === "error") {
|
|
653
|
+
return (
|
|
654
|
+
<ErrorBanner
|
|
655
|
+
client={props.client}
|
|
656
|
+
error={screen.error}
|
|
657
|
+
onCancel={() => {
|
|
658
|
+
setScreen({ id: "1:buy-ui" });
|
|
659
|
+
handleCancel(screen.preparedQuote);
|
|
660
|
+
}}
|
|
661
|
+
onRetry={() => {
|
|
662
|
+
setScreen({ id: "1:buy-ui" });
|
|
663
|
+
}}
|
|
664
|
+
/>
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
return null;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* @internal
|
|
673
|
+
*/
|
|
674
|
+
function BridgeWidgetContainer(props: {
|
|
675
|
+
theme: BuyWidgetProps["theme"];
|
|
676
|
+
className: string | undefined;
|
|
677
|
+
style?: React.CSSProperties | undefined;
|
|
678
|
+
children: React.ReactNode;
|
|
679
|
+
}) {
|
|
485
680
|
return (
|
|
486
|
-
<CustomThemeProvider theme={theme}>
|
|
681
|
+
<CustomThemeProvider theme={props.theme || "dark"}>
|
|
487
682
|
<EmbedContainer
|
|
488
683
|
className={props.className}
|
|
489
684
|
modalSize="compact"
|
|
490
685
|
style={props.style}
|
|
491
686
|
>
|
|
492
|
-
<DynamicHeight>{
|
|
687
|
+
<DynamicHeight>{props.children}</DynamicHeight>
|
|
493
688
|
</EmbedContainer>
|
|
494
689
|
</CustomThemeProvider>
|
|
495
690
|
);
|