@b3dotfun/sdk 0.1.69-alpha.2 → 0.1.69-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/rpc.d.ts +1 -1
- package/dist/cjs/anyspend/constants/rpc.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +1 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +15 -6
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +43 -23
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/KycGate.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +10 -9
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +7 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +37 -6
- package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/StepProgress.js +7 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -6
- package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/cjs/anyspend/react/hooks/useKycStatus.js +11 -7
- package/dist/cjs/anyspend/utils/chain.js +8 -7
- package/dist/cjs/app.shared.js +9 -7
- package/dist/cjs/global-account/better-auth-client.d.ts +1883 -0
- package/dist/cjs/global-account/better-auth-client.js +17 -0
- package/dist/cjs/global-account/bsmnt.d.ts +0 -1
- package/dist/cjs/global-account/bsmnt.js +0 -6
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +9 -12
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -8
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +120 -0
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
- package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +15 -6
- package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.js +57 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
- package/dist/cjs/global-account/react/components/Send/Send.js +5 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +67 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +163 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +10 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +138 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +96 -15
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +20 -3
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/cjs/global-account/react/components/Toast/ToastContext.js +30 -7
- package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/cjs/global-account/react/components/index.d.ts +3 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +5 -2
- package/dist/cjs/global-account/react/hooks/useAuth.js +26 -15
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +23 -12
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +157 -0
- package/dist/cjs/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/cjs/global-account/react/utils/createWagmiConfig.js +5 -24
- package/dist/cjs/global-account/react/utils/index.d.ts +0 -1
- package/dist/cjs/global-account/react/utils/index.js +0 -1
- package/dist/cjs/global-account/react/utils/profileDisplay.js +17 -18
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/cjs/shared/constants/chains/b3Chain.js +4 -4
- package/dist/cjs/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/cjs/shared/constants/chains/b3Viem.js +19 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
- package/dist/cjs/shared/generated/chain-networks.json +2 -2
- package/dist/cjs/shared/utils/chains.d.ts +1 -1
- package/dist/cjs/shared/utils/chains.js +2 -2
- package/dist/cjs/shared/utils/session-duration.d.ts +15 -0
- package/dist/cjs/shared/utils/session-duration.js +69 -0
- package/dist/cjs/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/cjs/wallet/react/components/ConnectWallet.js +467 -0
- package/dist/cjs/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/cjs/wallet/react/components/WalletProvider.js +20 -0
- package/dist/cjs/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/cjs/wallet/react/hooks/useWalletDisconnect.js +22 -0
- package/dist/cjs/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/cjs/wallet/react/hooks/useWalletState.js +63 -0
- package/dist/cjs/wallet/react/index.d.ts +5 -0
- package/dist/cjs/wallet/react/index.js +16 -0
- package/dist/cjs/wallet/utils/createWalletConfig.d.ts +21 -0
- package/dist/cjs/wallet/utils/createWalletConfig.js +24 -0
- package/dist/esm/anyspend/constants/rpc.d.ts +1 -1
- package/dist/esm/anyspend/constants/rpc.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +15 -6
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/esm/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +44 -24
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/KycGate.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -8
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -3
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +34 -3
- package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/StepProgress.js +4 -2
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -7
- package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/esm/anyspend/react/hooks/useKycStatus.js +9 -5
- package/dist/esm/anyspend/utils/chain.js +10 -9
- package/dist/esm/app.shared.js +9 -7
- package/dist/esm/global-account/better-auth-client.d.ts +1883 -0
- package/dist/esm/global-account/better-auth-client.js +13 -0
- package/dist/esm/global-account/bsmnt.d.ts +0 -1
- package/dist/esm/global-account/bsmnt.js +0 -5
- package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -7
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +4 -6
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +115 -0
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
- package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +13 -7
- package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.js +52 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
- package/dist/esm/global-account/react/components/Send/Send.js +5 -2
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +64 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +160 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
- package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +11 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +135 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +100 -19
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +19 -2
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/esm/global-account/react/components/Toast/ToastContext.js +30 -7
- package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/esm/global-account/react/components/index.d.ts +3 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuth.js +28 -17
- package/dist/esm/global-account/react/hooks/useAuthentication.js +24 -13
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +149 -0
- package/dist/esm/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/esm/global-account/react/utils/createWagmiConfig.js +5 -23
- package/dist/esm/global-account/react/utils/index.d.ts +0 -1
- package/dist/esm/global-account/react/utils/index.js +0 -1
- package/dist/esm/global-account/react/utils/profileDisplay.js +17 -18
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/esm/shared/constants/chains/b3Chain.js +4 -4
- package/dist/esm/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/esm/shared/constants/chains/b3Viem.js +16 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
- package/dist/esm/shared/generated/chain-networks.json +2 -2
- package/dist/esm/shared/utils/chains.d.ts +1 -1
- package/dist/esm/shared/utils/chains.js +2 -2
- package/dist/esm/shared/utils/session-duration.d.ts +15 -0
- package/dist/esm/shared/utils/session-duration.js +64 -0
- package/dist/esm/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/esm/wallet/react/components/ConnectWallet.js +431 -0
- package/dist/esm/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/esm/wallet/react/components/WalletProvider.js +17 -0
- package/dist/esm/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/esm/wallet/react/hooks/useWalletDisconnect.js +19 -0
- package/dist/esm/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/esm/wallet/react/hooks/useWalletState.js +60 -0
- package/dist/esm/wallet/react/index.d.ts +5 -0
- package/dist/esm/wallet/react/index.js +8 -0
- package/dist/esm/wallet/utils/createWalletConfig.d.ts +21 -0
- package/dist/esm/wallet/utils/createWalletConfig.js +21 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/rpc.d.ts +1 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/types/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/types/global-account/better-auth-client.d.ts +1883 -0
- package/dist/types/global-account/bsmnt.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/types/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/types/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/types/global-account/react/components/index.d.ts +3 -0
- package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/types/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/types/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/types/global-account/react/utils/index.d.ts +0 -1
- package/dist/types/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/types/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/types/shared/constants/chains/supported.d.ts +1 -1
- package/dist/types/shared/utils/chains.d.ts +1 -1
- package/dist/types/shared/utils/session-duration.d.ts +15 -0
- package/dist/types/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/types/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/types/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/types/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/types/wallet/react/index.d.ts +5 -0
- package/dist/types/wallet/utils/createWalletConfig.d.ts +21 -0
- package/package.json +15 -6
- package/src/anyspend/constants/rpc.ts +2 -1
- package/src/anyspend/react/components/AnySpendNFT.tsx +2 -2
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -2
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -2
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +25 -5
- package/src/anyspend/react/components/checkout/CartItemRow.tsx +2 -1
- package/src/anyspend/react/components/checkout/CartSummary.tsx +24 -20
- package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +12 -3
- package/src/anyspend/react/components/checkout/CheckoutFormPanel.tsx +5 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +2 -4
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +13 -3
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +45 -27
- package/src/anyspend/react/components/checkout/DiscountCodeInput.tsx +15 -5
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +9 -3
- package/src/anyspend/react/components/checkout/KycGate.tsx +8 -3
- package/src/anyspend/react/components/checkout/PriceSkeleton.tsx +19 -0
- package/src/anyspend/react/components/checkout/ShippingSelector.tsx +5 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +10 -8
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +10 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +4 -4
- package/src/anyspend/react/components/common/OrderStatus.tsx +38 -3
- package/src/anyspend/react/components/common/StepProgress.tsx +15 -5
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -7
- package/src/anyspend/react/hooks/useKycStatus.ts +8 -5
- package/src/anyspend/utils/chain.ts +9 -9
- package/src/app.shared.ts +9 -8
- package/src/global-account/better-auth-client.ts +17 -0
- package/src/global-account/bsmnt.ts +0 -6
- package/src/global-account/react/components/B3DynamicModal.tsx +5 -2
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +16 -21
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +52 -40
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +127 -0
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
- package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +17 -10
- package/src/global-account/react/components/LinkAccount/LinkedAccountItem.tsx +2 -1
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +29 -11
- package/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx +107 -0
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +28 -30
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -2
- package/src/global-account/react/components/Send/Send.tsx +8 -5
- package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +146 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +426 -0
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -4
- package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +21 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +308 -0
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +207 -54
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +24 -4
- package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +2 -1
- package/src/global-account/react/components/Toast/ToastContext.tsx +39 -7
- package/src/global-account/react/components/index.ts +3 -0
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +28 -17
- package/src/global-account/react/hooks/useAuthentication.ts +24 -13
- package/src/global-account/react/hooks/useBetterAuth.ts +191 -0
- package/src/global-account/react/hooks/useConnect.tsx +2 -2
- package/src/global-account/react/stores/useModalStore.ts +11 -0
- package/src/global-account/react/utils/createWagmiConfig.tsx +6 -25
- package/src/global-account/react/utils/index.ts +0 -1
- package/src/global-account/react/utils/profileDisplay.ts +21 -19
- package/src/shared/constants/chains/b3Chain.ts +5 -5
- package/src/shared/constants/chains/b3Viem.ts +18 -0
- package/src/shared/generated/chain-networks.json +2 -2
- package/src/shared/utils/chains.ts +3 -2
- package/src/shared/utils/session-duration.ts +64 -0
- package/src/types/torph.d.ts +4 -0
- package/src/wallet/__tests__/createWalletConfig.test.ts +39 -0
- package/src/wallet/react/components/ConnectWallet.tsx +665 -0
- package/src/wallet/react/components/WalletProvider.tsx +64 -0
- package/src/wallet/react/hooks/useWalletDisconnect.ts +22 -0
- package/src/wallet/react/hooks/useWalletState.ts +93 -0
- package/src/wallet/react/index.ts +10 -0
- package/src/wallet/utils/createWalletConfig.ts +39 -0
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -54
- package/dist/cjs/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/cjs/global-account/react/components/ProfileAvatar.js +0 -127
- package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/cjs/global-account/react/hooks/useRPMToken.js +0 -11
- package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/dist/cjs/global-account/react/utils/updateAvatar.js +0 -54
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -51
- package/dist/esm/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/esm/global-account/react/components/ProfileAvatar.js +0 -127
- package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/esm/global-account/react/hooks/useRPMToken.js +0 -8
- package/dist/esm/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/dist/esm/global-account/react/utils/updateAvatar.js +0 -18
- package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/types/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/types/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/types/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +0 -90
- package/src/global-account/react/components/ProfileAvatar.tsx +0 -138
- package/src/global-account/react/hooks/useRPMToken.ts +0 -17
- package/src/global-account/react/utils/updateAvatar.ts +0 -21
|
@@ -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]) {
|
package/src/app.shared.ts
CHANGED
|
@@ -2,12 +2,11 @@ import { ClientApplication } from "@b3dotfun/b3-api";
|
|
|
2
2
|
import { AuthenticationClient } from "@feathersjs/authentication-client";
|
|
3
3
|
import Cookies from "js-cookie";
|
|
4
4
|
import { B3_AUTH_COOKIE_NAME } from "./shared/constants";
|
|
5
|
+
import { getSessionDurationDays } from "./shared/utils/session-duration";
|
|
5
6
|
|
|
6
7
|
export const B3_API_URL =
|
|
7
8
|
process.env.EXPO_PUBLIC_B3_API || process.env.NEXT_PUBLIC_B3_API || process.env.PUBLIC_B3_API || "https://api.b3.fun";
|
|
8
9
|
|
|
9
|
-
const DEV_USER_GROUP = 4;
|
|
10
|
-
|
|
11
10
|
export const authenticate = async (
|
|
12
11
|
app: ClientApplication,
|
|
13
12
|
accessToken: string,
|
|
@@ -33,12 +32,14 @@ export const authenticate = async (
|
|
|
33
32
|
},
|
|
34
33
|
);
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
const token = Cookies.get(B3_AUTH_COOKIE_NAME);
|
|
36
|
+
if (token) {
|
|
37
|
+
const days = getSessionDurationDays(response?.user?.preferences, params?.partnerId);
|
|
38
|
+
Cookies.set(B3_AUTH_COOKIE_NAME, token, {
|
|
39
|
+
...(days > 0 ? { expires: days } : {}),
|
|
40
|
+
secure: true,
|
|
41
|
+
sameSite: "Lax",
|
|
42
|
+
});
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
return response;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createAuthClient } from "better-auth/client";
|
|
2
|
+
import { B3_API_URL } from "../app.shared";
|
|
3
|
+
|
|
4
|
+
export type B3BetterAuthClient = ReturnType<typeof createB3BetterAuthClient>;
|
|
5
|
+
|
|
6
|
+
export function createB3BetterAuthClient(baseURL: string = B3_API_URL) {
|
|
7
|
+
return createAuthClient({
|
|
8
|
+
baseURL,
|
|
9
|
+
basePath: "/auth",
|
|
10
|
+
fetchOptions: {
|
|
11
|
+
credentials: "include",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Default singleton for standard usage
|
|
17
|
+
export const betterAuthClient = createB3BetterAuthClient();
|
|
@@ -73,12 +73,6 @@ export const resetSocket = () => {
|
|
|
73
73
|
// reset the socket connection
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
export function extractAvatarIdFromUrl(url: string): string | null {
|
|
77
|
-
const regex = /https:\/\/models\.readyplayer\.me\/([a-f0-9]{24})\.[a-zA-Z0-9]+/;
|
|
78
|
-
const match = url.match(regex);
|
|
79
|
-
return match ? match[1] : null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
76
|
export const authenticateWithB3JWT = async (fullToken: string, params?: Record<string, any>) => {
|
|
83
77
|
// Do not authenticate if there is no token
|
|
84
78
|
if (!fullToken) {
|
|
@@ -27,6 +27,7 @@ import { LinkAccount } from "./LinkAccount/LinkAccount";
|
|
|
27
27
|
import { LinkNewAccount } from "./LinkAccount/LinkNewAccount";
|
|
28
28
|
import { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
29
29
|
import NotificationsContent from "./ManageAccount/NotificationsContent";
|
|
30
|
+
import SessionDurationContent from "./ManageAccount/SessionDurationContent";
|
|
30
31
|
import { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
31
32
|
import { Send } from "./Send/Send";
|
|
32
33
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
@@ -43,7 +44,7 @@ export function B3DynamicModal() {
|
|
|
43
44
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
44
45
|
const { theme } = useB3Config();
|
|
45
46
|
const isMobile = useIsMobile();
|
|
46
|
-
const { toasts, removeToast } = useToastContext();
|
|
47
|
+
const { toasts, removeToast, headerMode } = useToastContext();
|
|
47
48
|
|
|
48
49
|
// Define arrays for different modal type groups
|
|
49
50
|
const fullWidthTypes = [
|
|
@@ -172,6 +173,8 @@ export function B3DynamicModal() {
|
|
|
172
173
|
return <Send {...contentType} />;
|
|
173
174
|
case "notifications":
|
|
174
175
|
return <NotificationsContent {...contentType} />;
|
|
176
|
+
case "sessionDuration":
|
|
177
|
+
return <SessionDurationContent partnerId={contentType.partnerId} />;
|
|
175
178
|
// Add other modal types here
|
|
176
179
|
default:
|
|
177
180
|
return null;
|
|
@@ -247,7 +250,7 @@ export function B3DynamicModal() {
|
|
|
247
250
|
|
|
248
251
|
{/* Toast Container - Part of modal-inner-content layer */}
|
|
249
252
|
<AnimatePresence>
|
|
250
|
-
{toasts.length > 0 && (
|
|
253
|
+
{!headerMode && toasts.length > 0 && (
|
|
251
254
|
<motion.div
|
|
252
255
|
initial={{ height: 0 }}
|
|
253
256
|
animate={{ height: "auto" }}
|
|
@@ -15,6 +15,8 @@ const DEFAULT_PERMISSIONS: PermissionsConfig = {
|
|
|
15
15
|
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
export type AuthStrategy = "thirdweb" | "better-auth";
|
|
19
|
+
|
|
18
20
|
export interface B3ConfigContextType {
|
|
19
21
|
accountOverride?: Account;
|
|
20
22
|
automaticallySetFirstEoa: boolean;
|
|
@@ -25,6 +27,7 @@ export interface B3ConfigContextType {
|
|
|
25
27
|
partnerId: string;
|
|
26
28
|
stripePublishableKey?: string;
|
|
27
29
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
30
|
+
authStrategy: AuthStrategy;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
const B3ConfigContext = createContext<B3ConfigContextType | null>(null);
|
|
@@ -40,6 +43,7 @@ export function B3ConfigProvider({
|
|
|
40
43
|
partnerId,
|
|
41
44
|
stripePublishableKey,
|
|
42
45
|
createClientReferenceId,
|
|
46
|
+
authStrategy = "thirdweb",
|
|
43
47
|
}: {
|
|
44
48
|
children: React.ReactNode;
|
|
45
49
|
accountOverride?: Account;
|
|
@@ -51,6 +55,7 @@ export function B3ConfigProvider({
|
|
|
51
55
|
partnerId: string;
|
|
52
56
|
stripePublishableKey?: string;
|
|
53
57
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
58
|
+
authStrategy?: AuthStrategy;
|
|
54
59
|
}) {
|
|
55
60
|
return (
|
|
56
61
|
<B3ConfigContext.Provider
|
|
@@ -64,6 +69,7 @@ export function B3ConfigProvider({
|
|
|
64
69
|
partnerId,
|
|
65
70
|
stripePublishableKey,
|
|
66
71
|
createClientReferenceId,
|
|
72
|
+
authStrategy,
|
|
67
73
|
}}
|
|
68
74
|
>
|
|
69
75
|
{children}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
2
|
-
import {
|
|
2
|
+
import { WalletProvider } from "@b3dotfun/sdk/wallet/react";
|
|
3
3
|
import { ThirdwebProvider } from "thirdweb/react";
|
|
4
4
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
5
5
|
|
|
6
6
|
import { ClientType } from "../../../client-manager";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { useMemo } from "react";
|
|
9
9
|
import { createWagmiConfig } from "../../utils/createWagmiConfig";
|
|
10
10
|
import AuthenticationProvider from "./AuthenticationProvider";
|
|
11
11
|
import { B3ConfigProvider } from "./B3ConfigProvider";
|
|
12
12
|
import { LocalSDKProvider } from "./LocalSDKProvider";
|
|
13
13
|
|
|
14
|
-
// Create queryClient instance
|
|
15
|
-
const queryClient = new QueryClient();
|
|
16
|
-
|
|
17
14
|
/**
|
|
18
15
|
* Main B3Provider component
|
|
19
16
|
*/
|
|
@@ -82,23 +79,21 @@ export function InnerProvider({
|
|
|
82
79
|
partnerId: string;
|
|
83
80
|
rpcUrls?: Record<number, string>;
|
|
84
81
|
}) {
|
|
85
|
-
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
|
|
82
|
+
const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls }), [partnerId, rpcUrls]);
|
|
86
83
|
|
|
87
84
|
return (
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</QueryClientProvider>
|
|
102
|
-
</WagmiProvider>
|
|
85
|
+
<WalletProvider wagmiConfig={wagmiConfig}>
|
|
86
|
+
<B3ConfigProvider
|
|
87
|
+
accountOverride={accountOverride}
|
|
88
|
+
environment={environment}
|
|
89
|
+
automaticallySetFirstEoa={false}
|
|
90
|
+
theme={theme}
|
|
91
|
+
clientType={clientType}
|
|
92
|
+
partnerId={partnerId}
|
|
93
|
+
defaultPermissions={defaultPermissions}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
</B3ConfigProvider>
|
|
97
|
+
</WalletProvider>
|
|
103
98
|
);
|
|
104
99
|
}
|