@b3dotfun/sdk 0.1.66 → 0.1.68
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/anyspend/react/components/AnySpend.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +40 -11
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +16 -14
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +40 -10
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +10 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +5 -4
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/AnySpendTournament.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AddressForm.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/checkout/AddressForm.js +14 -0
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +117 -0
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +158 -0
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +81 -0
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +61 -0
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +30 -0
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +20 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +32 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +27 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormField.d.ts +10 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormField.js +31 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +39 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.js +75 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutLayout.js +13 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutOrderStatus.d.ts +28 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutOrderStatus.js +65 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +31 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +64 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +31 -0
- package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +20 -0
- package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +170 -0
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.d.ts +23 -0
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +324 -0
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.js +62 -0
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +20 -0
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +269 -0
- package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.js +20 -0
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +19 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +4 -4
- package/dist/cjs/anyspend/react/components/common/OrderStatus.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +93 -19
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/common/StepProgress.js +6 -11
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/common/TransferResultScreen.js +5 -1
- package/dist/cjs/anyspend/react/components/context/AnySpendCustomizationContext.d.ts +16 -0
- package/dist/cjs/anyspend/react/components/context/AnySpendCustomizationContext.js +92 -0
- package/dist/cjs/anyspend/react/components/icons/AnimatedCheckmark.d.ts +23 -0
- package/dist/cjs/anyspend/react/components/icons/AnimatedCheckmark.js +71 -0
- package/dist/cjs/anyspend/react/components/index.d.ts +8 -1
- package/dist/cjs/anyspend/react/components/index.js +10 -1
- package/dist/cjs/anyspend/react/components/types/classes.d.ts +50 -0
- package/dist/cjs/anyspend/react/components/types/customization.d.ts +75 -0
- package/dist/cjs/anyspend/react/components/types/customization.js +2 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +8 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +8 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +15 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +3 -2
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +9 -2
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -0
- package/dist/cjs/anyspend/services/anyspend.d.ts +1 -0
- package/dist/cjs/anyspend/services/anyspend.js +17 -2
- package/dist/cjs/anyspend/types/forms.d.ts +92 -0
- package/dist/cjs/anyspend/types/forms.js +8 -0
- package/dist/cjs/anyspend/utils/format.js +12 -3
- package/dist/cjs/app.shared.js +8 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +9 -3
- package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/cjs/global-account/react/components/ui/command.d.ts +7 -7
- package/dist/cjs/global-account/react/components/ui/dialog.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ui/dialog.js +2 -2
- package/dist/cjs/global-account/react/components/ui/drawer.d.ts +3 -1
- package/dist/cjs/global-account/react/components/ui/drawer.js +1 -1
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +53 -1
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/cjs/shared/constants/chains/supported.d.ts +3 -3
- package/dist/cjs/shared/utils/number.d.ts +5 -0
- package/dist/cjs/shared/utils/number.js +13 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +9 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +41 -12
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +6 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +9 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +16 -14
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +9 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +42 -12
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +10 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +5 -4
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendTournament.d.ts +11 -0
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AddressForm.d.ts +9 -0
- package/dist/esm/anyspend/react/components/checkout/AddressForm.js +11 -0
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +117 -0
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +155 -0
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +81 -0
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +58 -0
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +30 -0
- package/dist/esm/anyspend/react/components/checkout/CartSummary.js +17 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +32 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +24 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormField.d.ts +10 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormField.js +28 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +39 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.js +72 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutLayout.js +10 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutOrderStatus.d.ts +28 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutOrderStatus.js +62 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +31 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +61 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +28 -0
- package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +20 -0
- package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +167 -0
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.d.ts +23 -0
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +321 -0
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.d.ts +12 -0
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.js +59 -0
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +20 -0
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +266 -0
- package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
- package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.d.ts +11 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.js +17 -0
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +19 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +4 -4
- package/dist/esm/anyspend/react/components/common/OrderStatus.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +96 -22
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +5 -1
- package/dist/esm/anyspend/react/components/common/StepProgress.js +6 -11
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/esm/anyspend/react/components/common/TransferResultScreen.js +7 -3
- package/dist/esm/anyspend/react/components/context/AnySpendCustomizationContext.d.ts +16 -0
- package/dist/esm/anyspend/react/components/context/AnySpendCustomizationContext.js +88 -0
- package/dist/esm/anyspend/react/components/icons/AnimatedCheckmark.d.ts +23 -0
- package/dist/esm/anyspend/react/components/icons/AnimatedCheckmark.js +68 -0
- package/dist/esm/anyspend/react/components/index.d.ts +8 -1
- package/dist/esm/anyspend/react/components/index.js +5 -0
- package/dist/esm/anyspend/react/components/types/classes.d.ts +50 -0
- package/dist/esm/anyspend/react/components/types/customization.d.ts +75 -0
- package/dist/esm/anyspend/react/components/types/customization.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +8 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +8 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +15 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +3 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +9 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -0
- package/dist/esm/anyspend/services/anyspend.d.ts +1 -0
- package/dist/esm/anyspend/services/anyspend.js +17 -2
- package/dist/esm/anyspend/types/forms.d.ts +92 -0
- package/dist/esm/anyspend/types/forms.js +7 -0
- package/dist/esm/anyspend/utils/format.js +12 -3
- package/dist/esm/app.shared.js +8 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +9 -3
- package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/esm/global-account/react/components/ui/command.d.ts +7 -7
- package/dist/esm/global-account/react/components/ui/dialog.d.ts +2 -0
- package/dist/esm/global-account/react/components/ui/dialog.js +2 -2
- package/dist/esm/global-account/react/components/ui/drawer.d.ts +3 -1
- package/dist/esm/global-account/react/components/ui/drawer.js +1 -1
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/dist/esm/global-account/react/hooks/useUser.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +53 -1
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +3 -3
- package/dist/esm/shared/utils/number.d.ts +5 -0
- package/dist/esm/shared/utils/number.js +12 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +9 -0
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +6 -1
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +9 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +9 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +10 -1
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendTournament.d.ts +11 -0
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +5 -1
- package/dist/types/anyspend/react/components/checkout/AddressForm.d.ts +9 -0
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +117 -0
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +81 -0
- package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
- package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +30 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +32 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutFormField.d.ts +10 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +39 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutOrderStatus.d.ts +28 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +31 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
- package/dist/types/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +20 -0
- package/dist/types/anyspend/react/components/checkout/CryptoPayPanel.d.ts +23 -0
- package/dist/types/anyspend/react/components/checkout/DiscountCodeInput.d.ts +12 -0
- package/dist/types/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +20 -0
- package/dist/types/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
- package/dist/types/anyspend/react/components/checkout/ShippingSelector.d.ts +11 -0
- package/dist/types/anyspend/react/components/common/OrderStatus.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/StepProgress.d.ts +5 -1
- package/dist/types/anyspend/react/components/context/AnySpendCustomizationContext.d.ts +16 -0
- package/dist/types/anyspend/react/components/icons/AnimatedCheckmark.d.ts +23 -0
- package/dist/types/anyspend/react/components/index.d.ts +8 -1
- package/dist/types/anyspend/react/components/types/classes.d.ts +50 -0
- package/dist/types/anyspend/react/components/types/customization.d.ts +75 -0
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +8 -2
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +8 -2
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +15 -3
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +9 -2
- package/dist/types/anyspend/services/anyspend.d.ts +1 -0
- package/dist/types/anyspend/types/forms.d.ts +92 -0
- package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/types/global-account/react/components/ui/command.d.ts +7 -7
- package/dist/types/global-account/react/components/ui/dialog.d.ts +2 -0
- package/dist/types/global-account/react/components/ui/drawer.d.ts +3 -1
- package/dist/types/global-account/react/hooks/useAuth.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/dist/types/global-account/react/hooks/useUser.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +53 -1
- package/dist/types/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/types/shared/constants/chains/supported.d.ts +3 -3
- package/dist/types/shared/utils/number.d.ts +5 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +84 -37
- package/src/anyspend/react/components/AnySpendBondKit.tsx +12 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +14 -0
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +10 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +38 -20
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +82 -35
- package/src/anyspend/react/components/AnySpendDeposit.tsx +24 -2
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +14 -0
- package/src/anyspend/react/components/AnySpendNFT.tsx +14 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +14 -0
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +14 -0
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +14 -0
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +14 -0
- package/src/anyspend/react/components/AnySpendTournament.tsx +19 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +14 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +10 -0
- package/src/anyspend/react/components/checkout/AddressForm.tsx +98 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +398 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +221 -0
- package/src/anyspend/react/components/checkout/CartItemRow.tsx +58 -0
- package/src/anyspend/react/components/checkout/CartSummary.tsx +158 -0
- package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +98 -0
- package/src/anyspend/react/components/checkout/CheckoutFormField.tsx +129 -0
- package/src/anyspend/react/components/checkout/CheckoutFormPanel.tsx +241 -0
- package/src/anyspend/react/components/checkout/CheckoutLayout.tsx +52 -0
- package/src/anyspend/react/components/checkout/CheckoutOrderStatus.tsx +224 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +341 -0
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +110 -0
- package/src/anyspend/react/components/checkout/CoinbaseCheckoutPanel.tsx +279 -0
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +630 -0
- package/src/anyspend/react/components/checkout/DiscountCodeInput.tsx +127 -0
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +612 -0
- package/src/anyspend/react/components/checkout/PoweredByBranding.tsx +42 -0
- package/src/anyspend/react/components/checkout/ShippingSelector.tsx +73 -0
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +29 -7
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +1 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethodDisplay.tsx +1 -1
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +5 -5
- package/src/anyspend/react/components/common/OrderStatus.tsx +140 -34
- package/src/anyspend/react/components/common/PanelOnramp.tsx +9 -9
- package/src/anyspend/react/components/common/PaySection.tsx +1 -1
- package/src/anyspend/react/components/common/StepProgress.tsx +40 -52
- package/src/anyspend/react/components/common/TokenBalance.tsx +0 -12
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +1 -9
- package/src/anyspend/react/components/common/TransferResultScreen.tsx +19 -11
- package/src/anyspend/react/components/context/AnySpendCustomizationContext.tsx +124 -0
- package/src/anyspend/react/components/icons/AnimatedCheckmark.tsx +119 -0
- package/src/anyspend/react/components/index.ts +33 -0
- package/src/anyspend/react/components/types/classes.ts +70 -0
- package/src/anyspend/react/components/types/customization.ts +99 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +3 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +3 -2
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +5 -1
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +5 -2
- package/src/anyspend/services/anyspend.ts +19 -2
- package/src/anyspend/types/forms.ts +97 -0
- package/src/anyspend/utils/format.ts +12 -3
- package/src/app.shared.ts +11 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +13 -4
- package/src/global-account/react/components/ui/dialog.tsx +17 -8
- package/src/global-account/react/components/ui/drawer.tsx +2 -2
- package/src/global-account/react/stores/useModalStore.ts +52 -1
- package/src/shared/utils/number.ts +12 -0
- package/src/styles/index.css +48 -2
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
4
|
+
import { useAnyspendQuote } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendQuote";
|
|
5
|
+
import { useAnyspendCreateOrder } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
|
|
6
|
+
import { useAnyspendOrderAndTransactions } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendOrderAndTransactions";
|
|
7
|
+
import { useCreateDepositFirstOrder } from "@b3dotfun/sdk/anyspend/react/hooks/useCreateDepositFirstOrder";
|
|
8
|
+
import { useOnOrderSuccess } from "@b3dotfun/sdk/anyspend/react/hooks/useOnOrderSuccess";
|
|
9
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds } from "@b3dotfun/sdk/anyspend";
|
|
10
|
+
import { getPaymentUrl } from "@b3dotfun/sdk/anyspend/utils/chain";
|
|
11
|
+
import { isNativeToken } from "@b3dotfun/sdk/anyspend/utils/token";
|
|
12
|
+
import {
|
|
13
|
+
useAccountWallet,
|
|
14
|
+
useB3Config,
|
|
15
|
+
useIsMobile,
|
|
16
|
+
useModalStore,
|
|
17
|
+
useSimTokenBalance,
|
|
18
|
+
useTokenData,
|
|
19
|
+
useUnifiedChainSwitchAndExecute,
|
|
20
|
+
} from "@b3dotfun/sdk/global-account/react";
|
|
21
|
+
import { ShinyButton, TextShimmer } from "@b3dotfun/sdk/global-account/react";
|
|
22
|
+
import { thirdwebB3Chain } from "@b3dotfun/sdk/shared/constants/chains/b3Chain";
|
|
23
|
+
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
24
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
25
|
+
import { Check, ChevronDown, ChevronsUpDown, Copy, Loader2, QrCode } from "lucide-react";
|
|
26
|
+
import { QRCodeSVG } from "qrcode.react";
|
|
27
|
+
import { encodeFunctionData, erc20Abi } from "viem";
|
|
28
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
29
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
30
|
+
import { TokenSelector } from "@relayprotocol/relay-kit-ui";
|
|
31
|
+
import { ChainTokenIcon } from "../common/ChainTokenIcon";
|
|
32
|
+
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
33
|
+
|
|
34
|
+
interface CryptoPayPanelProps {
|
|
35
|
+
recipientAddress: string;
|
|
36
|
+
destinationTokenAddress: string;
|
|
37
|
+
destinationTokenChainId: number;
|
|
38
|
+
totalAmount: string;
|
|
39
|
+
buttonText?: string;
|
|
40
|
+
themeColor?: string;
|
|
41
|
+
/** @deprecated Use onOrderCreated instead. Kept for backward compatibility. */
|
|
42
|
+
onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
|
|
43
|
+
/** Called when an order is created and payment committed — triggers lifecycle tracking in parent */
|
|
44
|
+
onOrderCreated?: (orderId: string) => void;
|
|
45
|
+
onError?: (error: Error) => void;
|
|
46
|
+
callbackMetadata?: Record<string, unknown>;
|
|
47
|
+
classes?: AnySpendCheckoutClasses;
|
|
48
|
+
/** Optional sender address for pre-fetching balances. Falls back to connected wallet. */
|
|
49
|
+
senderAddress?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function CryptoPayPanel({
|
|
53
|
+
recipientAddress,
|
|
54
|
+
destinationTokenAddress,
|
|
55
|
+
destinationTokenChainId,
|
|
56
|
+
totalAmount,
|
|
57
|
+
buttonText = "Pay",
|
|
58
|
+
themeColor,
|
|
59
|
+
onSuccess,
|
|
60
|
+
onOrderCreated,
|
|
61
|
+
onError,
|
|
62
|
+
callbackMetadata,
|
|
63
|
+
classes,
|
|
64
|
+
senderAddress,
|
|
65
|
+
}: CryptoPayPanelProps) {
|
|
66
|
+
// Stable refs for callback props to avoid re-triggering effects
|
|
67
|
+
const onErrorRef = useRef(onError);
|
|
68
|
+
onErrorRef.current = onError;
|
|
69
|
+
const onOrderCreatedRef = useRef(onOrderCreated);
|
|
70
|
+
onOrderCreatedRef.current = onOrderCreated;
|
|
71
|
+
|
|
72
|
+
/* ------------------------------------------------------------------ */
|
|
73
|
+
/* Shared state: token selection, quote, balance */
|
|
74
|
+
/* ------------------------------------------------------------------ */
|
|
75
|
+
const [selectedSrcChainId, setSelectedSrcChainId] = useState(destinationTokenChainId);
|
|
76
|
+
const [selectedSrcToken, setSelectedSrcToken] = useState<components["schemas"]["Token"] | null>(null);
|
|
77
|
+
const [copied, setCopied] = useState(false);
|
|
78
|
+
|
|
79
|
+
const { address: walletAddress } = useAccountWallet();
|
|
80
|
+
const effectiveAddress = senderAddress || walletAddress;
|
|
81
|
+
const { partnerId } = useB3Config();
|
|
82
|
+
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
83
|
+
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
84
|
+
|
|
85
|
+
const { data: dstTokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
86
|
+
|
|
87
|
+
// Default to destination token data once available
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!selectedSrcToken && dstTokenData) {
|
|
90
|
+
setSelectedSrcToken({
|
|
91
|
+
address: destinationTokenAddress,
|
|
92
|
+
chainId: destinationTokenChainId,
|
|
93
|
+
decimals: dstTokenData.decimals || 18,
|
|
94
|
+
symbol: dstTokenData.symbol || "",
|
|
95
|
+
name: dstTokenData.name || "",
|
|
96
|
+
metadata: { logoURI: dstTokenData.logoURI || "" },
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, [selectedSrcToken, dstTokenData, destinationTokenAddress, destinationTokenChainId]);
|
|
100
|
+
|
|
101
|
+
const isSameToken =
|
|
102
|
+
selectedSrcToken &&
|
|
103
|
+
selectedSrcToken.address.toLowerCase() === destinationTokenAddress.toLowerCase() &&
|
|
104
|
+
selectedSrcToken.chainId === destinationTokenChainId;
|
|
105
|
+
|
|
106
|
+
const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote({
|
|
107
|
+
type: "swap",
|
|
108
|
+
srcChain: selectedSrcChainId,
|
|
109
|
+
dstChain: destinationTokenChainId,
|
|
110
|
+
srcTokenAddress: selectedSrcToken?.address || "",
|
|
111
|
+
dstTokenAddress: destinationTokenAddress,
|
|
112
|
+
tradeType: "EXACT_OUTPUT",
|
|
113
|
+
amount: totalAmount,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const tokenAddress = selectedSrcToken
|
|
117
|
+
? isNativeToken(selectedSrcToken.address)
|
|
118
|
+
? "native"
|
|
119
|
+
: selectedSrcToken.address
|
|
120
|
+
: undefined;
|
|
121
|
+
const { data: balanceData } = useSimTokenBalance(effectiveAddress, tokenAddress, selectedSrcChainId);
|
|
122
|
+
|
|
123
|
+
const balance = useMemo(() => {
|
|
124
|
+
const b = balanceData?.balances?.[0];
|
|
125
|
+
if (!b?.amount) return { raw: BigInt(0), formatted: "0", decimals: 18 };
|
|
126
|
+
return { raw: BigInt(b.amount), formatted: formatTokenAmount(BigInt(b.amount), b.decimals), decimals: b.decimals };
|
|
127
|
+
}, [balanceData]);
|
|
128
|
+
|
|
129
|
+
const srcAmount = useMemo(() => {
|
|
130
|
+
if (isSameToken) return totalAmount;
|
|
131
|
+
return anyspendQuote?.data?.currencyIn?.amount || "0";
|
|
132
|
+
}, [isSameToken, totalAmount, anyspendQuote]);
|
|
133
|
+
|
|
134
|
+
const srcAmountFormatted = useMemo(() => {
|
|
135
|
+
if (!selectedSrcToken) return "0";
|
|
136
|
+
return formatTokenAmount(BigInt(srcAmount || "0"), selectedSrcToken.decimals || 18);
|
|
137
|
+
}, [srcAmount, selectedSrcToken]);
|
|
138
|
+
|
|
139
|
+
const hasEnoughBalance = balance.raw >= BigInt(srcAmount || "0");
|
|
140
|
+
|
|
141
|
+
/* ------------------------------------------------------------------ */
|
|
142
|
+
/* Destination token object (shared by both flows) */
|
|
143
|
+
/* ------------------------------------------------------------------ */
|
|
144
|
+
const dstToken: components["schemas"]["Token"] = useMemo(
|
|
145
|
+
() => ({
|
|
146
|
+
address: destinationTokenAddress,
|
|
147
|
+
chainId: destinationTokenChainId,
|
|
148
|
+
decimals: dstTokenData?.decimals || 18,
|
|
149
|
+
symbol: dstTokenData?.symbol || "",
|
|
150
|
+
name: dstTokenData?.name || "",
|
|
151
|
+
metadata: { logoURI: dstTokenData?.logoURI || "" },
|
|
152
|
+
}),
|
|
153
|
+
[destinationTokenAddress, destinationTokenChainId, dstTokenData],
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
/* ------------------------------------------------------------------ */
|
|
157
|
+
/* QR / deposit-first order (always created for QR display) */
|
|
158
|
+
/* ------------------------------------------------------------------ */
|
|
159
|
+
const [qrOrderId, setQrOrderId] = useState<string | undefined>();
|
|
160
|
+
const [globalAddress, setGlobalAddress] = useState<string | undefined>();
|
|
161
|
+
const qrOrderCreatedRef = useRef(false);
|
|
162
|
+
|
|
163
|
+
const { createOrder: createDepositOrder, isCreatingOrder: isCreatingQrOrder } = useCreateDepositFirstOrder({
|
|
164
|
+
onSuccess: data => {
|
|
165
|
+
setQrOrderId(data.data?.id);
|
|
166
|
+
setGlobalAddress(data.data?.globalAddress);
|
|
167
|
+
},
|
|
168
|
+
onError: (error: Error) => {
|
|
169
|
+
qrOrderCreatedRef.current = false;
|
|
170
|
+
onErrorRef.current?.(error);
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Create deposit-first order on mount and when token changes
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if (qrOrderCreatedRef.current) return;
|
|
177
|
+
if (!selectedSrcToken) return;
|
|
178
|
+
qrOrderCreatedRef.current = true;
|
|
179
|
+
createDepositOrder({
|
|
180
|
+
recipientAddress,
|
|
181
|
+
srcChain: selectedSrcChainId,
|
|
182
|
+
dstChain: destinationTokenChainId,
|
|
183
|
+
srcToken: selectedSrcToken,
|
|
184
|
+
dstToken,
|
|
185
|
+
callbackMetadata,
|
|
186
|
+
creatorAddress: effectiveAddress,
|
|
187
|
+
});
|
|
188
|
+
}, [
|
|
189
|
+
selectedSrcToken,
|
|
190
|
+
selectedSrcChainId,
|
|
191
|
+
recipientAddress,
|
|
192
|
+
destinationTokenChainId,
|
|
193
|
+
dstToken,
|
|
194
|
+
callbackMetadata,
|
|
195
|
+
createDepositOrder,
|
|
196
|
+
effectiveAddress,
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
const { orderAndTransactions: qrOat } = useAnyspendOrderAndTransactions(qrOrderId);
|
|
200
|
+
useOnOrderSuccess({
|
|
201
|
+
orderData: qrOat,
|
|
202
|
+
orderId: qrOrderId,
|
|
203
|
+
onSuccess: (txHash?: string) => onSuccess?.({ orderId: qrOrderId, txHash }),
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// Notify parent when a deposit is detected on the QR/deposit-first order
|
|
207
|
+
const qrDepositNotifiedRef = useRef(false);
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
if (
|
|
210
|
+
qrOrderId &&
|
|
211
|
+
!qrDepositNotifiedRef.current &&
|
|
212
|
+
qrOat?.data?.depositTxs?.length &&
|
|
213
|
+
qrOat.data.depositTxs.length > 0
|
|
214
|
+
) {
|
|
215
|
+
qrDepositNotifiedRef.current = true;
|
|
216
|
+
onOrderCreatedRef.current?.(qrOrderId);
|
|
217
|
+
}
|
|
218
|
+
}, [qrOrderId, qrOat?.data?.depositTxs?.length]);
|
|
219
|
+
|
|
220
|
+
// QR code value
|
|
221
|
+
const qrAmount = srcAmount && srcAmount !== "0" ? BigInt(srcAmount) : undefined;
|
|
222
|
+
const qrValue =
|
|
223
|
+
globalAddress && selectedSrcToken
|
|
224
|
+
? getPaymentUrl(
|
|
225
|
+
globalAddress,
|
|
226
|
+
qrAmount,
|
|
227
|
+
isNativeToken(selectedSrcToken.address) ? "ETH" : selectedSrcToken.address,
|
|
228
|
+
selectedSrcChainId,
|
|
229
|
+
selectedSrcToken.decimals,
|
|
230
|
+
)
|
|
231
|
+
: "";
|
|
232
|
+
|
|
233
|
+
/* ------------------------------------------------------------------ */
|
|
234
|
+
/* Wallet / swap order (created on button click) */
|
|
235
|
+
/* ------------------------------------------------------------------ */
|
|
236
|
+
const [walletOrderId, setWalletOrderId] = useState<string | undefined>();
|
|
237
|
+
const [isSendingDeposit, setIsSendingDeposit] = useState(false);
|
|
238
|
+
const [depositRejected, setDepositRejected] = useState(false);
|
|
239
|
+
const depositSentRef = useRef(false);
|
|
240
|
+
const { switchChainAndExecute } = useUnifiedChainSwitchAndExecute();
|
|
241
|
+
|
|
242
|
+
const { createOrder: createSwapOrder, isCreatingOrder: isCreatingSwapOrder } = useAnyspendCreateOrder({
|
|
243
|
+
onSuccess: data => {
|
|
244
|
+
const id = data.data?.id;
|
|
245
|
+
if (id) setWalletOrderId(id);
|
|
246
|
+
},
|
|
247
|
+
onError: (error: Error) => {
|
|
248
|
+
setIsSendingDeposit(false);
|
|
249
|
+
onErrorRef.current?.(error);
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
const { orderAndTransactions: walletOat } = useAnyspendOrderAndTransactions(walletOrderId);
|
|
254
|
+
|
|
255
|
+
// Auto-send deposit tx once swap order is ready
|
|
256
|
+
useEffect(() => {
|
|
257
|
+
if (!walletOat?.data?.order || depositSentRef.current || depositRejected) return;
|
|
258
|
+
const order = walletOat.data.order;
|
|
259
|
+
if (order.status !== "scanning_deposit_transaction") return;
|
|
260
|
+
if (walletOat.data.depositTxs?.length) return;
|
|
261
|
+
depositSentRef.current = true;
|
|
262
|
+
|
|
263
|
+
const sendDeposit = async () => {
|
|
264
|
+
try {
|
|
265
|
+
setIsSendingDeposit(true);
|
|
266
|
+
const amount = BigInt(order.srcAmount);
|
|
267
|
+
if (isNativeToken(order.srcTokenAddress)) {
|
|
268
|
+
await switchChainAndExecute(order.srcChain, {
|
|
269
|
+
to: order.globalAddress as `0x${string}`,
|
|
270
|
+
value: amount,
|
|
271
|
+
});
|
|
272
|
+
} else {
|
|
273
|
+
const data = encodeFunctionData({
|
|
274
|
+
abi: erc20Abi,
|
|
275
|
+
functionName: "transfer",
|
|
276
|
+
args: [order.globalAddress as `0x${string}`, amount],
|
|
277
|
+
});
|
|
278
|
+
await switchChainAndExecute(order.srcChain, {
|
|
279
|
+
to: order.srcTokenAddress as `0x${string}`,
|
|
280
|
+
data,
|
|
281
|
+
value: BigInt(0),
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
// Deposit sent — notify parent to transition to order lifecycle tracking
|
|
285
|
+
if (walletOrderId) {
|
|
286
|
+
onOrderCreatedRef.current?.(walletOrderId);
|
|
287
|
+
}
|
|
288
|
+
} catch (error: any) {
|
|
289
|
+
depositSentRef.current = false;
|
|
290
|
+
const isUserRejection =
|
|
291
|
+
error?.code === 4001 || error?.message?.includes("rejected") || error?.message?.includes("denied");
|
|
292
|
+
if (isUserRejection) {
|
|
293
|
+
setDepositRejected(true);
|
|
294
|
+
}
|
|
295
|
+
onErrorRef.current?.(error instanceof Error ? error : new Error(error?.message || "Transaction rejected"));
|
|
296
|
+
} finally {
|
|
297
|
+
setIsSendingDeposit(false);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
sendDeposit();
|
|
301
|
+
}, [walletOat, switchChainAndExecute, walletOrderId, depositRejected]);
|
|
302
|
+
|
|
303
|
+
useOnOrderSuccess({
|
|
304
|
+
orderData: walletOat,
|
|
305
|
+
orderId: walletOrderId,
|
|
306
|
+
onSuccess: (txHash?: string) => onSuccess?.({ orderId: walletOrderId, txHash }),
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
const isWaitingForExecution = !!walletOrderId && walletOat?.data?.order.status !== "executed";
|
|
310
|
+
|
|
311
|
+
const handleWalletPay = useCallback(() => {
|
|
312
|
+
if (!selectedSrcToken || !walletAddress) return;
|
|
313
|
+
depositSentRef.current = false;
|
|
314
|
+
createSwapOrder({
|
|
315
|
+
recipientAddress,
|
|
316
|
+
orderType: "swap",
|
|
317
|
+
srcChain: selectedSrcChainId,
|
|
318
|
+
dstChain: destinationTokenChainId,
|
|
319
|
+
srcToken: selectedSrcToken,
|
|
320
|
+
dstToken,
|
|
321
|
+
srcAmount,
|
|
322
|
+
expectedDstAmount: totalAmount,
|
|
323
|
+
callbackMetadata,
|
|
324
|
+
creatorAddress: effectiveAddress,
|
|
325
|
+
});
|
|
326
|
+
}, [
|
|
327
|
+
selectedSrcToken,
|
|
328
|
+
walletAddress,
|
|
329
|
+
effectiveAddress,
|
|
330
|
+
recipientAddress,
|
|
331
|
+
selectedSrcChainId,
|
|
332
|
+
destinationTokenChainId,
|
|
333
|
+
dstToken,
|
|
334
|
+
srcAmount,
|
|
335
|
+
totalAmount,
|
|
336
|
+
callbackMetadata,
|
|
337
|
+
createSwapOrder,
|
|
338
|
+
]);
|
|
339
|
+
|
|
340
|
+
/* ------------------------------------------------------------------ */
|
|
341
|
+
/* Handlers */
|
|
342
|
+
/* ------------------------------------------------------------------ */
|
|
343
|
+
const handleSelectToken = (token: components["schemas"]["Token"]) => {
|
|
344
|
+
setSelectedSrcToken(token);
|
|
345
|
+
setSelectedSrcChainId(token.chainId);
|
|
346
|
+
// Reset both order flows
|
|
347
|
+
setQrOrderId(undefined);
|
|
348
|
+
setGlobalAddress(undefined);
|
|
349
|
+
qrOrderCreatedRef.current = false;
|
|
350
|
+
qrDepositNotifiedRef.current = false;
|
|
351
|
+
setWalletOrderId(undefined);
|
|
352
|
+
depositSentRef.current = false;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const handleCopyAddress = async () => {
|
|
356
|
+
if (globalAddress) {
|
|
357
|
+
await navigator.clipboard.writeText(globalAddress);
|
|
358
|
+
setCopied(true);
|
|
359
|
+
setTimeout(() => setCopied(false), 2000);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const handleConnectWallet = () => {
|
|
364
|
+
setB3ModalContentType({ type: "signInWithB3", showBackButton: false, chain: thirdwebB3Chain, partnerId });
|
|
365
|
+
setB3ModalOpen(true);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const isLoading = isLoadingAnyspendQuote;
|
|
369
|
+
const isPending = isCreatingSwapOrder || isSendingDeposit || isWaitingForExecution;
|
|
370
|
+
const canPay = walletAddress && selectedSrcToken && hasEnoughBalance && !isLoading && !isPending;
|
|
371
|
+
|
|
372
|
+
const chainName = ALL_CHAINS[selectedSrcChainId]?.name || "the specified chain";
|
|
373
|
+
const chainLogoUrl = ALL_CHAINS[selectedSrcChainId]?.logoUrl;
|
|
374
|
+
|
|
375
|
+
// Collapse QR on mobile when a wallet connector is available
|
|
376
|
+
const isMobile = useIsMobile();
|
|
377
|
+
const hasWalletConnector = typeof window !== "undefined" && !!(window as any).ethereum;
|
|
378
|
+
const [qrExpanded, setQrExpanded] = useState(!isMobile || !hasWalletConnector);
|
|
379
|
+
|
|
380
|
+
/* ------------------------------------------------------------------ */
|
|
381
|
+
/* Render */
|
|
382
|
+
/* ------------------------------------------------------------------ */
|
|
383
|
+
return (
|
|
384
|
+
<div className={cn("anyspend-crypto-pay-panel flex flex-col gap-4", classes?.cryptoPanel)}>
|
|
385
|
+
{/* ---- Token Selector (Relay SDK) ---- */}
|
|
386
|
+
<div className="anyspend-token-selector">
|
|
387
|
+
<label className="mb-1.5 block text-sm font-medium text-gray-700 dark:text-gray-300">Pay with</label>
|
|
388
|
+
<TokenSelector
|
|
389
|
+
address={effectiveAddress}
|
|
390
|
+
chainIdsFilter={getAvailableChainIds("from")}
|
|
391
|
+
context="from"
|
|
392
|
+
fromChainWalletVMSupported={true}
|
|
393
|
+
isValidAddress={true}
|
|
394
|
+
lockedChainIds={getAvailableChainIds("from")}
|
|
395
|
+
multiWalletSupportEnabled={true}
|
|
396
|
+
onAnalyticEvent={undefined}
|
|
397
|
+
popularChainIds={[1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID]}
|
|
398
|
+
setToken={token => {
|
|
399
|
+
handleSelectToken({
|
|
400
|
+
address: token.address,
|
|
401
|
+
chainId: token.chainId,
|
|
402
|
+
decimals: token.decimals,
|
|
403
|
+
metadata: { logoURI: token.logoURI },
|
|
404
|
+
name: token.name,
|
|
405
|
+
symbol: token.symbol,
|
|
406
|
+
});
|
|
407
|
+
}}
|
|
408
|
+
supportedWalletVMs={["evm", "svm"]}
|
|
409
|
+
token={undefined}
|
|
410
|
+
trigger={
|
|
411
|
+
<button
|
|
412
|
+
className={cn(
|
|
413
|
+
"flex w-full items-center justify-between rounded-xl border border-gray-200 bg-white px-4 py-3 transition-colors hover:border-gray-300 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:border-neutral-600",
|
|
414
|
+
classes?.tokenSelector,
|
|
415
|
+
)}
|
|
416
|
+
>
|
|
417
|
+
{selectedSrcToken ? (
|
|
418
|
+
<div className="flex items-center gap-3">
|
|
419
|
+
<ChainTokenIcon
|
|
420
|
+
chainUrl={ALL_CHAINS[selectedSrcToken.chainId]?.logoUrl || ""}
|
|
421
|
+
tokenUrl={selectedSrcToken.metadata?.logoURI}
|
|
422
|
+
className="h-8 w-8"
|
|
423
|
+
/>
|
|
424
|
+
<div className="text-left">
|
|
425
|
+
<p className="text-sm font-medium text-gray-900 dark:text-gray-100">{selectedSrcToken.symbol}</p>
|
|
426
|
+
<p className="text-xs text-gray-500 dark:text-gray-400">Balance: {balance.formatted}</p>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
) : (
|
|
430
|
+
<span className="text-sm text-gray-400">Select token</span>
|
|
431
|
+
)}
|
|
432
|
+
<ChevronsUpDown className="h-4 w-4 text-gray-400" />
|
|
433
|
+
</button>
|
|
434
|
+
}
|
|
435
|
+
/>
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
{/* ---- Quote ---- */}
|
|
439
|
+
<motion.div
|
|
440
|
+
initial={{ opacity: 0, y: 6 }}
|
|
441
|
+
animate={{ opacity: 1, y: 0 }}
|
|
442
|
+
transition={{ duration: 0.25, ease: "easeOut" }}
|
|
443
|
+
className={cn(
|
|
444
|
+
"rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 dark:border-neutral-700 dark:bg-neutral-800/50",
|
|
445
|
+
classes?.quoteDisplay,
|
|
446
|
+
)}
|
|
447
|
+
>
|
|
448
|
+
<div className="flex items-center justify-between">
|
|
449
|
+
<span className="text-sm text-gray-500 dark:text-gray-400">You pay</span>
|
|
450
|
+
<AnimatePresence mode="wait">
|
|
451
|
+
{isLoadingAnyspendQuote ? (
|
|
452
|
+
<motion.div
|
|
453
|
+
key="quote-loading"
|
|
454
|
+
initial={{ opacity: 0 }}
|
|
455
|
+
animate={{ opacity: 1 }}
|
|
456
|
+
exit={{ opacity: 0 }}
|
|
457
|
+
transition={{ duration: 0.15 }}
|
|
458
|
+
>
|
|
459
|
+
<TextShimmer duration={1} className="text-sm">
|
|
460
|
+
Fetching quote...
|
|
461
|
+
</TextShimmer>
|
|
462
|
+
</motion.div>
|
|
463
|
+
) : (
|
|
464
|
+
<motion.span
|
|
465
|
+
key="quote-amount"
|
|
466
|
+
initial={{ opacity: 0 }}
|
|
467
|
+
animate={{ opacity: 1 }}
|
|
468
|
+
exit={{ opacity: 0 }}
|
|
469
|
+
transition={{ duration: 0.15 }}
|
|
470
|
+
className="text-sm font-medium text-gray-900 dark:text-gray-100"
|
|
471
|
+
>
|
|
472
|
+
{srcAmountFormatted} {selectedSrcToken?.symbol || ""}
|
|
473
|
+
</motion.span>
|
|
474
|
+
)}
|
|
475
|
+
</AnimatePresence>
|
|
476
|
+
</div>
|
|
477
|
+
</motion.div>
|
|
478
|
+
|
|
479
|
+
{/* ---- Insufficient balance warning ---- */}
|
|
480
|
+
<AnimatePresence>
|
|
481
|
+
{walletAddress && selectedSrcToken && !hasEnoughBalance && !isLoading && (
|
|
482
|
+
<motion.p
|
|
483
|
+
key="balance-warning"
|
|
484
|
+
initial={{ opacity: 0, height: 0 }}
|
|
485
|
+
animate={{ opacity: 1, height: "auto" }}
|
|
486
|
+
exit={{ opacity: 0, height: 0 }}
|
|
487
|
+
transition={{ duration: 0.2, ease: "easeOut" }}
|
|
488
|
+
className="text-center text-sm text-red-500"
|
|
489
|
+
>
|
|
490
|
+
Insufficient {selectedSrcToken.symbol} balance
|
|
491
|
+
</motion.p>
|
|
492
|
+
)}
|
|
493
|
+
</AnimatePresence>
|
|
494
|
+
|
|
495
|
+
{/* ---- Wallet Pay Button ---- */}
|
|
496
|
+
{!walletAddress ? (
|
|
497
|
+
<ShinyButton
|
|
498
|
+
accentColor={themeColor || "hsl(var(--as-brand))"}
|
|
499
|
+
onClick={handleConnectWallet}
|
|
500
|
+
className={cn("w-full", classes?.payButton)}
|
|
501
|
+
textClassName="text-white"
|
|
502
|
+
>
|
|
503
|
+
Connect Wallet to Pay
|
|
504
|
+
</ShinyButton>
|
|
505
|
+
) : (
|
|
506
|
+
<ShinyButton
|
|
507
|
+
accentColor={themeColor || "hsl(var(--as-brand))"}
|
|
508
|
+
onClick={handleWalletPay}
|
|
509
|
+
disabled={!canPay}
|
|
510
|
+
className={cn("w-full", classes?.payButton)}
|
|
511
|
+
textClassName={cn(!canPay ? "text-as-secondary" : "text-white")}
|
|
512
|
+
>
|
|
513
|
+
{isPending ? (
|
|
514
|
+
<span className="flex items-center justify-center gap-2">
|
|
515
|
+
<Loader2 className="h-4 w-4 animate-spin" />
|
|
516
|
+
{isCreatingSwapOrder
|
|
517
|
+
? "Creating order..."
|
|
518
|
+
: isSendingDeposit
|
|
519
|
+
? "Confirm in wallet..."
|
|
520
|
+
: "Confirming transaction..."}
|
|
521
|
+
</span>
|
|
522
|
+
) : (
|
|
523
|
+
buttonText
|
|
524
|
+
)}
|
|
525
|
+
</ShinyButton>
|
|
526
|
+
)}
|
|
527
|
+
|
|
528
|
+
{/* ---- "or" divider / accordion toggle ---- */}
|
|
529
|
+
{isMobile && hasWalletConnector ? (
|
|
530
|
+
<button
|
|
531
|
+
type="button"
|
|
532
|
+
onClick={() => setQrExpanded(prev => !prev)}
|
|
533
|
+
className="flex w-full items-center gap-3 py-1"
|
|
534
|
+
>
|
|
535
|
+
<div className="h-px flex-1 bg-gray-200 dark:bg-neutral-700" />
|
|
536
|
+
<span className="flex items-center gap-1 text-xs font-medium text-gray-400 dark:text-gray-500">
|
|
537
|
+
{qrExpanded ? (
|
|
538
|
+
"or send directly"
|
|
539
|
+
) : (
|
|
540
|
+
<>
|
|
541
|
+
<QrCode className="h-3 w-3" /> or send with QR code
|
|
542
|
+
</>
|
|
543
|
+
)}
|
|
544
|
+
<ChevronDown className={cn("h-3 w-3 transition-transform", qrExpanded && "rotate-180")} />
|
|
545
|
+
</span>
|
|
546
|
+
<div className="h-px flex-1 bg-gray-200 dark:bg-neutral-700" />
|
|
547
|
+
</button>
|
|
548
|
+
) : (
|
|
549
|
+
<div className="flex items-center gap-3 py-1">
|
|
550
|
+
<div className="h-px flex-1 bg-gray-200 dark:bg-neutral-700" />
|
|
551
|
+
<span className="text-xs font-medium text-gray-400 dark:text-gray-500">or send directly</span>
|
|
552
|
+
<div className="h-px flex-1 bg-gray-200 dark:bg-neutral-700" />
|
|
553
|
+
</div>
|
|
554
|
+
)}
|
|
555
|
+
|
|
556
|
+
{/* ---- QR + Deposit Section ---- */}
|
|
557
|
+
<AnimatePresence initial={false}>
|
|
558
|
+
{qrExpanded && (
|
|
559
|
+
<motion.div
|
|
560
|
+
key="qr-section"
|
|
561
|
+
initial={{ height: 0, opacity: 0 }}
|
|
562
|
+
animate={{ height: "auto", opacity: 1 }}
|
|
563
|
+
exit={{ height: 0, opacity: 0 }}
|
|
564
|
+
transition={{ duration: 0.25, ease: "easeInOut" }}
|
|
565
|
+
className="overflow-hidden"
|
|
566
|
+
>
|
|
567
|
+
{isCreatingQrOrder && !globalAddress ? (
|
|
568
|
+
<div className="flex items-center justify-center py-8">
|
|
569
|
+
<Loader2 className="h-5 w-5 animate-spin text-gray-400" />
|
|
570
|
+
<span className="ml-2 text-sm text-gray-500 dark:text-gray-400">Creating deposit address...</span>
|
|
571
|
+
</div>
|
|
572
|
+
) : globalAddress ? (
|
|
573
|
+
<div className="flex items-center gap-4">
|
|
574
|
+
{/* QR Code — left */}
|
|
575
|
+
<div className="shrink-0 rounded-xl bg-white p-2.5 shadow-sm ring-1 ring-gray-100 dark:bg-white dark:ring-gray-200">
|
|
576
|
+
<QRCodeSVG value={qrValue} size={132} level="M" marginSize={0} />
|
|
577
|
+
</div>
|
|
578
|
+
|
|
579
|
+
{/* Info — right */}
|
|
580
|
+
<div className="flex min-w-0 flex-1 flex-col gap-2.5">
|
|
581
|
+
{/* Instruction label */}
|
|
582
|
+
<p className="text-sm font-medium text-gray-700 dark:text-gray-300">
|
|
583
|
+
Send{" "}
|
|
584
|
+
<span className="font-semibold text-gray-900 dark:text-gray-100">
|
|
585
|
+
{srcAmountFormatted} {selectedSrcToken?.symbol}
|
|
586
|
+
</span>{" "}
|
|
587
|
+
on{" "}
|
|
588
|
+
<span className="font-semibold text-gray-900 dark:text-gray-100">
|
|
589
|
+
{chainLogoUrl && (
|
|
590
|
+
<img
|
|
591
|
+
src={chainLogoUrl}
|
|
592
|
+
alt=""
|
|
593
|
+
className="mb-px mr-0.5 inline h-3.5 w-3.5 rounded-full align-text-bottom"
|
|
594
|
+
/>
|
|
595
|
+
)}
|
|
596
|
+
{chainName}
|
|
597
|
+
</span>{" "}
|
|
598
|
+
to:
|
|
599
|
+
</p>
|
|
600
|
+
|
|
601
|
+
{/* Address with copy */}
|
|
602
|
+
<button
|
|
603
|
+
onClick={handleCopyAddress}
|
|
604
|
+
className="group flex items-start gap-1.5 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-left transition-colors hover:border-gray-300 hover:bg-gray-100 dark:border-neutral-700 dark:bg-neutral-800/60 dark:hover:border-neutral-600 dark:hover:bg-neutral-800"
|
|
605
|
+
>
|
|
606
|
+
<span className="min-w-0 break-all font-mono text-xs leading-relaxed text-gray-800 dark:text-gray-200">
|
|
607
|
+
{globalAddress}
|
|
608
|
+
</span>
|
|
609
|
+
<span className="mt-0.5 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:group-hover:text-gray-300">
|
|
610
|
+
{copied ? <Check className="h-3.5 w-3.5 text-green-500" /> : <Copy className="h-3.5 w-3.5" />}
|
|
611
|
+
</span>
|
|
612
|
+
</button>
|
|
613
|
+
|
|
614
|
+
{/* Warning */}
|
|
615
|
+
<p className="text-xs leading-snug text-orange-500/80 dark:text-orange-400/80">
|
|
616
|
+
Only send {selectedSrcToken?.symbol} on{" "}
|
|
617
|
+
{chainLogoUrl && (
|
|
618
|
+
<img src={chainLogoUrl} alt="" className="mr-0.5 inline h-3 w-3 rounded-full align-text-bottom" />
|
|
619
|
+
)}
|
|
620
|
+
{chainName}. Sending other tokens or using a different network may result in loss of funds.
|
|
621
|
+
</p>
|
|
622
|
+
</div>
|
|
623
|
+
</div>
|
|
624
|
+
) : null}
|
|
625
|
+
</motion.div>
|
|
626
|
+
)}
|
|
627
|
+
</AnimatePresence>
|
|
628
|
+
</div>
|
|
629
|
+
);
|
|
630
|
+
}
|