@b3dotfun/sdk 0.1.69-alpha.1 → 0.1.69

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.
Files changed (19) hide show
  1. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +1 -3
  2. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +1 -2
  3. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -4
  4. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
  5. package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.d.ts +3 -6
  6. package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.js +3 -31
  7. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +1 -3
  8. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +1 -2
  9. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -4
  10. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
  11. package/dist/esm/global-account/react/hooks/useAutoSelectWallet.d.ts +3 -6
  12. package/dist/esm/global-account/react/hooks/useAutoSelectWallet.js +5 -33
  13. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +1 -3
  14. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -4
  15. package/dist/types/global-account/react/hooks/useAutoSelectWallet.d.ts +3 -6
  16. package/package.json +1 -1
  17. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -4
  18. package/src/global-account/react/components/B3Provider/B3Provider.tsx +2 -9
  19. package/src/global-account/react/hooks/useAutoSelectWallet.ts +6 -40
@@ -1,7 +1,5 @@
1
- import { EIP1193 } from "thirdweb/wallets";
2
- declare const AuthenticationProvider: ({ partnerId, automaticallySetFirstEoa, defaultEoaProvider, }: {
1
+ declare const AuthenticationProvider: ({ partnerId, automaticallySetFirstEoa, }: {
3
2
  partnerId: string;
4
3
  automaticallySetFirstEoa: boolean;
5
- defaultEoaProvider?: EIP1193.EIP1193Provider;
6
4
  }) => null;
7
5
  export default AuthenticationProvider;
@@ -2,11 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const hooks_1 = require("../../hooks");
4
4
  const useAutoSelectWallet_1 = require("../../hooks/useAutoSelectWallet");
5
- const AuthenticationProvider = ({ partnerId, automaticallySetFirstEoa, defaultEoaProvider, }) => {
5
+ const AuthenticationProvider = ({ partnerId, automaticallySetFirstEoa, }) => {
6
6
  (0, hooks_1.useAuthentication)(partnerId);
7
7
  (0, useAutoSelectWallet_1.useAutoSelectWallet)({
8
8
  enabled: automaticallySetFirstEoa,
9
- defaultEoaProvider,
10
9
  });
11
10
  return null;
12
11
  };
@@ -2,20 +2,18 @@ import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAny
2
2
  import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
3
3
  import { PermissionsConfig } from "../../../../global-account/types/permissions";
4
4
  import "@relayprotocol/relay-kit-ui/styles.css";
5
- import { Account, EIP1193, Wallet } from "thirdweb/wallets";
5
+ import { Account, Wallet } from "thirdweb/wallets";
6
6
  import { CreateConnectorFn } from "wagmi";
7
7
  import { ClientType } from "../../../client-manager";
8
8
  /**
9
9
  * Main B3Provider component
10
10
  */
11
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
11
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
12
12
  theme: "light" | "dark";
13
13
  children: React.ReactNode;
14
14
  accountOverride?: Account;
15
15
  environment?: "development" | "production";
16
16
  automaticallySetFirstEoa?: boolean;
17
- /** EIP-1193 provider to auto-connect as the default EOA wallet (e.g., Farcaster frame wallet) */
18
- defaultEoaProvider?: EIP1193.EIP1193Provider;
19
17
  simDuneApiKey?: string;
20
18
  toaster?: {
21
19
  position?: "top-center" | "top-right" | "bottom-center" | "bottom-right";
@@ -24,7 +24,7 @@ const queryClient = new react_query_1.QueryClient();
24
24
  /**
25
25
  * Main B3Provider component
26
26
  */
27
- function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey,
27
+ function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
28
28
  // deprecated since v0.0.87
29
29
  toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, }) {
30
30
  // Initialize Google Analytics on mount
@@ -36,7 +36,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
36
36
  (0, client_manager_1.setClientType)(clientType);
37
37
  }, [clientType]);
38
38
  const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
39
- return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] }), (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa, defaultEoaProvider: defaultEoaProvider })] }) }) }) }) }) }) }));
39
+ return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] }), (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }) }));
40
40
  }
41
41
  /**
42
42
  * Component to connect the toast context to the global toast API
@@ -1,10 +1,7 @@
1
- import { EIP1193 } from "thirdweb/wallets";
2
1
  /**
3
- * Hook to automatically connect a default EOA provider (if given) and
4
- * select the first EOA wallet when user is authenticated.
5
- * Only auto-selects if the last auth was via wallet or no previous auth provider.
2
+ * Hook to automatically select the first EOA wallet when user is authenticated
3
+ * Only auto-selects if the last auth was via wallet or no previous auth provider
6
4
  */
7
- export declare function useAutoSelectWallet({ enabled, defaultEoaProvider, }: {
5
+ export declare function useAutoSelectWallet({ enabled }: {
8
6
  enabled: boolean;
9
- defaultEoaProvider?: EIP1193.EIP1193Provider;
10
7
  }): void;
@@ -1,47 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useAutoSelectWallet = useAutoSelectWallet;
4
- const thirdweb_1 = require("../../../shared/utils/thirdweb");
5
4
  const debug_1 = require("../../../shared/utils/debug");
6
5
  const react_1 = require("react");
7
6
  const react_2 = require("thirdweb/react");
8
- const wallets_1 = require("thirdweb/wallets");
9
7
  const stores_1 = require("../stores");
10
8
  const debug = (0, debug_1.debugB3React)("useAutoSelectWallet");
11
9
  /**
12
- * Hook to automatically connect a default EOA provider (if given) and
13
- * select the first EOA wallet when user is authenticated.
14
- * Only auto-selects if the last auth was via wallet or no previous auth provider.
10
+ * Hook to automatically select the first EOA wallet when user is authenticated
11
+ * Only auto-selects if the last auth was via wallet or no previous auth provider
15
12
  */
16
- function useAutoSelectWallet({ enabled, defaultEoaProvider, }) {
13
+ function useAutoSelectWallet({ enabled }) {
17
14
  const isAuthenticated = (0, stores_1.useAuthStore)(state => state.isAuthenticated);
18
15
  const wallets = (0, react_2.useConnectedWallets)();
19
16
  const setActiveWallet = (0, react_2.useSetActiveWallet)();
20
- const addConnectedWallet = (0, react_2.useAddConnectedWallet)();
21
- const hasConnectedProvider = (0, react_1.useRef)(false);
22
- // Auto-connect the default EOA provider (e.g. Farcaster frame wallet) on mount.
23
- // Uses useAddConnectedWallet instead of useConnect so the wallet is added to
24
- // connectedWallets WITHOUT becoming the active wallet. This prevents
25
- // useAuthentication's logout/onTimeout from disconnecting it (logout only
26
- // disconnects ecosystem wallets and the active wallet).
27
- (0, react_1.useEffect)(() => {
28
- if (!defaultEoaProvider || hasConnectedProvider.current)
29
- return;
30
- hasConnectedProvider.current = true;
31
- const connectDefaultProvider = async () => {
32
- try {
33
- const wallet = wallets_1.EIP1193.fromProvider({ provider: defaultEoaProvider });
34
- await wallet.connect({ client: thirdweb_1.client });
35
- addConnectedWallet(wallet);
36
- debug("Auto-connected default EOA provider", wallet.id);
37
- }
38
- catch (error) {
39
- debug("Failed to auto-connect default EOA provider", error);
40
- hasConnectedProvider.current = false;
41
- }
42
- };
43
- connectDefaultProvider();
44
- }, [defaultEoaProvider, addConnectedWallet]);
45
17
  const setWallet = (0, react_1.useCallback)((wallet) => {
46
18
  debug("@@setWallet", wallet.id, wallet.getAccount()?.address);
47
19
  setActiveWallet(wallet);
@@ -1,7 +1,5 @@
1
- import { EIP1193 } from "thirdweb/wallets";
2
- declare const AuthenticationProvider: ({ partnerId, automaticallySetFirstEoa, defaultEoaProvider, }: {
1
+ declare const AuthenticationProvider: ({ partnerId, automaticallySetFirstEoa, }: {
3
2
  partnerId: string;
4
3
  automaticallySetFirstEoa: boolean;
5
- defaultEoaProvider?: EIP1193.EIP1193Provider;
6
4
  }) => null;
7
5
  export default AuthenticationProvider;
@@ -1,10 +1,9 @@
1
1
  import { useAuthentication } from "../../hooks/index.js";
2
2
  import { useAutoSelectWallet } from "../../hooks/useAutoSelectWallet.js";
3
- const AuthenticationProvider = ({ partnerId, automaticallySetFirstEoa, defaultEoaProvider, }) => {
3
+ const AuthenticationProvider = ({ partnerId, automaticallySetFirstEoa, }) => {
4
4
  useAuthentication(partnerId);
5
5
  useAutoSelectWallet({
6
6
  enabled: automaticallySetFirstEoa,
7
- defaultEoaProvider,
8
7
  });
9
8
  return null;
10
9
  };
@@ -2,20 +2,18 @@ import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAny
2
2
  import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
3
3
  import { PermissionsConfig } from "../../../../global-account/types/permissions";
4
4
  import "@relayprotocol/relay-kit-ui/styles.css";
5
- import { Account, EIP1193, Wallet } from "thirdweb/wallets";
5
+ import { Account, Wallet } from "thirdweb/wallets";
6
6
  import { CreateConnectorFn } from "wagmi";
7
7
  import { ClientType } from "../../../client-manager";
8
8
  /**
9
9
  * Main B3Provider component
10
10
  */
11
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
11
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
12
12
  theme: "light" | "dark";
13
13
  children: React.ReactNode;
14
14
  accountOverride?: Account;
15
15
  environment?: "development" | "production";
16
16
  automaticallySetFirstEoa?: boolean;
17
- /** EIP-1193 provider to auto-connect as the default EOA wallet (e.g., Farcaster frame wallet) */
18
- defaultEoaProvider?: EIP1193.EIP1193Provider;
19
17
  simDuneApiKey?: string;
20
18
  toaster?: {
21
19
  position?: "top-center" | "top-right" | "bottom-center" | "bottom-right";
@@ -18,7 +18,7 @@ const queryClient = new QueryClient();
18
18
  /**
19
19
  * Main B3Provider component
20
20
  */
21
- export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey,
21
+ export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
22
22
  // deprecated since v0.0.87
23
23
  toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, }) {
24
24
  // Initialize Google Analytics on mount
@@ -30,7 +30,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
30
30
  setClientType(clientType);
31
31
  }, [clientType]);
32
32
  const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
33
- 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, onLogoutCallback: onLogout, children: _jsxs(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] }), _jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa, defaultEoaProvider: defaultEoaProvider })] }) }) }) }) }) }) }));
33
+ 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, onLogoutCallback: onLogout, children: _jsxs(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] }), _jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }) }));
34
34
  }
35
35
  /**
36
36
  * Component to connect the toast context to the global toast API
@@ -1,10 +1,7 @@
1
- import { EIP1193 } from "thirdweb/wallets";
2
1
  /**
3
- * Hook to automatically connect a default EOA provider (if given) and
4
- * select the first EOA wallet when user is authenticated.
5
- * Only auto-selects if the last auth was via wallet or no previous auth provider.
2
+ * Hook to automatically select the first EOA wallet when user is authenticated
3
+ * Only auto-selects if the last auth was via wallet or no previous auth provider
6
4
  */
7
- export declare function useAutoSelectWallet({ enabled, defaultEoaProvider, }: {
5
+ export declare function useAutoSelectWallet({ enabled }: {
8
6
  enabled: boolean;
9
- defaultEoaProvider?: EIP1193.EIP1193Provider;
10
7
  }): void;
@@ -1,44 +1,16 @@
1
- import { client } from "../../../shared/utils/thirdweb.js";
2
1
  import { debugB3React } from "../../../shared/utils/debug.js";
3
- import { useCallback, useEffect, useRef } from "react";
4
- import { getLastAuthProvider, useAddConnectedWallet, useConnectedWallets, useSetActiveWallet } from "thirdweb/react";
5
- import { EIP1193 } from "thirdweb/wallets";
2
+ import { useCallback, useEffect } from "react";
3
+ import { getLastAuthProvider, useConnectedWallets, useSetActiveWallet } from "thirdweb/react";
6
4
  import { useAuthStore } from "../stores/index.js";
7
5
  const debug = debugB3React("useAutoSelectWallet");
8
6
  /**
9
- * Hook to automatically connect a default EOA provider (if given) and
10
- * select the first EOA wallet when user is authenticated.
11
- * Only auto-selects if the last auth was via wallet or no previous auth provider.
7
+ * Hook to automatically select the first EOA wallet when user is authenticated
8
+ * Only auto-selects if the last auth was via wallet or no previous auth provider
12
9
  */
13
- export function useAutoSelectWallet({ enabled, defaultEoaProvider, }) {
10
+ export function useAutoSelectWallet({ enabled }) {
14
11
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
15
12
  const wallets = useConnectedWallets();
16
13
  const setActiveWallet = useSetActiveWallet();
17
- const addConnectedWallet = useAddConnectedWallet();
18
- const hasConnectedProvider = useRef(false);
19
- // Auto-connect the default EOA provider (e.g. Farcaster frame wallet) on mount.
20
- // Uses useAddConnectedWallet instead of useConnect so the wallet is added to
21
- // connectedWallets WITHOUT becoming the active wallet. This prevents
22
- // useAuthentication's logout/onTimeout from disconnecting it (logout only
23
- // disconnects ecosystem wallets and the active wallet).
24
- useEffect(() => {
25
- if (!defaultEoaProvider || hasConnectedProvider.current)
26
- return;
27
- hasConnectedProvider.current = true;
28
- const connectDefaultProvider = async () => {
29
- try {
30
- const wallet = EIP1193.fromProvider({ provider: defaultEoaProvider });
31
- await wallet.connect({ client });
32
- addConnectedWallet(wallet);
33
- debug("Auto-connected default EOA provider", wallet.id);
34
- }
35
- catch (error) {
36
- debug("Failed to auto-connect default EOA provider", error);
37
- hasConnectedProvider.current = false;
38
- }
39
- };
40
- connectDefaultProvider();
41
- }, [defaultEoaProvider, addConnectedWallet]);
42
14
  const setWallet = useCallback((wallet) => {
43
15
  debug("@@setWallet", wallet.id, wallet.getAccount()?.address);
44
16
  setActiveWallet(wallet);
@@ -1,7 +1,5 @@
1
- import { EIP1193 } from "thirdweb/wallets";
2
- declare const AuthenticationProvider: ({ partnerId, automaticallySetFirstEoa, defaultEoaProvider, }: {
1
+ declare const AuthenticationProvider: ({ partnerId, automaticallySetFirstEoa, }: {
3
2
  partnerId: string;
4
3
  automaticallySetFirstEoa: boolean;
5
- defaultEoaProvider?: EIP1193.EIP1193Provider;
6
4
  }) => null;
7
5
  export default AuthenticationProvider;
@@ -2,20 +2,18 @@ import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useA
2
2
  import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
3
3
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
4
4
  import "@relayprotocol/relay-kit-ui/styles.css";
5
- import { Account, EIP1193, Wallet } from "thirdweb/wallets";
5
+ import { Account, Wallet } from "thirdweb/wallets";
6
6
  import { CreateConnectorFn } from "wagmi";
7
7
  import { ClientType } from "../../../client-manager";
8
8
  /**
9
9
  * Main B3Provider component
10
10
  */
11
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
11
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
12
12
  theme: "light" | "dark";
13
13
  children: React.ReactNode;
14
14
  accountOverride?: Account;
15
15
  environment?: "development" | "production";
16
16
  automaticallySetFirstEoa?: boolean;
17
- /** EIP-1193 provider to auto-connect as the default EOA wallet (e.g., Farcaster frame wallet) */
18
- defaultEoaProvider?: EIP1193.EIP1193Provider;
19
17
  simDuneApiKey?: string;
20
18
  toaster?: {
21
19
  position?: "top-center" | "top-right" | "bottom-center" | "bottom-right";
@@ -1,10 +1,7 @@
1
- import { EIP1193 } from "thirdweb/wallets";
2
1
  /**
3
- * Hook to automatically connect a default EOA provider (if given) and
4
- * select the first EOA wallet when user is authenticated.
5
- * Only auto-selects if the last auth was via wallet or no previous auth provider.
2
+ * Hook to automatically select the first EOA wallet when user is authenticated
3
+ * Only auto-selects if the last auth was via wallet or no previous auth provider
6
4
  */
7
- export declare function useAutoSelectWallet({ enabled, defaultEoaProvider, }: {
5
+ export declare function useAutoSelectWallet({ enabled }: {
8
6
  enabled: boolean;
9
- defaultEoaProvider?: EIP1193.EIP1193Provider;
10
7
  }): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.1.69-alpha.1",
3
+ "version": "0.1.69",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -1,20 +1,16 @@
1
- import { EIP1193 } from "thirdweb/wallets";
2
1
  import { useAuthentication } from "../../hooks";
3
2
  import { useAutoSelectWallet } from "../../hooks/useAutoSelectWallet";
4
3
 
5
4
  const AuthenticationProvider = ({
6
5
  partnerId,
7
6
  automaticallySetFirstEoa,
8
- defaultEoaProvider,
9
7
  }: {
10
8
  partnerId: string;
11
9
  automaticallySetFirstEoa: boolean;
12
- defaultEoaProvider?: EIP1193.EIP1193Provider;
13
10
  }) => {
14
11
  useAuthentication(partnerId);
15
12
  useAutoSelectWallet({
16
13
  enabled: automaticallySetFirstEoa,
17
- defaultEoaProvider,
18
14
  });
19
15
 
20
16
  return null;
@@ -8,7 +8,7 @@ import "@relayprotocol/relay-kit-ui/styles.css";
8
8
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
9
9
  import { useEffect, useMemo } from "react";
10
10
  import { ThirdwebProvider } from "thirdweb/react";
11
- import { Account, EIP1193, Wallet } from "thirdweb/wallets";
11
+ import { Account, Wallet } from "thirdweb/wallets";
12
12
  import { CreateConnectorFn, WagmiProvider } from "wagmi";
13
13
  import { ClientType, setClientType } from "../../../client-manager";
14
14
  import { StyleRoot } from "../StyleRoot";
@@ -29,7 +29,6 @@ export function B3Provider({
29
29
  accountOverride,
30
30
  environment,
31
31
  automaticallySetFirstEoa,
32
- defaultEoaProvider,
33
32
  simDuneApiKey,
34
33
  // deprecated since v0.0.87
35
34
  toaster: _toaster,
@@ -49,8 +48,6 @@ export function B3Provider({
49
48
  accountOverride?: Account;
50
49
  environment?: "development" | "production";
51
50
  automaticallySetFirstEoa?: boolean;
52
- /** EIP-1193 provider to auto-connect as the default EOA wallet (e.g., Farcaster frame wallet) */
53
- defaultEoaProvider?: EIP1193.EIP1193Provider;
54
51
  simDuneApiKey?: string;
55
52
  toaster?: {
56
53
  position?: "top-center" | "top-right" | "bottom-center" | "bottom-right";
@@ -107,11 +104,7 @@ export function B3Provider({
107
104
  {/* For the modal https://github.com/b3-fun/b3/blob/main/packages/sdk/src/global-account/react/components/ui/dialog.tsx#L46 */}
108
105
  <StyleRoot id="b3-root" />
109
106
  </RelayKitProviderWrapper>
110
- <AuthenticationProvider
111
- partnerId={partnerId}
112
- automaticallySetFirstEoa={!!automaticallySetFirstEoa}
113
- defaultEoaProvider={defaultEoaProvider}
114
- />
107
+ <AuthenticationProvider partnerId={partnerId} automaticallySetFirstEoa={!!automaticallySetFirstEoa} />
115
108
  </B3ConfigProvider>
116
109
  </LocalSDKProvider>
117
110
  </ToastProvider>
@@ -1,53 +1,19 @@
1
- import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
2
1
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
- import { useCallback, useEffect, useRef } from "react";
4
- import { getLastAuthProvider, useAddConnectedWallet, useConnectedWallets, useSetActiveWallet } from "thirdweb/react";
5
- import { EIP1193, Wallet } from "thirdweb/wallets";
2
+ import { useCallback, useEffect } from "react";
3
+ import { getLastAuthProvider, useConnectedWallets, useSetActiveWallet } from "thirdweb/react";
4
+ import { Wallet } from "thirdweb/wallets";
6
5
  import { useAuthStore } from "../stores";
7
6
 
8
7
  const debug = debugB3React("useAutoSelectWallet");
9
8
 
10
9
  /**
11
- * Hook to automatically connect a default EOA provider (if given) and
12
- * select the first EOA wallet when user is authenticated.
13
- * Only auto-selects if the last auth was via wallet or no previous auth provider.
10
+ * Hook to automatically select the first EOA wallet when user is authenticated
11
+ * Only auto-selects if the last auth was via wallet or no previous auth provider
14
12
  */
15
- export function useAutoSelectWallet({
16
- enabled,
17
- defaultEoaProvider,
18
- }: {
19
- enabled: boolean;
20
- defaultEoaProvider?: EIP1193.EIP1193Provider;
21
- }) {
13
+ export function useAutoSelectWallet({ enabled }: { enabled: boolean }) {
22
14
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
23
15
  const wallets = useConnectedWallets();
24
16
  const setActiveWallet = useSetActiveWallet();
25
- const addConnectedWallet = useAddConnectedWallet();
26
- const hasConnectedProvider = useRef(false);
27
-
28
- // Auto-connect the default EOA provider (e.g. Farcaster frame wallet) on mount.
29
- // Uses useAddConnectedWallet instead of useConnect so the wallet is added to
30
- // connectedWallets WITHOUT becoming the active wallet. This prevents
31
- // useAuthentication's logout/onTimeout from disconnecting it (logout only
32
- // disconnects ecosystem wallets and the active wallet).
33
- useEffect(() => {
34
- if (!defaultEoaProvider || hasConnectedProvider.current) return;
35
- hasConnectedProvider.current = true;
36
-
37
- const connectDefaultProvider = async () => {
38
- try {
39
- const wallet = EIP1193.fromProvider({ provider: defaultEoaProvider });
40
- await wallet.connect({ client });
41
- addConnectedWallet(wallet);
42
- debug("Auto-connected default EOA provider", wallet.id);
43
- } catch (error) {
44
- debug("Failed to auto-connect default EOA provider", error);
45
- hasConnectedProvider.current = false;
46
- }
47
- };
48
-
49
- connectDefaultProvider();
50
- }, [defaultEoaProvider, addConnectedWallet]);
51
17
 
52
18
  const setWallet = useCallback(
53
19
  (wallet: Wallet) => {