@b3dotfun/sdk 0.1.69-alpha.2 → 0.1.69-alpha.20
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 +10 -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/FiatCheckoutPanel.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/KycGate.js +1 -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 +10 -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/FiatCheckoutPanel.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/KycGate.js +2 -3
- 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/CheckoutSuccess.d.ts +2 -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 +15 -1
- 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/FiatCheckoutPanel.tsx +9 -3
- package/src/anyspend/react/components/checkout/KycGate.tsx +8 -3
- 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
|
@@ -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}
|
|
@@ -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.
|
|
@@ -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({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ANYSPEND_MAINNET_BASE_URL } from "@b3dotfun/sdk/anyspend/constants";
|
|
4
|
+
import { useAccountWallet } from "@b3dotfun/sdk/global-account/react";
|
|
4
5
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
5
6
|
import { useCallback } from "react";
|
|
6
|
-
import { useAccount, useSignMessage } from "wagmi";
|
|
7
7
|
|
|
8
8
|
export interface KycStatusResponse {
|
|
9
9
|
kycRequired: boolean;
|
|
@@ -46,14 +46,17 @@ export function getCachedWalletHeaders(address: string): Record<string, string>
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Returns a function that builds the wallet-signature auth headers.
|
|
49
|
+
* Uses useAccountWallet (thirdweb) instead of wagmi so signing works
|
|
50
|
+
* for all wallet types (social login, EOA, smart wallet, etc.).
|
|
49
51
|
* Caches signatures for 4 minutes (server allows 5-minute window).
|
|
50
52
|
*/
|
|
51
53
|
export function useWalletAuthHeaders() {
|
|
52
|
-
const { address } =
|
|
53
|
-
const
|
|
54
|
+
const { address, wallet } = useAccountWallet();
|
|
55
|
+
const signMessage = wallet.signMessage;
|
|
54
56
|
|
|
55
57
|
const getHeaders = useCallback(async (): Promise<Record<string, string>> => {
|
|
56
58
|
if (!address) throw new Error("No wallet connected");
|
|
59
|
+
if (!signMessage) throw new Error("Wallet does not support message signing");
|
|
57
60
|
const walletAddress = address.toLowerCase();
|
|
58
61
|
|
|
59
62
|
const cached = headerCache.get(walletAddress);
|
|
@@ -61,7 +64,7 @@ export function useWalletAuthHeaders() {
|
|
|
61
64
|
|
|
62
65
|
const timestamp = Math.floor(Date.now() / 1000);
|
|
63
66
|
const message = buildWalletAuthMessage(walletAddress, timestamp);
|
|
64
|
-
const signature = await
|
|
67
|
+
const signature = await signMessage({ message });
|
|
65
68
|
|
|
66
69
|
const headers = {
|
|
67
70
|
"X-Wallet-Address": walletAddress,
|
|
@@ -71,7 +74,7 @@ export function useWalletAuthHeaders() {
|
|
|
71
74
|
// Cache for 4 minutes so repeated fetches don't re-prompt the user
|
|
72
75
|
headerCache.set(walletAddress, { headers, expiresAt: Date.now() + 4 * 60 * 1000 });
|
|
73
76
|
return headers;
|
|
74
|
-
}, [address,
|
|
77
|
+
}, [address, signMessage]);
|
|
75
78
|
|
|
76
79
|
return { address, getHeaders };
|
|
77
80
|
}
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
ABSTRACT_PUBLIC_RPC,
|
|
4
4
|
ARBITRUM_PUBLIC_RPC,
|
|
5
5
|
AVALANCHE_PUBLIC_RPC,
|
|
6
|
-
B3_PUBLIC_RPC,
|
|
7
6
|
BASE_PUBLIC_RPC,
|
|
8
7
|
BSC_PUBLIC_RPC,
|
|
9
8
|
ETHEREUM_PUBLIC_RPC,
|
|
@@ -12,6 +11,7 @@ import {
|
|
|
12
11
|
POLYGON_PUBLIC_RPC,
|
|
13
12
|
} from "@b3dotfun/sdk/anyspend/constants/rpc";
|
|
14
13
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
14
|
+
import { b3Viem } from "@b3dotfun/sdk/shared/constants/chains/b3Viem";
|
|
15
15
|
import invariant from "invariant";
|
|
16
16
|
import {
|
|
17
17
|
Account,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
Transport,
|
|
26
26
|
WalletClient,
|
|
27
27
|
} from "viem";
|
|
28
|
-
import { abstract, arbitrum, avalanche,
|
|
28
|
+
import { abstract, arbitrum, avalanche, base, bsc, mainnet, optimism, polygon } from "viem/chains";
|
|
29
29
|
import { ChainType, IBaseChain, IEVMChain, IHyperliquidChain, ISolanaChain } from "../types/chain";
|
|
30
30
|
import {
|
|
31
31
|
getAvaxToken,
|
|
@@ -203,16 +203,16 @@ export const EVM_MAINNET: Record<number, IEVMChain> = {
|
|
|
203
203
|
coingeckoName: "bsc",
|
|
204
204
|
wethAddress: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
|
|
205
205
|
},
|
|
206
|
-
[
|
|
207
|
-
id:
|
|
208
|
-
name:
|
|
206
|
+
[b3Viem.id]: {
|
|
207
|
+
id: b3Viem.id,
|
|
208
|
+
name: b3Viem.name,
|
|
209
209
|
logoUrl: "https://assets.relay.link/icons/square/8333/light.png",
|
|
210
210
|
type: ChainType.EVM,
|
|
211
211
|
nativeRequired: parseEther("0.0001"),
|
|
212
212
|
canDepositNative: true,
|
|
213
|
-
defaultToken: getEthToken(
|
|
214
|
-
nativeToken: getEthToken(
|
|
215
|
-
viem:
|
|
213
|
+
defaultToken: getEthToken(b3Viem.id),
|
|
214
|
+
nativeToken: getEthToken(b3Viem.id),
|
|
215
|
+
viem: b3Viem,
|
|
216
216
|
pollingInterval: 1000, // 1 second for B3
|
|
217
217
|
zapperEnum: "B3_MAINNET",
|
|
218
218
|
coingeckoName: "b3",
|
|
@@ -605,7 +605,7 @@ export function getPaymentUrl(
|
|
|
605
605
|
}
|
|
606
606
|
|
|
607
607
|
export function getExplorerTxUrl(chainId: number, txHash: string) {
|
|
608
|
-
if (chainId ===
|
|
608
|
+
if (chainId === b3Viem.id) {
|
|
609
609
|
return "https://explorer.b3.fun/b3/tx/" + txHash;
|
|
610
610
|
}
|
|
611
611
|
if (EVM_CHAINS[chainId]) {
|