@b3dotfun/sdk 0.0.40-alpha.6 → 0.0.40-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.
@@ -1,12 +1,12 @@
1
1
  import { PermissionsConfig } from "../../../../global-account/types/permissions";
2
+ import "@reservoir0x/relay-kit-ui/styles.css";
2
3
  import { Account } from "thirdweb/wallets";
3
4
  import { ClientType } from "../../../client-manager";
4
5
  import { B3ContextType } from "./types";
5
- import "@reservoir0x/relay-kit-ui/styles.css";
6
6
  /**
7
7
  * Main B3Provider component
8
8
  */
9
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, }: {
9
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, partnerId, }: {
10
10
  theme: "light" | "dark";
11
11
  children: React.ReactNode;
12
12
  accountOverride?: Account;
@@ -19,6 +19,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
19
19
  };
20
20
  clientType?: ClientType;
21
21
  rpcUrls?: Record<number, string>;
22
+ partnerId?: string;
22
23
  }): import("react/jsx-runtime").JSX.Element;
23
24
  /**
24
25
  * Inner provider component that provides the actual B3Context
@@ -5,8 +5,13 @@ exports.InnerProvider = InnerProvider;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("../../../../global-account/react");
7
7
  const analytics_1 = require("../../../../global-account/utils/analytics");
8
+ const constants_1 = require("../../../../shared/constants");
8
9
  const supported_1 = require("../../../../shared/constants/chains/supported");
10
+ const debug_1 = require("../../../../shared/utils/debug");
11
+ const thirdweb_1 = require("../../../../shared/utils/thirdweb");
12
+ require("@reservoir0x/relay-kit-ui/styles.css");
9
13
  const react_query_1 = require("@tanstack/react-query");
14
+ const wagmi_adapter_1 = require("@thirdweb-dev/wagmi-adapter");
10
15
  const react_2 = require("react");
11
16
  const sonner_1 = require("sonner");
12
17
  const react_3 = require("thirdweb/react");
@@ -14,7 +19,7 @@ const wagmi_1 = require("wagmi");
14
19
  const client_manager_1 = require("../../../client-manager");
15
20
  const StyleRoot_1 = require("../StyleRoot");
16
21
  const types_1 = require("./types");
17
- require("@reservoir0x/relay-kit-ui/styles.css");
22
+ const debug = (0, debug_1.debugB3React)("B3Provider");
18
23
  /**
19
24
  * Default permissions configuration for B3 provider
20
25
  */
@@ -24,24 +29,12 @@ const DEFAULT_PERMISSIONS = {
24
29
  startDate: new Date(),
25
30
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
26
31
  };
27
- /**
28
- * Creates wagmi config with optional custom RPC URLs
29
- * @param rpcUrls - Optional mapping of chain IDs to RPC URLs
30
- */
31
- function createWagmiConfig(rpcUrls) {
32
- return (0, wagmi_1.createConfig)({
33
- chains: [supported_1.supportedChains[0], ...supported_1.supportedChains.slice(1)],
34
- transports: Object.fromEntries(supported_1.supportedChains.map(chain => [chain.id, (0, wagmi_1.http)(rpcUrls?.[chain.id])])),
35
- });
36
- }
37
32
  // Create queryClient instance
38
33
  const queryClient = new react_query_1.QueryClient();
39
34
  /**
40
35
  * Main B3Provider component
41
36
  */
42
- function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", rpcUrls, }) {
43
- // Create wagmi config with custom RPC URLs if provided
44
- const [wagmiConfig] = (0, react_2.useState)(() => createWagmiConfig(rpcUrls));
37
+ function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", rpcUrls, partnerId, }) {
45
38
  // Initialize Google Analytics on mount
46
39
  (0, react_2.useEffect)(() => {
47
40
  (0, analytics_1.loadGA4Script)();
@@ -50,7 +43,32 @@ function B3Provider({ theme = "light", children, accountOverride, environment, a
50
43
  (0, react_2.useEffect)(() => {
51
44
  (0, client_manager_1.setClientType)(clientType);
52
45
  }, [clientType]);
53
- return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, children: (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)(sonner_1.Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
46
+ const ecocystemConfig = (0, react_2.useMemo)(() => {
47
+ if (!partnerId)
48
+ return undefined;
49
+ return {
50
+ ecosystemId: constants_1.ecosystemWalletId,
51
+ partnerId: partnerId,
52
+ client: thirdweb_1.client,
53
+ };
54
+ }, [partnerId]);
55
+ /**
56
+ * Creates wagmi config with optional custom RPC URLs
57
+ * @param rpcUrls - Optional mapping of chain IDs to RPC URLs
58
+ */
59
+ const wagmiConfig = (0, react_2.useMemo)(() => (0, wagmi_1.createConfig)({
60
+ chains: [supported_1.supportedChains[0], ...supported_1.supportedChains.slice(1)],
61
+ transports: Object.fromEntries(supported_1.supportedChains.map(chain => [chain.id, (0, wagmi_1.http)(rpcUrls?.[chain.id])])),
62
+ connectors: [
63
+ (0, wagmi_adapter_1.inAppWalletConnector)({
64
+ ...(ecocystemConfig || {}),
65
+ client: thirdweb_1.client,
66
+ }),
67
+ // injected(),
68
+ // coinbaseWallet({ appName: "HypeDuel" }),
69
+ ],
70
+ }), [partnerId]);
71
+ return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, 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)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, children: (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)(sonner_1.Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
54
72
  }
55
73
  /**
56
74
  * Inner provider component that provides the actual B3Context
@@ -61,6 +79,7 @@ function InnerProvider({ children, accountOverride, environment, defaultPermissi
61
79
  const wallets = (0, react_3.useConnectedWallets)();
62
80
  const setActiveWallet = (0, react_3.useSetActiveWallet)();
63
81
  const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
82
+ debug("@@wallets", wallets);
64
83
  const [user, setUser] = (0, react_2.useState)(() => {
65
84
  // Try to restore user from localStorage on initialization
66
85
  if (typeof window !== "undefined") {
@@ -91,7 +110,7 @@ function InnerProvider({ children, accountOverride, environment, defaultPermissi
91
110
  const setWallet = (0, react_2.useCallback)((wallet) => {
92
111
  setManuallySelectedWallet(wallet);
93
112
  const account = wallet.getAccount();
94
- console.log("@@gio:setWallet", wallet.id, account?.address);
113
+ debug("@@setWallet", wallet.id, account?.address);
95
114
  setActiveWallet(wallet);
96
115
  }, [setManuallySelectedWallet, setActiveWallet]);
97
116
  (0, react_2.useEffect)(() => {
@@ -8,6 +8,7 @@ const thirdweb_1 = require("../../../../../shared/utils/thirdweb");
8
8
  const react_2 = require("react");
9
9
  const react_3 = require("thirdweb/react");
10
10
  const wallets_1 = require("thirdweb/wallets");
11
+ const debug = (0, debug_1.debugB3React)("LoginStepCustom");
11
12
  function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
12
13
  const [isLoading, setIsLoading] = (0, react_2.useState)(false);
13
14
  const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
@@ -24,7 +25,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
24
25
  const handleConnect = async (strategy) => {
25
26
  try {
26
27
  setIsLoading(true);
27
- (0, debug_1.debug)("setIsAuthenticating:true:3");
28
+ debug("setIsAuthenticating:true:3");
28
29
  setIsAuthenticating(true);
29
30
  const options = (0, react_1.getConnectOptionsFromStrategy)(strategy);
30
31
  let connectResult;
@@ -45,7 +46,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
45
46
  connectResult = await connect(options);
46
47
  }
47
48
  const account = connectResult?.getAccount();
48
- console.log("@@gio:connectResult", { connectResult, account, options });
49
+ debug("@@connectResult", { connectResult, account, options });
49
50
  if (!account)
50
51
  throw new Error("Failed to connect");
51
52
  await onSuccess(account);
@@ -58,7 +59,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
58
59
  }
59
60
  finally {
60
61
  setIsLoading(false);
61
- (0, debug_1.debug)("setIsAuthenticating:false:3");
62
+ debug("setIsAuthenticating:false:3");
62
63
  setIsAuthenticating(false);
63
64
  }
64
65
  };
@@ -122,8 +122,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
122
122
  if (activeWallet) {
123
123
  debug("@@logout:activeWallet", activeWallet);
124
124
  disconnect(activeWallet);
125
- debug("@@logout:disconnected");
126
- console.log("@@gio:logout:activeWallet", activeWallet);
125
+ debug("@@logout:activeWallet", activeWallet);
127
126
  }
128
127
  // Log out of each wallet
129
128
  wallets.forEach(wallet => {
@@ -1,12 +1,12 @@
1
1
  import { PermissionsConfig } from "../../../../global-account/types/permissions";
2
+ import "@reservoir0x/relay-kit-ui/styles.css";
2
3
  import { Account } from "thirdweb/wallets";
3
4
  import { ClientType } from "../../../client-manager";
4
5
  import { B3ContextType } from "./types";
5
- import "@reservoir0x/relay-kit-ui/styles.css";
6
6
  /**
7
7
  * Main B3Provider component
8
8
  */
9
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, }: {
9
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, partnerId, }: {
10
10
  theme: "light" | "dark";
11
11
  children: React.ReactNode;
12
12
  accountOverride?: Account;
@@ -19,6 +19,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
19
19
  };
20
20
  clientType?: ClientType;
21
21
  rpcUrls?: Record<number, string>;
22
+ partnerId?: string;
22
23
  }): import("react/jsx-runtime").JSX.Element;
23
24
  /**
24
25
  * Inner provider component that provides the actual B3Context
@@ -1,16 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "../../../../global-account/react/index.js";
3
3
  import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
4
+ import { ecosystemWalletId } from "../../../../shared/constants/index.js";
4
5
  import { supportedChains } from "../../../../shared/constants/chains/supported.js";
6
+ import { debugB3React } from "../../../../shared/utils/debug.js";
7
+ import { client } from "../../../../shared/utils/thirdweb.js";
8
+ import "@reservoir0x/relay-kit-ui/styles.css";
5
9
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
6
- import { useCallback, useEffect, useState } from "react";
10
+ import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
11
+ import { useCallback, useEffect, useMemo, useState } from "react";
7
12
  import { Toaster } from "sonner";
8
13
  import { getLastAuthProvider, ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet, } from "thirdweb/react";
9
14
  import { createConfig, http, WagmiProvider } from "wagmi";
10
15
  import { setClientType } from "../../../client-manager.js";
11
16
  import { StyleRoot } from "../StyleRoot.js";
12
17
  import { B3Context } from "./types.js";
13
- import "@reservoir0x/relay-kit-ui/styles.css";
18
+ const debug = debugB3React("B3Provider");
14
19
  /**
15
20
  * Default permissions configuration for B3 provider
16
21
  */
@@ -20,24 +25,12 @@ const DEFAULT_PERMISSIONS = {
20
25
  startDate: new Date(),
21
26
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
22
27
  };
23
- /**
24
- * Creates wagmi config with optional custom RPC URLs
25
- * @param rpcUrls - Optional mapping of chain IDs to RPC URLs
26
- */
27
- function createWagmiConfig(rpcUrls) {
28
- return createConfig({
29
- chains: [supportedChains[0], ...supportedChains.slice(1)],
30
- transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http(rpcUrls?.[chain.id])])),
31
- });
32
- }
33
28
  // Create queryClient instance
34
29
  const queryClient = new QueryClient();
35
30
  /**
36
31
  * Main B3Provider component
37
32
  */
38
- export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", rpcUrls, }) {
39
- // Create wagmi config with custom RPC URLs if provided
40
- const [wagmiConfig] = useState(() => createWagmiConfig(rpcUrls));
33
+ export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", rpcUrls, partnerId, }) {
41
34
  // Initialize Google Analytics on mount
42
35
  useEffect(() => {
43
36
  loadGA4Script();
@@ -46,7 +39,32 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
46
39
  useEffect(() => {
47
40
  setClientType(clientType);
48
41
  }, [clientType]);
49
- return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThirdwebProvider, { children: _jsx(TooltipProvider, { children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, children: _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" }), _jsx(Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
42
+ const ecocystemConfig = useMemo(() => {
43
+ if (!partnerId)
44
+ return undefined;
45
+ return {
46
+ ecosystemId: ecosystemWalletId,
47
+ partnerId: partnerId,
48
+ client,
49
+ };
50
+ }, [partnerId]);
51
+ /**
52
+ * Creates wagmi config with optional custom RPC URLs
53
+ * @param rpcUrls - Optional mapping of chain IDs to RPC URLs
54
+ */
55
+ const wagmiConfig = useMemo(() => createConfig({
56
+ chains: [supportedChains[0], ...supportedChains.slice(1)],
57
+ transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http(rpcUrls?.[chain.id])])),
58
+ connectors: [
59
+ inAppWalletConnector({
60
+ ...(ecocystemConfig || {}),
61
+ client,
62
+ }),
63
+ // injected(),
64
+ // coinbaseWallet({ appName: "HypeDuel" }),
65
+ ],
66
+ }), [partnerId]);
67
+ return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, children: _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" }), _jsx(Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
50
68
  }
51
69
  /**
52
70
  * Inner provider component that provides the actual B3Context
@@ -57,6 +75,7 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
57
75
  const wallets = useConnectedWallets();
58
76
  const setActiveWallet = useSetActiveWallet();
59
77
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
78
+ debug("@@wallets", wallets);
60
79
  const [user, setUser] = useState(() => {
61
80
  // Try to restore user from localStorage on initialization
62
81
  if (typeof window !== "undefined") {
@@ -87,7 +106,7 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
87
106
  const setWallet = useCallback((wallet) => {
88
107
  setManuallySelectedWallet(wallet);
89
108
  const account = wallet.getAccount();
90
- console.log("@@gio:setWallet", wallet.id, account?.address);
109
+ debug("@@setWallet", wallet.id, account?.address);
91
110
  setActiveWallet(wallet);
92
111
  }, [setManuallySelectedWallet, setActiveWallet]);
93
112
  useEffect(() => {
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore, useConnect, WalletRow, } from "../../../../../global-account/react/index.js";
3
- import { debug } from "../../../../../shared/utils/debug.js";
3
+ import { debugB3React } from "../../../../../shared/utils/debug.js";
4
4
  import { client } from "../../../../../shared/utils/thirdweb.js";
5
5
  import { useState } from "react";
6
6
  import { useConnect as useConnectTW } from "thirdweb/react";
7
7
  import { createWallet } from "thirdweb/wallets";
8
+ const debug = debugB3React("LoginStepCustom");
8
9
  export function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
9
10
  const [isLoading, setIsLoading] = useState(false);
10
11
  const [showAllWallets, setShowAllWallets] = useState(false);
@@ -42,7 +43,7 @@ export function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategi
42
43
  connectResult = await connect(options);
43
44
  }
44
45
  const account = connectResult?.getAccount();
45
- console.log("@@gio:connectResult", { connectResult, account, options });
46
+ debug("@@connectResult", { connectResult, account, options });
46
47
  if (!account)
47
48
  throw new Error("Failed to connect");
48
49
  await onSuccess(account);
@@ -116,8 +116,7 @@ export function useAuthentication(partnerId, loginWithSiwe) {
116
116
  if (activeWallet) {
117
117
  debug("@@logout:activeWallet", activeWallet);
118
118
  disconnect(activeWallet);
119
- debug("@@logout:disconnected");
120
- console.log("@@gio:logout:activeWallet", activeWallet);
119
+ debug("@@logout:activeWallet", activeWallet);
121
120
  }
122
121
  // Log out of each wallet
123
122
  wallets.forEach(wallet => {
@@ -1,12 +1,12 @@
1
1
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
2
+ import "@reservoir0x/relay-kit-ui/styles.css";
2
3
  import { Account } from "thirdweb/wallets";
3
4
  import { ClientType } from "../../../client-manager";
4
5
  import { B3ContextType } from "./types";
5
- import "@reservoir0x/relay-kit-ui/styles.css";
6
6
  /**
7
7
  * Main B3Provider component
8
8
  */
9
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, }: {
9
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, partnerId, }: {
10
10
  theme: "light" | "dark";
11
11
  children: React.ReactNode;
12
12
  accountOverride?: Account;
@@ -19,6 +19,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
19
19
  };
20
20
  clientType?: ClientType;
21
21
  rpcUrls?: Record<number, string>;
22
+ partnerId?: string;
22
23
  }): import("react/jsx-runtime").JSX.Element;
23
24
  /**
24
25
  * Inner provider component that provides the actual B3Context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.40-alpha.6",
3
+ "version": "0.0.40-alpha.7",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -241,8 +241,8 @@
241
241
  "@b3dotfun/basement-api": "0.0.11",
242
242
  "@feathersjs/authentication-client": "5.0.33",
243
243
  "@feathersjs/feathers": "5.0.33",
244
- "@feathersjs/socketio-client": "5.0.33",
245
244
  "@feathersjs/rest-client": "5.0.33",
245
+ "@feathersjs/socketio-client": "5.0.33",
246
246
  "@feathersjs/typebox": "5.0.33",
247
247
  "@fingerprintjs/fingerprintjs-pro-react": "^2.7.0",
248
248
  "@hey-api/client-fetch": "0.8.3",
@@ -261,6 +261,7 @@
261
261
  "@solana/web3.js": "^1.98.2",
262
262
  "@stripe/react-stripe-js": "^3.7.0",
263
263
  "@stripe/stripe-js": "^7.3.1",
264
+ "@thirdweb-dev/wagmi-adapter": "^0.2.141",
264
265
  "@web3icons/react": "3.16.0",
265
266
  "big.js": "^7.0.1",
266
267
  "class-variance-authority": "0.7.0",
@@ -329,10 +330,10 @@
329
330
  "react": "^18.0.0 || ^19.0.0",
330
331
  "react-dom": "^18.0.0 || ^19.0.0",
331
332
  "react-native-mmkv": "^3.2.0",
332
- "thirdweb": "^5.105.20",
333
+ "thirdweb": "5.106.0",
333
334
  "three": "^0.175.0",
334
- "wagmi": "^2.14.15",
335
- "viem": "^2.28.1"
335
+ "viem": "^2.28.1",
336
+ "wagmi": "^2.14.15"
336
337
  },
337
338
  "peerDependenciesMeta": {
338
339
  "@react-three/postprocessing": {
@@ -1,9 +1,15 @@
1
+ import { Users } from "@b3dotfun/b3-api";
1
2
  import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "@b3dotfun/sdk/global-account/react";
2
3
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
3
4
  import { loadGA4Script } from "@b3dotfun/sdk/global-account/utils/analytics";
5
+ import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
4
6
  import { supportedChains } from "@b3dotfun/sdk/shared/constants/chains/supported";
7
+ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
8
+ import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
9
+ import "@reservoir0x/relay-kit-ui/styles.css";
5
10
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
6
- import { useCallback, useEffect, useState } from "react";
11
+ import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
12
+ import { useCallback, useEffect, useMemo, useState } from "react";
7
13
  import { Toaster } from "sonner";
8
14
  import {
9
15
  getLastAuthProvider,
@@ -18,8 +24,7 @@ import { ClientType, setClientType } from "../../../client-manager";
18
24
  import { StyleRoot } from "../StyleRoot";
19
25
  import { B3Context, B3ContextType } from "./types";
20
26
 
21
- import { Users } from "@b3dotfun/b3-api";
22
- import "@reservoir0x/relay-kit-ui/styles.css";
27
+ const debug = debugB3React("B3Provider");
23
28
 
24
29
  /**
25
30
  * Default permissions configuration for B3 provider
@@ -31,17 +36,6 @@ const DEFAULT_PERMISSIONS = {
31
36
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
32
37
  };
33
38
 
34
- /**
35
- * Creates wagmi config with optional custom RPC URLs
36
- * @param rpcUrls - Optional mapping of chain IDs to RPC URLs
37
- */
38
- function createWagmiConfig(rpcUrls?: Record<number, string>) {
39
- return createConfig({
40
- chains: [supportedChains[0], ...supportedChains.slice(1)],
41
- transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http(rpcUrls?.[chain.id])])) as any,
42
- });
43
- }
44
-
45
39
  // Create queryClient instance
46
40
  const queryClient = new QueryClient();
47
41
 
@@ -58,6 +52,7 @@ export function B3Provider({
58
52
  toaster,
59
53
  clientType = "rest",
60
54
  rpcUrls,
55
+ partnerId,
61
56
  }: {
62
57
  theme: "light" | "dark";
63
58
  children: React.ReactNode;
@@ -71,10 +66,8 @@ export function B3Provider({
71
66
  };
72
67
  clientType?: ClientType;
73
68
  rpcUrls?: Record<number, string>;
69
+ partnerId?: string;
74
70
  }) {
75
- // Create wagmi config with custom RPC URLs if provided
76
- const [wagmiConfig] = useState(() => createWagmiConfig(rpcUrls));
77
-
78
71
  // Initialize Google Analytics on mount
79
72
  useEffect(() => {
80
73
  loadGA4Script();
@@ -85,10 +78,41 @@ export function B3Provider({
85
78
  setClientType(clientType);
86
79
  }, [clientType]);
87
80
 
81
+ const ecocystemConfig = useMemo(() => {
82
+ if (!partnerId) return undefined;
83
+
84
+ return {
85
+ ecosystemId: ecosystemWalletId,
86
+ partnerId: partnerId,
87
+ client,
88
+ };
89
+ }, [partnerId]);
90
+
91
+ /**
92
+ * Creates wagmi config with optional custom RPC URLs
93
+ * @param rpcUrls - Optional mapping of chain IDs to RPC URLs
94
+ */
95
+ const wagmiConfig = useMemo(
96
+ () =>
97
+ createConfig({
98
+ chains: [supportedChains[0], ...supportedChains.slice(1)],
99
+ transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http(rpcUrls?.[chain.id])])) as any,
100
+ connectors: [
101
+ inAppWalletConnector({
102
+ ...(ecocystemConfig || {}),
103
+ client,
104
+ }),
105
+ // injected(),
106
+ // coinbaseWallet({ appName: "HypeDuel" }),
107
+ ],
108
+ }),
109
+ [partnerId],
110
+ );
111
+
88
112
  return (
89
- <WagmiProvider config={wagmiConfig}>
90
- <QueryClientProvider client={queryClient}>
91
- <ThirdwebProvider>
113
+ <ThirdwebProvider>
114
+ <WagmiProvider config={wagmiConfig}>
115
+ <QueryClientProvider client={queryClient}>
92
116
  <TooltipProvider>
93
117
  <InnerProvider
94
118
  accountOverride={accountOverride}
@@ -105,9 +129,9 @@ export function B3Provider({
105
129
  </RelayKitProviderWrapper>
106
130
  </InnerProvider>
107
131
  </TooltipProvider>
108
- </ThirdwebProvider>
109
- </QueryClientProvider>
110
- </WagmiProvider>
132
+ </QueryClientProvider>
133
+ </WagmiProvider>
134
+ </ThirdwebProvider>
111
135
  );
112
136
  }
113
137
 
@@ -136,6 +160,7 @@ export function InnerProvider({
136
160
  const wallets = useConnectedWallets();
137
161
  const setActiveWallet = useSetActiveWallet();
138
162
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
163
+ debug("@@wallets", wallets);
139
164
 
140
165
  const [user, setUser] = useState<Users | undefined>(() => {
141
166
  // Try to restore user from localStorage on initialization
@@ -169,7 +194,7 @@ export function InnerProvider({
169
194
  (wallet: Wallet) => {
170
195
  setManuallySelectedWallet(wallet);
171
196
  const account = wallet.getAccount();
172
- console.log("@@gio:setWallet", wallet.id, account?.address);
197
+ debug("@@setWallet", wallet.id, account?.address);
173
198
  setActiveWallet(wallet);
174
199
  },
175
200
  [setManuallySelectedWallet, setActiveWallet],
@@ -10,7 +10,7 @@ import {
10
10
  useConnect,
11
11
  WalletRow,
12
12
  } from "@b3dotfun/sdk/global-account/react";
13
- import { debug } from "@b3dotfun/sdk/shared/utils/debug";
13
+ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
14
14
  import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
15
15
  import { useState } from "react";
16
16
  import { Chain } from "thirdweb";
@@ -27,6 +27,8 @@ interface LoginStepCustomProps {
27
27
  maxInitialWallets?: number;
28
28
  }
29
29
 
30
+ const debug = debugB3React("LoginStepCustom");
31
+
30
32
  export function LoginStepCustom({
31
33
  onSuccess,
32
34
  onError,
@@ -76,7 +78,7 @@ export function LoginStepCustom({
76
78
  }
77
79
 
78
80
  const account = connectResult?.getAccount();
79
- console.log("@@gio:connectResult", { connectResult, account, options });
81
+ debug("@@connectResult", { connectResult, account, options });
80
82
  if (!account) throw new Error("Failed to connect");
81
83
  await onSuccess(account);
82
84
  setIsAuthenticated(true);
@@ -124,8 +124,7 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) {
124
124
  if (activeWallet) {
125
125
  debug("@@logout:activeWallet", activeWallet);
126
126
  disconnect(activeWallet);
127
- debug("@@logout:disconnected");
128
- console.log("@@gio:logout:activeWallet", activeWallet);
127
+ debug("@@logout:activeWallet", activeWallet);
129
128
  }
130
129
 
131
130
  // Log out of each wallet