@b3dotfun/sdk 0.0.88-alpha.10 → 0.0.88-alpha.3
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/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 +15 -11
- 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/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 -1
- package/dist/cjs/global-account/react/hooks/index.js +1 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +2 -1
- 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/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- 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/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 +16 -12
- 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/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 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAuth.js +3 -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/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- 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 -1
- 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/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 +14 -11
- 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/custom/ManageAccountButton.tsx +3 -2
- package/src/global-account/react/components/index.ts +2 -1
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +3 -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/useTokenBalance.tsx +7 -8
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
- 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/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/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/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/useUser.ts +0 -20
- package/src/global-account/react/stores/configStore.ts +0 -51
- package/src/global-account/react/stores/userStore.ts +0 -41
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { RelayKitProviderWrapper, TooltipProvider } from "../../../../global-account/react/index.js";
|
|
2
|
+
import { RelayKitProviderWrapper, TooltipProvider, useAuthentication, useAuthStore, } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { useAutoSelectWallet } from "../../../../global-account/react/hooks/useAutoSelectWallet.js";
|
|
3
4
|
import { createWagmiConfig } from "../../../../global-account/react/utils/createWagmiConfig.js";
|
|
4
5
|
import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
5
6
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
6
7
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
7
8
|
import { useEffect, useMemo } from "react";
|
|
8
|
-
import { ThirdwebProvider } from "thirdweb/react";
|
|
9
|
+
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
|
|
9
10
|
import { WagmiProvider } from "wagmi";
|
|
10
11
|
import { setClientType } from "../../../client-manager.js";
|
|
11
|
-
import { useB3ConfigStore } from "../../stores/configStore.js";
|
|
12
12
|
import { StyleRoot } from "../StyleRoot.js";
|
|
13
13
|
import { setToastContext, ToastProvider, useToastContext } from "../Toast/index.js";
|
|
14
|
-
import AuthenticationProvider from "./AuthenticationProvider.js";
|
|
15
14
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
15
|
+
import { B3Context } from "./types.js";
|
|
16
|
+
/**
|
|
17
|
+
* Default permissions configuration for B3 provider
|
|
18
|
+
*/
|
|
19
|
+
const DEFAULT_PERMISSIONS = {
|
|
20
|
+
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
21
|
+
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
22
|
+
startDate: new Date(),
|
|
23
|
+
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
24
|
+
};
|
|
16
25
|
// Create queryClient instance
|
|
17
26
|
const queryClient = new QueryClient();
|
|
18
27
|
/**
|
|
@@ -20,35 +29,7 @@ const queryClient = new QueryClient();
|
|
|
20
29
|
*/
|
|
21
30
|
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
|
|
22
31
|
// deprecated since v0.0.87
|
|
23
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false,
|
|
24
|
-
const setConfig = useB3ConfigStore(state => state.setConfig);
|
|
25
|
-
// Initialize config store on mount
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
setConfig({
|
|
28
|
-
accountOverride,
|
|
29
|
-
environment: environment ?? "development",
|
|
30
|
-
automaticallySetFirstEoa: !!automaticallySetFirstEoa,
|
|
31
|
-
theme,
|
|
32
|
-
clientType,
|
|
33
|
-
partnerId,
|
|
34
|
-
stripePublishableKey,
|
|
35
|
-
createClientReferenceId,
|
|
36
|
-
enableTurnkey,
|
|
37
|
-
defaultPermissions,
|
|
38
|
-
});
|
|
39
|
-
}, [
|
|
40
|
-
accountOverride,
|
|
41
|
-
environment,
|
|
42
|
-
automaticallySetFirstEoa,
|
|
43
|
-
theme,
|
|
44
|
-
clientType,
|
|
45
|
-
partnerId,
|
|
46
|
-
stripePublishableKey,
|
|
47
|
-
createClientReferenceId,
|
|
48
|
-
enableTurnkey,
|
|
49
|
-
defaultPermissions,
|
|
50
|
-
setConfig,
|
|
51
|
-
]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
32
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
|
|
52
33
|
// Initialize Google Analytics on mount
|
|
53
34
|
useEffect(() => {
|
|
54
35
|
loadGA4Script();
|
|
@@ -58,7 +39,50 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
58
39
|
setClientType(clientType);
|
|
59
40
|
}, [clientType]);
|
|
60
41
|
const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
61
|
-
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children:
|
|
42
|
+
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsxs(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Inner provider component that provides the actual B3Context
|
|
46
|
+
*/
|
|
47
|
+
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
|
|
48
|
+
const activeAccount = useActiveAccount();
|
|
49
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
50
|
+
//const isConnected = useAuthStore(state => state.isConnected);
|
|
51
|
+
//const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
52
|
+
// Note: This fixes a bug where useAuthentication is no longer rendered on every page, as of this PR https://github.com/b3-fun/b3/pull/385/files#diff-3ef996931b8fc8e49021ba1b42ddaa97535214681610dc5fdacf63542e261af7
|
|
53
|
+
// The above PR removes useAuthentication from the overall B3Provider. useAuthentication should be everywhere the provider is, since it sets the overall auth state
|
|
54
|
+
// By just calling it manually, we fix that issue
|
|
55
|
+
// As a follow up, we should fix the SDK directly
|
|
56
|
+
useAuthentication(partnerId);
|
|
57
|
+
// Use given accountOverride or activeAccount from thirdweb
|
|
58
|
+
// WOJ: why if isAuthenticated is false, we don't use activeAccount, which should be undefined?
|
|
59
|
+
// skip isAuthenticated check ?
|
|
60
|
+
const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
61
|
+
// Wrapper to set active wallet via thirdweb
|
|
62
|
+
// Note: `wallet` in context is deprecated - use useActiveWallet() from thirdweb/react instead
|
|
63
|
+
// Auto-select first EOA wallet when enabled
|
|
64
|
+
useAutoSelectWallet({
|
|
65
|
+
enabled: automaticallySetFirstEoa,
|
|
66
|
+
});
|
|
67
|
+
return (_jsx(B3Context.Provider, { value: {
|
|
68
|
+
account: effectiveAccount,
|
|
69
|
+
// setWallet,
|
|
70
|
+
//wallet: undefined, // Deprecated: use useActiveWallet() from thirdweb/react instead
|
|
71
|
+
//user,
|
|
72
|
+
//setUser,
|
|
73
|
+
//refetchUser,
|
|
74
|
+
initialized: true,
|
|
75
|
+
ready: !!effectiveAccount,
|
|
76
|
+
automaticallySetFirstEoa,
|
|
77
|
+
environment,
|
|
78
|
+
defaultPermissions,
|
|
79
|
+
theme,
|
|
80
|
+
clientType,
|
|
81
|
+
partnerId: partnerId,
|
|
82
|
+
stripePublishableKey,
|
|
83
|
+
createClientReferenceId,
|
|
84
|
+
enableTurnkey,
|
|
85
|
+
}, children: children }));
|
|
62
86
|
}
|
|
63
87
|
/**
|
|
64
88
|
* Component to connect the toast context to the global toast API
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
2
2
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
3
3
|
import { ClientType } from "../../../client-manager";
|
|
4
|
+
import { B3ContextType } from "./types";
|
|
4
5
|
/**
|
|
5
6
|
* Main B3Provider component
|
|
6
7
|
*/
|
|
7
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect,
|
|
8
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, }: {
|
|
8
9
|
theme: "light" | "dark";
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
accountOverride?: Account;
|
|
11
|
-
environment
|
|
12
|
+
environment: B3ContextType["environment"];
|
|
12
13
|
clientType?: ClientType;
|
|
13
14
|
partnerId: string;
|
|
14
15
|
rpcUrls?: Record<number, string>;
|
|
15
16
|
onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
16
|
-
defaultPermissions?: PermissionsConfig;
|
|
17
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
/**
|
|
19
|
-
* Inner provider component
|
|
19
|
+
* Inner provider component that provides the actual B3Context
|
|
20
20
|
*/
|
|
21
21
|
export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, partnerId, rpcUrls, }: {
|
|
22
22
|
children: React.ReactNode;
|
|
23
23
|
accountOverride?: Account;
|
|
24
|
-
environment
|
|
24
|
+
environment: B3ContextType["environment"];
|
|
25
25
|
defaultPermissions?: PermissionsConfig;
|
|
26
26
|
theme: "light" | "dark";
|
|
27
27
|
clientType?: ClientType;
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
-
import {
|
|
4
|
-
import { ThirdwebProvider } from "thirdweb/react";
|
|
3
|
+
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
|
|
5
4
|
import { WagmiProvider } from "wagmi";
|
|
6
|
-
import { useB3ConfigStore } from "../../stores/configStore.js";
|
|
7
5
|
import { createWagmiConfig } from "../../utils/createWagmiConfig.js";
|
|
8
|
-
import AuthenticationProvider from "./AuthenticationProvider.js";
|
|
9
6
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
7
|
+
import { B3Context } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Default permissions configuration for B3 provider
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_PERMISSIONS = {
|
|
12
|
+
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
13
|
+
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
14
|
+
startDate: new Date(),
|
|
15
|
+
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
16
|
+
};
|
|
10
17
|
// Create queryClient instance
|
|
11
18
|
const queryClient = new QueryClient();
|
|
12
19
|
/**
|
|
13
20
|
* Main B3Provider component
|
|
14
21
|
*/
|
|
15
|
-
export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect,
|
|
16
|
-
|
|
17
|
-
// Initialize config store on mount - props are static and never change
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setConfig({
|
|
20
|
-
accountOverride,
|
|
21
|
-
environment: environment ?? "development",
|
|
22
|
-
automaticallySetFirstEoa: false,
|
|
23
|
-
theme,
|
|
24
|
-
clientType,
|
|
25
|
-
partnerId,
|
|
26
|
-
defaultPermissions,
|
|
27
|
-
});
|
|
28
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
29
|
-
return (_jsx(ThirdwebProvider, { children: _jsxs(LocalSDKProvider, { onConnectCallback: onConnect, children: [children, _jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }));
|
|
22
|
+
export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, }) {
|
|
23
|
+
return (_jsx(ThirdwebProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, clientType: clientType, partnerId: partnerId, rpcUrls: rpcUrls, children: children }) }) }));
|
|
30
24
|
}
|
|
31
25
|
/**
|
|
32
|
-
* Inner provider component
|
|
26
|
+
* Inner provider component that provides the actual B3Context
|
|
33
27
|
*/
|
|
34
|
-
export function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
35
|
-
const
|
|
28
|
+
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
29
|
+
const activeAccount = useActiveAccount();
|
|
30
|
+
//const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
36
31
|
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
// Use given accountOverride or activeAccount from thirdweb
|
|
33
|
+
const effectiveAccount = accountOverride || activeAccount;
|
|
34
|
+
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(B3Context.Provider, { value: {
|
|
35
|
+
//account: effectiveAccount,
|
|
36
|
+
automaticallySetFirstEoa: false,
|
|
37
|
+
//setWallet: () => {},
|
|
38
|
+
wallet: undefined,
|
|
39
|
+
//user,
|
|
40
|
+
//setUser,
|
|
41
|
+
initialized: true,
|
|
42
|
+
ready: !!effectiveAccount,
|
|
43
|
+
environment,
|
|
44
|
+
defaultPermissions,
|
|
45
|
+
theme,
|
|
46
|
+
clientType,
|
|
47
|
+
partnerId,
|
|
48
|
+
//refetchUser,
|
|
49
|
+
}, children: children }) }) }));
|
|
50
50
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
2
|
+
import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
|
|
3
|
+
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
4
|
+
import { Account, Wallet } from "thirdweb/wallets";
|
|
5
|
+
import { ClientType } from "../../../client-manager";
|
|
6
|
+
/**
|
|
7
|
+
* Context type for B3Provider
|
|
8
|
+
*/
|
|
9
|
+
export interface B3ContextType {
|
|
10
|
+
account?: Account;
|
|
11
|
+
automaticallySetFirstEoa: boolean;
|
|
12
|
+
wallet?: Wallet;
|
|
13
|
+
initialized: boolean;
|
|
14
|
+
ready: boolean;
|
|
15
|
+
environment?: "development" | "production";
|
|
16
|
+
defaultPermissions?: PermissionsConfig;
|
|
17
|
+
theme: "light" | "dark";
|
|
18
|
+
clientType: ClientType;
|
|
19
|
+
partnerId: string;
|
|
20
|
+
stripePublishableKey?: string;
|
|
21
|
+
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
22
|
+
enableTurnkey?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Context for B3 provider
|
|
26
|
+
*/
|
|
27
|
+
export declare const B3Context: import("react").Context<B3ContextType>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Context for B3 provider
|
|
4
|
+
*/
|
|
5
|
+
export const B3Context = createContext({
|
|
6
|
+
account: undefined,
|
|
7
|
+
automaticallySetFirstEoa: false,
|
|
8
|
+
//user: undefined,
|
|
9
|
+
//setWallet: () => {},
|
|
10
|
+
wallet: undefined,
|
|
11
|
+
//setUser: () => {},
|
|
12
|
+
//refetchUser: async () => {},
|
|
13
|
+
initialized: false,
|
|
14
|
+
ready: false,
|
|
15
|
+
environment: "development",
|
|
16
|
+
theme: "light",
|
|
17
|
+
clientType: "rest",
|
|
18
|
+
partnerId: "",
|
|
19
|
+
createClientReferenceId: undefined,
|
|
20
|
+
enableTurnkey: false,
|
|
21
|
+
});
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook to access the B3
|
|
3
|
-
* @
|
|
2
|
+
* Hook to access the B3 context
|
|
3
|
+
* @throws Error if used outside a B3Provider
|
|
4
|
+
* @deprecated Use useB3Config or useB3Account instead
|
|
4
5
|
*/
|
|
5
|
-
export declare function useB3():
|
|
6
|
-
automaticallySetFirstEoa: boolean;
|
|
7
|
-
environment: "development" | "production";
|
|
8
|
-
theme: "light" | "dark";
|
|
9
|
-
clientType: import("../../../client-manager").ClientType;
|
|
10
|
-
partnerId: string;
|
|
11
|
-
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
12
|
-
enableTurnkey: boolean;
|
|
13
|
-
stripePublishableKey: string | undefined;
|
|
14
|
-
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
15
|
-
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
16
|
-
};
|
|
6
|
+
export declare function useB3(): import("./types").B3ContextType;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useContext, useMemo } from "react";
|
|
2
|
+
import { B3Context } from "./types.js";
|
|
2
3
|
/**
|
|
3
|
-
* Hook to access the B3
|
|
4
|
-
* @
|
|
4
|
+
* Hook to access the B3 context
|
|
5
|
+
* @throws Error if used outside a B3Provider
|
|
6
|
+
* @deprecated Use useB3Config or useB3Account instead
|
|
5
7
|
*/
|
|
6
8
|
export function useB3() {
|
|
7
|
-
|
|
9
|
+
const context = useContext(B3Context);
|
|
10
|
+
if (!context.initialized) {
|
|
11
|
+
throw new Error("useB3 must be used within a B3Provider");
|
|
12
|
+
}
|
|
13
|
+
// Return a stable reference
|
|
14
|
+
return useMemo(() => context, [context]);
|
|
8
15
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { useActiveAccount } from "thirdweb/react";
|
|
2
|
-
import { useAuthStore } from "../../stores/useAuthStore.js";
|
|
3
2
|
// Wrapper around useActiveAccount
|
|
4
3
|
export const useB3Account = () => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const effectiveAccount = isAuthenticated ? activeAccount : undefined;
|
|
8
|
-
return effectiveAccount;
|
|
4
|
+
const account = useActiveAccount();
|
|
5
|
+
return account;
|
|
9
6
|
};
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to access B3 configuration
|
|
3
|
-
* Returns all config values from the Zustand store
|
|
4
|
-
* Since config is static (set once at initialization), destructuring is fine here
|
|
5
|
-
*/
|
|
6
1
|
export declare const useB3Config: () => {
|
|
7
2
|
automaticallySetFirstEoa: boolean;
|
|
8
|
-
environment: "development" | "production";
|
|
3
|
+
environment: "development" | "production" | undefined;
|
|
9
4
|
theme: "light" | "dark";
|
|
10
5
|
clientType: import("../../../client-manager").ClientType;
|
|
11
6
|
partnerId: string;
|
|
12
7
|
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
13
|
-
enableTurnkey: boolean;
|
|
14
|
-
stripePublishableKey: string | undefined;
|
|
15
|
-
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
16
|
-
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
8
|
+
enableTurnkey: boolean | undefined;
|
|
17
9
|
};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
* Hook to access B3 configuration
|
|
4
|
-
* Returns all config values from the Zustand store
|
|
5
|
-
* Since config is static (set once at initialization), destructuring is fine here
|
|
6
|
-
*/
|
|
1
|
+
import { useContext, useMemo } from "react";
|
|
2
|
+
import { B3Context } from "./types.js";
|
|
7
3
|
export const useB3Config = () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
const context = useContext(B3Context);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("useB3 must be used within a B3Provider");
|
|
7
|
+
}
|
|
8
|
+
const { automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, } = context;
|
|
9
|
+
// Return a stable reference
|
|
10
|
+
return useMemo(() => ({
|
|
11
|
+
automaticallySetFirstEoa,
|
|
12
|
+
environment,
|
|
13
|
+
theme,
|
|
14
|
+
clientType,
|
|
15
|
+
partnerId,
|
|
16
|
+
createClientReferenceId,
|
|
17
|
+
enableTurnkey,
|
|
18
|
+
}), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
|
|
20
19
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAccountWallet, useModalStore, useProfile, useSimBalance,
|
|
2
|
+
import { useAccountWallet, useAuthentication, useB3Config, useModalStore, useProfile, useSimBalance, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
4
4
|
import { formatDisplayNumber } from "../../../../shared/utils/number.js";
|
|
5
5
|
import { Pencil } from "lucide-react";
|
|
@@ -15,7 +15,8 @@ const ProfileSection = () => {
|
|
|
15
15
|
address: eoaAddress || account?.address,
|
|
16
16
|
fresh: true,
|
|
17
17
|
});
|
|
18
|
-
const {
|
|
18
|
+
const { partnerId } = useB3Config();
|
|
19
|
+
const { user } = useAuthentication(partnerId);
|
|
19
20
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
20
21
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
21
22
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
3
2
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
5
|
+
import { useB3 } from "../../B3Provider/useB3.js";
|
|
6
6
|
import { toast } from "../../Toast/toastApi.js";
|
|
7
7
|
import { NotificationChannel } from "../NotificationChannel.js";
|
|
8
8
|
const debug = debugB3React("DiscordChannel");
|
|
9
9
|
export const DiscordChannel = ({ userId, jwtToken, discordChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3();
|
|
11
11
|
const [discordId, setDiscordId] = useState("");
|
|
12
12
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
13
13
|
const [showInput, setShowInput] = useState(false);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
3
2
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
5
|
+
import { useB3 } from "../../B3Provider/useB3.js";
|
|
6
6
|
import { toast } from "../../Toast/toastApi.js";
|
|
7
7
|
import { NotificationChannel } from "../NotificationChannel.js";
|
|
8
8
|
const debug = debugB3React("EmailChannel");
|
|
@@ -11,7 +11,7 @@ const validateEmail = (email) => {
|
|
|
11
11
|
return emailRegex.test(email);
|
|
12
12
|
};
|
|
13
13
|
export const EmailChannel = ({ userId, jwtToken, emailChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
14
|
-
const { partnerId } =
|
|
14
|
+
const { partnerId } = useB3();
|
|
15
15
|
const [email, setEmail] = useState("");
|
|
16
16
|
const [emailError, setEmailError] = useState(null);
|
|
17
17
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
3
2
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
5
|
+
import { useB3 } from "../../B3Provider/useB3.js";
|
|
6
6
|
import { toast } from "../../Toast/toastApi.js";
|
|
7
7
|
import { NotificationChannel } from "../NotificationChannel.js";
|
|
8
8
|
const debug = debugB3React("PhoneChannel");
|
|
9
9
|
export const PhoneChannel = ({ userId, jwtToken, smsChannel, whatsappChannel, isSMSConnected, isWhatsAppConnected, isOptimisticallySMSConnected, isOptimisticallyWhatsAppConnected, onConnectionChange, onToggle, }) => {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3();
|
|
11
11
|
const [phoneNumber, setPhoneNumber] = useState("");
|
|
12
12
|
const [isConnectingSMS, setIsConnectingSMS] = useState(false);
|
|
13
13
|
const [isConnectingWhatsApp, setIsConnectingWhatsApp] = useState(false);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
3
2
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
5
|
+
import { useB3 } from "../../B3Provider/useB3.js";
|
|
6
6
|
import { toast } from "../../Toast/toastApi.js";
|
|
7
7
|
import { NotificationChannel } from "../NotificationChannel.js";
|
|
8
8
|
const debug = debugB3React("TelegramChannel");
|
|
9
9
|
export const TelegramChannel = ({ userId, jwtToken, telegramChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3();
|
|
11
11
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
12
12
|
const [status, setStatus] = useState("idle");
|
|
13
13
|
// Detect if we're disconnecting
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button,
|
|
2
|
+
import { Button, useB3, useAddTWSessionKey, useGetAllTWSigners, } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { PermissionItem } from "../../../../global-account/react/index.js";
|
|
3
4
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
5
|
import { formatAddress } from "../../../../shared/utils/formatAddress.js";
|
|
5
6
|
import { CreditCard, Eye } from "lucide-react";
|
|
@@ -14,7 +15,7 @@ const debug = debugB3React("RequestPermissions");
|
|
|
14
15
|
export function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, permissions, }) {
|
|
15
16
|
const [isApproving, setIsApproving] = useState(false);
|
|
16
17
|
const account = useActiveAccount();
|
|
17
|
-
const { defaultPermissions } =
|
|
18
|
+
const { defaultPermissions } = useB3();
|
|
18
19
|
const DEFAULT_PERMISSIONS = useMemo(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
|
|
19
20
|
const { refetch: refetchSigners } = useGetAllTWSigners({
|
|
20
21
|
chain,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { IPFSMediaRenderer, SignInWithB3, StyleRoot, useAccountWallet, useAuthentication,
|
|
2
|
+
import { IPFSMediaRenderer, SignInWithB3, StyleRoot, useAccountWallet, useAuthentication, useB3, useIsMobile, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import Icon from "../../../../global-account/react/components/custom/Icon.js";
|
|
4
4
|
import { ecosystemWalletId } from "../../../../shared/constants/index.js";
|
|
5
5
|
import { cn, truncateAddress } from "../../../../shared/utils/index.js";
|
|
@@ -9,7 +9,7 @@ import { useConnectedWallets, useSetActiveWallet, useWalletImage } from "thirdwe
|
|
|
9
9
|
import { ManageAccountButton } from "../custom/ManageAccountButton.js";
|
|
10
10
|
export function SignIn(props) {
|
|
11
11
|
const { className } = props;
|
|
12
|
-
const { automaticallySetFirstEoa, partnerId } =
|
|
12
|
+
const { automaticallySetFirstEoa, partnerId } = useB3();
|
|
13
13
|
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = useAccountWallet();
|
|
14
14
|
const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
|
|
15
15
|
const isMobile = useIsMobile();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Loading, useAuthentication, useAuthStore, useB3Config, useGetAllTWSigners, useModalStore, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
5
|
import { useActiveAccount } from "thirdweb/react";
|
|
6
6
|
import { TurnkeyAuthModal } from "../TurnkeyAuthModal.js";
|
|
7
7
|
import { SignInWithB3Privy } from "./SignInWithB3Privy.js";
|
|
@@ -29,6 +29,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
29
29
|
const [refetchCount, setRefetchCount] = useState(0);
|
|
30
30
|
const [refetchError, setRefetchError] = useState(null);
|
|
31
31
|
const [turnkeyAuthCompleted, setTurnkeyAuthCompleted] = useState(false);
|
|
32
|
+
const justCompletedLoginRef = useRef(false);
|
|
32
33
|
const { data: signers, refetch: refetchSigners, isFetching: isFetchingSigners, } = useGetAllTWSigners({
|
|
33
34
|
chain,
|
|
34
35
|
accountAddress: account?.address,
|
|
@@ -148,8 +149,12 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
148
149
|
signersEnabled,
|
|
149
150
|
});
|
|
150
151
|
// The useEffect will re-run with updated user data to complete the sign-in process
|
|
151
|
-
},
|
|
152
|
+
},
|
|
153
|
+
// Zustand setters are stable and don't need to be in dependencies:
|
|
154
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
155
|
+
[
|
|
152
156
|
refetchUser,
|
|
157
|
+
setB3ModalContentType,
|
|
153
158
|
strategies,
|
|
154
159
|
onLoginSuccess,
|
|
155
160
|
onSessionKeySuccess,
|
|
@@ -160,10 +165,8 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
160
165
|
closeAfterLogin,
|
|
161
166
|
source,
|
|
162
167
|
signersEnabled,
|
|
163
|
-
|
|
164
|
-
setIsAuthenticated,
|
|
165
|
-
setIsConnected,
|
|
166
|
-
setJustCompletedLogin,
|
|
168
|
+
// Zustand setters are stable and don't need to be in dependencies:
|
|
169
|
+
// setIsAuthenticated, setIsConnected, setJustCompletedLogin
|
|
167
170
|
]);
|
|
168
171
|
// Handle post-login flow after signers are loaded
|
|
169
172
|
useEffect(() => {
|
|
@@ -178,7 +181,9 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
178
181
|
if (isConnected && isAuthenticated && user) {
|
|
179
182
|
// Mark that login just completed BEFORE opening manage account or closing modal
|
|
180
183
|
// This allows Turnkey modal to show (if enableTurnkey is true)
|
|
181
|
-
|
|
184
|
+
// Use ref to prevent setting this multiple times and causing infinite loops
|
|
185
|
+
if (closeAfterLogin && !justCompletedLoginRef.current) {
|
|
186
|
+
justCompletedLoginRef.current = true;
|
|
182
187
|
setJustCompletedLogin(true);
|
|
183
188
|
}
|
|
184
189
|
// Check if we should show Turnkey login form as SECONDARY option (after wallet connection)
|
|
@@ -222,6 +227,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
222
227
|
handlePostTurnkeyFlow();
|
|
223
228
|
}
|
|
224
229
|
},
|
|
230
|
+
// handlePostTurnkeyFlow changes when its dependencies change, causing infinite loops
|
|
225
231
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
226
232
|
[
|
|
227
233
|
signers,
|
|
@@ -242,9 +248,9 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
242
248
|
user,
|
|
243
249
|
enableTurnkey,
|
|
244
250
|
turnkeyAuthCompleted,
|
|
245
|
-
|
|
251
|
+
handleTurnkeySuccess,
|
|
246
252
|
contentType,
|
|
247
|
-
handlePostTurnkeyFlow,
|
|
253
|
+
// handlePostTurnkeyFlow - removed because it changes when signers/partnerId/etc change, triggering infinite loops
|
|
248
254
|
]);
|
|
249
255
|
debug("render", {
|
|
250
256
|
step,
|
|
@@ -259,9 +265,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
259
265
|
if (closeAfterLogin && sessionKeyAdded) {
|
|
260
266
|
setB3ModalOpen(false);
|
|
261
267
|
}
|
|
262
|
-
|
|
263
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
264
|
-
}, [closeAfterLogin, sessionKeyAdded]);
|
|
268
|
+
}, [closeAfterLogin, sessionKeyAdded, setB3ModalOpen]);
|
|
265
269
|
const onSessionKeySuccessEnhanced = useCallback(() => {
|
|
266
270
|
onSessionKeySuccess?.();
|
|
267
271
|
setB3ModalContentType({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loading, useAuthentication, useAuthStore,
|
|
2
|
+
import { Loading, useAuthentication, useAuthStore, useB3, useHandleConnectWithPrivy, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
4
|
import { useEffect } from "react";
|
|
5
5
|
const debug = debugB3React("SignInWithB3Privy");
|
|
6
6
|
export function SignInWithB3Privy({ onSuccess, onError, chain }) {
|
|
7
|
-
const { partnerId } =
|
|
7
|
+
const { partnerId } = useB3();
|
|
8
8
|
const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
|
|
9
9
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
10
10
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|