@b3dotfun/sdk 0.1.69-alpha.2 → 0.1.69-alpha.21
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/constants/rpc.d.ts +1 -1
- package/dist/cjs/anyspend/constants/rpc.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +1 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +15 -6
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +43 -23
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/KycGate.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +10 -9
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +7 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +37 -6
- package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/StepProgress.js +7 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -6
- package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/cjs/anyspend/react/hooks/useKycStatus.js +11 -7
- package/dist/cjs/anyspend/utils/chain.js +8 -7
- package/dist/cjs/app.shared.js +9 -7
- package/dist/cjs/global-account/better-auth-client.d.ts +1883 -0
- package/dist/cjs/global-account/better-auth-client.js +17 -0
- package/dist/cjs/global-account/bsmnt.d.ts +0 -1
- package/dist/cjs/global-account/bsmnt.js +0 -6
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +9 -12
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -8
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +120 -0
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
- package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +15 -6
- package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.js +57 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
- package/dist/cjs/global-account/react/components/Send/Send.js +5 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +67 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +163 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +10 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +138 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +96 -15
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +20 -3
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/cjs/global-account/react/components/Toast/ToastContext.js +30 -7
- package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/cjs/global-account/react/components/index.d.ts +3 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +5 -2
- package/dist/cjs/global-account/react/hooks/useAuth.js +26 -15
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +23 -12
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +157 -0
- package/dist/cjs/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/cjs/global-account/react/utils/createWagmiConfig.js +5 -24
- package/dist/cjs/global-account/react/utils/index.d.ts +0 -1
- package/dist/cjs/global-account/react/utils/index.js +0 -1
- package/dist/cjs/global-account/react/utils/profileDisplay.js +17 -18
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/cjs/shared/constants/chains/b3Chain.js +4 -4
- package/dist/cjs/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/cjs/shared/constants/chains/b3Viem.js +19 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
- package/dist/cjs/shared/generated/chain-networks.json +2 -2
- package/dist/cjs/shared/utils/chains.d.ts +1 -1
- package/dist/cjs/shared/utils/chains.js +2 -2
- package/dist/cjs/shared/utils/session-duration.d.ts +15 -0
- package/dist/cjs/shared/utils/session-duration.js +69 -0
- package/dist/cjs/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/cjs/wallet/react/components/ConnectWallet.js +467 -0
- package/dist/cjs/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/cjs/wallet/react/components/WalletProvider.js +20 -0
- package/dist/cjs/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/cjs/wallet/react/hooks/useWalletDisconnect.js +22 -0
- package/dist/cjs/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/cjs/wallet/react/hooks/useWalletState.js +63 -0
- package/dist/cjs/wallet/react/index.d.ts +5 -0
- package/dist/cjs/wallet/react/index.js +16 -0
- package/dist/cjs/wallet/utils/createWalletConfig.d.ts +21 -0
- package/dist/cjs/wallet/utils/createWalletConfig.js +24 -0
- package/dist/esm/anyspend/constants/rpc.d.ts +1 -1
- package/dist/esm/anyspend/constants/rpc.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +15 -6
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/esm/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +44 -24
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/KycGate.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -8
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -3
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +34 -3
- package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/StepProgress.js +4 -2
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -7
- package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/esm/anyspend/react/hooks/useKycStatus.js +9 -5
- package/dist/esm/anyspend/utils/chain.js +10 -9
- package/dist/esm/app.shared.js +9 -7
- package/dist/esm/global-account/better-auth-client.d.ts +1883 -0
- package/dist/esm/global-account/better-auth-client.js +13 -0
- package/dist/esm/global-account/bsmnt.d.ts +0 -1
- package/dist/esm/global-account/bsmnt.js +0 -5
- package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -7
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +4 -6
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +115 -0
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
- package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +13 -7
- package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.js +52 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
- package/dist/esm/global-account/react/components/Send/Send.js +5 -2
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +64 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +160 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
- package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +11 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +135 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +100 -19
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +19 -2
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/esm/global-account/react/components/Toast/ToastContext.js +30 -7
- package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/esm/global-account/react/components/index.d.ts +3 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuth.js +28 -17
- package/dist/esm/global-account/react/hooks/useAuthentication.js +24 -13
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +149 -0
- package/dist/esm/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/esm/global-account/react/utils/createWagmiConfig.js +5 -23
- package/dist/esm/global-account/react/utils/index.d.ts +0 -1
- package/dist/esm/global-account/react/utils/index.js +0 -1
- package/dist/esm/global-account/react/utils/profileDisplay.js +17 -18
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/esm/shared/constants/chains/b3Chain.js +4 -4
- package/dist/esm/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/esm/shared/constants/chains/b3Viem.js +16 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
- package/dist/esm/shared/generated/chain-networks.json +2 -2
- package/dist/esm/shared/utils/chains.d.ts +1 -1
- package/dist/esm/shared/utils/chains.js +2 -2
- package/dist/esm/shared/utils/session-duration.d.ts +15 -0
- package/dist/esm/shared/utils/session-duration.js +64 -0
- package/dist/esm/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/esm/wallet/react/components/ConnectWallet.js +431 -0
- package/dist/esm/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/esm/wallet/react/components/WalletProvider.js +17 -0
- package/dist/esm/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/esm/wallet/react/hooks/useWalletDisconnect.js +19 -0
- package/dist/esm/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/esm/wallet/react/hooks/useWalletState.js +60 -0
- package/dist/esm/wallet/react/index.d.ts +5 -0
- package/dist/esm/wallet/react/index.js +8 -0
- package/dist/esm/wallet/utils/createWalletConfig.d.ts +21 -0
- package/dist/esm/wallet/utils/createWalletConfig.js +21 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/rpc.d.ts +1 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/types/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/types/global-account/better-auth-client.d.ts +1883 -0
- package/dist/types/global-account/bsmnt.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/types/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/types/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/types/global-account/react/components/index.d.ts +3 -0
- package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/types/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/types/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/types/global-account/react/utils/index.d.ts +0 -1
- package/dist/types/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/types/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/types/shared/constants/chains/supported.d.ts +1 -1
- package/dist/types/shared/utils/chains.d.ts +1 -1
- package/dist/types/shared/utils/session-duration.d.ts +15 -0
- package/dist/types/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/types/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/types/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/types/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/types/wallet/react/index.d.ts +5 -0
- package/dist/types/wallet/utils/createWalletConfig.d.ts +21 -0
- package/package.json +15 -6
- package/src/anyspend/constants/rpc.ts +2 -1
- package/src/anyspend/react/components/AnySpendNFT.tsx +2 -2
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -2
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -2
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +25 -5
- package/src/anyspend/react/components/checkout/CartItemRow.tsx +2 -1
- package/src/anyspend/react/components/checkout/CartSummary.tsx +24 -20
- package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +12 -3
- package/src/anyspend/react/components/checkout/CheckoutFormPanel.tsx +5 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +2 -4
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +13 -3
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +45 -27
- package/src/anyspend/react/components/checkout/DiscountCodeInput.tsx +15 -5
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +9 -3
- package/src/anyspend/react/components/checkout/KycGate.tsx +8 -3
- package/src/anyspend/react/components/checkout/PriceSkeleton.tsx +19 -0
- package/src/anyspend/react/components/checkout/ShippingSelector.tsx +5 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +10 -8
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +10 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +4 -4
- package/src/anyspend/react/components/common/OrderStatus.tsx +38 -3
- package/src/anyspend/react/components/common/StepProgress.tsx +15 -5
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -7
- package/src/anyspend/react/hooks/useKycStatus.ts +8 -5
- package/src/anyspend/utils/chain.ts +9 -9
- package/src/app.shared.ts +9 -8
- package/src/global-account/better-auth-client.ts +17 -0
- package/src/global-account/bsmnt.ts +0 -6
- package/src/global-account/react/components/B3DynamicModal.tsx +5 -2
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +16 -21
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +52 -40
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +127 -0
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
- package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +17 -10
- package/src/global-account/react/components/LinkAccount/LinkedAccountItem.tsx +2 -1
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +29 -11
- package/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx +107 -0
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +28 -30
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -2
- package/src/global-account/react/components/Send/Send.tsx +8 -5
- package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +146 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +426 -0
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -4
- package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +21 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +308 -0
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +207 -54
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +24 -4
- package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +2 -1
- package/src/global-account/react/components/Toast/ToastContext.tsx +39 -7
- package/src/global-account/react/components/index.ts +3 -0
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +28 -17
- package/src/global-account/react/hooks/useAuthentication.ts +24 -13
- package/src/global-account/react/hooks/useBetterAuth.ts +191 -0
- package/src/global-account/react/hooks/useConnect.tsx +2 -2
- package/src/global-account/react/stores/useModalStore.ts +11 -0
- package/src/global-account/react/utils/createWagmiConfig.tsx +6 -25
- package/src/global-account/react/utils/index.ts +0 -1
- package/src/global-account/react/utils/profileDisplay.ts +21 -19
- package/src/shared/constants/chains/b3Chain.ts +5 -5
- package/src/shared/constants/chains/b3Viem.ts +18 -0
- package/src/shared/generated/chain-networks.json +2 -2
- package/src/shared/utils/chains.ts +3 -2
- package/src/shared/utils/session-duration.ts +64 -0
- package/src/types/torph.d.ts +4 -0
- package/src/wallet/__tests__/createWalletConfig.test.ts +39 -0
- package/src/wallet/react/components/ConnectWallet.tsx +665 -0
- package/src/wallet/react/components/WalletProvider.tsx +64 -0
- package/src/wallet/react/hooks/useWalletDisconnect.ts +22 -0
- package/src/wallet/react/hooks/useWalletState.ts +93 -0
- package/src/wallet/react/index.ts +10 -0
- package/src/wallet/utils/createWalletConfig.ts +39 -0
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -54
- package/dist/cjs/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/cjs/global-account/react/components/ProfileAvatar.js +0 -127
- package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/cjs/global-account/react/hooks/useRPMToken.js +0 -11
- package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/dist/cjs/global-account/react/utils/updateAvatar.js +0 -54
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -51
- package/dist/esm/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/esm/global-account/react/components/ProfileAvatar.js +0 -127
- package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/esm/global-account/react/hooks/useRPMToken.js +0 -8
- package/dist/esm/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/dist/esm/global-account/react/utils/updateAvatar.js +0 -18
- package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/types/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/types/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/types/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +0 -90
- package/src/global-account/react/components/ProfileAvatar.tsx +0 -138
- package/src/global-account/react/hooks/useRPMToken.ts +0 -17
- package/src/global-account/react/utils/updateAvatar.ts +0 -21
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
4
|
import { formatTokenAmount, safeBigInt } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
|
-
import { useMemo } from "react";
|
|
6
|
-
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
7
|
-
import type { CheckoutSummaryLine } from "./AnySpendCheckout";
|
|
5
|
+
import { useMemo, type ReactNode } from "react";
|
|
6
|
+
import type { AnySpendCheckoutClasses, CheckoutSummaryLine } from "./AnySpendCheckout";
|
|
8
7
|
|
|
9
8
|
interface CartSummaryProps {
|
|
10
9
|
/** Formatted total (final amount after all adjustments) */
|
|
11
|
-
total:
|
|
10
|
+
total: ReactNode;
|
|
12
11
|
tokenSymbol?: string;
|
|
13
12
|
classes?: AnySpendCheckoutClasses;
|
|
14
13
|
/** Formatted subtotal (sum of items only — shown when adjustments exist) */
|
|
@@ -20,6 +19,8 @@ interface CartSummaryProps {
|
|
|
20
19
|
summaryLines?: CheckoutSummaryLine[];
|
|
21
20
|
/** Formatted USD equivalent (e.g. "$5.56") — shown for non-stablecoin tokens */
|
|
22
21
|
usdEquivalent?: string | null;
|
|
22
|
+
/** When true, hide adjustment rows and USD equivalent (caller passes a skeleton as `total`). */
|
|
23
|
+
pricesLoading?: boolean;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export function CartSummary({
|
|
@@ -33,35 +34,38 @@ export function CartSummary({
|
|
|
33
34
|
discount,
|
|
34
35
|
summaryLines,
|
|
35
36
|
usdEquivalent,
|
|
37
|
+
pricesLoading = false,
|
|
36
38
|
}: CartSummaryProps) {
|
|
37
|
-
const hasAdjustments =
|
|
38
|
-
!!shipping?.amount || !!tax?.amount || !!discount?.amount || (summaryLines && summaryLines.length > 0);
|
|
39
|
-
|
|
40
39
|
const formattedShipping = useMemo(
|
|
41
|
-
() => (shipping?.amount ? formatTokenAmount(safeBigInt(shipping.amount), tokenDecimals) : null),
|
|
42
|
-
[shipping?.amount, tokenDecimals],
|
|
40
|
+
() => (!pricesLoading && shipping?.amount ? formatTokenAmount(safeBigInt(shipping.amount), tokenDecimals) : null),
|
|
41
|
+
[pricesLoading, shipping?.amount, tokenDecimals],
|
|
43
42
|
);
|
|
44
43
|
|
|
45
44
|
const formattedTax = useMemo(
|
|
46
|
-
() => (tax?.amount ? formatTokenAmount(safeBigInt(tax.amount), tokenDecimals) : null),
|
|
47
|
-
[tax?.amount, tokenDecimals],
|
|
45
|
+
() => (!pricesLoading && tax?.amount ? formatTokenAmount(safeBigInt(tax.amount), tokenDecimals) : null),
|
|
46
|
+
[pricesLoading, tax?.amount, tokenDecimals],
|
|
48
47
|
);
|
|
49
48
|
|
|
50
49
|
const formattedDiscount = useMemo(
|
|
51
|
-
() => (discount?.amount ? formatTokenAmount(safeBigInt(discount.amount), tokenDecimals) : null),
|
|
52
|
-
[discount?.amount, tokenDecimals],
|
|
50
|
+
() => (!pricesLoading && discount?.amount ? formatTokenAmount(safeBigInt(discount.amount), tokenDecimals) : null),
|
|
51
|
+
[pricesLoading, discount?.amount, tokenDecimals],
|
|
53
52
|
);
|
|
54
53
|
|
|
55
54
|
const formattedSummaryLines = useMemo(
|
|
56
55
|
() =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
pricesLoading
|
|
57
|
+
? undefined
|
|
58
|
+
: summaryLines?.map(line => ({
|
|
59
|
+
...line,
|
|
60
|
+
formattedAmount: formatTokenAmount(safeBigInt(line.amount), tokenDecimals),
|
|
61
|
+
isNegative: safeBigInt(line.amount) < BigInt(0),
|
|
62
|
+
})),
|
|
63
|
+
[pricesLoading, summaryLines, tokenDecimals],
|
|
63
64
|
);
|
|
64
65
|
|
|
66
|
+
const hasAdjustments =
|
|
67
|
+
!!formattedShipping || !!formattedTax || !!formattedDiscount || !!formattedSummaryLines?.length;
|
|
68
|
+
|
|
65
69
|
return (
|
|
66
70
|
<div className={cn("border-t border-gray-200 pt-3 dark:border-neutral-700", classes?.cartSummary)}>
|
|
67
71
|
{/* Subtotal — only shown when adjustments exist */}
|
|
@@ -147,7 +151,7 @@ export function CartSummary({
|
|
|
147
151
|
{total} {tokenSymbol}
|
|
148
152
|
</span>
|
|
149
153
|
</div>
|
|
150
|
-
{usdEquivalent && (
|
|
154
|
+
{!pricesLoading && usdEquivalent && (
|
|
151
155
|
<div className="flex justify-end">
|
|
152
156
|
<span className="text-xs text-gray-400 dark:text-gray-500">~{usdEquivalent} USD</span>
|
|
153
157
|
</div>
|
|
@@ -7,12 +7,15 @@ import type { CheckoutItem, CheckoutSummaryLine, AnySpendCheckoutClasses } from
|
|
|
7
7
|
import { CartItemRow } from "./CartItemRow";
|
|
8
8
|
import { CartSummary } from "./CartSummary";
|
|
9
9
|
import { PoweredByBranding } from "./PoweredByBranding";
|
|
10
|
+
import { PriceSkeleton } from "./PriceSkeleton";
|
|
10
11
|
|
|
11
12
|
interface CheckoutCartPanelProps {
|
|
12
13
|
items: CheckoutItem[];
|
|
13
14
|
totalAmount: string;
|
|
14
15
|
tokenSymbol?: string;
|
|
15
16
|
tokenDecimals?: number;
|
|
17
|
+
/** True while token decimals/symbol are still loading — prevents rendering mis-decimalized prices. */
|
|
18
|
+
pricesLoading?: boolean;
|
|
16
19
|
organizationName?: string;
|
|
17
20
|
organizationLogo?: string;
|
|
18
21
|
classes?: AnySpendCheckoutClasses;
|
|
@@ -31,6 +34,7 @@ export function CheckoutCartPanel({
|
|
|
31
34
|
totalAmount,
|
|
32
35
|
tokenSymbol = "",
|
|
33
36
|
tokenDecimals = 18,
|
|
37
|
+
pricesLoading = false,
|
|
34
38
|
organizationName,
|
|
35
39
|
organizationLogo,
|
|
36
40
|
classes,
|
|
@@ -56,7 +60,7 @@ export function CheckoutCartPanel({
|
|
|
56
60
|
}, [items, tokenDecimals]);
|
|
57
61
|
|
|
58
62
|
return (
|
|
59
|
-
<div className={cn("anyspend-cart-panel flex flex-col", classes?.cartPanel)}>
|
|
63
|
+
<div className={cn("anyspend-cart-panel flex flex-col", classes?.cartPanel)} aria-busy={pricesLoading || undefined}>
|
|
60
64
|
<h2
|
|
61
65
|
className={cn(
|
|
62
66
|
"anyspend-cart-title mb-4 text-lg font-semibold text-gray-900 dark:text-gray-100",
|
|
@@ -69,14 +73,18 @@ export function CheckoutCartPanel({
|
|
|
69
73
|
<div className="anyspend-cart-items divide-y divide-gray-100 dark:divide-gray-800">
|
|
70
74
|
{items.map((item, index) => {
|
|
71
75
|
const itemTotal = safeBigInt(item.amount) * BigInt(item.quantity);
|
|
72
|
-
const formattedPrice =
|
|
76
|
+
const formattedPrice: ReactNode = pricesLoading ? (
|
|
77
|
+
<PriceSkeleton />
|
|
78
|
+
) : (
|
|
79
|
+
`${formatTokenAmount(itemTotal, tokenDecimals)} ${tokenSymbol}`
|
|
80
|
+
);
|
|
73
81
|
|
|
74
82
|
return <CartItemRow key={item.id || index} item={item} formattedPrice={formattedPrice} classes={classes} />;
|
|
75
83
|
})}
|
|
76
84
|
</div>
|
|
77
85
|
|
|
78
86
|
<CartSummary
|
|
79
|
-
total={formattedTotal}
|
|
87
|
+
total={pricesLoading ? <PriceSkeleton className="w-20" /> : formattedTotal}
|
|
80
88
|
tokenSymbol={tokenSymbol}
|
|
81
89
|
classes={classes}
|
|
82
90
|
subtotal={formattedSubtotal}
|
|
@@ -86,6 +94,7 @@ export function CheckoutCartPanel({
|
|
|
86
94
|
discount={discount}
|
|
87
95
|
summaryLines={summaryLines}
|
|
88
96
|
usdEquivalent={usdEquivalent}
|
|
97
|
+
pricesLoading={pricesLoading}
|
|
89
98
|
/>
|
|
90
99
|
|
|
91
100
|
{footer === undefined ? (
|
|
@@ -31,6 +31,8 @@ interface CheckoutFormPanelProps {
|
|
|
31
31
|
/** Token info for display */
|
|
32
32
|
tokenSymbol?: string;
|
|
33
33
|
tokenDecimals?: number;
|
|
34
|
+
/** True while token decimals/symbol are still loading — prevents rendering mis-decimalized prices. */
|
|
35
|
+
pricesLoading?: boolean;
|
|
34
36
|
/** CSS class overrides */
|
|
35
37
|
classes?: AnySpendCheckoutClasses;
|
|
36
38
|
/** Current form data (lifted state) */
|
|
@@ -62,6 +64,7 @@ export function CheckoutFormPanel({
|
|
|
62
64
|
validateDiscount,
|
|
63
65
|
tokenSymbol,
|
|
64
66
|
tokenDecimals,
|
|
67
|
+
pricesLoading = false,
|
|
65
68
|
classes,
|
|
66
69
|
formData,
|
|
67
70
|
onFormDataChange,
|
|
@@ -144,6 +147,7 @@ export function CheckoutFormPanel({
|
|
|
144
147
|
onSelect={onShippingChange}
|
|
145
148
|
tokenSymbol={tokenSymbol}
|
|
146
149
|
tokenDecimals={tokenDecimals}
|
|
150
|
+
pricesLoading={pricesLoading}
|
|
147
151
|
/>
|
|
148
152
|
)}
|
|
149
153
|
{enableDiscountCode && validateDiscount && (
|
|
@@ -153,6 +157,7 @@ export function CheckoutFormPanel({
|
|
|
153
157
|
onRemove={onDiscountRemoved}
|
|
154
158
|
tokenSymbol={tokenSymbol}
|
|
155
159
|
tokenDecimals={tokenDecimals}
|
|
160
|
+
pricesLoading={pricesLoading}
|
|
156
161
|
/>
|
|
157
162
|
)}
|
|
158
163
|
</>
|
|
@@ -186,14 +186,12 @@ export function CheckoutPaymentPanel({
|
|
|
186
186
|
const accordionButtonClass = (active: boolean) =>
|
|
187
187
|
cn(
|
|
188
188
|
"anyspend-payment-method-btn flex w-full items-center gap-3 px-4 py-4 text-left transition-colors",
|
|
189
|
-
active
|
|
190
|
-
? "bg-white dark:bg-neutral-900"
|
|
191
|
-
: "bg-white hover:bg-gray-50 dark:bg-neutral-900 dark:hover:bg-neutral-800",
|
|
189
|
+
!active && "hover:bg-gray-50 dark:hover:bg-neutral-800",
|
|
192
190
|
classes?.paymentMethodButton,
|
|
193
191
|
);
|
|
194
192
|
|
|
195
193
|
const expandedPanelClass = cn(
|
|
196
|
-
"anyspend-payment-method-panel border-t border-gray-100
|
|
194
|
+
"anyspend-payment-method-panel border-t border-gray-100 px-4 py-4 dark:border-neutral-800",
|
|
197
195
|
);
|
|
198
196
|
|
|
199
197
|
return (
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { getExplorerTxUrl } from "@b3dotfun/sdk/anyspend";
|
|
4
|
+
import { b3Viem } from "@b3dotfun/sdk/shared/constants/chains/b3Viem";
|
|
3
5
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
6
|
import { ExternalLink } from "lucide-react";
|
|
5
7
|
import { motion } from "motion/react";
|
|
@@ -9,13 +11,21 @@ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
|
9
11
|
|
|
10
12
|
interface CheckoutSuccessProps {
|
|
11
13
|
txHash?: string;
|
|
14
|
+
dstChainId?: number;
|
|
12
15
|
orderId?: string;
|
|
13
16
|
returnUrl?: string;
|
|
14
17
|
returnLabel?: string;
|
|
15
18
|
classes?: AnySpendCheckoutClasses;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
export function CheckoutSuccess({
|
|
21
|
+
export function CheckoutSuccess({
|
|
22
|
+
txHash,
|
|
23
|
+
dstChainId,
|
|
24
|
+
orderId,
|
|
25
|
+
returnUrl,
|
|
26
|
+
returnLabel,
|
|
27
|
+
classes,
|
|
28
|
+
}: CheckoutSuccessProps) {
|
|
19
29
|
const { content, slots } = useAnySpendCustomization();
|
|
20
30
|
|
|
21
31
|
if (slots.successScreen) {
|
|
@@ -29,7 +39,7 @@ export function CheckoutSuccess({ txHash, orderId, returnUrl, returnLabel, class
|
|
|
29
39
|
: "Your payment has been processed successfully.",
|
|
30
40
|
txHash,
|
|
31
41
|
orderId,
|
|
32
|
-
explorerUrl: txHash ?
|
|
42
|
+
explorerUrl: txHash ? getExplorerTxUrl(dstChainId ?? b3Viem.id, txHash) : undefined,
|
|
33
43
|
onDone: () => {
|
|
34
44
|
if (returnUrl) window.location.href = returnUrl;
|
|
35
45
|
},
|
|
@@ -69,7 +79,7 @@ export function CheckoutSuccess({ txHash, orderId, returnUrl, returnLabel, class
|
|
|
69
79
|
initial={{ opacity: 0 }}
|
|
70
80
|
animate={{ opacity: 1 }}
|
|
71
81
|
transition={{ duration: 0.3, delay: 0.5, ease: "easeOut" }}
|
|
72
|
-
href={
|
|
82
|
+
href={getExplorerTxUrl(dstChainId ?? b3Viem.id, txHash)}
|
|
73
83
|
target="_blank"
|
|
74
84
|
rel="noopener noreferrer"
|
|
75
85
|
className="anyspend-success-tx-link mt-4 flex items-center gap-1.5 text-sm text-blue-600 hover:underline dark:text-blue-400"
|
|
@@ -11,15 +11,12 @@ import { getPaymentUrl } from "@b3dotfun/sdk/anyspend/utils/chain";
|
|
|
11
11
|
import { isNativeToken } from "@b3dotfun/sdk/anyspend/utils/token";
|
|
12
12
|
import {
|
|
13
13
|
useAccountWallet,
|
|
14
|
-
useB3Config,
|
|
15
14
|
useIsMobile,
|
|
16
|
-
useModalStore,
|
|
17
15
|
useSimTokenBalance,
|
|
18
16
|
useTokenData,
|
|
19
17
|
useUnifiedChainSwitchAndExecute,
|
|
20
18
|
} from "@b3dotfun/sdk/global-account/react";
|
|
21
19
|
import { ShinyButton, TextShimmer } from "@b3dotfun/sdk/global-account/react";
|
|
22
|
-
import { thirdwebB3Chain } from "@b3dotfun/sdk/shared/constants/chains/b3Chain";
|
|
23
20
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
24
21
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
25
22
|
import { Check, ChevronDown, ChevronsUpDown, Copy, Loader2, QrCode } from "lucide-react";
|
|
@@ -27,8 +24,10 @@ import { QRCodeSVG } from "qrcode.react";
|
|
|
27
24
|
import { encodeFunctionData, erc20Abi } from "viem";
|
|
28
25
|
import { AnimatePresence, motion } from "motion/react";
|
|
29
26
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
27
|
+
import { useConnectModal } from "thirdweb/react";
|
|
30
28
|
import { TokenSelector } from "@relayprotocol/relay-kit-ui";
|
|
31
29
|
import { ChainTokenIcon } from "../common/ChainTokenIcon";
|
|
30
|
+
import { connectModalConfig } from "../common/CryptoPaymentMethod";
|
|
32
31
|
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
33
32
|
|
|
34
33
|
interface CryptoPayPanelProps {
|
|
@@ -76,11 +75,10 @@ export function CryptoPayPanel({
|
|
|
76
75
|
const [selectedSrcToken, setSelectedSrcToken] = useState<components["schemas"]["Token"] | null>(null);
|
|
77
76
|
const [copied, setCopied] = useState(false);
|
|
78
77
|
|
|
79
|
-
const { address: walletAddress } = useAccountWallet();
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
78
|
+
const { address: walletAddress, connectedEOAWallet } = useAccountWallet();
|
|
79
|
+
const connectedAddress = walletAddress || connectedEOAWallet?.getAccount()?.address;
|
|
80
|
+
const effectiveAddress = connectedAddress || senderAddress;
|
|
81
|
+
const { connect: openConnectModal } = useConnectModal();
|
|
84
82
|
|
|
85
83
|
const { data: dstTokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
86
84
|
|
|
@@ -235,9 +233,8 @@ export function CryptoPayPanel({
|
|
|
235
233
|
/* ------------------------------------------------------------------ */
|
|
236
234
|
const [walletOrderId, setWalletOrderId] = useState<string | undefined>();
|
|
237
235
|
const [isSendingDeposit, setIsSendingDeposit] = useState(false);
|
|
238
|
-
const [depositRejected, setDepositRejected] = useState(false);
|
|
239
236
|
const depositSentRef = useRef(false);
|
|
240
|
-
const {
|
|
237
|
+
const { switchChainAndExecuteWithEOA } = useUnifiedChainSwitchAndExecute();
|
|
241
238
|
|
|
242
239
|
const { createOrder: createSwapOrder, isCreatingOrder: isCreatingSwapOrder } = useAnyspendCreateOrder({
|
|
243
240
|
onSuccess: data => {
|
|
@@ -254,7 +251,7 @@ export function CryptoPayPanel({
|
|
|
254
251
|
|
|
255
252
|
// Auto-send deposit tx once swap order is ready
|
|
256
253
|
useEffect(() => {
|
|
257
|
-
if (!walletOat?.data?.order || depositSentRef.current
|
|
254
|
+
if (!walletOat?.data?.order || depositSentRef.current) return;
|
|
258
255
|
const order = walletOat.data.order;
|
|
259
256
|
if (order.status !== "scanning_deposit_transaction") return;
|
|
260
257
|
if (walletOat.data.depositTxs?.length) return;
|
|
@@ -264,8 +261,9 @@ export function CryptoPayPanel({
|
|
|
264
261
|
try {
|
|
265
262
|
setIsSendingDeposit(true);
|
|
266
263
|
const amount = BigInt(order.srcAmount);
|
|
264
|
+
let txHash: string | undefined;
|
|
267
265
|
if (isNativeToken(order.srcTokenAddress)) {
|
|
268
|
-
await
|
|
266
|
+
txHash = await switchChainAndExecuteWithEOA(order.srcChain, {
|
|
269
267
|
to: order.globalAddress as `0x${string}`,
|
|
270
268
|
value: amount,
|
|
271
269
|
});
|
|
@@ -275,30 +273,33 @@ export function CryptoPayPanel({
|
|
|
275
273
|
functionName: "transfer",
|
|
276
274
|
args: [order.globalAddress as `0x${string}`, amount],
|
|
277
275
|
});
|
|
278
|
-
await
|
|
276
|
+
txHash = await switchChainAndExecuteWithEOA(order.srcChain, {
|
|
279
277
|
to: order.srcTokenAddress as `0x${string}`,
|
|
280
278
|
data,
|
|
281
279
|
value: BigInt(0),
|
|
282
280
|
});
|
|
283
281
|
}
|
|
282
|
+
if (!txHash) {
|
|
283
|
+
// User cancelled or tx failed — reset so they can retry
|
|
284
|
+
depositSentRef.current = false;
|
|
285
|
+
setWalletOrderId(undefined);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
284
288
|
// Deposit sent — notify parent to transition to order lifecycle tracking
|
|
285
289
|
if (walletOrderId) {
|
|
286
290
|
onOrderCreatedRef.current?.(walletOrderId);
|
|
287
291
|
}
|
|
288
292
|
} catch (error: any) {
|
|
289
293
|
depositSentRef.current = false;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
if (isUserRejection) {
|
|
293
|
-
setDepositRejected(true);
|
|
294
|
-
}
|
|
294
|
+
// Reset order so user can retry
|
|
295
|
+
setWalletOrderId(undefined);
|
|
295
296
|
onErrorRef.current?.(error instanceof Error ? error : new Error(error?.message || "Transaction rejected"));
|
|
296
297
|
} finally {
|
|
297
298
|
setIsSendingDeposit(false);
|
|
298
299
|
}
|
|
299
300
|
};
|
|
300
301
|
sendDeposit();
|
|
301
|
-
}, [walletOat,
|
|
302
|
+
}, [walletOat, switchChainAndExecuteWithEOA, walletOrderId]);
|
|
302
303
|
|
|
303
304
|
useOnOrderSuccess({
|
|
304
305
|
orderData: walletOat,
|
|
@@ -309,8 +310,9 @@ export function CryptoPayPanel({
|
|
|
309
310
|
const isWaitingForExecution = !!walletOrderId && walletOat?.data?.order.status !== "executed";
|
|
310
311
|
|
|
311
312
|
const handleWalletPay = useCallback(() => {
|
|
312
|
-
if (!selectedSrcToken || !
|
|
313
|
+
if (!selectedSrcToken || !connectedAddress) return;
|
|
313
314
|
depositSentRef.current = false;
|
|
315
|
+
setWalletOrderId(undefined);
|
|
314
316
|
createSwapOrder({
|
|
315
317
|
recipientAddress,
|
|
316
318
|
orderType: "swap",
|
|
@@ -325,7 +327,7 @@ export function CryptoPayPanel({
|
|
|
325
327
|
});
|
|
326
328
|
}, [
|
|
327
329
|
selectedSrcToken,
|
|
328
|
-
|
|
330
|
+
connectedAddress,
|
|
329
331
|
effectiveAddress,
|
|
330
332
|
recipientAddress,
|
|
331
333
|
selectedSrcChainId,
|
|
@@ -360,14 +362,30 @@ export function CryptoPayPanel({
|
|
|
360
362
|
}
|
|
361
363
|
};
|
|
362
364
|
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
365
|
+
const [shouldAutoPay, setShouldAutoPay] = useState(false);
|
|
366
|
+
|
|
367
|
+
const handleConnectWallet = async () => {
|
|
368
|
+
try {
|
|
369
|
+
const wallet = await openConnectModal(connectModalConfig);
|
|
370
|
+
if (wallet) {
|
|
371
|
+
setShouldAutoPay(true);
|
|
372
|
+
}
|
|
373
|
+
} catch (error) {
|
|
374
|
+
console.error("Failed to connect wallet:", error);
|
|
375
|
+
}
|
|
366
376
|
};
|
|
367
377
|
|
|
378
|
+
// Auto-trigger payment after wallet connect
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
if (shouldAutoPay && connectedAddress && selectedSrcToken && hasEnoughBalance && !isLoadingAnyspendQuote) {
|
|
381
|
+
setShouldAutoPay(false);
|
|
382
|
+
handleWalletPay();
|
|
383
|
+
}
|
|
384
|
+
}, [shouldAutoPay, connectedAddress, selectedSrcToken, hasEnoughBalance, isLoadingAnyspendQuote, handleWalletPay]);
|
|
385
|
+
|
|
368
386
|
const isLoading = isLoadingAnyspendQuote;
|
|
369
387
|
const isPending = isCreatingSwapOrder || isSendingDeposit || isWaitingForExecution;
|
|
370
|
-
const canPay =
|
|
388
|
+
const canPay = connectedAddress && selectedSrcToken && hasEnoughBalance && !isLoading && !isPending;
|
|
371
389
|
|
|
372
390
|
const chainName = ALL_CHAINS[selectedSrcChainId]?.name || "the specified chain";
|
|
373
391
|
const chainLogoUrl = ALL_CHAINS[selectedSrcChainId]?.logoUrl;
|
|
@@ -478,7 +496,7 @@ export function CryptoPayPanel({
|
|
|
478
496
|
|
|
479
497
|
{/* ---- Insufficient balance warning ---- */}
|
|
480
498
|
<AnimatePresence>
|
|
481
|
-
{
|
|
499
|
+
{connectedAddress && selectedSrcToken && !hasEnoughBalance && !isLoading && (
|
|
482
500
|
<motion.p
|
|
483
501
|
key="balance-warning"
|
|
484
502
|
initial={{ opacity: 0, height: 0 }}
|
|
@@ -493,7 +511,7 @@ export function CryptoPayPanel({
|
|
|
493
511
|
</AnimatePresence>
|
|
494
512
|
|
|
495
513
|
{/* ---- Wallet Pay Button ---- */}
|
|
496
|
-
{!
|
|
514
|
+
{!connectedAddress ? (
|
|
497
515
|
<ShinyButton
|
|
498
516
|
accentColor={themeColor || "hsl(var(--as-brand))"}
|
|
499
517
|
onClick={handleConnectWallet}
|
|
@@ -5,6 +5,7 @@ import { formatTokenAmount, safeBigInt } from "@b3dotfun/sdk/shared/utils/number
|
|
|
5
5
|
import { X, Loader2, Check } from "lucide-react";
|
|
6
6
|
import { useState, useCallback } from "react";
|
|
7
7
|
import type { DiscountResult } from "../../../types/forms";
|
|
8
|
+
import { PriceSkeleton } from "./PriceSkeleton";
|
|
8
9
|
|
|
9
10
|
interface DiscountCodeInputProps {
|
|
10
11
|
onApply: (code: string) => Promise<DiscountResult>;
|
|
@@ -13,6 +14,8 @@ interface DiscountCodeInputProps {
|
|
|
13
14
|
loading?: boolean;
|
|
14
15
|
tokenSymbol?: string;
|
|
15
16
|
tokenDecimals?: number;
|
|
17
|
+
/** True while token decimals/symbol are still loading — renders applied amount as skeleton. */
|
|
18
|
+
pricesLoading?: boolean;
|
|
16
19
|
className?: string;
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -29,6 +32,7 @@ export function DiscountCodeInput({
|
|
|
29
32
|
loading = false,
|
|
30
33
|
tokenSymbol = "",
|
|
31
34
|
tokenDecimals = 6,
|
|
35
|
+
pricesLoading = false,
|
|
32
36
|
className,
|
|
33
37
|
}: DiscountCodeInputProps) {
|
|
34
38
|
const [code, setCode] = useState("");
|
|
@@ -67,11 +71,17 @@ export function DiscountCodeInput({
|
|
|
67
71
|
<div className="flex items-center gap-2">
|
|
68
72
|
<Check className="h-4 w-4 text-green-600 dark:text-green-400" />
|
|
69
73
|
<span className="anyspend-discount-value text-sm font-medium text-green-700 dark:text-green-300">
|
|
70
|
-
{appliedDiscount.discount_type === "percentage"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
{appliedDiscount.discount_type === "percentage" ? (
|
|
75
|
+
`${appliedDiscount.discount_value}% off`
|
|
76
|
+
) : appliedDiscount.discount_amount ? (
|
|
77
|
+
pricesLoading ? (
|
|
78
|
+
<PriceSkeleton />
|
|
79
|
+
) : (
|
|
80
|
+
`-${formatAmount(appliedDiscount.discount_amount, tokenDecimals, tokenSymbol)}`
|
|
81
|
+
)
|
|
82
|
+
) : (
|
|
83
|
+
"Discount applied"
|
|
84
|
+
)}
|
|
75
85
|
</span>
|
|
76
86
|
</div>
|
|
77
87
|
<button
|
|
@@ -10,14 +10,20 @@ import { USDC_BASE } from "@b3dotfun/sdk/anyspend/constants";
|
|
|
10
10
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
11
11
|
import { formatUnits } from "@b3dotfun/sdk/shared/utils/number";
|
|
12
12
|
import { getStripePromise } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
ShinyButton,
|
|
15
|
+
TextShimmer,
|
|
16
|
+
useAccountWallet,
|
|
17
|
+
useB3Config,
|
|
18
|
+
useModalStore,
|
|
19
|
+
useTokenData,
|
|
20
|
+
} from "@b3dotfun/sdk/global-account/react";
|
|
14
21
|
import { thirdwebB3Chain } from "@b3dotfun/sdk/shared/constants/chains/b3Chain";
|
|
15
22
|
import { AddressElement, Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
|
|
16
23
|
import type { PaymentIntentResult, StripePaymentElementOptions } from "@stripe/stripe-js";
|
|
17
24
|
import { Loader2, Lock, Wallet } from "lucide-react";
|
|
18
25
|
import { AnimatePresence, motion } from "motion/react";
|
|
19
26
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
20
|
-
import { useAccount } from "wagmi";
|
|
21
27
|
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
22
28
|
import { KycGate } from "./KycGate";
|
|
23
29
|
|
|
@@ -58,7 +64,7 @@ export function FiatCheckoutPanel({
|
|
|
58
64
|
const onErrorRef = useRef(onError);
|
|
59
65
|
onErrorRef.current = onError;
|
|
60
66
|
|
|
61
|
-
const { address } =
|
|
67
|
+
const { address } = useAccountWallet();
|
|
62
68
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
63
69
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
64
70
|
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ShinyButton,
|
|
6
|
+
TextShimmer,
|
|
7
|
+
useAccountWallet,
|
|
8
|
+
useB3Config,
|
|
9
|
+
useModalStore,
|
|
10
|
+
} from "@b3dotfun/sdk/global-account/react";
|
|
5
11
|
import { thirdwebB3Chain } from "@b3dotfun/sdk/shared/constants/chains/b3Chain";
|
|
6
12
|
import { Loader2, ShieldCheck, AlertTriangle, Clock, Wallet } from "lucide-react";
|
|
7
13
|
import { AnimatePresence, motion } from "motion/react";
|
|
8
14
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
9
|
-
import { useAccount } from "wagmi";
|
|
10
15
|
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
11
16
|
import { useCreateKycInquiry, useKycStatus, useVerifyKyc, useWalletAuthHeaders } from "../../hooks/useKycStatus";
|
|
12
17
|
|
|
@@ -20,7 +25,7 @@ interface KycGateProps {
|
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
export function KycGate({ themeColor, classes, enabled = false, onStatusResolved }: KycGateProps) {
|
|
23
|
-
const { address } =
|
|
28
|
+
const { address } = useAccountWallet();
|
|
24
29
|
const { partnerId } = useB3Config();
|
|
25
30
|
// Gate the status fetch behind explicit user consent so the wallet
|
|
26
31
|
// signature prompt doesn't fire automatically on tab open.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
|
+
|
|
5
|
+
interface PriceSkeletonProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function PriceSkeleton({ className }: PriceSkeletonProps) {
|
|
10
|
+
return (
|
|
11
|
+
<span
|
|
12
|
+
className={cn(
|
|
13
|
+
"animate-pulse-fade bg-b3-react-background inline-block h-4 w-16 rounded-md align-middle",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
aria-hidden="true"
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
4
|
import { formatTokenAmount, safeBigInt } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
5
|
import type { ShippingOption } from "../../../types/forms";
|
|
6
|
+
import { PriceSkeleton } from "./PriceSkeleton";
|
|
6
7
|
|
|
7
8
|
interface ShippingSelectorProps {
|
|
8
9
|
options: ShippingOption[];
|
|
@@ -10,6 +11,8 @@ interface ShippingSelectorProps {
|
|
|
10
11
|
onSelect: (option: ShippingOption) => void;
|
|
11
12
|
tokenSymbol?: string;
|
|
12
13
|
tokenDecimals?: number;
|
|
14
|
+
/** True while token decimals/symbol are still loading — renders price as skeleton. */
|
|
15
|
+
pricesLoading?: boolean;
|
|
13
16
|
className?: string;
|
|
14
17
|
}
|
|
15
18
|
|
|
@@ -25,6 +28,7 @@ export function ShippingSelector({
|
|
|
25
28
|
onSelect,
|
|
26
29
|
tokenSymbol = "",
|
|
27
30
|
tokenDecimals = 6,
|
|
31
|
+
pricesLoading = false,
|
|
28
32
|
className,
|
|
29
33
|
}: ShippingSelectorProps) {
|
|
30
34
|
if (options.length === 0) return null;
|
|
@@ -63,7 +67,7 @@ export function ShippingSelector({
|
|
|
63
67
|
</div>
|
|
64
68
|
</div>
|
|
65
69
|
<div className="anyspend-shipping-option-price text-sm font-medium text-gray-900 dark:text-gray-100">
|
|
66
|
-
{formatAmount(option.amount, tokenDecimals, tokenSymbol)}
|
|
70
|
+
{pricesLoading ? <PriceSkeleton /> : formatAmount(option.amount, tokenDecimals, tokenSymbol)}
|
|
67
71
|
</div>
|
|
68
72
|
</label>
|
|
69
73
|
))}
|
|
@@ -17,13 +17,21 @@ export enum CryptoPaymentMethodType {
|
|
|
17
17
|
TRANSFER_CRYPTO = "transfer_crypto",
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const recommendWallets = [
|
|
20
|
+
export const recommendWallets = [
|
|
21
21
|
createWallet("io.metamask"),
|
|
22
22
|
createWallet("com.coinbase.wallet"),
|
|
23
23
|
createWallet("me.rainbow"),
|
|
24
24
|
createWallet("io.rabby"),
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
+
export const connectModalConfig = {
|
|
28
|
+
client,
|
|
29
|
+
setActive: false as const,
|
|
30
|
+
size: "compact" as const,
|
|
31
|
+
showThirdwebBranding: false,
|
|
32
|
+
wallets: recommendWallets,
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
interface CryptoPaymentMethodProps {
|
|
28
36
|
selectedPaymentMethod: CryptoPaymentMethodType;
|
|
29
37
|
setSelectedPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
@@ -65,13 +73,7 @@ export function CryptoPaymentMethod({
|
|
|
65
73
|
disconnect(connectedEOAWallet);
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
const wallet = await openConnectModal(
|
|
69
|
-
client,
|
|
70
|
-
setActive: false,
|
|
71
|
-
size: "compact",
|
|
72
|
-
showThirdwebBranding: false,
|
|
73
|
-
wallets: recommendWallets,
|
|
74
|
-
});
|
|
76
|
+
const wallet = await openConnectModal(connectModalConfig);
|
|
75
77
|
|
|
76
78
|
if (wallet) {
|
|
77
79
|
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
11
11
|
import { Badge, CopyToClipboard, ShinyButton, TextLoop } from "@b3dotfun/sdk/global-account/react";
|
|
12
12
|
import { cn } from "@b3dotfun/sdk/shared/utils";
|
|
13
|
-
import {
|
|
13
|
+
import { b3Viem } from "@b3dotfun/sdk/shared/constants/chains/b3Viem";
|
|
14
14
|
|
|
15
15
|
import { toast } from "@b3dotfun/sdk/global-account/react";
|
|
16
16
|
import { formatUnits } from "@b3dotfun/sdk/shared/utils/number";
|
|
@@ -63,7 +63,7 @@ export function InsufficientDepositPayment({
|
|
|
63
63
|
<img
|
|
64
64
|
src={ALL_CHAINS[order.srcChain].logoUrl}
|
|
65
65
|
alt={getChainName(order.srcChain)}
|
|
66
|
-
className={cn("h-6 rounded-full", order.srcChain ===
|
|
66
|
+
className={cn("h-6 rounded-full", order.srcChain === b3Viem.id && "h-5 rounded-none")}
|
|
67
67
|
/>
|
|
68
68
|
</Badge>
|
|
69
69
|
</div>
|