@b3dotfun/sdk 0.0.88-alpha.5 → 0.0.88-alpha.7
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/react/components/AnySpend.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +5 -5
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +33 -5
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +3 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- 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 +2 -3
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +12 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +23 -57
- 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 +38 -35
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
- 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 +8 -9
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- 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 +1 -2
- package/dist/cjs/global-account/react/components/index.d.ts +1 -2
- package/dist/cjs/global-account/react/components/index.js +3 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAuth.js +1 -2
- 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/useUser.d.ts +60 -0
- package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +9 -35
- package/dist/cjs/global-account/react/index.native.d.ts +0 -2
- package/dist/cjs/global-account/react/index.native.js +1 -5
- package/dist/cjs/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/cjs/global-account/react/stores/configStore.js +30 -0
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
- package/dist/cjs/global-account/react/stores/index.js +3 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +6 -0
- package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/cjs/global-account/react/stores/userStore.js +30 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +6 -6
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +3 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +35 -7
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +3 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- 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 +3 -4
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +22 -58
- 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/useB3.d.ts +14 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
- 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 +2 -3
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- 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 +2 -3
- package/dist/esm/global-account/react/components/index.d.ts +1 -2
- package/dist/esm/global-account/react/components/index.js +1 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuth.js +2 -3
- 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/useUser.d.ts +60 -0
- package/dist/esm/global-account/react/hooks/useUser.js +17 -0
- package/dist/esm/global-account/react/hooks/useUserQuery.js +1 -27
- package/dist/esm/global-account/react/index.native.d.ts +0 -2
- package/dist/esm/global-account/react/index.native.js +0 -2
- package/dist/esm/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/esm/global-account/react/stores/configStore.js +27 -0
- package/dist/esm/global-account/react/stores/index.d.ts +1 -0
- package/dist/esm/global-account/react/stores/index.js +1 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +6 -0
- package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/esm/global-account/react/stores/userStore.js +27 -0
- package/dist/types/anyspend/react/components/AnySpend.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/types/global-account/react/components/index.d.ts +1 -2
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/types/global-account/react/index.native.d.ts +0 -2
- package/dist/types/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/types/global-account/react/stores/index.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +6 -0
- package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +18 -2
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +13 -0
- package/src/anyspend/react/components/AnySpendDeposit.tsx +15 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +4 -0
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +5 -1
- package/src/anyspend/react/components/common/OrderDetails.tsx +54 -42
- package/src/anyspend/react/components/common/PanelOnramp.tsx +5 -1
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -4
- 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 +3 -4
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +43 -54
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +32 -117
- package/src/global-account/react/components/B3Provider/useB3.ts +4 -13
- package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
- package/src/global-account/react/components/B3Provider/useB3Config.ts +18 -31
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
- 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/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 +2 -3
- package/src/global-account/react/components/index.ts +1 -2
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +2 -3
- 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 +8 -7
- package/src/global-account/react/hooks/useUser.ts +20 -0
- package/src/global-account/react/hooks/useUserQuery.ts +1 -40
- package/src/global-account/react/index.native.ts +0 -2
- package/src/global-account/react/stores/configStore.ts +51 -0
- package/src/global-account/react/stores/index.ts +1 -0
- package/src/global-account/react/stores/useModalStore.ts +6 -0
- package/src/global-account/react/stores/userStore.ts +41 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/src/global-account/react/components/B3Provider/types.ts +0 -50
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { RelayKitProviderWrapper, TooltipProvider
|
|
3
|
-
import { useAutoSelectWallet } from "../../../../global-account/react/hooks/useAutoSelectWallet.js";
|
|
2
|
+
import { RelayKitProviderWrapper, TooltipProvider } from "../../../../global-account/react/index.js";
|
|
4
3
|
import { createWagmiConfig } from "../../../../global-account/react/utils/createWagmiConfig.js";
|
|
5
4
|
import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
6
5
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
7
6
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
8
7
|
import { useEffect, useMemo } from "react";
|
|
9
|
-
import { ThirdwebProvider
|
|
8
|
+
import { ThirdwebProvider } from "thirdweb/react";
|
|
10
9
|
import { WagmiProvider } from "wagmi";
|
|
11
10
|
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";
|
|
14
15
|
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
|
-
};
|
|
25
16
|
// Create queryClient instance
|
|
26
17
|
const queryClient = new QueryClient();
|
|
27
18
|
/**
|
|
@@ -29,7 +20,23 @@ const queryClient = new QueryClient();
|
|
|
29
20
|
*/
|
|
30
21
|
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
|
|
31
22
|
// deprecated since v0.0.87
|
|
32
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
|
|
23
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
|
|
24
|
+
const setConfig = useB3ConfigStore(state => state.setConfig);
|
|
25
|
+
// Initialize config store on mount - props are static and never change
|
|
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
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
33
40
|
// Initialize Google Analytics on mount
|
|
34
41
|
useEffect(() => {
|
|
35
42
|
loadGA4Script();
|
|
@@ -39,50 +46,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
39
46
|
setClientType(clientType);
|
|
40
47
|
}, [clientType]);
|
|
41
48
|
const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
42
|
-
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children:
|
|
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 }));
|
|
49
|
+
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsxs(LocalSDKProvider, { onConnectCallback: onConnect, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] }), _jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }));
|
|
86
50
|
}
|
|
87
51
|
/**
|
|
88
52
|
* 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";
|
|
5
4
|
/**
|
|
6
5
|
* Main B3Provider component
|
|
7
6
|
*/
|
|
8
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, }: {
|
|
7
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, defaultPermissions, }: {
|
|
9
8
|
theme: "light" | "dark";
|
|
10
9
|
children: React.ReactNode;
|
|
11
10
|
accountOverride?: Account;
|
|
12
|
-
environment
|
|
11
|
+
environment?: "development" | "production";
|
|
13
12
|
clientType?: ClientType;
|
|
14
13
|
partnerId: string;
|
|
15
14
|
rpcUrls?: Record<number, string>;
|
|
16
15
|
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 for native
|
|
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?: "development" | "production";
|
|
25
25
|
defaultPermissions?: PermissionsConfig;
|
|
26
26
|
theme: "light" | "dark";
|
|
27
27
|
clientType?: ClientType;
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { ThirdwebProvider } from "thirdweb/react";
|
|
4
5
|
import { WagmiProvider } from "wagmi";
|
|
6
|
+
import { useB3ConfigStore } from "../../stores/configStore.js";
|
|
5
7
|
import { createWagmiConfig } from "../../utils/createWagmiConfig.js";
|
|
8
|
+
import AuthenticationProvider from "./AuthenticationProvider.js";
|
|
6
9
|
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
|
-
};
|
|
17
10
|
// Create queryClient instance
|
|
18
11
|
const queryClient = new QueryClient();
|
|
19
12
|
/**
|
|
20
13
|
* Main B3Provider component
|
|
21
14
|
*/
|
|
22
|
-
export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, }) {
|
|
23
|
-
|
|
15
|
+
export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, defaultPermissions, }) {
|
|
16
|
+
const setConfig = useB3ConfigStore(state => state.setConfig);
|
|
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 })] }) }));
|
|
24
30
|
}
|
|
25
31
|
/**
|
|
26
|
-
* Inner provider component
|
|
32
|
+
* Inner provider component for native
|
|
27
33
|
*/
|
|
28
|
-
export function InnerProvider({ children, accountOverride, environment, defaultPermissions
|
|
29
|
-
const
|
|
30
|
-
//const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
34
|
+
export function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
35
|
+
const setConfig = useB3ConfigStore(state => state.setConfig);
|
|
31
36
|
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
theme,
|
|
46
|
-
clientType,
|
|
47
|
-
partnerId,
|
|
48
|
-
//refetchUser,
|
|
49
|
-
}, children: children }) }) }));
|
|
37
|
+
// Initialize config store on mount - props are static and never change
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
setConfig({
|
|
40
|
+
accountOverride,
|
|
41
|
+
environment: environment ?? "development",
|
|
42
|
+
automaticallySetFirstEoa: false,
|
|
43
|
+
theme,
|
|
44
|
+
clientType,
|
|
45
|
+
partnerId,
|
|
46
|
+
defaultPermissions,
|
|
47
|
+
});
|
|
48
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
49
|
+
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: children }) }));
|
|
50
50
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook to access the B3
|
|
3
|
-
* @
|
|
4
|
-
* @deprecated Use useB3Config or useB3Account instead
|
|
2
|
+
* Hook to access the B3 configuration
|
|
3
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
5
4
|
*/
|
|
6
|
-
export declare function useB3():
|
|
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
|
+
};
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B3Context } from "./types.js";
|
|
1
|
+
import { useB3Config } from "./useB3Config.js";
|
|
3
2
|
/**
|
|
4
|
-
* Hook to access the B3
|
|
5
|
-
* @
|
|
6
|
-
* @deprecated Use useB3Config or useB3Account instead
|
|
3
|
+
* Hook to access the B3 configuration
|
|
4
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
7
5
|
*/
|
|
8
6
|
export function useB3() {
|
|
9
|
-
|
|
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]);
|
|
7
|
+
return useB3Config();
|
|
15
8
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { useActiveAccount } from "thirdweb/react";
|
|
2
|
+
import { useAuthStore } from "../../stores/useAuthStore.js";
|
|
2
3
|
// Wrapper around useActiveAccount
|
|
3
4
|
export const useB3Account = () => {
|
|
4
|
-
const
|
|
5
|
-
|
|
5
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
6
|
+
const activeAccount = useActiveAccount();
|
|
7
|
+
const effectiveAccount = isAuthenticated ? activeAccount : undefined;
|
|
8
|
+
return effectiveAccount;
|
|
6
9
|
};
|
|
@@ -1,9 +1,17 @@
|
|
|
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
|
+
*/
|
|
1
6
|
export declare const useB3Config: () => {
|
|
2
7
|
automaticallySetFirstEoa: boolean;
|
|
3
|
-
environment: "development" | "production"
|
|
8
|
+
environment: "development" | "production";
|
|
4
9
|
theme: "light" | "dark";
|
|
5
10
|
clientType: import("../../../client-manager").ClientType;
|
|
6
11
|
partnerId: string;
|
|
7
12
|
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
8
|
-
enableTurnkey: boolean
|
|
13
|
+
enableTurnkey: boolean;
|
|
14
|
+
stripePublishableKey: string | undefined;
|
|
15
|
+
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
16
|
+
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
9
17
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { useB3ConfigStore } from "../../stores/configStore.js";
|
|
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
|
+
*/
|
|
3
7
|
export const useB3Config = () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
createClientReferenceId,
|
|
17
|
-
enableTurnkey,
|
|
18
|
-
}), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
|
|
8
|
+
return useB3ConfigStore(state => ({
|
|
9
|
+
automaticallySetFirstEoa: state.automaticallySetFirstEoa,
|
|
10
|
+
environment: state.environment,
|
|
11
|
+
theme: state.theme,
|
|
12
|
+
clientType: state.clientType,
|
|
13
|
+
partnerId: state.partnerId,
|
|
14
|
+
createClientReferenceId: state.createClientReferenceId,
|
|
15
|
+
enableTurnkey: state.enableTurnkey,
|
|
16
|
+
stripePublishableKey: state.stripePublishableKey,
|
|
17
|
+
defaultPermissions: state.defaultPermissions,
|
|
18
|
+
accountOverride: state.accountOverride,
|
|
19
|
+
}));
|
|
19
20
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAccountWallet,
|
|
2
|
+
import { useAccountWallet, useModalStore, useProfile, useSimBalance, useUser, } 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,8 +15,7 @@ const ProfileSection = () => {
|
|
|
15
15
|
address: eoaAddress || account?.address,
|
|
16
16
|
fresh: true,
|
|
17
17
|
});
|
|
18
|
-
const {
|
|
19
|
-
const { user } = useAuthentication(partnerId);
|
|
18
|
+
const { user } = useUser();
|
|
20
19
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
21
20
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
22
21
|
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";
|
|
2
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
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 } = useB3Config();
|
|
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";
|
|
2
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
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 } = useB3Config();
|
|
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";
|
|
2
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
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 } = useB3Config();
|
|
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";
|
|
2
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
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 } = useB3Config();
|
|
11
11
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
12
12
|
const [status, setStatus] = useState("idle");
|
|
13
13
|
// Detect if we're disconnecting
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button,
|
|
3
|
-
import { PermissionItem } from "../../../../global-account/react/index.js";
|
|
2
|
+
import { Button, PermissionItem, useAddTWSessionKey, useB3Config, useGetAllTWSigners, } from "../../../../global-account/react/index.js";
|
|
4
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
5
4
|
import { formatAddress } from "../../../../shared/utils/formatAddress.js";
|
|
6
5
|
import { CreditCard, Eye } from "lucide-react";
|
|
@@ -15,7 +14,7 @@ const debug = debugB3React("RequestPermissions");
|
|
|
15
14
|
export function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, permissions, }) {
|
|
16
15
|
const [isApproving, setIsApproving] = useState(false);
|
|
17
16
|
const account = useActiveAccount();
|
|
18
|
-
const { defaultPermissions } =
|
|
17
|
+
const { defaultPermissions } = useB3Config();
|
|
19
18
|
const DEFAULT_PERMISSIONS = useMemo(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
|
|
20
19
|
const { refetch: refetchSigners } = useGetAllTWSigners({
|
|
21
20
|
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, useB3Config, 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 } = useB3Config();
|
|
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,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loading, useAuthentication, useAuthStore,
|
|
2
|
+
import { Loading, useAuthentication, useAuthStore, useB3Config, 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 } = useB3Config();
|
|
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);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAuthentication,
|
|
2
|
+
import { useAuthentication, useB3Config, useQueryB3 } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { ecosystemWalletId } from "../../../../../shared/constants/index.js";
|
|
4
4
|
import { client } from "../../../../../shared/utils/thirdweb.js";
|
|
5
5
|
import { ConnectEmbed, darkTheme, lightTheme } from "thirdweb/react";
|
|
@@ -15,7 +15,7 @@ export function LoginStepContainer({ children, partnerId }) {
|
|
|
15
15
|
return (_jsxs("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && (_jsx("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
|
|
16
16
|
}
|
|
17
17
|
export function LoginStep({ onSuccess, chain }) {
|
|
18
|
-
const { partnerId, theme } =
|
|
18
|
+
const { partnerId, theme } = useB3Config();
|
|
19
19
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
20
20
|
partnerId: partnerId,
|
|
21
21
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore,
|
|
2
|
+
import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore, useB3Config, useConnect, WalletRow, } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
4
|
import { client } from "../../../../../shared/utils/thirdweb.js";
|
|
5
5
|
import { useState } from "react";
|
|
@@ -7,7 +7,7 @@ import { useConnect as useConnectTW } from "thirdweb/react";
|
|
|
7
7
|
import { createWallet } from "thirdweb/wallets";
|
|
8
8
|
const debug = debugB3React("LoginStepCustom");
|
|
9
9
|
export function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3Config();
|
|
11
11
|
const [isLoading, setIsLoading] = useState(false);
|
|
12
12
|
const [showAllWallets, setShowAllWallets] = useState(false);
|
|
13
13
|
const { connect } = useConnect(partnerId, chain);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "./B3Provider/useB3Config.js";
|
|
3
3
|
export function StyleRoot({ children, id }) {
|
|
4
|
-
const { theme
|
|
5
|
-
return (_jsx("div", { className: "b3-root", id: id, "data-theme":
|
|
4
|
+
const { theme } = useB3Config();
|
|
5
|
+
return (_jsx("div", { className: "b3-root", id: id, "data-theme": theme, children: children }));
|
|
6
6
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, StyleRoot,
|
|
2
|
+
import { Button, StyleRoot, useModalStore, useUser } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { cn } from "../../../../shared/utils/index.js";
|
|
4
4
|
export function ManageAccountButton(props) {
|
|
5
|
-
const { partnerId } = useB3();
|
|
6
5
|
const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
|
|
7
|
-
const { isConnected } =
|
|
6
|
+
const { isConnected } = useUser();
|
|
8
7
|
const handleClickManageAccount = () => {
|
|
9
8
|
setB3ModalContentType({
|
|
10
9
|
...props,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
|
-
export { B3Provider
|
|
2
|
+
export { B3Provider } from "./B3Provider/B3Provider";
|
|
3
3
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
4
|
-
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
4
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
5
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
7
6
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
@@ -1,9 +1,8 @@
|
|
|
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.js";
|
|
4
|
-
export { B3Provider
|
|
4
|
+
export { B3Provider } from "./B3Provider/B3Provider.js";
|
|
5
5
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
|
|
6
|
-
export { B3Context } from "./B3Provider/types.js";
|
|
7
6
|
export { useB3 } from "./B3Provider/useB3.js";
|
|
8
7
|
export { useB3Account } from "./B3Provider/useB3Account.js";
|
|
9
8
|
export { useB3Config } from "./B3Provider/useB3Config.js";
|
|
@@ -43,3 +43,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
|
43
43
|
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
44
44
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
45
45
|
export { useURLParams } from "./useURLParams";
|
|
46
|
+
export { useUser } from "./useUser";
|
|
@@ -43,3 +43,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress.js";
|
|
|
43
43
|
export { useTurnkeyAuth } from "./useTurnkeyAuth.js";
|
|
44
44
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute.js";
|
|
45
45
|
export { useURLParams } from "./useURLParams.js";
|
|
46
|
+
export { useUser } from "./useUser.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import app from "../../../global-account/app.js";
|
|
2
2
|
import { authenticateWithB3JWT } from "../../../global-account/bsmnt.js";
|
|
3
|
-
import { useAuthStore } from "../../../global-account/react/index.js";
|
|
3
|
+
import { useAuthStore, useB3Config } from "../../../global-account/react/index.js";
|
|
4
4
|
import { ecosystemWalletId } from "../../../shared/constants/index.js";
|
|
5
5
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
6
6
|
import { client } from "../../../shared/utils/thirdweb.js";
|
|
@@ -11,7 +11,6 @@ import { ecosystemWallet } from "thirdweb/wallets";
|
|
|
11
11
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
12
12
|
import { useAccount, useConnect, useSwitchAccount } from "wagmi";
|
|
13
13
|
import { LocalSDKContext } from "../components/B3Provider/LocalSDKProvider.js";
|
|
14
|
-
import { useB3 } from "../components/B3Provider/useB3.js";
|
|
15
14
|
import { createWagmiConfig } from "../utils/createWagmiConfig.js";
|
|
16
15
|
import { useSearchParam } from "./useSearchParamsSSR.js";
|
|
17
16
|
import { useUserQuery } from "./useUserQuery.js";
|
|
@@ -39,7 +38,7 @@ export function useAuth() {
|
|
|
39
38
|
const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
|
|
40
39
|
const useAutoConnectLoadingPrevious = useRef(false);
|
|
41
40
|
const referralCode = useSearchParam("referralCode");
|
|
42
|
-
const { partnerId } =
|
|
41
|
+
const { partnerId } = useB3Config();
|
|
43
42
|
const wagmiConfig = createWagmiConfig({ partnerId });
|
|
44
43
|
const { connect } = useConnect();
|
|
45
44
|
const activeWagmiAccount = useAccount();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config } from "../../../global-account/react/index.js";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { authenticateBoth, authenticateWithClient, getClient, getClientByType, setClientType, } from "../../client-manager.js";
|
|
4
4
|
/**
|
|
5
5
|
* Hook to access the current FeathersJS client and client management utilities
|
|
6
6
|
*/
|
|
7
7
|
export function useClient() {
|
|
8
|
-
const { clientType } =
|
|
8
|
+
const { clientType } = useB3Config();
|
|
9
9
|
const getCurrentClient = useCallback(() => {
|
|
10
10
|
return getClient();
|
|
11
11
|
}, []);
|