@b3dotfun/sdk 0.0.40-test.2 → 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,6 +1,5 @@
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");
@@ -28,24 +27,12 @@ const DEFAULT_PERMISSIONS = {
28
27
  startDate: new Date(),
29
28
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
30
29
  };
31
- exports.wagmiConfig = (0, wagmi_1.createConfig)({
32
- chains: [supported_1.supportedChains[0], ...supported_1.supportedChains.slice(1)],
33
- transports: Object.fromEntries(supported_1.supportedChains.map(chain => [chain.id, (0, wagmi_1.http)()])),
34
- connectors: [
35
- (0, wagmi_adapter_1.inAppWalletConnector)({
36
- ecosystemId: constants_1.ecosystemWalletId,
37
- client: thirdweb_1.client,
38
- }),
39
- // injected(),
40
- // coinbaseWallet({ appName: "HypeDuel" }),
41
- ],
42
- });
43
30
  // Create queryClient instance
44
31
  const queryClient = new react_query_1.QueryClient();
45
32
  /**
46
33
  * Main B3Provider component
47
34
  */
48
- 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, }) {
49
36
  // Initialize Google Analytics on mount
50
37
  (0, react_2.useEffect)(() => {
51
38
  (0, analytics_1.loadGA4Script)();
@@ -54,7 +41,28 @@ function B3Provider({ theme = "light", children, accountOverride, environment, a
54
41
  (0, react_2.useEffect)(() => {
55
42
  (0, client_manager_1.setClientType)(clientType);
56
43
  }, [clientType]);
57
- 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 })] }) }) }) }) }) }));
58
66
  }
59
67
  /**
60
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
@@ -7,7 +7,7 @@ import { client } from "../../../../shared/utils/thirdweb.js";
7
7
  import "@reservoir0x/relay-kit-ui/styles.css";
8
8
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
9
9
  import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
10
- import { useCallback, useEffect, useState } from "react";
10
+ import { useCallback, useEffect, useMemo, useState } from "react";
11
11
  import { Toaster } from "sonner";
12
12
  import { getLastAuthProvider, ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet, } from "thirdweb/react";
13
13
  import { createConfig, http, WagmiProvider } from "wagmi";
@@ -23,24 +23,12 @@ const DEFAULT_PERMISSIONS = {
23
23
  startDate: new Date(),
24
24
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
25
25
  };
26
- export const wagmiConfig = createConfig({
27
- chains: [supportedChains[0], ...supportedChains.slice(1)],
28
- transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])),
29
- connectors: [
30
- inAppWalletConnector({
31
- ecosystemId: ecosystemWalletId,
32
- client,
33
- }),
34
- // injected(),
35
- // coinbaseWallet({ appName: "HypeDuel" }),
36
- ],
37
- });
38
26
  // Create queryClient instance
39
27
  const queryClient = new QueryClient();
40
28
  /**
41
29
  * Main B3Provider component
42
30
  */
43
- 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, }) {
44
32
  // Initialize Google Analytics on mount
45
33
  useEffect(() => {
46
34
  loadGA4Script();
@@ -49,6 +37,27 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
49
37
  useEffect(() => {
50
38
  setClientType(clientType);
51
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]);
52
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 })] }) }) }) }) }) }));
53
62
  }
54
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.40-test.2",
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",
@@ -8,7 +8,7 @@ import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
8
8
  import "@reservoir0x/relay-kit-ui/styles.css";
9
9
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
10
10
  import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
11
- import { useCallback, useEffect, useState } from "react";
11
+ import { useCallback, useEffect, useMemo, useState } from "react";
12
12
  import { Toaster } from "sonner";
13
13
  import {
14
14
  getLastAuthProvider,
@@ -33,19 +33,6 @@ const DEFAULT_PERMISSIONS = {
33
33
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
34
34
  };
35
35
 
36
- export const wagmiConfig = createConfig({
37
- chains: [supportedChains[0], ...supportedChains.slice(1)],
38
- transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])) as any,
39
- connectors: [
40
- inAppWalletConnector({
41
- ecosystemId: ecosystemWalletId,
42
- client,
43
- }),
44
- // injected(),
45
- // coinbaseWallet({ appName: "HypeDuel" }),
46
- ],
47
- });
48
-
49
36
  // Create queryClient instance
50
37
  const queryClient = new QueryClient();
51
38
 
@@ -61,6 +48,7 @@ export function B3Provider({
61
48
  simDuneApiKey,
62
49
  toaster,
63
50
  clientType = "rest",
51
+ partnerId,
64
52
  }: {
65
53
  theme: "light" | "dark";
66
54
  children: React.ReactNode;
@@ -73,6 +61,7 @@ export function B3Provider({
73
61
  style?: React.CSSProperties;
74
62
  };
75
63
  clientType?: ClientType;
64
+ partnerId?: string;
76
65
  }) {
77
66
  // Initialize Google Analytics on mount
78
67
  useEffect(() => {
@@ -84,6 +73,33 @@ export function B3Provider({
84
73
  setClientType(clientType);
85
74
  }, [clientType]);
86
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
+
87
103
  return (
88
104
  <WagmiProvider config={wagmiConfig}>
89
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
-