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
|
@@ -13,8 +13,11 @@ import type {
|
|
|
13
13
|
BridgePrepareResult,
|
|
14
14
|
} from "../../react/core/hooks/useBridgePrepare.js";
|
|
15
15
|
import { getDefaultToken } from "../../react/core/utils/defaultTokens.js";
|
|
16
|
-
import type {
|
|
17
|
-
import {
|
|
16
|
+
import type { DirectPaymentInfo } from "../../react/web/ui/Bridge/types.js";
|
|
17
|
+
import {
|
|
18
|
+
type PreparedTransaction,
|
|
19
|
+
prepareTransaction,
|
|
20
|
+
} from "../../transaction/prepare-transaction.js";
|
|
18
21
|
import { toWei } from "../../utils/units.js";
|
|
19
22
|
import type { Account, Wallet } from "../../wallets/interfaces/wallet.js";
|
|
20
23
|
import { storyClient } from "../utils.js";
|
|
@@ -636,7 +639,7 @@ const contractInteractionTransaction = claimTo({
|
|
|
636
639
|
// ========== COMMON DUMMY DATA FOR STORYBOOK ========== //
|
|
637
640
|
|
|
638
641
|
// Common receiver addresses for testing
|
|
639
|
-
|
|
642
|
+
const RECEIVER_ADDRESSES = {
|
|
640
643
|
physical: "0x5555666677778888999900001111222233334444" as const,
|
|
641
644
|
primary: "0x2247d5d238d0f9d37184d8332aE0289d1aD9991b" as const,
|
|
642
645
|
secondary: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD" as const,
|
|
@@ -677,57 +680,24 @@ const PRODUCT_METADATA = {
|
|
|
677
680
|
},
|
|
678
681
|
};
|
|
679
682
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
683
|
+
type DirectPaymentUIOptions = {
|
|
684
|
+
metadata: {
|
|
685
|
+
description: string | undefined;
|
|
686
|
+
title: string | undefined;
|
|
687
|
+
image: string | undefined;
|
|
688
|
+
};
|
|
689
|
+
paymentInfo: DirectPaymentInfo;
|
|
690
|
+
buttonLabel: string | undefined;
|
|
691
|
+
};
|
|
684
692
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
description: "Add funds to your wallet",
|
|
694
|
-
title: "Fund Wallet",
|
|
695
|
-
},
|
|
696
|
-
mode: "fund_wallet" as const,
|
|
697
|
-
},
|
|
698
|
-
ethWithAmount: {
|
|
699
|
-
destinationToken: ETH,
|
|
700
|
-
initialAmount: "0.001",
|
|
701
|
-
metadata: {
|
|
702
|
-
description: "Add funds to your wallet",
|
|
703
|
-
title: "Fund Wallet",
|
|
704
|
-
},
|
|
705
|
-
mode: "fund_wallet" as const,
|
|
706
|
-
},
|
|
707
|
-
uniLarge: {
|
|
708
|
-
destinationToken: UNI,
|
|
709
|
-
initialAmount: "150000",
|
|
710
|
-
metadata: {
|
|
711
|
-
description: "Add UNI tokens to your wallet",
|
|
712
|
-
title: "Fund Wallet",
|
|
713
|
-
},
|
|
714
|
-
mode: "fund_wallet" as const,
|
|
715
|
-
},
|
|
716
|
-
usdcDefault: {
|
|
717
|
-
destinationToken: USDC,
|
|
718
|
-
initialAmount: "5",
|
|
719
|
-
mode: "fund_wallet" as const,
|
|
720
|
-
},
|
|
721
|
-
customButton: {
|
|
722
|
-
destinationToken: ETH,
|
|
723
|
-
initialAmount: "0.01",
|
|
724
|
-
metadata: {
|
|
725
|
-
description: "Test custom button label for funding",
|
|
726
|
-
title: "Custom Fund Wallet",
|
|
727
|
-
},
|
|
728
|
-
mode: "fund_wallet" as const,
|
|
729
|
-
buttonLabel: "Add Funds Now",
|
|
730
|
-
},
|
|
693
|
+
type TransactionUIOptions = {
|
|
694
|
+
metadata: {
|
|
695
|
+
description: string | undefined;
|
|
696
|
+
title: string | undefined;
|
|
697
|
+
image: string | undefined;
|
|
698
|
+
};
|
|
699
|
+
transaction: PreparedTransaction;
|
|
700
|
+
buttonLabel: string | undefined;
|
|
731
701
|
};
|
|
732
702
|
|
|
733
703
|
// UI Options for DirectPayment mode
|
|
@@ -746,7 +716,7 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
|
|
|
746
716
|
image: PRODUCT_METADATA.concertTicket.image,
|
|
747
717
|
title: "Buy Concert Ticket",
|
|
748
718
|
},
|
|
749
|
-
|
|
719
|
+
buttonLabel: undefined,
|
|
750
720
|
paymentInfo: {
|
|
751
721
|
amount: "25.00",
|
|
752
722
|
feePayer: "receiver" as const,
|
|
@@ -758,8 +728,9 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
|
|
|
758
728
|
metadata: {
|
|
759
729
|
description: PRODUCT_METADATA.credits.description,
|
|
760
730
|
title: "Add Credits",
|
|
731
|
+
image: undefined,
|
|
761
732
|
},
|
|
762
|
-
|
|
733
|
+
buttonLabel: undefined,
|
|
763
734
|
paymentInfo: {
|
|
764
735
|
amount: "25",
|
|
765
736
|
feePayer: "receiver" as const,
|
|
@@ -773,7 +744,7 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
|
|
|
773
744
|
image: PRODUCT_METADATA.digitalArt.image,
|
|
774
745
|
title: "Purchase Digital Art",
|
|
775
746
|
},
|
|
776
|
-
|
|
747
|
+
buttonLabel: undefined,
|
|
777
748
|
paymentInfo: {
|
|
778
749
|
amount: "0.1",
|
|
779
750
|
feePayer: "sender" as const,
|
|
@@ -787,7 +758,7 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
|
|
|
787
758
|
image: PRODUCT_METADATA.sneakers.image,
|
|
788
759
|
title: "Buy Sneakers",
|
|
789
760
|
},
|
|
790
|
-
|
|
761
|
+
buttonLabel: undefined,
|
|
791
762
|
paymentInfo: {
|
|
792
763
|
amount: "0.05",
|
|
793
764
|
feePayer: "receiver" as const,
|
|
@@ -801,7 +772,7 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
|
|
|
801
772
|
image: PRODUCT_METADATA.subscription.image,
|
|
802
773
|
title: "Subscribe to Premium",
|
|
803
774
|
},
|
|
804
|
-
|
|
775
|
+
buttonLabel: undefined,
|
|
805
776
|
paymentInfo: {
|
|
806
777
|
amount: "9.99",
|
|
807
778
|
feePayer: "sender" as const,
|
|
@@ -815,7 +786,6 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
|
|
|
815
786
|
image: PRODUCT_METADATA.digitalArt.image,
|
|
816
787
|
title: "Custom Button Test",
|
|
817
788
|
},
|
|
818
|
-
mode: "direct_payment" as const,
|
|
819
789
|
buttonLabel: "Purchase Now",
|
|
820
790
|
paymentInfo: {
|
|
821
791
|
amount: "0.05",
|
|
@@ -835,32 +805,35 @@ export const TRANSACTION_UI_OPTIONS: Record<
|
|
|
835
805
|
metadata: {
|
|
836
806
|
description: "Interact with smart contract",
|
|
837
807
|
title: "Contract Interaction",
|
|
808
|
+
image: undefined,
|
|
838
809
|
},
|
|
839
|
-
|
|
810
|
+
buttonLabel: undefined,
|
|
840
811
|
transaction: contractInteractionTransaction,
|
|
841
812
|
},
|
|
842
813
|
erc20Transfer: {
|
|
843
814
|
metadata: {
|
|
844
815
|
description: "Transfer ERC20 tokens",
|
|
845
816
|
title: "Token Transfer",
|
|
817
|
+
image: undefined,
|
|
846
818
|
},
|
|
847
|
-
|
|
819
|
+
buttonLabel: undefined,
|
|
848
820
|
transaction: erc20Transaction,
|
|
849
821
|
},
|
|
850
822
|
ethTransfer: {
|
|
851
823
|
metadata: {
|
|
852
824
|
description: "Review and execute transaction",
|
|
853
825
|
title: "Execute Transaction",
|
|
826
|
+
image: undefined,
|
|
854
827
|
},
|
|
855
|
-
|
|
828
|
+
buttonLabel: undefined,
|
|
856
829
|
transaction: ethTransferTransaction,
|
|
857
830
|
},
|
|
858
831
|
customButton: {
|
|
859
832
|
metadata: {
|
|
860
833
|
description: "Test custom button label for transactions",
|
|
861
834
|
title: "Custom Transaction",
|
|
835
|
+
image: undefined,
|
|
862
836
|
},
|
|
863
|
-
mode: "transaction" as const,
|
|
864
837
|
buttonLabel: "Execute Now",
|
|
865
838
|
transaction: ethTransferTransaction,
|
|
866
839
|
},
|
|
@@ -1,30 +1,105 @@
|
|
|
1
1
|
import type { Meta } from "@storybook/react-vite";
|
|
2
2
|
import { base } from "../chains/chain-definitions/base.js";
|
|
3
|
+
import { ethereum } from "../chains/chain-definitions/ethereum.js";
|
|
3
4
|
import { defineChain } from "../chains/utils.js";
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
BuyWidget,
|
|
7
|
+
type BuyWidgetProps,
|
|
8
|
+
} from "../react/web/ui/Bridge/BuyWidget.js";
|
|
5
9
|
import { storyClient } from "./utils.js";
|
|
6
10
|
|
|
7
11
|
const meta = {
|
|
8
12
|
parameters: {
|
|
9
13
|
layout: "centered",
|
|
10
14
|
},
|
|
11
|
-
title: "
|
|
15
|
+
title: "Bridge/Buy/BuyWidget",
|
|
12
16
|
} satisfies Meta<typeof BuyWidget>;
|
|
13
17
|
export default meta;
|
|
14
18
|
|
|
15
|
-
export function
|
|
16
|
-
return <
|
|
19
|
+
export function Basic() {
|
|
20
|
+
return <Variant client={storyClient} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function PayAnotherWallet() {
|
|
24
|
+
return (
|
|
25
|
+
<Variant
|
|
26
|
+
client={storyClient}
|
|
27
|
+
amount="10"
|
|
28
|
+
chain={base}
|
|
29
|
+
tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
30
|
+
receiverAddress="0x83Dd93fA5D8343094f850f90B3fb90088C1bB425"
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function BuyBaseNativeToken() {
|
|
36
|
+
return <Variant client={storyClient} chain={base} amount="0.1" />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function JPYCurrency() {
|
|
40
|
+
return (
|
|
41
|
+
<Variant client={storyClient} chain={base} amount="0.1" currency="JPY" />
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function NoThirdwebBranding() {
|
|
46
|
+
return (
|
|
47
|
+
<Variant
|
|
48
|
+
client={storyClient}
|
|
49
|
+
chain={base}
|
|
50
|
+
amount="0.1"
|
|
51
|
+
currency="JPY"
|
|
52
|
+
showThirdwebBranding={false}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function BuyBaseUSDC() {
|
|
58
|
+
return (
|
|
59
|
+
<Variant
|
|
60
|
+
client={storyClient}
|
|
61
|
+
chain={base}
|
|
62
|
+
amount="0.1"
|
|
63
|
+
tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function CustomTitleDescriptionAndButtonLabel() {
|
|
69
|
+
return (
|
|
70
|
+
<Variant
|
|
71
|
+
client={storyClient}
|
|
72
|
+
title="Custom Title"
|
|
73
|
+
description="Custom Description"
|
|
74
|
+
chain={base}
|
|
75
|
+
amount="0.1"
|
|
76
|
+
tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
77
|
+
buttonLabel="Custom Button Label"
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function HideTitle() {
|
|
83
|
+
return (
|
|
84
|
+
<Variant
|
|
85
|
+
client={storyClient}
|
|
86
|
+
title=""
|
|
87
|
+
chain={base}
|
|
88
|
+
amount="0.1"
|
|
89
|
+
tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
17
92
|
}
|
|
18
93
|
|
|
19
94
|
export function UnsupportedChain() {
|
|
20
95
|
return (
|
|
21
|
-
<
|
|
96
|
+
<Variant client={storyClient} chain={defineChain(84532)} amount="0.1" />
|
|
22
97
|
);
|
|
23
98
|
}
|
|
24
99
|
|
|
25
100
|
export function UnsupportedToken() {
|
|
26
101
|
return (
|
|
27
|
-
<
|
|
102
|
+
<Variant
|
|
28
103
|
client={storyClient}
|
|
29
104
|
chain={base}
|
|
30
105
|
amount="0.1"
|
|
@@ -35,7 +110,7 @@ export function UnsupportedToken() {
|
|
|
35
110
|
|
|
36
111
|
export function OnlyCardSupported() {
|
|
37
112
|
return (
|
|
38
|
-
<
|
|
113
|
+
<Variant
|
|
39
114
|
client={storyClient}
|
|
40
115
|
chain={base}
|
|
41
116
|
amount="0.1"
|
|
@@ -46,7 +121,7 @@ export function OnlyCardSupported() {
|
|
|
46
121
|
|
|
47
122
|
export function OnlyCryptoSupported() {
|
|
48
123
|
return (
|
|
49
|
-
<
|
|
124
|
+
<Variant
|
|
50
125
|
client={storyClient}
|
|
51
126
|
chain={base}
|
|
52
127
|
amount="0.1"
|
|
@@ -54,3 +129,23 @@ export function OnlyCryptoSupported() {
|
|
|
54
129
|
/>
|
|
55
130
|
);
|
|
56
131
|
}
|
|
132
|
+
|
|
133
|
+
export function LargeAmount() {
|
|
134
|
+
return (
|
|
135
|
+
<Variant
|
|
136
|
+
client={storyClient}
|
|
137
|
+
chain={ethereum}
|
|
138
|
+
tokenAddress="0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"
|
|
139
|
+
amount="150000"
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function Variant(props: BuyWidgetProps) {
|
|
145
|
+
return (
|
|
146
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "40px" }}>
|
|
147
|
+
<BuyWidget {...props} theme="dark" />
|
|
148
|
+
<BuyWidget {...props} theme="light" />
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
}
|
package/src/stories/utils.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
CustomThemeProvider,
|
|
4
4
|
useCustomTheme,
|
|
5
5
|
} from "../react/core/design-system/CustomThemeProvider.js";
|
|
6
|
-
import type { Theme } from "../react/core/design-system/index.js";
|
|
7
6
|
import { radius } from "../react/native/design-system/index.js";
|
|
8
7
|
|
|
9
8
|
const clientId = process.env.STORYBOOK_CLIENT_ID;
|
|
@@ -16,15 +15,23 @@ export const storyClient = createThirdwebClient({
|
|
|
16
15
|
clientId: clientId,
|
|
17
16
|
});
|
|
18
17
|
|
|
19
|
-
export const ModalThemeWrapper = (props: {
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
theme: "light" | "dark" | Theme;
|
|
22
|
-
}) => {
|
|
23
|
-
const { theme } = props;
|
|
18
|
+
export const ModalThemeWrapper = (props: { children: React.ReactNode }) => {
|
|
24
19
|
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
<div
|
|
21
|
+
style={{
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "column",
|
|
24
|
+
gap: "40px",
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<CustomThemeProvider theme={"dark"}>
|
|
28
|
+
<ModalWrapper>{props.children}</ModalWrapper>
|
|
29
|
+
</CustomThemeProvider>
|
|
30
|
+
|
|
31
|
+
<CustomThemeProvider theme={"light"}>
|
|
32
|
+
<ModalWrapper>{props.children}</ModalWrapper>
|
|
33
|
+
</CustomThemeProvider>
|
|
34
|
+
</div>
|
|
28
35
|
);
|
|
29
36
|
};
|
|
30
37
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "5.108.
|
|
1
|
+
export const version = "5.108.8";
|
package/src/x402/common.ts
CHANGED
|
@@ -46,7 +46,6 @@ export async function decodePaymentRequest(
|
|
|
46
46
|
facilitator,
|
|
47
47
|
resourceUrl,
|
|
48
48
|
routeConfig = {},
|
|
49
|
-
payTo,
|
|
50
49
|
method,
|
|
51
50
|
paymentData,
|
|
52
51
|
} = args;
|
|
@@ -105,10 +104,9 @@ export async function decodePaymentRequest(
|
|
|
105
104
|
resource: resourceUrl,
|
|
106
105
|
description: description ?? "",
|
|
107
106
|
mimeType: mimeType ?? "application/json",
|
|
108
|
-
payTo: getAddress(
|
|
107
|
+
payTo: getAddress(facilitator.address),
|
|
109
108
|
maxTimeoutSeconds: maxTimeoutSeconds ?? 300,
|
|
110
109
|
asset: getAddress(asset.address),
|
|
111
|
-
// TODO: Rename outputSchema to requestStructure
|
|
112
110
|
outputSchema: {
|
|
113
111
|
input: {
|
|
114
112
|
type: "http",
|
|
@@ -119,7 +117,6 @@ export async function decodePaymentRequest(
|
|
|
119
117
|
output: outputSchema,
|
|
120
118
|
},
|
|
121
119
|
extra: {
|
|
122
|
-
facilitatorAddress: facilitator.address,
|
|
123
120
|
...((asset as ERC20TokenAmount["asset"]).eip712 ?? {}),
|
|
124
121
|
},
|
|
125
122
|
});
|
|
@@ -139,7 +136,7 @@ export async function decodePaymentRequest(
|
|
|
139
136
|
};
|
|
140
137
|
}
|
|
141
138
|
|
|
142
|
-
//
|
|
139
|
+
// decode b64 payment
|
|
143
140
|
let decodedPayment: RequestedPaymentPayload;
|
|
144
141
|
try {
|
|
145
142
|
decodedPayment = decodePayment(paymentData);
|
package/src/x402/facilitator.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { withCache } from "../utils/promise/withCache.js";
|
|
|
5
5
|
import type {
|
|
6
6
|
FacilitatorSettleResponse,
|
|
7
7
|
FacilitatorSupportedResponse,
|
|
8
|
+
FacilitatorVerifyResponse,
|
|
8
9
|
RequestedPaymentPayload,
|
|
9
10
|
RequestedPaymentRequirements,
|
|
10
11
|
} from "./schemas.js";
|
|
@@ -14,7 +15,7 @@ export type WaitUntil = "simulated" | "submitted" | "confirmed";
|
|
|
14
15
|
export type ThirdwebX402FacilitatorConfig = {
|
|
15
16
|
client: ThirdwebClient;
|
|
16
17
|
serverWalletAddress: string;
|
|
17
|
-
|
|
18
|
+
waitUntil?: WaitUntil;
|
|
18
19
|
vaultAccessToken?: string;
|
|
19
20
|
baseUrl?: string;
|
|
20
21
|
};
|
|
@@ -35,11 +36,11 @@ export type ThirdwebX402Facilitator = {
|
|
|
35
36
|
verify: (
|
|
36
37
|
payload: RequestedPaymentPayload,
|
|
37
38
|
paymentRequirements: RequestedPaymentRequirements,
|
|
38
|
-
) => Promise<
|
|
39
|
+
) => Promise<FacilitatorVerifyResponse>;
|
|
39
40
|
settle: (
|
|
40
41
|
payload: RequestedPaymentPayload,
|
|
41
42
|
paymentRequirements: RequestedPaymentRequirements,
|
|
42
|
-
|
|
43
|
+
waitUntil?: WaitUntil,
|
|
43
44
|
) => Promise<FacilitatorSettleResponse>;
|
|
44
45
|
supported: (filters?: {
|
|
45
46
|
chainId: number;
|
|
@@ -126,7 +127,6 @@ export function facilitator(
|
|
|
126
127
|
},
|
|
127
128
|
settle: {
|
|
128
129
|
"x-secret-key": secretKey,
|
|
129
|
-
"x-settlement-wallet-address": serverWalletAddress,
|
|
130
130
|
...(config.vaultAccessToken
|
|
131
131
|
? { "x-vault-access-token": config.vaultAccessToken }
|
|
132
132
|
: {}),
|
|
@@ -149,7 +149,7 @@ export function facilitator(
|
|
|
149
149
|
async verify(
|
|
150
150
|
payload: RequestedPaymentPayload,
|
|
151
151
|
paymentRequirements: RequestedPaymentRequirements,
|
|
152
|
-
): Promise<
|
|
152
|
+
): Promise<FacilitatorVerifyResponse> {
|
|
153
153
|
const url = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
154
154
|
|
|
155
155
|
let headers = { "Content-Type": "application/json" };
|
|
@@ -185,14 +185,14 @@ export function facilitator(
|
|
|
185
185
|
async settle(
|
|
186
186
|
payload: RequestedPaymentPayload,
|
|
187
187
|
paymentRequirements: RequestedPaymentRequirements,
|
|
188
|
-
|
|
188
|
+
waitUntil?: WaitUntil,
|
|
189
189
|
): Promise<FacilitatorSettleResponse> {
|
|
190
190
|
const url = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
191
191
|
|
|
192
192
|
let headers = { "Content-Type": "application/json" };
|
|
193
193
|
const authHeaders = await facilitator.createAuthHeaders();
|
|
194
194
|
headers = { ...headers, ...authHeaders.settle };
|
|
195
|
-
const
|
|
195
|
+
const waitUntilParam = waitUntil || config.waitUntil;
|
|
196
196
|
|
|
197
197
|
const res = await fetch(`${url}/settle`, {
|
|
198
198
|
method: "POST",
|
|
@@ -201,7 +201,7 @@ export function facilitator(
|
|
|
201
201
|
x402Version: payload.x402Version,
|
|
202
202
|
paymentPayload: payload,
|
|
203
203
|
paymentRequirements: paymentRequirements,
|
|
204
|
-
...(
|
|
204
|
+
...(waitUntilParam ? { waitUntil: waitUntilParam } : {}),
|
|
205
205
|
}),
|
|
206
206
|
});
|
|
207
207
|
|
package/src/x402/schemas.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
PaymentRequirementsSchema,
|
|
7
7
|
SettleResponseSchema,
|
|
8
8
|
SupportedPaymentKindsResponseSchema,
|
|
9
|
+
VerifyResponseSchema,
|
|
9
10
|
} from "x402/types";
|
|
10
11
|
import { z } from "zod";
|
|
11
12
|
import type { Chain } from "../chains/types.js";
|
|
@@ -52,11 +53,20 @@ export type RequestedPaymentRequirements = z.infer<
|
|
|
52
53
|
|
|
53
54
|
const FacilitatorSettleResponseSchema = SettleResponseSchema.extend({
|
|
54
55
|
network: FacilitatorNetworkSchema,
|
|
56
|
+
errorMessage: z.string().optional(),
|
|
55
57
|
});
|
|
56
58
|
export type FacilitatorSettleResponse = z.infer<
|
|
57
59
|
typeof FacilitatorSettleResponseSchema
|
|
58
60
|
>;
|
|
59
61
|
|
|
62
|
+
const FacilitatorVerifyResponseSchema = VerifyResponseSchema.extend({
|
|
63
|
+
errorMessage: z.string().optional(),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export type FacilitatorVerifyResponse = z.infer<
|
|
67
|
+
typeof FacilitatorVerifyResponseSchema
|
|
68
|
+
>;
|
|
69
|
+
|
|
60
70
|
export const SupportedSignatureTypeSchema = z.enum([
|
|
61
71
|
"TransferWithAuthorization",
|
|
62
72
|
"Permit",
|
|
@@ -156,6 +156,7 @@ export async function settlePayment(
|
|
|
156
156
|
},
|
|
157
157
|
};
|
|
158
158
|
} else {
|
|
159
|
+
const error = settlement.errorReason || "Settlement error";
|
|
159
160
|
return {
|
|
160
161
|
status: 402,
|
|
161
162
|
responseHeaders: {
|
|
@@ -163,10 +164,9 @@ export async function settlePayment(
|
|
|
163
164
|
},
|
|
164
165
|
responseBody: {
|
|
165
166
|
x402Version,
|
|
166
|
-
error
|
|
167
|
-
|
|
168
|
-
settlement.
|
|
169
|
-
"Settlement failed",
|
|
167
|
+
error,
|
|
168
|
+
errorMessage:
|
|
169
|
+
errorMessages?.settlementFailed || settlement.errorMessage,
|
|
170
170
|
accepts: paymentRequirements,
|
|
171
171
|
},
|
|
172
172
|
};
|
|
@@ -179,9 +179,10 @@ export async function settlePayment(
|
|
|
179
179
|
},
|
|
180
180
|
responseBody: {
|
|
181
181
|
x402Version,
|
|
182
|
-
error:
|
|
182
|
+
error: "Settlement error",
|
|
183
|
+
errorMessage:
|
|
183
184
|
errorMessages?.settlementFailed ||
|
|
184
|
-
(error instanceof Error ? error.message :
|
|
185
|
+
(error instanceof Error ? error.message : undefined),
|
|
185
186
|
accepts: paymentRequirements,
|
|
186
187
|
},
|
|
187
188
|
};
|
package/src/x402/sign.ts
CHANGED
|
@@ -230,18 +230,13 @@ async function signERC3009Authorization(
|
|
|
230
230
|
|
|
231
231
|
async function signERC2612Permit(
|
|
232
232
|
account: Account,
|
|
233
|
-
{ from, value, validBefore, nonce }: ExactEvmPayloadAuthorization,
|
|
233
|
+
{ from, to, value, validBefore, nonce }: ExactEvmPayloadAuthorization,
|
|
234
234
|
{ asset, network, extra }: RequestedPaymentRequirements,
|
|
235
235
|
): Promise<{ signature: Hex }> {
|
|
236
236
|
const chainId = networkToChainId(network);
|
|
237
237
|
const name = extra?.name;
|
|
238
238
|
const version = extra?.version;
|
|
239
|
-
|
|
240
|
-
if (!facilitatorAddress) {
|
|
241
|
-
throw new Error(
|
|
242
|
-
"facilitatorAddress is required in PaymentRequirements extra to pay with permit-based assets",
|
|
243
|
-
);
|
|
244
|
-
}
|
|
239
|
+
|
|
245
240
|
if (!name || !version) {
|
|
246
241
|
throw new Error(
|
|
247
242
|
"name and version are required in PaymentRequirements extra to pay with permit-based assets",
|
|
@@ -268,7 +263,7 @@ async function signERC2612Permit(
|
|
|
268
263
|
primaryType: "Permit" as const,
|
|
269
264
|
message: {
|
|
270
265
|
owner: getAddress(from),
|
|
271
|
-
spender: getAddress(
|
|
266
|
+
spender: getAddress(to),
|
|
272
267
|
value: BigInt(value),
|
|
273
268
|
nonce: hexToBigInt(nonce as Hex),
|
|
274
269
|
deadline: BigInt(validBefore),
|
package/src/x402/types.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Money, PaymentMiddlewareConfig } from "x402/types";
|
|
2
2
|
import type z from "zod";
|
|
3
3
|
import type { Chain } from "../chains/types.js";
|
|
4
|
-
import type { Address } from "../utils/address.js";
|
|
5
4
|
import type { Prettify } from "../utils/type-utils.js";
|
|
6
5
|
import type { ThirdwebX402Facilitator, WaitUntil } from "./facilitator.js";
|
|
7
6
|
import type {
|
|
@@ -27,8 +26,6 @@ export type PaymentArgs = {
|
|
|
27
26
|
method: "GET" | "POST" | ({} & string);
|
|
28
27
|
/** The payment data/proof provided by the client, typically from the X-PAYMENT header */
|
|
29
28
|
paymentData?: string | null;
|
|
30
|
-
/** The wallet address that should receive the payment */
|
|
31
|
-
payTo: Address;
|
|
32
29
|
/** The blockchain network where the payment should be processed */
|
|
33
30
|
network: FacilitatorNetwork | Chain;
|
|
34
31
|
/** The price for accessing the resource - either a USD amount (e.g., "$0.10") or a specific token amount */
|
|
@@ -37,6 +34,8 @@ export type PaymentArgs = {
|
|
|
37
34
|
facilitator: ThirdwebX402Facilitator;
|
|
38
35
|
/** Optional configuration for the payment middleware route */
|
|
39
36
|
routeConfig?: PaymentMiddlewareConfig;
|
|
37
|
+
/** @deprecated Use facilitator.address instead */
|
|
38
|
+
payTo?: string;
|
|
40
39
|
};
|
|
41
40
|
|
|
42
41
|
export type SettlePaymentArgs = PaymentArgs & {
|
|
@@ -50,8 +49,10 @@ export type PaymentRequiredResult = {
|
|
|
50
49
|
responseBody: {
|
|
51
50
|
/** The X402 protocol version */
|
|
52
51
|
x402Version: number;
|
|
53
|
-
/**
|
|
52
|
+
/** error code */
|
|
54
53
|
error: string;
|
|
54
|
+
/** Human-readable error message */
|
|
55
|
+
errorMessage?: string;
|
|
55
56
|
/** Array of acceptable payment methods and requirements */
|
|
56
57
|
accepts: RequestedPaymentRequirements[];
|
|
57
58
|
/** Optional payer address if verification partially succeeded */
|
|
@@ -101,6 +101,7 @@ export async function verifyPayment(
|
|
|
101
101
|
selectedPaymentRequirements,
|
|
102
102
|
};
|
|
103
103
|
} else {
|
|
104
|
+
const error = verification.invalidReason || "Verification failed";
|
|
104
105
|
return {
|
|
105
106
|
status: 402,
|
|
106
107
|
responseHeaders: {
|
|
@@ -108,10 +109,9 @@ export async function verifyPayment(
|
|
|
108
109
|
},
|
|
109
110
|
responseBody: {
|
|
110
111
|
x402Version,
|
|
111
|
-
error:
|
|
112
|
-
|
|
113
|
-
verification.
|
|
114
|
-
"Verification failed",
|
|
112
|
+
error: error,
|
|
113
|
+
errorMessage:
|
|
114
|
+
errorMessages?.verificationFailed || verification.errorMessage,
|
|
115
115
|
accepts: paymentRequirements,
|
|
116
116
|
},
|
|
117
117
|
};
|
|
@@ -124,9 +124,10 @@ export async function verifyPayment(
|
|
|
124
124
|
},
|
|
125
125
|
responseBody: {
|
|
126
126
|
x402Version,
|
|
127
|
-
error:
|
|
127
|
+
error: "Verification error",
|
|
128
|
+
errorMessage:
|
|
128
129
|
errorMessages?.verificationFailed ||
|
|
129
|
-
(error instanceof Error ? error.message :
|
|
130
|
+
(error instanceof Error ? error.message : undefined),
|
|
130
131
|
accepts: paymentRequirements,
|
|
131
132
|
},
|
|
132
133
|
};
|