@b3dotfun/sdk 0.0.88-alpha.10 → 0.0.88-alpha.2
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/index.d.ts +0 -2
- package/dist/cjs/anyspend/constants/index.js +1 -3
- package/dist/cjs/anyspend/index.d.ts +0 -2
- package/dist/cjs/anyspend/index.js +0 -3
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpend.js +6 -9
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +20 -24
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -34
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/index.js +0 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +57 -35
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +35 -38
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +24 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +9 -8
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -76
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +1 -3
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -1
- package/dist/cjs/global-account/react/components/index.js +6 -3
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -2
- package/dist/cjs/global-account/react/hooks/index.js +1 -5
- package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
- package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -8
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +22 -50
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +35 -9
- package/dist/cjs/global-account/react/index.native.d.ts +2 -0
- package/dist/cjs/global-account/react/index.native.js +5 -1
- package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
- package/dist/cjs/global-account/react/stores/index.js +1 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/esm/anyspend/constants/index.d.ts +0 -2
- package/dist/esm/anyspend/constants/index.js +0 -2
- package/dist/esm/anyspend/index.d.ts +0 -2
- package/dist/esm/anyspend/index.js +0 -3
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpend.js +8 -11
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -8
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -36
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/index.js +0 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +58 -34
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +21 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -76
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +3 -5
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -1
- package/dist/esm/global-account/react/components/index.js +2 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -2
- package/dist/esm/global-account/react/hooks/index.js +0 -2
- package/dist/esm/global-account/react/hooks/useClient.js +2 -2
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
- package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -8
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +22 -50
- package/dist/esm/global-account/react/hooks/useUserQuery.js +27 -1
- package/dist/esm/global-account/react/index.native.d.ts +2 -0
- package/dist/esm/global-account/react/index.native.js +2 -0
- package/dist/esm/global-account/react/stores/index.d.ts +0 -1
- package/dist/esm/global-account/react/stores/index.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +0 -2
- package/dist/types/anyspend/index.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/types/global-account/react/components/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -2
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/types/global-account/react/index.native.d.ts +2 -0
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -10
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +0 -3
- package/src/anyspend/index.ts +0 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -28
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +0 -6
- package/src/anyspend/react/components/AnySpendCustom.tsx +47 -52
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -23
- package/src/anyspend/react/components/AnySpendDeposit.tsx +1 -18
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -4
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -15
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -5
- package/src/anyspend/react/components/common/OrderDetails.tsx +42 -60
- package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -5
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
- package/src/anyspend/react/hooks/index.ts +0 -1
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +4 -3
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +54 -43
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +117 -44
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
- package/src/global-account/react/components/B3Provider/types.ts +50 -0
- package/src/global-account/react/components/B3Provider/useB3.ts +13 -4
- package/src/global-account/react/components/B3Provider/useB3Account.ts +2 -6
- package/src/global-account/react/components/B3Provider/useB3Config.ts +31 -18
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +4 -2
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
- package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +100 -168
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
- package/src/global-account/react/components/StyleRoot.tsx +3 -3
- package/src/global-account/react/components/TurnkeyAuthModal.tsx +4 -7
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
- package/src/global-account/react/components/index.ts +2 -1
- package/src/global-account/react/hooks/index.ts +0 -2
- package/src/global-account/react/hooks/useClient.ts +2 -2
- package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
- package/src/global-account/react/hooks/useNotifications.ts +2 -2
- package/src/global-account/react/hooks/useTWAuth.tsx +0 -10
- package/src/global-account/react/hooks/useTokenBalance.tsx +7 -8
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +23 -54
- package/src/global-account/react/hooks/useUserQuery.ts +40 -1
- package/src/global-account/react/index.native.ts +2 -0
- package/src/global-account/react/stores/index.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +0 -10
- package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/common/GasIndicator.js +0 -34
- package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/cjs/anyspend/react/hooks/useGasPrice.js +0 -43
- package/dist/cjs/anyspend/services/gas.d.ts +0 -21
- package/dist/cjs/anyspend/services/gas.js +0 -65
- package/dist/cjs/anyspend/types/gas.d.ts +0 -61
- package/dist/cjs/anyspend/types/gas.js +0 -2
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -12
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/cjs/global-account/react/hooks/useAuth.js +0 -337
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/cjs/global-account/react/hooks/useUser.js +0 -20
- package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/cjs/global-account/react/stores/configStore.js +0 -30
- package/dist/cjs/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/cjs/global-account/react/stores/userStore.js +0 -30
- package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/esm/anyspend/react/components/common/GasIndicator.js +0 -31
- package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/esm/anyspend/react/hooks/useGasPrice.js +0 -40
- package/dist/esm/anyspend/services/gas.d.ts +0 -21
- package/dist/esm/anyspend/services/gas.js +0 -59
- package/dist/esm/anyspend/types/gas.d.ts +0 -61
- package/dist/esm/anyspend/types/gas.js +0 -1
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -10
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/esm/global-account/react/hooks/useAuth.js +0 -331
- package/dist/esm/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/esm/global-account/react/hooks/useUser.js +0 -17
- package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/esm/global-account/react/stores/configStore.js +0 -27
- package/dist/esm/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/esm/global-account/react/stores/userStore.js +0 -27
- package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/types/anyspend/services/gas.d.ts +0 -21
- package/dist/types/anyspend/types/gas.d.ts +0 -61
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/types/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/types/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/types/global-account/react/stores/userStore.d.ts +0 -22
- package/src/anyspend/react/components/common/GasIndicator.tsx +0 -59
- package/src/anyspend/react/hooks/useGasPrice.ts +0 -70
- package/src/anyspend/services/gas.test.ts +0 -31
- package/src/anyspend/services/gas.ts +0 -73
- package/src/anyspend/types/gas.ts +0 -66
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -19
- package/src/global-account/react/hooks/useAuth.ts +0 -379
- package/src/global-account/react/hooks/useUser.ts +0 -20
- package/src/global-account/react/stores/configStore.ts +0 -51
- package/src/global-account/react/stores/userStore.ts +0 -41
|
@@ -11,7 +11,6 @@ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
|
11
11
|
import { useCallback, useEffect, useState } from "react";
|
|
12
12
|
import { useActiveAccount } from "thirdweb/react";
|
|
13
13
|
import { Account } from "thirdweb/wallets";
|
|
14
|
-
import { TurnkeyAuthModal } from "../TurnkeyAuthModal";
|
|
15
14
|
import { SignInWithB3Privy } from "./SignInWithB3Privy";
|
|
16
15
|
import { LoginStep, LoginStepContainer } from "./steps/LoginStep";
|
|
17
16
|
import { LoginStepCustom } from "./steps/LoginStepCustom";
|
|
@@ -44,9 +43,7 @@ export function SignInWithB3Flow({
|
|
|
44
43
|
const account = useActiveAccount();
|
|
45
44
|
const isAuthenticating = useAuthStore(state => state.isAuthenticating);
|
|
46
45
|
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
47
|
-
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
48
46
|
const isConnected = useAuthStore(state => state.isConnected);
|
|
49
|
-
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
50
47
|
const setJustCompletedLogin = useAuthStore(state => state.setJustCompletedLogin);
|
|
51
48
|
const [refetchCount, setRefetchCount] = useState(0);
|
|
52
49
|
const [refetchError, setRefetchError] = useState<string | null>(null);
|
|
@@ -88,9 +85,7 @@ export function SignInWithB3Flow({
|
|
|
88
85
|
refetchSigners();
|
|
89
86
|
setRefetchQueued(false);
|
|
90
87
|
}, backoffDelay);
|
|
91
|
-
|
|
92
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
93
|
-
}, [refetchCount, refetchSigners, onError, refetchQueued]);
|
|
88
|
+
}, [refetchCount, refetchSigners, onError, setRefetchQueued, refetchQueued]);
|
|
94
89
|
|
|
95
90
|
// Extract the completion flow logic to be reused
|
|
96
91
|
const handlePostTurnkeyFlow = useCallback(() => {
|
|
@@ -162,11 +157,6 @@ export function SignInWithB3Flow({
|
|
|
162
157
|
await refetchUser();
|
|
163
158
|
debug("User refetched successfully");
|
|
164
159
|
|
|
165
|
-
// Set authentication and connection state so UI updates properly
|
|
166
|
-
setIsAuthenticated(true);
|
|
167
|
-
setIsConnected(true);
|
|
168
|
-
setJustCompletedLogin(true);
|
|
169
|
-
|
|
170
160
|
// After user data is refreshed, close Turnkey modal and go back to sign-in flow
|
|
171
161
|
debug("Switching back to signInWithB3 modal");
|
|
172
162
|
setB3ModalContentType({
|
|
@@ -186,6 +176,7 @@ export function SignInWithB3Flow({
|
|
|
186
176
|
},
|
|
187
177
|
[
|
|
188
178
|
refetchUser,
|
|
179
|
+
setB3ModalContentType,
|
|
189
180
|
strategies,
|
|
190
181
|
onLoginSuccess,
|
|
191
182
|
onSessionKeySuccess,
|
|
@@ -196,102 +187,90 @@ export function SignInWithB3Flow({
|
|
|
196
187
|
closeAfterLogin,
|
|
197
188
|
source,
|
|
198
189
|
signersEnabled,
|
|
199
|
-
setB3ModalContentType,
|
|
200
|
-
setIsAuthenticated,
|
|
201
|
-
setIsConnected,
|
|
202
|
-
setJustCompletedLogin,
|
|
203
190
|
],
|
|
204
191
|
);
|
|
205
192
|
|
|
206
193
|
// Handle post-login flow after signers are loaded
|
|
207
|
-
useEffect(
|
|
208
|
-
(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
if (isConnected && isAuthenticated && user) {
|
|
219
|
-
// Mark that login just completed BEFORE opening manage account or closing modal
|
|
220
|
-
// This allows Turnkey modal to show (if enableTurnkey is true)
|
|
221
|
-
if (closeAfterLogin) {
|
|
222
|
-
setJustCompletedLogin(true);
|
|
223
|
-
}
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
debug("@@SignInWithB3Flow:useEffect", {
|
|
196
|
+
isConnected,
|
|
197
|
+
isAuthenticating,
|
|
198
|
+
isFetchingSigners,
|
|
199
|
+
closeAfterLogin,
|
|
200
|
+
isOpen,
|
|
201
|
+
source,
|
|
202
|
+
});
|
|
224
203
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
// For returning users (turnkeyId && turnkeyEmail): Auto-skip to OTP
|
|
232
|
-
// Also check that we're not already showing the Turnkey modal
|
|
233
|
-
const hasTurnkeyId = user?.partnerIds?.turnkeyId;
|
|
234
|
-
const hasTurnkeyEmail = !!user?.email;
|
|
235
|
-
const isTurnkeyModalCurrentlyOpen = contentType?.type === "turnkeyAuth";
|
|
236
|
-
const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
|
|
237
|
-
const shouldShowTurnkeyModal =
|
|
238
|
-
enableTurnkey &&
|
|
239
|
-
!isTurnkeyPrimary &&
|
|
240
|
-
user &&
|
|
241
|
-
!turnkeyAuthCompleted &&
|
|
242
|
-
!isTurnkeyModalCurrentlyOpen &&
|
|
243
|
-
(!hasTurnkeyId || (hasTurnkeyId && hasTurnkeyEmail));
|
|
204
|
+
if (isConnected && isAuthenticated && user) {
|
|
205
|
+
// Mark that login just completed BEFORE opening manage account or closing modal
|
|
206
|
+
// This allows Turnkey modal to show (if enableTurnkey is true)
|
|
207
|
+
if (closeAfterLogin) {
|
|
208
|
+
setJustCompletedLogin(true);
|
|
209
|
+
}
|
|
244
210
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
211
|
+
// Check if we should show Turnkey login form
|
|
212
|
+
// Show if enableTurnkey is true AND user just logged in AND hasn't completed Turnkey auth in this session
|
|
213
|
+
// For new users (!turnkeyId): Show email form
|
|
214
|
+
// For returning users (turnkeyId && turnkeyEmail): Auto-skip to OTP
|
|
215
|
+
// Also check that we're not already showing the Turnkey modal
|
|
216
|
+
const hasTurnkeyId = user?.partnerIds?.turnkeyId;
|
|
217
|
+
const hasTurnkeyEmail = !!user?.email;
|
|
218
|
+
const isTurnkeyModalCurrentlyOpen = contentType?.type === "turnkeyAuth";
|
|
219
|
+
const shouldShowTurnkeyModal =
|
|
220
|
+
enableTurnkey &&
|
|
221
|
+
user &&
|
|
222
|
+
!turnkeyAuthCompleted &&
|
|
223
|
+
!isTurnkeyModalCurrentlyOpen &&
|
|
224
|
+
(!hasTurnkeyId || (hasTurnkeyId && hasTurnkeyEmail));
|
|
248
225
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
onSuccess: handleTurnkeySuccess,
|
|
253
|
-
onClose: () => {
|
|
254
|
-
// After closing Turnkey modal, continue with the rest of the flow
|
|
255
|
-
setTurnkeyAuthCompleted(true);
|
|
256
|
-
debug("Turnkey modal closed, running post-Turnkey flow");
|
|
257
|
-
handlePostTurnkeyFlow();
|
|
258
|
-
},
|
|
259
|
-
initialEmail: email,
|
|
260
|
-
skipToOtp: !!(hasTurnkeyId && hasTurnkeyEmail),
|
|
261
|
-
closable: false, // Turnkey modal cannot be closed until auth is complete
|
|
262
|
-
});
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
226
|
+
if (shouldShowTurnkeyModal) {
|
|
227
|
+
// Extract email from user object - check partnerIds.turnkeyEmail first, then twProfiles, then user.email
|
|
228
|
+
const email = user?.email || user?.twProfiles?.find((profile: any) => profile.details?.email)?.details?.email;
|
|
265
229
|
|
|
266
|
-
//
|
|
267
|
-
|
|
230
|
+
// Open Turnkey modal through the modal store
|
|
231
|
+
setB3ModalContentType({
|
|
232
|
+
type: "turnkeyAuth",
|
|
233
|
+
onSuccess: handleTurnkeySuccess,
|
|
234
|
+
onClose: () => {
|
|
235
|
+
// After closing Turnkey modal, continue with the rest of the flow
|
|
236
|
+
setTurnkeyAuthCompleted(true);
|
|
237
|
+
debug("Turnkey modal closed, running post-Turnkey flow");
|
|
238
|
+
handlePostTurnkeyFlow();
|
|
239
|
+
},
|
|
240
|
+
initialEmail: email,
|
|
241
|
+
skipToOtp: !!(hasTurnkeyId && hasTurnkeyEmail),
|
|
242
|
+
closable: false, // Turnkey modal cannot be closed until auth is complete
|
|
243
|
+
});
|
|
244
|
+
return;
|
|
268
245
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
246
|
+
|
|
247
|
+
// Normal flow continues after Turnkey auth is complete (or if not needed)
|
|
248
|
+
handlePostTurnkeyFlow();
|
|
249
|
+
}
|
|
250
|
+
}, [
|
|
251
|
+
signers,
|
|
252
|
+
isFetchingSigners,
|
|
253
|
+
partnerId,
|
|
254
|
+
handleRefetchSigners,
|
|
255
|
+
source,
|
|
256
|
+
closeAfterLogin,
|
|
257
|
+
setB3ModalContentType,
|
|
258
|
+
chain,
|
|
259
|
+
onSessionKeySuccess,
|
|
260
|
+
setB3ModalOpen,
|
|
261
|
+
signersEnabled,
|
|
262
|
+
isConnected,
|
|
263
|
+
isAuthenticating,
|
|
264
|
+
isAuthenticated,
|
|
265
|
+
isOpen,
|
|
266
|
+
setJustCompletedLogin,
|
|
267
|
+
user,
|
|
268
|
+
enableTurnkey,
|
|
269
|
+
turnkeyAuthCompleted,
|
|
270
|
+
handleTurnkeySuccess,
|
|
271
|
+
contentType,
|
|
272
|
+
handlePostTurnkeyFlow,
|
|
273
|
+
]);
|
|
295
274
|
|
|
296
275
|
debug("render", {
|
|
297
276
|
step,
|
|
@@ -307,9 +286,7 @@ export function SignInWithB3Flow({
|
|
|
307
286
|
if (closeAfterLogin && sessionKeyAdded) {
|
|
308
287
|
setB3ModalOpen(false);
|
|
309
288
|
}
|
|
310
|
-
|
|
311
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
312
|
-
}, [closeAfterLogin, sessionKeyAdded]);
|
|
289
|
+
}, [closeAfterLogin, sessionKeyAdded, setB3ModalOpen]);
|
|
313
290
|
|
|
314
291
|
const onSessionKeySuccessEnhanced = useCallback(() => {
|
|
315
292
|
onSessionKeySuccess?.();
|
|
@@ -366,77 +343,32 @@ export function SignInWithB3Flow({
|
|
|
366
343
|
<div className="p-4 text-center text-red-500">{refetchError}</div>
|
|
367
344
|
</LoginStepContainer>
|
|
368
345
|
);
|
|
346
|
+
} else if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
|
|
347
|
+
content = (
|
|
348
|
+
<LoginStepContainer partnerId={partnerId}>
|
|
349
|
+
<div className="my-8 flex min-h-[350px] items-center justify-center">
|
|
350
|
+
<Loading variant="white" size="lg" />
|
|
351
|
+
</div>
|
|
352
|
+
</LoginStepContainer>
|
|
353
|
+
);
|
|
369
354
|
} else if (step === "login") {
|
|
370
|
-
//
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if (shouldShowTurnkeyFirst) {
|
|
376
|
-
// Don't show loading spinner for Turnkey - let the modal handle its own loading state
|
|
377
|
-
// This prevents the infinite loop where isAuthenticating causes the modal to be replaced
|
|
378
|
-
debug("Showing Turnkey as primary authentication option", {
|
|
379
|
-
isTurnkeyPrimary,
|
|
380
|
-
turnkeyAuthCompleted,
|
|
381
|
-
isAuthenticated,
|
|
382
|
-
});
|
|
383
|
-
// Show Turnkey authentication as primary option
|
|
355
|
+
// Custom strategy
|
|
356
|
+
if (strategies?.[0] === "privy") {
|
|
357
|
+
content = <SignInWithB3Privy onSuccess={handleLoginSuccess} chain={chain} />;
|
|
358
|
+
} else if (strategies) {
|
|
359
|
+
// Strategies are explicitly provided
|
|
384
360
|
content = (
|
|
385
|
-
<
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
// User is now authenticated via Turnkey
|
|
393
|
-
// Set both isAuthenticated and isConnected to true so UI updates properly
|
|
394
|
-
// Wallet connection is optional and can happen later for signing transactions
|
|
395
|
-
setIsAuthenticated(true);
|
|
396
|
-
setIsConnected(true);
|
|
397
|
-
setJustCompletedLogin(true);
|
|
398
|
-
// Call the login success callback
|
|
399
|
-
onLoginSuccess?.({} as Account);
|
|
400
|
-
}}
|
|
401
|
-
onClose={() => {
|
|
402
|
-
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
403
|
-
setTurnkeyAuthCompleted(true);
|
|
404
|
-
}}
|
|
405
|
-
initialEmail=""
|
|
406
|
-
skipToOtp={false}
|
|
407
|
-
/>
|
|
408
|
-
</LoginStepContainer>
|
|
361
|
+
<LoginStepCustom
|
|
362
|
+
strategies={strategies}
|
|
363
|
+
chain={chain}
|
|
364
|
+
onSuccess={handleLoginSuccess}
|
|
365
|
+
onError={onError}
|
|
366
|
+
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
367
|
+
/>
|
|
409
368
|
);
|
|
410
369
|
} else {
|
|
411
|
-
//
|
|
412
|
-
|
|
413
|
-
content = (
|
|
414
|
-
<LoginStepContainer partnerId={partnerId}>
|
|
415
|
-
<div className="my-8 flex min-h-[350px] items-center justify-center">
|
|
416
|
-
<Loading variant="white" size="lg" />
|
|
417
|
-
</div>
|
|
418
|
-
</LoginStepContainer>
|
|
419
|
-
);
|
|
420
|
-
} else {
|
|
421
|
-
// Custom strategy
|
|
422
|
-
if (strategies?.[0] === "privy") {
|
|
423
|
-
content = <SignInWithB3Privy onSuccess={handleLoginSuccess} chain={chain} />;
|
|
424
|
-
} else if (strategies) {
|
|
425
|
-
// Strategies are explicitly provided
|
|
426
|
-
content = (
|
|
427
|
-
<LoginStepCustom
|
|
428
|
-
strategies={strategies}
|
|
429
|
-
chain={chain}
|
|
430
|
-
onSuccess={handleLoginSuccess}
|
|
431
|
-
onError={onError}
|
|
432
|
-
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
433
|
-
/>
|
|
434
|
-
);
|
|
435
|
-
} else {
|
|
436
|
-
// Default to handle all strategies we support
|
|
437
|
-
content = <LoginStep chain={chain} onSuccess={handleLoginSuccess} onError={onError} />;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
370
|
+
// Default to handle all strategies we support
|
|
371
|
+
content = <LoginStep chain={chain} onSuccess={handleLoginSuccess} onError={onError} />;
|
|
440
372
|
}
|
|
441
373
|
}
|
|
442
374
|
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Loading,
|
|
3
3
|
useAuthentication,
|
|
4
4
|
useAuthStore,
|
|
5
|
-
|
|
5
|
+
useB3,
|
|
6
6
|
useHandleConnectWithPrivy,
|
|
7
7
|
} from "@b3dotfun/sdk/global-account/react";
|
|
8
8
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
@@ -19,7 +19,7 @@ interface SignInWithB3PrivyProps {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function SignInWithB3Privy({ onSuccess, onError, chain }: SignInWithB3PrivyProps) {
|
|
22
|
-
const { partnerId } =
|
|
22
|
+
const { partnerId } = useB3();
|
|
23
23
|
const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
|
|
24
24
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
25
25
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useAuthentication,
|
|
1
|
+
import { useAuthentication, useB3, useQueryB3 } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
|
|
3
3
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
4
4
|
import { Chain } from "thirdweb";
|
|
@@ -50,7 +50,7 @@ export function LoginStepContainer({ children, partnerId }: LoginStepContainerPr
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export function LoginStep({ onSuccess, chain }: LoginStepProps) {
|
|
53
|
-
const { partnerId, theme } =
|
|
53
|
+
const { partnerId, theme } = useB3();
|
|
54
54
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
55
55
|
partnerId: partnerId,
|
|
56
56
|
});
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
LoginStepContainer,
|
|
8
8
|
useAuthentication,
|
|
9
9
|
useAuthStore,
|
|
10
|
-
|
|
10
|
+
useB3,
|
|
11
11
|
useConnect,
|
|
12
12
|
WalletRow,
|
|
13
13
|
} from "@b3dotfun/sdk/global-account/react";
|
|
@@ -37,7 +37,7 @@ export function LoginStepCustom({
|
|
|
37
37
|
maxInitialWallets = 2,
|
|
38
38
|
automaticallySetFirstEoa,
|
|
39
39
|
}: LoginStepCustomProps) {
|
|
40
|
-
const { partnerId } =
|
|
40
|
+
const { partnerId } = useB3();
|
|
41
41
|
const [isLoading, setIsLoading] = useState(false);
|
|
42
42
|
const [showAllWallets, setShowAllWallets] = useState(false);
|
|
43
43
|
const { connect } = useConnect(partnerId, chain);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3 } from "./B3Provider/useB3";
|
|
3
3
|
|
|
4
4
|
export function StyleRoot({ children, id }: PropsWithChildren<{ id?: string }>) {
|
|
5
|
-
const { theme } =
|
|
5
|
+
const { theme: b3Theme } = useB3();
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
|
-
<div className="b3-root" id={id} data-theme={
|
|
8
|
+
<div className="b3-root" id={id} data-theme={b3Theme}>
|
|
9
9
|
{children}
|
|
10
10
|
</div>
|
|
11
11
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef
|
|
1
|
+
import React, { useState, useEffect, useRef } from "react";
|
|
2
2
|
import { useTurnkeyAuth } from "../hooks/useTurnkeyAuth";
|
|
3
3
|
|
|
4
4
|
type ModalStep = "email" | "otp" | "success";
|
|
@@ -94,20 +94,17 @@ export function TurnkeyAuthModal({ onClose, onSuccess, initialEmail = "", skipTo
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
|
|
98
|
-
const walletBrand = isTurnkeyPrimary ? "Smart Wallet" : "AnySpend Wallet";
|
|
99
|
-
|
|
100
97
|
return (
|
|
101
98
|
<div className="font-neue-montreal p-8">
|
|
102
99
|
{/* Email Step */}
|
|
103
100
|
{step === "email" && (
|
|
104
101
|
<>
|
|
105
102
|
<h2 className="mb-6 text-center text-2xl font-bold text-gray-900 dark:text-white">
|
|
106
|
-
Setup your
|
|
103
|
+
Setup your AnySpend Wallet
|
|
107
104
|
</h2>
|
|
108
105
|
<div className="mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400">
|
|
109
106
|
<p>
|
|
110
|
-
|
|
107
|
+
AnySpend uses a secure,
|
|
111
108
|
<br />
|
|
112
109
|
embedded wallet to fund your workflows.
|
|
113
110
|
</p>
|
|
@@ -161,7 +158,7 @@ export function TurnkeyAuthModal({ onClose, onSuccess, initialEmail = "", skipTo
|
|
|
161
158
|
<h2 className="mb-4 text-center text-2xl font-bold text-gray-900 dark:text-white">2FA Security</h2>
|
|
162
159
|
<div className="mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400">
|
|
163
160
|
<p>
|
|
164
|
-
|
|
161
|
+
AnySpend uses a secure,
|
|
165
162
|
<br />
|
|
166
163
|
embedded wallet to fund your workflows.
|
|
167
164
|
<br />
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Button, StyleRoot,
|
|
1
|
+
import { Button, StyleRoot, useAuthentication, useB3, useModalStore } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { cn } from "@b3dotfun/sdk/shared/utils";
|
|
3
3
|
import { SignInWithB3Props } from "../SignInWithB3/SignInWithB3";
|
|
4
4
|
|
|
5
5
|
export function ManageAccountButton(props: SignInWithB3Props & { className?: string }) {
|
|
6
|
+
const { partnerId } = useB3();
|
|
6
7
|
const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
|
|
7
|
-
const { isConnected } =
|
|
8
|
+
const { isConnected } = useAuthentication(partnerId);
|
|
8
9
|
|
|
9
10
|
const handleClickManageAccount = () => {
|
|
10
11
|
setB3ModalContentType({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
2
2
|
// Core Components
|
|
3
3
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
4
|
-
export { B3Provider } from "./B3Provider/B3Provider";
|
|
4
|
+
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
5
5
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
6
|
+
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
6
7
|
export { useB3 } from "./B3Provider/useB3";
|
|
7
8
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
8
9
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
@@ -3,7 +3,6 @@ export { useAccountAssets } from "./useAccountAssets";
|
|
|
3
3
|
export { useAccountWallet } from "./useAccountWallet";
|
|
4
4
|
export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
5
5
|
export { useAnalytics } from "./useAnalytics";
|
|
6
|
-
export { useAuth } from "./useAuth";
|
|
7
6
|
export { useAuthentication } from "./useAuthentication";
|
|
8
7
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
9
8
|
export { useB3EnsName } from "./useB3EnsName";
|
|
@@ -52,4 +51,3 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
|
52
51
|
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
53
52
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
54
53
|
export { useURLParams } from "./useURLParams";
|
|
55
|
-
export { useUser } from "./useUser";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3 } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import {
|
|
4
4
|
ClientType,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
* Hook to access the current FeathersJS client and client management utilities
|
|
14
14
|
*/
|
|
15
15
|
export function useClient() {
|
|
16
|
-
const { clientType } =
|
|
16
|
+
const { clientType } = useB3();
|
|
17
17
|
|
|
18
18
|
const getCurrentClient = useCallback(() => {
|
|
19
19
|
return getClient();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3, useConnect } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
3
3
|
import { useIdentityToken, usePrivy } from "@privy-io/react-auth";
|
|
4
4
|
import { useCallback, useRef, useState } from "react";
|
|
@@ -11,7 +11,7 @@ const debug = debugB3React("@@b3:useHandleConnectWithPrivy");
|
|
|
11
11
|
* Currently, this is for the basement-privy strategy
|
|
12
12
|
*/
|
|
13
13
|
export function useHandleConnectWithPrivy(chain?: Chain, onSuccess?: (account: Account) => void) {
|
|
14
|
-
const { partnerId } =
|
|
14
|
+
const { partnerId } = useB3();
|
|
15
15
|
if (!chain) {
|
|
16
16
|
throw new Error("Chain is required");
|
|
17
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
2
1
|
import { getAuthToken } from "@b3dotfun/sdk/shared/utils/auth-token";
|
|
3
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
4
3
|
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { useB3 } from "../components";
|
|
5
5
|
import { notificationsAPI, UserData } from "../utils/notificationsAPI";
|
|
6
6
|
import { useUserQuery } from "./useUserQuery";
|
|
7
7
|
|
|
@@ -56,7 +56,7 @@ export interface UseNotificationsReturn {
|
|
|
56
56
|
*/
|
|
57
57
|
export function useNotifications(): UseNotificationsReturn {
|
|
58
58
|
const { user } = useUserQuery();
|
|
59
|
-
const { partnerId } =
|
|
59
|
+
const { partnerId } = useB3();
|
|
60
60
|
const [userData, setUserData] = useState<UserData | null>(null);
|
|
61
61
|
const [loading, setLoading] = useState(true);
|
|
62
62
|
const [error, setError] = useState<string | null>(null);
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated This hook is deprecated. Use useAuth() with Turnkey authentication instead.
|
|
3
|
-
* This file is kept for backward compatibility but should not be used in new code.
|
|
4
|
-
*/
|
|
5
1
|
import app from "@b3dotfun/sdk/global-account/app";
|
|
6
2
|
import debug from "@b3dotfun/sdk/shared/utils/debug";
|
|
7
3
|
import { useCallback } from "react";
|
|
8
4
|
import { Wallet } from "thirdweb/wallets";
|
|
9
5
|
import { useSearchParam } from "./useSearchParamsSSR";
|
|
10
6
|
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use useAuth() with Turnkey authentication instead
|
|
13
|
-
*/
|
|
14
7
|
export function useTWAuth() {
|
|
15
|
-
console.warn(
|
|
16
|
-
"useTWAuth is deprecated. Please migrate to useAuth() with Turnkey authentication. See useTurnkeyAuth.ts for the new implementation.",
|
|
17
|
-
);
|
|
18
8
|
const referralCode = useSearchParam("referralCode");
|
|
19
9
|
|
|
20
10
|
const authenticate = useCallback(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { isNativeToken } from "@b3dotfun/sdk/anyspend";
|
|
4
|
-
import {
|
|
5
|
-
import { useAccountWallet, useAuthStore } from "@b3dotfun/sdk/global-account/react";
|
|
4
|
+
import { useB3, useAccountWallet } from "@b3dotfun/sdk/global-account/react";
|
|
6
5
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
7
6
|
import { getERC20Balances, getNativeTokenBalance } from "@b3dotfun/sdk/shared/utils/thirdweb-insights";
|
|
8
7
|
import { useQuery } from "@tanstack/react-query";
|
|
9
8
|
import { useEffect } from "react";
|
|
9
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
10
10
|
|
|
11
11
|
interface UseTokenBalanceProps {
|
|
12
12
|
token: components["schemas"]["Token"];
|
|
@@ -20,8 +20,7 @@ export interface TokenBalanceResult {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function useTokenBalance({ token, address }: UseTokenBalanceProps): TokenBalanceResult {
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const { ready } = useB3();
|
|
25
24
|
const account = useAccountWallet();
|
|
26
25
|
|
|
27
26
|
const effectiveAddress = address || account?.address;
|
|
@@ -61,7 +60,7 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
|
|
|
61
60
|
}
|
|
62
61
|
return { formatted: "0", raw: null };
|
|
63
62
|
},
|
|
64
|
-
enabled:
|
|
63
|
+
enabled: ready && !!effectiveAddress,
|
|
65
64
|
staleTime: 30000,
|
|
66
65
|
gcTime: 5 * 60 * 1000,
|
|
67
66
|
retry: 2,
|
|
@@ -70,13 +69,13 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
|
|
|
70
69
|
|
|
71
70
|
// Force a refetch when the wallet or token changes
|
|
72
71
|
useEffect(() => {
|
|
73
|
-
if (
|
|
72
|
+
if (ready && effectiveAddress) {
|
|
74
73
|
refetch();
|
|
75
74
|
}
|
|
76
|
-
}, [
|
|
75
|
+
}, [ready, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
|
|
77
76
|
|
|
78
77
|
// Determine if we're actually loading
|
|
79
|
-
const isActuallyLoading = !
|
|
78
|
+
const isActuallyLoading = !ready || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
|
|
80
79
|
|
|
81
80
|
return {
|
|
82
81
|
rawBalance: tokenBalance?.raw || BigInt(0),
|
|
@@ -6,8 +6,8 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
6
6
|
import { viemToThirdwebChain } from "@b3dotfun/sdk/shared/constants/chains/b3Chain";
|
|
7
7
|
import { getChainById } from "@b3dotfun/sdk/shared/utils/chains";
|
|
8
8
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
9
|
-
import invariant from "invariant";
|
|
10
9
|
import { getWalletBalance } from "thirdweb/wallets";
|
|
10
|
+
import invariant from "invariant";
|
|
11
11
|
|
|
12
12
|
type GetWalletBalanceResult = {
|
|
13
13
|
value: bigint;
|
|
@@ -83,9 +83,7 @@ export function useTokenBalancesByChain({
|
|
|
83
83
|
staleTime: 30000, // Consider data fresh for 30 seconds
|
|
84
84
|
gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes
|
|
85
85
|
retry: 2, // Limit retries on failure
|
|
86
|
-
|
|
87
|
-
// This ensures we only get new references when data actually changes
|
|
88
|
-
structuralSharing: true,
|
|
86
|
+
structuralSharing: false,
|
|
89
87
|
});
|
|
90
88
|
|
|
91
89
|
return {
|