@b3dotfun/sdk 0.1.69 → 0.1.70-alpha.1
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/AnySpend.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -4
- 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 +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +4 -4
- 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/AnySpendStakeUpside.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- 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/AvatarEditor/AvatarEditor.js +3 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +8 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +27 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +11 -13
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -8
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.js +31 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +121 -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/BottomNavigation.js +4 -2
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +36 -4
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +4 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +17 -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 +14 -29
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +27 -16
- 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 +68 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +39 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +173 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +85 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +14 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +14 -5
- package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +10 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.js +10 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +8 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +141 -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/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/cjs/global-account/react/components/UserAvatar/UserAvatar.js +27 -0
- package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/cjs/global-account/react/components/index.d.ts +6 -0
- package/dist/cjs/global-account/react/components/index.js +14 -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/useAutoSelectWallet.d.ts +6 -3
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.js +31 -3
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +159 -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/hooks/useTWAuth.js +0 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +14 -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/constants/index.d.ts +1 -0
- package/dist/cjs/shared/constants/index.js +2 -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/AnySpend.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +12 -4
- 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 +2 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +4 -4
- 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/AnySpendStakeUpside.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.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/AvatarEditor/AvatarEditor.js +3 -1
- package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +3 -1
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +8 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +3 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +27 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +6 -8
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +4 -6
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.js +27 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +116 -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/BottomNavigation.js +5 -3
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +37 -5
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +4 -1
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +7 -1
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +16 -8
- 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 +16 -31
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +27 -16
- 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 +65 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +39 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +170 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +82 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +15 -5
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +14 -5
- package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +11 -2
- package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.js +7 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +8 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +138 -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/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/esm/global-account/react/components/UserAvatar/UserAvatar.js +21 -0
- package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/esm/global-account/react/components/index.d.ts +6 -0
- package/dist/esm/global-account/react/components/index.js +6 -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/useAutoSelectWallet.d.ts +6 -3
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.js +33 -5
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +151 -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/hooks/useTWAuth.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +14 -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/constants/index.d.ts +1 -0
- package/dist/esm/shared/constants/index.js +1 -0
- 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/AnySpend.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -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/AuthenticationProvider.d.ts +3 -1
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +8 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +27 -2
- package/dist/types/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
- 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 +39 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/types/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +8 -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/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/types/global-account/react/components/index.d.ts +6 -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/useAutoSelectWallet.d.ts +6 -3
- 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 +14 -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/constants/index.d.ts +1 -0
- 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/AnySpend.tsx +24 -12
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +12 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +38 -31
- package/src/anyspend/react/components/AnySpendNFT.tsx +6 -2
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -2
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -2
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +4 -0
- 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/AvatarEditor/AvatarEditor.tsx +3 -1
- package/src/global-account/react/components/B3DynamicModal.tsx +5 -2
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +4 -0
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +12 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +16 -21
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +78 -38
- package/src/global-account/react/components/B3Provider/BetterAuthClientProvider.tsx +40 -0
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +128 -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/BottomNavigation.tsx +18 -14
- package/src/global-account/react/components/ManageAccount/Header.tsx +71 -4
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +25 -19
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +13 -0
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +40 -15
- package/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx +107 -0
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +35 -54
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +31 -22
- package/src/global-account/react/components/Send/Send.tsx +8 -5
- package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +145 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +446 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.tsx +155 -0
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +42 -13
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +20 -4
- package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +21 -2
- package/src/global-account/react/components/SignInWithB3/components/PasswordInput.tsx +62 -0
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +315 -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/UserAvatar/UserAvatar.tsx +45 -0
- package/src/global-account/react/components/index.ts +12 -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/useAutoSelectWallet.ts +40 -6
- package/src/global-account/react/hooks/useBetterAuth.ts +193 -0
- package/src/global-account/react/hooks/useConnect.tsx +2 -2
- package/src/global-account/react/hooks/useTWAuth.tsx +0 -1
- package/src/global-account/react/stores/useModalStore.ts +15 -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/constants/index.ts +2 -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
|
@@ -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>
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
useB3Config,
|
|
25
25
|
useModalStore,
|
|
26
26
|
useProfile,
|
|
27
|
+
useToastContext,
|
|
27
28
|
useUnifiedChainSwitchAndExecute,
|
|
28
29
|
} from "@b3dotfun/sdk/global-account/react";
|
|
29
30
|
import { useRouter, useSearchParams } from "@b3dotfun/sdk/shared/react/hooks";
|
|
@@ -40,7 +41,7 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
40
41
|
import TimeAgo from "react-timeago";
|
|
41
42
|
|
|
42
43
|
import { encodeFunctionData, erc20Abi } from "viem";
|
|
43
|
-
import {
|
|
44
|
+
import { b3Viem } from "@b3dotfun/sdk/shared/constants/chains/b3Viem";
|
|
44
45
|
import { useWaitForTransactionReceipt, useWalletClient } from "wagmi";
|
|
45
46
|
import { usePhantomTransfer } from "../../hooks/usePhantomTransfer";
|
|
46
47
|
import type { OrderDetailsClasses } from "../types/classes";
|
|
@@ -231,6 +232,13 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
231
232
|
const router = useRouter();
|
|
232
233
|
const searchParams = useSearchParams();
|
|
233
234
|
|
|
235
|
+
const { setHeaderMode } = useToastContext();
|
|
236
|
+
|
|
237
|
+
useEffect(() => {
|
|
238
|
+
setHeaderMode(true);
|
|
239
|
+
return () => setHeaderMode(false);
|
|
240
|
+
}, [setHeaderMode]);
|
|
241
|
+
|
|
234
242
|
// Get theme from B3Provider context
|
|
235
243
|
const { theme } = useB3Config();
|
|
236
244
|
const colorMode = theme || "light";
|
|
@@ -1011,7 +1019,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1011
1019
|
<img
|
|
1012
1020
|
src={ALL_CHAINS[order.srcChain].logoUrl}
|
|
1013
1021
|
alt={getChainName(order.srcChain)}
|
|
1014
|
-
className={cn("h-6 rounded-full", order.srcChain ===
|
|
1022
|
+
className={cn("h-6 rounded-full", order.srcChain === b3Viem.id && "h-5 rounded-none")}
|
|
1015
1023
|
/>
|
|
1016
1024
|
</Badge>
|
|
1017
1025
|
</div>
|
|
@@ -11,7 +11,7 @@ import { ChevronDown, Copy } from "lucide-react";
|
|
|
11
11
|
import { motion } from "motion/react";
|
|
12
12
|
import { memo, useState } from "react";
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { b3Viem } from "@b3dotfun/sdk/shared/constants/chains/b3Viem";
|
|
15
15
|
import type { OrderDetailsCollapsibleClasses } from "../types/classes";
|
|
16
16
|
|
|
17
17
|
type Order = components["schemas"]["Order"];
|
|
@@ -154,15 +154,15 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
|
154
154
|
|
|
155
155
|
<div className="order-details-chain-info text-as-primary/50 flex items-center gap-2">
|
|
156
156
|
<span className="order-details-chain-text">
|
|
157
|
-
on {order.dstChain !==
|
|
157
|
+
on {order.dstChain !== b3Viem.id && getChainName(order.dstChain)}
|
|
158
158
|
</span>
|
|
159
159
|
<img
|
|
160
160
|
src={ALL_CHAINS[order.dstChain].logoUrl}
|
|
161
161
|
alt={getChainName(order.dstChain)}
|
|
162
162
|
className={cn(
|
|
163
163
|
"order-details-chain-logo h-3",
|
|
164
|
-
order.dstChain !==
|
|
165
|
-
order.dstChain ===
|
|
164
|
+
order.dstChain !== b3Viem.id && "w-3 rounded-full",
|
|
165
|
+
order.dstChain === b3Viem.id && "h-4",
|
|
166
166
|
)}
|
|
167
167
|
/>
|
|
168
168
|
</div>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getStatusDisplay } from "@b3dotfun/sdk/anyspend";
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
3
|
import { useSearchParams } from "@b3dotfun/sdk/shared/react";
|
|
4
|
-
import { Clock, Loader2, RotateCcw, X } from "lucide-react";
|
|
4
|
+
import { AlertCircle, AlertTriangle, CheckCircle, Clock, Info, Loader2, RotateCcw, X } from "lucide-react";
|
|
5
|
+
import { useToastContext } from "@b3dotfun/sdk/global-account/react";
|
|
6
|
+
import type { ToastType } from "@b3dotfun/sdk/global-account/react";
|
|
5
7
|
import React, { memo, useEffect, useRef } from "react";
|
|
6
8
|
import { useAnySpendCustomization } from "../context/AnySpendCustomizationContext";
|
|
7
9
|
import { AnimatedCheckmark } from "../icons/AnimatedCheckmark";
|
|
@@ -15,6 +17,20 @@ function getStepIndex(status: string): number {
|
|
|
15
17
|
return -1;
|
|
16
18
|
}
|
|
17
19
|
|
|
20
|
+
function getToastIcon(type: ToastType): React.ReactNode {
|
|
21
|
+
const iconClass = "h-5 w-5";
|
|
22
|
+
switch (type) {
|
|
23
|
+
case "success":
|
|
24
|
+
return <CheckCircle className={`${iconClass} text-green-500`} />;
|
|
25
|
+
case "error":
|
|
26
|
+
return <AlertCircle className={`${iconClass} text-red-500`} />;
|
|
27
|
+
case "info":
|
|
28
|
+
return <Info className={`${iconClass} text-blue-500`} />;
|
|
29
|
+
case "warning":
|
|
30
|
+
return <AlertTriangle className={`${iconClass} text-amber-500`} />;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
export const OrderStatus = memo(function OrderStatus({
|
|
19
35
|
order,
|
|
20
36
|
selectedCryptoPaymentMethod,
|
|
@@ -56,9 +72,28 @@ export const OrderStatus = memo(function OrderStatus({
|
|
|
56
72
|
if (content.processingDescription) description = content.processingDescription;
|
|
57
73
|
}
|
|
58
74
|
|
|
75
|
+
const { latestToast } = useToastContext();
|
|
76
|
+
|
|
77
|
+
// Override subtitle with toast notification when present (title stays unchanged)
|
|
78
|
+
let notificationIcon: React.ReactNode = undefined;
|
|
79
|
+
if (latestToast && currentStepIndex >= 0) {
|
|
80
|
+
description = latestToast.message;
|
|
81
|
+
notificationIcon = getToastIcon(latestToast.type);
|
|
82
|
+
}
|
|
83
|
+
|
|
59
84
|
const paymentSteps: Step[] = [
|
|
60
|
-
{
|
|
61
|
-
|
|
85
|
+
{
|
|
86
|
+
id: 1,
|
|
87
|
+
title: text,
|
|
88
|
+
description: typeof description === "string" ? description : defaultDescription || "",
|
|
89
|
+
icon: notificationIcon,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 2,
|
|
93
|
+
title: text,
|
|
94
|
+
description: typeof description === "string" ? description : defaultDescription || "",
|
|
95
|
+
icon: notificationIcon,
|
|
96
|
+
},
|
|
62
97
|
];
|
|
63
98
|
|
|
64
99
|
if (currentStepIndex === 0) {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import React from "react";
|
|
3
4
|
import { motion } from "framer-motion";
|
|
5
|
+
import { TextMorph } from "torph/react";
|
|
4
6
|
import { AnimatedCheckmark } from "../icons/AnimatedCheckmark";
|
|
5
7
|
|
|
6
8
|
export interface Step {
|
|
7
9
|
id: string | number;
|
|
8
10
|
title: string;
|
|
9
11
|
description?: string;
|
|
12
|
+
icon?: React.ReactNode;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
export interface StepProgressProps {
|
|
@@ -32,8 +35,8 @@ export function StepProgress({
|
|
|
32
35
|
{/* Step Progress Indicator */}
|
|
33
36
|
<div className="flex items-center gap-2">
|
|
34
37
|
{steps.map((_, index) => (
|
|
35
|
-
|
|
36
|
-
<div
|
|
38
|
+
<React.Fragment key={index}>
|
|
39
|
+
<div className="flex items-center">
|
|
37
40
|
{index < currentStepIndex ? (
|
|
38
41
|
// Completed step - checkmark replaces the whole circle
|
|
39
42
|
<motion.div
|
|
@@ -71,7 +74,7 @@ export function StepProgress({
|
|
|
71
74
|
))}
|
|
72
75
|
</div>
|
|
73
76
|
)}
|
|
74
|
-
|
|
77
|
+
</React.Fragment>
|
|
75
78
|
))}
|
|
76
79
|
</div>
|
|
77
80
|
|
|
@@ -83,8 +86,15 @@ export function StepProgress({
|
|
|
83
86
|
transition={{ delay: 0.3 }}
|
|
84
87
|
className="text-center"
|
|
85
88
|
>
|
|
86
|
-
<h2 className="text-as-primary text-xl font-semibold">
|
|
87
|
-
|
|
89
|
+
<h2 className="text-as-primary text-xl font-semibold">
|
|
90
|
+
<TextMorph>{currentStep.title}</TextMorph>
|
|
91
|
+
</h2>
|
|
92
|
+
{currentStep.description && (
|
|
93
|
+
<p className="text-as-tertiary mt-1 flex items-center justify-center gap-1.5 text-sm">
|
|
94
|
+
{currentStep.icon}
|
|
95
|
+
<TextMorph>{currentStep.description}</TextMorph>
|
|
96
|
+
</p>
|
|
97
|
+
)}
|
|
88
98
|
</motion.div>
|
|
89
99
|
)}
|
|
90
100
|
</div>
|
|
@@ -10,7 +10,7 @@ import { ChevronLeft, Copy } from "lucide-react";
|
|
|
10
10
|
import { QRCodeSVG } from "qrcode.react";
|
|
11
11
|
import { memo, useEffect, useMemo, useState } from "react";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { b3Viem } from "@b3dotfun/sdk/shared/constants/chains/b3Viem";
|
|
14
14
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
15
15
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
|
|
16
16
|
import { PaymentMethodSwitch } from "./PaymentMethodSwitch";
|
|
@@ -193,7 +193,7 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
193
193
|
alt={getChainName(order.srcChain)}
|
|
194
194
|
className={cn(
|
|
195
195
|
"order-transfer-crypto-chain-logo h-6 rounded-full",
|
|
196
|
-
order.srcChain ===
|
|
196
|
+
order.srcChain === b3Viem.id && "h-5 rounded-none",
|
|
197
197
|
)}
|
|
198
198
|
/>
|
|
199
199
|
<span className="order-transfer-crypto-chain-name text-as-primary text-sm font-semibold">
|
|
@@ -11,9 +11,8 @@ import { useMemo } from "react";
|
|
|
11
11
|
|
|
12
12
|
import { parseUnits } from "viem";
|
|
13
13
|
import { base } from "viem/chains";
|
|
14
|
-
import { useAccount } from "wagmi";
|
|
15
14
|
import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
16
|
-
import { getCachedWalletHeaders } from "./useKycStatus";
|
|
15
|
+
import { getCachedWalletHeaders, useWalletAuthHeaders } from "./useKycStatus";
|
|
17
16
|
import { useValidatedClientReferenceId } from "./useValidatedClientReferenceId";
|
|
18
17
|
|
|
19
18
|
export type OnrampOptions = {
|
|
@@ -42,7 +41,7 @@ export type UseAnyspendCreateOnrampOrderProps = {
|
|
|
42
41
|
export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspendCreateOnrampOrderProps = {}) {
|
|
43
42
|
// Get B3 context values
|
|
44
43
|
const { partnerId } = useB3Config();
|
|
45
|
-
const { address } =
|
|
44
|
+
const { address, getHeaders: getWalletAuthHeaders } = useWalletAuthHeaders();
|
|
46
45
|
|
|
47
46
|
// Get validated client reference ID from B3 context
|
|
48
47
|
const createValidatedClientReferenceId = useValidatedClientReferenceId();
|
|
@@ -86,12 +85,11 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspend
|
|
|
86
85
|
|
|
87
86
|
// For card payments, include wallet auth headers so the backend can verify
|
|
88
87
|
// KYC by the signing wallet address (may differ from the B3 JWT address).
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
// KycGate pre-caches the headers in the "Continue to Verify" user-gesture.
|
|
88
|
+
// First try cached headers (from KycGate), then sign on-the-fly.
|
|
89
|
+
// The user is already clicking "Continue"/"Pay" so signing here is acceptable.
|
|
92
90
|
let kycWalletHeaders: Record<string, string> | undefined;
|
|
93
91
|
if (onramp.vendor === "stripe-web2" && address) {
|
|
94
|
-
kycWalletHeaders = getCachedWalletHeaders(address);
|
|
92
|
+
kycWalletHeaders = getCachedWalletHeaders(address) || (await getWalletAuthHeaders());
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
return await anyspendService.createOrder({
|