thirdweb 5.108.6 → 5.108.8
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 +3 -4
- 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 +3 -4
- 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 +4 -5
- 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 +3 -3
- 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 +8 -8
- 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,11 +1,7 @@
|
|
|
1
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
2
|
import type { CompletedStatusResult } from "../../react/core/hooks/useStepExecutor.js";
|
|
3
|
+
import { webWindowAdapter } from "../../react/web/adapters/WindowAdapter.js";
|
|
7
4
|
import { StepRunner } from "../../react/web/ui/Bridge/StepRunner.js";
|
|
8
|
-
import type { Wallet } from "../../wallets/interfaces/wallet.js";
|
|
9
5
|
import { ModalThemeWrapper, storyClient } from "../utils.js";
|
|
10
6
|
import {
|
|
11
7
|
STORY_MOCK_WALLET,
|
|
@@ -13,80 +9,37 @@ import {
|
|
|
13
9
|
simpleBuyRequest,
|
|
14
10
|
} from "./fixtures.js";
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
const mockWindowAdapter: WindowAdapter = {
|
|
18
|
-
open: async (_url: string) => {},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Props interface for the wrapper component
|
|
22
|
-
interface StepRunnerWithThemeProps {
|
|
23
|
-
request: BridgePrepareRequest;
|
|
24
|
-
wallet: Wallet;
|
|
25
|
-
client: ThirdwebClient;
|
|
26
|
-
windowAdapter: WindowAdapter;
|
|
27
|
-
onComplete: (completedStatuses: CompletedStatusResult[]) => void;
|
|
28
|
-
onError: (error: Error) => void;
|
|
29
|
-
onCancel?: () => void;
|
|
30
|
-
onBack?: () => void;
|
|
31
|
-
theme: "light" | "dark" | Theme;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Wrapper component to provide theme context
|
|
35
|
-
const StepRunnerWithTheme = (props: StepRunnerWithThemeProps) => {
|
|
36
|
-
const { theme, ...componentProps } = props;
|
|
37
|
-
return (
|
|
38
|
-
<ModalThemeWrapper theme={theme}>
|
|
39
|
-
<StepRunner {...componentProps} preparedQuote={simpleBuyQuote} />
|
|
40
|
-
</ModalThemeWrapper>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const meta = {
|
|
12
|
+
const meta: Meta<typeof StepRunner> = {
|
|
45
13
|
args: {
|
|
46
14
|
client: storyClient,
|
|
47
15
|
onCancel: () => {},
|
|
48
16
|
onComplete: (_completedStatuses: CompletedStatusResult[]) => {},
|
|
49
|
-
onError: (error: Error) => console.error("Error:", error),
|
|
50
|
-
theme: "dark",
|
|
51
17
|
wallet: STORY_MOCK_WALLET,
|
|
52
|
-
windowAdapter:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
onError: { action: "error occurred" },
|
|
58
|
-
theme: {
|
|
59
|
-
control: "select",
|
|
60
|
-
description: "Theme for the component",
|
|
61
|
-
options: ["light", "dark"],
|
|
62
|
-
},
|
|
18
|
+
windowAdapter: webWindowAdapter,
|
|
19
|
+
title: undefined,
|
|
20
|
+
autoStart: true,
|
|
21
|
+
onBack: undefined,
|
|
22
|
+
preparedQuote: simpleBuyQuote,
|
|
63
23
|
},
|
|
64
|
-
component:
|
|
24
|
+
component: StepRunner,
|
|
25
|
+
decorators: [
|
|
26
|
+
(Story) => (
|
|
27
|
+
<ModalThemeWrapper>
|
|
28
|
+
<Story />
|
|
29
|
+
</ModalThemeWrapper>
|
|
30
|
+
),
|
|
31
|
+
],
|
|
65
32
|
parameters: {
|
|
66
33
|
layout: "centered",
|
|
67
34
|
},
|
|
68
|
-
title: "Bridge/StepRunner",
|
|
69
|
-
}
|
|
35
|
+
title: "Bridge/screens/StepRunner",
|
|
36
|
+
};
|
|
70
37
|
|
|
71
38
|
export default meta;
|
|
72
39
|
type Story = StoryObj<typeof meta>;
|
|
73
40
|
|
|
74
|
-
export const
|
|
75
|
-
args: {
|
|
76
|
-
request: simpleBuyRequest,
|
|
77
|
-
theme: "light",
|
|
78
|
-
},
|
|
79
|
-
parameters: {
|
|
80
|
-
backgrounds: { default: "light" },
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const Dark: Story = {
|
|
41
|
+
export const Basic: Story = {
|
|
85
42
|
args: {
|
|
86
43
|
request: simpleBuyRequest,
|
|
87
|
-
theme: "dark",
|
|
88
|
-
},
|
|
89
|
-
parameters: {
|
|
90
|
-
backgrounds: { default: "dark" },
|
|
91
44
|
},
|
|
92
45
|
};
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { stringify } from "viem";
|
|
3
|
-
import type { Theme } from "../../react/core/design-system/index.js";
|
|
4
3
|
import type { CompletedStatusResult } from "../../react/core/hooks/useStepExecutor.js";
|
|
5
4
|
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";
|
|
5
|
+
import { SuccessScreen } from "../../react/web/ui/Bridge/payment-success/SuccessScreen.js";
|
|
10
6
|
import { ModalThemeWrapper, storyClient } from "../utils.js";
|
|
11
|
-
import {
|
|
12
|
-
FUND_WALLET_UI_OPTIONS,
|
|
13
|
-
simpleBuyQuote,
|
|
14
|
-
simpleOnrampQuote,
|
|
15
|
-
TRANSACTION_UI_OPTIONS,
|
|
16
|
-
} from "./fixtures.js";
|
|
7
|
+
import { simpleBuyQuote, simpleOnrampQuote } from "./fixtures.js";
|
|
17
8
|
|
|
18
9
|
const mockBuyCompletedStatuses: CompletedStatusResult[] = JSON.parse(
|
|
19
10
|
stringify([
|
|
@@ -75,164 +66,64 @@ const mockOnrampCompletedStatuses: CompletedStatusResult[] = JSON.parse(
|
|
|
75
66
|
]),
|
|
76
67
|
);
|
|
77
68
|
|
|
78
|
-
|
|
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 = {
|
|
69
|
+
const meta: Meta<typeof SuccessScreen> = {
|
|
94
70
|
args: {
|
|
95
71
|
completedStatuses: mockBuyCompletedStatuses,
|
|
96
72
|
onDone: () => {},
|
|
97
73
|
preparedQuote: simpleBuyQuote,
|
|
98
|
-
|
|
99
|
-
uiOptions: FUND_WALLET_UI_OPTIONS.ethDefault,
|
|
74
|
+
showContinueWithTx: false,
|
|
100
75
|
windowAdapter: webWindowAdapter,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
component:
|
|
115
|
-
"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.",
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
layout: "centered",
|
|
119
|
-
},
|
|
120
|
-
tags: ["autodocs"],
|
|
121
|
-
title: "Bridge/SuccessScreen",
|
|
122
|
-
} satisfies Meta<typeof SuccessScreenWithTheme>;
|
|
76
|
+
client: storyClient,
|
|
77
|
+
hasPaymentId: false,
|
|
78
|
+
},
|
|
79
|
+
component: SuccessScreen,
|
|
80
|
+
decorators: [
|
|
81
|
+
(Story) => (
|
|
82
|
+
<ModalThemeWrapper>
|
|
83
|
+
<Story />
|
|
84
|
+
</ModalThemeWrapper>
|
|
85
|
+
),
|
|
86
|
+
],
|
|
87
|
+
title: "Bridge/screens/SuccessScreen",
|
|
88
|
+
};
|
|
123
89
|
|
|
124
90
|
export default meta;
|
|
125
91
|
type Story = StoryObj<typeof meta>;
|
|
126
92
|
|
|
127
|
-
export const
|
|
128
|
-
args: {
|
|
129
|
-
client: storyClient,
|
|
130
|
-
theme: "dark",
|
|
131
|
-
},
|
|
132
|
-
parameters: {
|
|
133
|
-
backgrounds: { default: "dark" },
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export const DefaultLight: Story = {
|
|
138
|
-
args: {
|
|
139
|
-
client: storyClient,
|
|
140
|
-
theme: "light",
|
|
141
|
-
},
|
|
142
|
-
parameters: {
|
|
143
|
-
backgrounds: { default: "light" },
|
|
144
|
-
},
|
|
93
|
+
export const Basic: Story = {
|
|
94
|
+
args: {},
|
|
145
95
|
};
|
|
146
96
|
|
|
147
97
|
export const OnrampPayment: Story = {
|
|
148
98
|
args: {
|
|
149
|
-
client: storyClient,
|
|
150
|
-
completedStatuses: mockOnrampCompletedStatuses,
|
|
151
|
-
preparedQuote: simpleOnrampQuote,
|
|
152
|
-
theme: "dark",
|
|
153
|
-
},
|
|
154
|
-
parameters: {
|
|
155
|
-
backgrounds: { default: "dark" },
|
|
156
|
-
docs: {
|
|
157
|
-
description: {
|
|
158
|
-
story:
|
|
159
|
-
"Success screen for onramp payments showing payment ID that can be copied to clipboard.",
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const OnrampPaymentLight: Story = {
|
|
166
|
-
args: {
|
|
167
|
-
client: storyClient,
|
|
168
99
|
completedStatuses: mockOnrampCompletedStatuses,
|
|
169
100
|
preparedQuote: simpleOnrampQuote,
|
|
170
|
-
theme: "light",
|
|
171
|
-
},
|
|
172
|
-
parameters: {
|
|
173
|
-
backgrounds: { default: "light" },
|
|
174
101
|
},
|
|
175
102
|
};
|
|
176
103
|
|
|
177
104
|
export const ComplexPayment: Story = {
|
|
178
105
|
args: {
|
|
179
|
-
client: storyClient,
|
|
180
|
-
completedStatuses: [
|
|
181
|
-
...mockOnrampCompletedStatuses,
|
|
182
|
-
...mockBuyCompletedStatuses,
|
|
183
|
-
],
|
|
184
|
-
preparedQuote: simpleOnrampQuote,
|
|
185
|
-
theme: "dark",
|
|
186
|
-
},
|
|
187
|
-
parameters: {
|
|
188
|
-
backgrounds: { default: "dark" },
|
|
189
|
-
docs: {
|
|
190
|
-
description: {
|
|
191
|
-
story:
|
|
192
|
-
"Success screen for onramp payments showing payment ID that can be copied to clipboard.",
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export const ComplexPaymentLight: Story = {
|
|
199
|
-
args: {
|
|
200
|
-
client: storyClient,
|
|
201
106
|
completedStatuses: [
|
|
202
107
|
...mockOnrampCompletedStatuses,
|
|
203
108
|
...mockBuyCompletedStatuses,
|
|
204
109
|
],
|
|
205
110
|
preparedQuote: simpleOnrampQuote,
|
|
206
|
-
theme: "light",
|
|
207
|
-
},
|
|
208
|
-
parameters: {
|
|
209
|
-
backgrounds: { default: "light" },
|
|
210
111
|
},
|
|
211
112
|
};
|
|
212
113
|
|
|
213
114
|
export const TransactionPayment: Story = {
|
|
214
115
|
args: {
|
|
215
|
-
client: storyClient,
|
|
216
116
|
completedStatuses: mockBuyCompletedStatuses,
|
|
217
117
|
preparedQuote: simpleBuyQuote,
|
|
218
|
-
|
|
219
|
-
uiOptions: TRANSACTION_UI_OPTIONS.contractInteraction,
|
|
220
|
-
},
|
|
221
|
-
parameters: {
|
|
222
|
-
backgrounds: { default: "light" },
|
|
118
|
+
showContinueWithTx: true,
|
|
223
119
|
},
|
|
224
120
|
};
|
|
225
121
|
|
|
226
122
|
export const PaymentId: Story = {
|
|
227
123
|
args: {
|
|
228
|
-
client: storyClient,
|
|
229
124
|
completedStatuses: mockBuyCompletedStatuses,
|
|
230
125
|
hasPaymentId: true,
|
|
231
126
|
preparedQuote: simpleBuyQuote,
|
|
232
|
-
|
|
233
|
-
uiOptions: TRANSACTION_UI_OPTIONS.contractInteraction,
|
|
234
|
-
},
|
|
235
|
-
parameters: {
|
|
236
|
-
backgrounds: { default: "light" },
|
|
127
|
+
showContinueWithTx: true,
|
|
237
128
|
},
|
|
238
129
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
TransactionWidget,
|
|
4
|
+
type TransactionWidgetProps,
|
|
5
|
+
} from "../../../react/web/ui/Bridge/TransactionWidget.js";
|
|
6
|
+
import { storyClient } from "../../utils.js";
|
|
7
|
+
import { TRANSACTION_UI_OPTIONS } from "../fixtures.js";
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof StoryVariant> = {
|
|
10
|
+
args: {
|
|
11
|
+
client: storyClient,
|
|
12
|
+
onSuccess: () => {},
|
|
13
|
+
onError: () => {},
|
|
14
|
+
onCancel: () => {},
|
|
15
|
+
currency: "USD",
|
|
16
|
+
...TRANSACTION_UI_OPTIONS.ethTransfer,
|
|
17
|
+
},
|
|
18
|
+
component: StoryVariant,
|
|
19
|
+
title: "Bridge/Transaction/TransactionWidget",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const EthereumTransfer: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
...TRANSACTION_UI_OPTIONS.ethTransfer,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const ERC20TokenTransfer: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
...TRANSACTION_UI_OPTIONS.erc20Transfer,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const ContractInteraction: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
...TRANSACTION_UI_OPTIONS.contractInteraction,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const CustomButtonLabel: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
...TRANSACTION_UI_OPTIONS.customButton,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function StoryVariant(props: TransactionWidgetProps) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
style={{
|
|
53
|
+
display: "flex",
|
|
54
|
+
flexDirection: "column",
|
|
55
|
+
gap: "40px",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<TransactionWidget {...props} theme="dark" />
|
|
60
|
+
<TransactionWidget {...props} theme="light" />
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
|
+
import { base } from "../../../chains/chain-definitions/base.js";
|
|
3
|
+
import { sepolia } from "../../../chains/chain-definitions/sepolia.js";
|
|
4
|
+
import { useActiveAccount } from "../../../react/core/hooks/wallets/useActiveAccount.js";
|
|
5
|
+
import { useSendTransaction } from "../../../react/web/hooks/transaction/useSendTransaction.js";
|
|
6
|
+
import { ConnectButton } from "../../../react/web/ui/ConnectWallet/ConnectButton.js";
|
|
7
|
+
import { Button } from "../../../react/web/ui/components/buttons.js";
|
|
8
|
+
import { Spinner } from "../../../react/web/ui/components/Spinner.js";
|
|
9
|
+
import {
|
|
10
|
+
type PreparedTransaction,
|
|
11
|
+
prepareTransaction,
|
|
12
|
+
} from "../../../transaction/prepare-transaction.js";
|
|
13
|
+
import { toWei } from "../../../utils/units.js";
|
|
14
|
+
import { storyClient } from "../../utils.js";
|
|
15
|
+
|
|
16
|
+
const meta: Meta<typeof Variant> = {
|
|
17
|
+
component: Variant,
|
|
18
|
+
title: "Bridge/Transaction/useSendTransaction",
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
const sendBase = prepareTransaction({
|
|
23
|
+
chain: base,
|
|
24
|
+
client: storyClient,
|
|
25
|
+
to: "0x83Dd93fA5D8343094f850f90B3fb90088C1bB425",
|
|
26
|
+
value: toWei("100"),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// using an unsupported chain to popup deposit screen
|
|
30
|
+
const sendSepolia = prepareTransaction({
|
|
31
|
+
chain: sepolia,
|
|
32
|
+
client: storyClient,
|
|
33
|
+
to: "0x83Dd93fA5D8343094f850f90B3fb90088C1bB425",
|
|
34
|
+
value: toWei("100"),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const BuyAndExecuteTx = {
|
|
38
|
+
args: {
|
|
39
|
+
transaction: sendBase,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const DepositAndExecuteTx = {
|
|
44
|
+
args: {
|
|
45
|
+
transaction: sendSepolia,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function Variant(props: { transaction: PreparedTransaction }) {
|
|
50
|
+
const sendTx = useSendTransaction();
|
|
51
|
+
const account = useActiveAccount();
|
|
52
|
+
|
|
53
|
+
if (!account) {
|
|
54
|
+
return <ConnectButton client={storyClient} />;
|
|
55
|
+
}
|
|
56
|
+
return (
|
|
57
|
+
<Button
|
|
58
|
+
variant="primary"
|
|
59
|
+
gap="xs"
|
|
60
|
+
onClick={() => {
|
|
61
|
+
sendTx.mutate(props.transaction);
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{sendTx.isPending && <Spinner size="sm" />}
|
|
65
|
+
Execute
|
|
66
|
+
</Button>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -1,58 +1,25 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { defineChain } from "../../chains/utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
UnsupportedTokenScreen,
|
|
7
|
-
type UnsupportedTokenScreenProps,
|
|
8
|
-
} from "../../react/web/ui/Bridge/UnsupportedTokenScreen.js";
|
|
9
|
-
import { ModalThemeWrapper } from "../utils.js";
|
|
3
|
+
import { NATIVE_TOKEN_ADDRESS } from "../../constants/addresses.js";
|
|
4
|
+
import { UnsupportedTokenScreen } from "../../react/web/ui/Bridge/UnsupportedTokenScreen.js";
|
|
5
|
+
import { ModalThemeWrapper, storyClient } from "../utils.js";
|
|
10
6
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
// Props interface for the wrapper component
|
|
14
|
-
interface UnsupportedTokenScreenWithThemeProps
|
|
15
|
-
extends UnsupportedTokenScreenProps {
|
|
16
|
-
theme: "light" | "dark" | Theme;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Wrapper component to provide theme context
|
|
20
|
-
const UnsupportedTokenScreenWithTheme = (
|
|
21
|
-
props: UnsupportedTokenScreenWithThemeProps,
|
|
22
|
-
) => {
|
|
23
|
-
const { theme, ...componentProps } = props;
|
|
24
|
-
return (
|
|
25
|
-
<ModalThemeWrapper theme={theme}>
|
|
26
|
-
<UnsupportedTokenScreen {...componentProps} />
|
|
27
|
-
</ModalThemeWrapper>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const meta = {
|
|
7
|
+
const meta: Meta<typeof UnsupportedTokenScreen> = {
|
|
32
8
|
args: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
component:
|
|
48
|
-
"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.",
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
layout: "centered",
|
|
52
|
-
},
|
|
53
|
-
tags: ["autodocs"],
|
|
54
|
-
title: "Bridge/UnsupportedTokenScreen",
|
|
55
|
-
} satisfies Meta<typeof UnsupportedTokenScreenWithTheme>;
|
|
9
|
+
client: storyClient,
|
|
10
|
+
chain: defineChain(1),
|
|
11
|
+
tokenAddress: NATIVE_TOKEN_ADDRESS,
|
|
12
|
+
},
|
|
13
|
+
component: UnsupportedTokenScreen,
|
|
14
|
+
title: "Bridge/screens/UnsupportedTokenScreen",
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (
|
|
17
|
+
<ModalThemeWrapper>
|
|
18
|
+
<Story />
|
|
19
|
+
</ModalThemeWrapper>
|
|
20
|
+
),
|
|
21
|
+
],
|
|
22
|
+
};
|
|
56
23
|
|
|
57
24
|
export default meta;
|
|
58
25
|
type Story = StoryObj<typeof meta>;
|
|
@@ -60,67 +27,11 @@ type Story = StoryObj<typeof meta>;
|
|
|
60
27
|
export const TokenNotSupported: Story = {
|
|
61
28
|
args: {
|
|
62
29
|
chain: defineChain(1),
|
|
63
|
-
client: TEST_CLIENT,
|
|
64
|
-
theme: "dark", // Ethereum mainnet - will show indexing spinner
|
|
65
|
-
},
|
|
66
|
-
parameters: {
|
|
67
|
-
backgrounds: { default: "dark" },
|
|
68
|
-
docs: {
|
|
69
|
-
description: {
|
|
70
|
-
story:
|
|
71
|
-
"Shows the loading state when a token is being indexed by the Bridge on a mainnet chain.",
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const TokenNotSupportedLight: Story = {
|
|
78
|
-
args: {
|
|
79
|
-
chain: defineChain(1),
|
|
80
|
-
client: TEST_CLIENT,
|
|
81
|
-
theme: "light", // Ethereum mainnet - will show indexing spinner
|
|
82
|
-
},
|
|
83
|
-
parameters: {
|
|
84
|
-
backgrounds: { default: "light" },
|
|
85
|
-
docs: {
|
|
86
|
-
description: {
|
|
87
|
-
story:
|
|
88
|
-
"Shows the loading state when a token is being indexed by the Bridge on a mainnet chain (light theme).",
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
30
|
},
|
|
92
31
|
};
|
|
93
32
|
|
|
94
33
|
export const TestnetNotSupported: Story = {
|
|
95
34
|
args: {
|
|
96
|
-
chain: defineChain(11155111),
|
|
97
|
-
client: TEST_CLIENT,
|
|
98
|
-
theme: "dark", // Sepolia testnet - will show error state
|
|
99
|
-
},
|
|
100
|
-
parameters: {
|
|
101
|
-
backgrounds: { default: "dark" },
|
|
102
|
-
docs: {
|
|
103
|
-
description: {
|
|
104
|
-
story:
|
|
105
|
-
"Shows the error state when trying to use the Bridge on a testnet chain (Sepolia in this example).",
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export const TestnetNotSupportedLight: Story = {
|
|
112
|
-
args: {
|
|
113
|
-
chain: defineChain(11155111),
|
|
114
|
-
client: TEST_CLIENT,
|
|
115
|
-
theme: "light", // Sepolia testnet - will show error state
|
|
116
|
-
},
|
|
117
|
-
parameters: {
|
|
118
|
-
backgrounds: { default: "light" },
|
|
119
|
-
docs: {
|
|
120
|
-
description: {
|
|
121
|
-
story:
|
|
122
|
-
"Shows the error state when trying to use the Bridge on a testnet chain (Sepolia in this example, light theme).",
|
|
123
|
-
},
|
|
124
|
-
},
|
|
35
|
+
chain: defineChain(11155111), // Sepolia testnet
|
|
125
36
|
},
|
|
126
37
|
};
|