@b3dotfun/sdk 0.0.39-alpha.0 → 0.0.40-test.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,18 +3,10 @@ import "@reservoir0x/relay-kit-ui/styles.css";
3
3
  import { Account } from "thirdweb/wallets";
4
4
  import { ClientType } from "../../../client-manager";
5
5
  import { B3ContextType } from "./types";
6
- export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any, readonly [import("wagmi").CreateConnectorFn<import("thirdweb/dist/types/adapters/eip1193").EIP1193Provider | undefined, {
7
- connect(parameters?: import("@thirdweb-dev/wagmi-adapter/dist/types/connector").ConnectionOptions): Promise<{
8
- accounts: readonly `0x${string}`[];
9
- chainId: number;
10
- }>;
11
- }, {
12
- "thirdweb:lastChainId": number;
13
- }>]>;
14
6
  /**
15
7
  * Main B3Provider component
16
8
  */
17
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, }: {
9
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, partnerId, }: {
18
10
  theme: "light" | "dark";
19
11
  children: React.ReactNode;
20
12
  accountOverride?: Account;
@@ -26,6 +18,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
26
18
  style?: React.CSSProperties;
27
19
  };
28
20
  clientType?: ClientType;
21
+ partnerId?: string;
29
22
  }): import("react/jsx-runtime").JSX.Element;
30
23
  /**
31
24
  * Inner provider component that provides the actual B3Context
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wagmiConfig = void 0;
4
3
  exports.B3Provider = B3Provider;
5
4
  exports.InnerProvider = InnerProvider;
6
5
  const jsx_runtime_1 = require("react/jsx-runtime");
7
6
  const react_1 = require("../../../../global-account/react");
8
7
  const analytics_1 = require("../../../../global-account/utils/analytics");
8
+ const constants_1 = require("../../../../shared/constants");
9
9
  const supported_1 = require("../../../../shared/constants/chains/supported");
10
10
  const thirdweb_1 = require("../../../../shared/utils/thirdweb");
11
11
  require("@reservoir0x/relay-kit-ui/styles.css");
@@ -27,23 +27,12 @@ const DEFAULT_PERMISSIONS = {
27
27
  startDate: new Date(),
28
28
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
29
29
  };
30
- exports.wagmiConfig = (0, wagmi_1.createConfig)({
31
- chains: [supported_1.supportedChains[0], ...supported_1.supportedChains.slice(1)],
32
- transports: Object.fromEntries(supported_1.supportedChains.map(chain => [chain.id, (0, wagmi_1.http)()])),
33
- connectors: [
34
- (0, wagmi_adapter_1.inAppWalletConnector)({
35
- client: thirdweb_1.client,
36
- }),
37
- // injected(),
38
- // coinbaseWallet({ appName: "HypeDuel" }),
39
- ],
40
- });
41
30
  // Create queryClient instance
42
31
  const queryClient = new react_query_1.QueryClient();
43
32
  /**
44
33
  * Main B3Provider component
45
34
  */
46
- function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", }) {
35
+ function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", partnerId, }) {
47
36
  // Initialize Google Analytics on mount
48
37
  (0, react_2.useEffect)(() => {
49
38
  (0, analytics_1.loadGA4Script)();
@@ -52,7 +41,28 @@ function B3Provider({ theme = "light", children, accountOverride, environment, a
52
41
  (0, react_2.useEffect)(() => {
53
42
  (0, client_manager_1.setClientType)(clientType);
54
43
  }, [clientType]);
55
- return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: exports.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 })] }) }) }) }) }) }));
44
+ const ecocystemConfig = (0, react_2.useMemo)(() => {
45
+ if (!partnerId)
46
+ return undefined;
47
+ return {
48
+ ecosystemId: constants_1.ecosystemWalletId,
49
+ partnerId: partnerId,
50
+ client: thirdweb_1.client,
51
+ };
52
+ }, [partnerId]);
53
+ const wagmiConfig = (0, react_2.useMemo)(() => (0, wagmi_1.createConfig)({
54
+ chains: [supported_1.supportedChains[0], ...supported_1.supportedChains.slice(1)],
55
+ transports: Object.fromEntries(supported_1.supportedChains.map(chain => [chain.id, (0, wagmi_1.http)()])),
56
+ connectors: [
57
+ (0, wagmi_adapter_1.inAppWalletConnector)({
58
+ ...ecocystemConfig,
59
+ client: thirdweb_1.client,
60
+ }),
61
+ // injected(),
62
+ // coinbaseWallet({ appName: "HypeDuel" }),
63
+ ],
64
+ }), [partnerId]);
65
+ 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 })] }) }) }) }) }) }));
56
66
  }
57
67
  /**
58
68
  * Inner provider component that provides the actual B3Context
@@ -3,18 +3,10 @@ import "@reservoir0x/relay-kit-ui/styles.css";
3
3
  import { Account } from "thirdweb/wallets";
4
4
  import { ClientType } from "../../../client-manager";
5
5
  import { B3ContextType } from "./types";
6
- export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any, readonly [import("wagmi").CreateConnectorFn<import("thirdweb/dist/types/adapters/eip1193").EIP1193Provider | undefined, {
7
- connect(parameters?: import("@thirdweb-dev/wagmi-adapter/dist/types/connector").ConnectionOptions): Promise<{
8
- accounts: readonly `0x${string}`[];
9
- chainId: number;
10
- }>;
11
- }, {
12
- "thirdweb:lastChainId": number;
13
- }>]>;
14
6
  /**
15
7
  * Main B3Provider component
16
8
  */
17
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, }: {
9
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, partnerId, }: {
18
10
  theme: "light" | "dark";
19
11
  children: React.ReactNode;
20
12
  accountOverride?: Account;
@@ -26,6 +18,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
26
18
  style?: React.CSSProperties;
27
19
  };
28
20
  clientType?: ClientType;
21
+ partnerId?: string;
29
22
  }): import("react/jsx-runtime").JSX.Element;
30
23
  /**
31
24
  * Inner provider component that provides the actual B3Context
@@ -1,12 +1,13 @@
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";
5
6
  import { client } from "../../../../shared/utils/thirdweb.js";
6
7
  import "@reservoir0x/relay-kit-ui/styles.css";
7
8
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
8
9
  import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
9
- import { useCallback, useEffect, useState } from "react";
10
+ import { useCallback, useEffect, useMemo, useState } from "react";
10
11
  import { Toaster } from "sonner";
11
12
  import { getLastAuthProvider, ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet, } from "thirdweb/react";
12
13
  import { createConfig, http, WagmiProvider } from "wagmi";
@@ -22,23 +23,12 @@ const DEFAULT_PERMISSIONS = {
22
23
  startDate: new Date(),
23
24
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
24
25
  };
25
- export const wagmiConfig = createConfig({
26
- chains: [supportedChains[0], ...supportedChains.slice(1)],
27
- transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])),
28
- connectors: [
29
- inAppWalletConnector({
30
- client,
31
- }),
32
- // injected(),
33
- // coinbaseWallet({ appName: "HypeDuel" }),
34
- ],
35
- });
36
26
  // Create queryClient instance
37
27
  const queryClient = new QueryClient();
38
28
  /**
39
29
  * Main B3Provider component
40
30
  */
41
- export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", }) {
31
+ export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", partnerId, }) {
42
32
  // Initialize Google Analytics on mount
43
33
  useEffect(() => {
44
34
  loadGA4Script();
@@ -47,6 +37,27 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
47
37
  useEffect(() => {
48
38
  setClientType(clientType);
49
39
  }, [clientType]);
40
+ const ecocystemConfig = useMemo(() => {
41
+ if (!partnerId)
42
+ return undefined;
43
+ return {
44
+ ecosystemId: ecosystemWalletId,
45
+ partnerId: partnerId,
46
+ client,
47
+ };
48
+ }, [partnerId]);
49
+ const wagmiConfig = useMemo(() => createConfig({
50
+ chains: [supportedChains[0], ...supportedChains.slice(1)],
51
+ transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])),
52
+ connectors: [
53
+ inAppWalletConnector({
54
+ ...ecocystemConfig,
55
+ client,
56
+ }),
57
+ // injected(),
58
+ // coinbaseWallet({ appName: "HypeDuel" }),
59
+ ],
60
+ }), [partnerId]);
50
61
  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 })] }) }) }) }) }) }));
51
62
  }
52
63
  /**
@@ -3,18 +3,10 @@ import "@reservoir0x/relay-kit-ui/styles.css";
3
3
  import { Account } from "thirdweb/wallets";
4
4
  import { ClientType } from "../../../client-manager";
5
5
  import { B3ContextType } from "./types";
6
- export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any, readonly [import("wagmi").CreateConnectorFn<import("thirdweb/dist/types/adapters/eip1193").EIP1193Provider | undefined, {
7
- connect(parameters?: import("@thirdweb-dev/wagmi-adapter/dist/types/connector").ConnectionOptions): Promise<{
8
- accounts: readonly `0x${string}`[];
9
- chainId: number;
10
- }>;
11
- }, {
12
- "thirdweb:lastChainId": number;
13
- }>]>;
14
6
  /**
15
7
  * Main B3Provider component
16
8
  */
17
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, }: {
9
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, partnerId, }: {
18
10
  theme: "light" | "dark";
19
11
  children: React.ReactNode;
20
12
  accountOverride?: Account;
@@ -26,6 +18,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
26
18
  style?: React.CSSProperties;
27
19
  };
28
20
  clientType?: ClientType;
21
+ partnerId?: string;
29
22
  }): import("react/jsx-runtime").JSX.Element;
30
23
  /**
31
24
  * 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.39-alpha.0",
3
+ "version": "0.0.40-test.3",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -2,12 +2,13 @@ import { Users } from "@b3dotfun/b3-api";
2
2
  import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "@b3dotfun/sdk/global-account/react";
3
3
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
4
4
  import { loadGA4Script } from "@b3dotfun/sdk/global-account/utils/analytics";
5
+ import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
5
6
  import { supportedChains } from "@b3dotfun/sdk/shared/constants/chains/supported";
6
7
  import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
7
8
  import "@reservoir0x/relay-kit-ui/styles.css";
8
9
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
9
10
  import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
10
- import { useCallback, useEffect, useState } from "react";
11
+ import { useCallback, useEffect, useMemo, useState } from "react";
11
12
  import { Toaster } from "sonner";
12
13
  import {
13
14
  getLastAuthProvider,
@@ -32,18 +33,6 @@ const DEFAULT_PERMISSIONS = {
32
33
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
33
34
  };
34
35
 
35
- export const wagmiConfig = createConfig({
36
- chains: [supportedChains[0], ...supportedChains.slice(1)],
37
- transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])) as any,
38
- connectors: [
39
- inAppWalletConnector({
40
- client,
41
- }),
42
- // injected(),
43
- // coinbaseWallet({ appName: "HypeDuel" }),
44
- ],
45
- });
46
-
47
36
  // Create queryClient instance
48
37
  const queryClient = new QueryClient();
49
38
 
@@ -59,6 +48,7 @@ export function B3Provider({
59
48
  simDuneApiKey,
60
49
  toaster,
61
50
  clientType = "rest",
51
+ partnerId,
62
52
  }: {
63
53
  theme: "light" | "dark";
64
54
  children: React.ReactNode;
@@ -71,6 +61,7 @@ export function B3Provider({
71
61
  style?: React.CSSProperties;
72
62
  };
73
63
  clientType?: ClientType;
64
+ partnerId?: string;
74
65
  }) {
75
66
  // Initialize Google Analytics on mount
76
67
  useEffect(() => {
@@ -82,6 +73,33 @@ export function B3Provider({
82
73
  setClientType(clientType);
83
74
  }, [clientType]);
84
75
 
76
+ const ecocystemConfig = useMemo(() => {
77
+ if (!partnerId) return undefined;
78
+
79
+ return {
80
+ ecosystemId: ecosystemWalletId,
81
+ partnerId: partnerId,
82
+ client,
83
+ };
84
+ }, [partnerId]);
85
+
86
+ const wagmiConfig = useMemo(
87
+ () =>
88
+ createConfig({
89
+ chains: [supportedChains[0], ...supportedChains.slice(1)],
90
+ transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])) as any,
91
+ connectors: [
92
+ inAppWalletConnector({
93
+ ...ecocystemConfig,
94
+ client,
95
+ }),
96
+ // injected(),
97
+ // coinbaseWallet({ appName: "HypeDuel" }),
98
+ ],
99
+ }),
100
+ [partnerId],
101
+ );
102
+
85
103
  return (
86
104
  <WagmiProvider config={wagmiConfig}>
87
105
  <QueryClientProvider client={queryClient}>
@@ -1,14 +0,0 @@
1
- import { ClientApplication } from "@b3dotfun/b3-api";
2
- import { ClientType } from "./client-manager";
3
-
4
- // Hybrid app type that is both a client instance AND a function
5
- export interface HybridApp extends ClientApplication {
6
- (clientType: "socket"): ClientApplication;
7
- (clientType: "rest"): ClientApplication;
8
- (clientType: ClientType): ClientApplication;
9
- }
10
-
11
- // Export the hybrid app as the default
12
- declare const app: HybridApp;
13
- export default app;
14
-