@b3dotfun/sdk 0.0.88-alpha.7 → 0.0.88-alpha.8
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/global-account/react/components/B3Provider/B3Provider.js +14 -2
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +4 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +14 -2
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -2
- package/package.json +1 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +14 -2
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +4 -2
|
@@ -28,7 +28,7 @@ function B3Provider({ theme = "light", children, accountOverride, environment, a
|
|
|
28
28
|
// deprecated since v0.0.87
|
|
29
29
|
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
|
|
30
30
|
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
31
|
-
// Initialize config store on mount
|
|
31
|
+
// Initialize config store on mount
|
|
32
32
|
(0, react_2.useEffect)(() => {
|
|
33
33
|
setConfig({
|
|
34
34
|
accountOverride,
|
|
@@ -42,7 +42,19 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
42
42
|
enableTurnkey,
|
|
43
43
|
defaultPermissions,
|
|
44
44
|
});
|
|
45
|
-
}, [
|
|
45
|
+
}, [
|
|
46
|
+
accountOverride,
|
|
47
|
+
environment,
|
|
48
|
+
automaticallySetFirstEoa,
|
|
49
|
+
theme,
|
|
50
|
+
clientType,
|
|
51
|
+
partnerId,
|
|
52
|
+
stripePublishableKey,
|
|
53
|
+
createClientReferenceId,
|
|
54
|
+
enableTurnkey,
|
|
55
|
+
defaultPermissions,
|
|
56
|
+
setConfig,
|
|
57
|
+
]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
46
58
|
// Initialize Google Analytics on mount
|
|
47
59
|
(0, react_2.useEffect)(() => {
|
|
48
60
|
(0, analytics_1.loadGA4Script)();
|
|
@@ -10,8 +10,8 @@ const react_query_1 = require("@tanstack/react-query");
|
|
|
10
10
|
const b3Chain_1 = require("../../../shared/constants/chains/b3Chain");
|
|
11
11
|
const chains_1 = require("../../../shared/utils/chains");
|
|
12
12
|
const thirdweb_1 = require("../../../shared/utils/thirdweb");
|
|
13
|
-
const wallets_1 = require("thirdweb/wallets");
|
|
14
13
|
const invariant_1 = __importDefault(require("invariant"));
|
|
14
|
+
const wallets_1 = require("thirdweb/wallets");
|
|
15
15
|
function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
|
|
16
16
|
// Normalize chains to array
|
|
17
17
|
const chainIds = Array.isArray(chainsIds) ? chainsIds : [chainsIds];
|
|
@@ -52,7 +52,9 @@ function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
|
|
|
52
52
|
staleTime: 30000, // Consider data fresh for 30 seconds
|
|
53
53
|
gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes
|
|
54
54
|
retry: 2, // Limit retries on failure
|
|
55
|
-
|
|
55
|
+
// Enable structural sharing to prevent infinite loops
|
|
56
|
+
// This ensures we only get new references when data actually changes
|
|
57
|
+
structuralSharing: true,
|
|
56
58
|
});
|
|
57
59
|
return {
|
|
58
60
|
nativeTokens: combinedData?.nativeTokens ?? [],
|
|
@@ -22,7 +22,7 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
|
|
|
22
22
|
// deprecated since v0.0.87
|
|
23
23
|
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
|
|
24
24
|
const setConfig = useB3ConfigStore(state => state.setConfig);
|
|
25
|
-
// Initialize config store on mount
|
|
25
|
+
// Initialize config store on mount
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
setConfig({
|
|
28
28
|
accountOverride,
|
|
@@ -36,7 +36,19 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
36
36
|
enableTurnkey,
|
|
37
37
|
defaultPermissions,
|
|
38
38
|
});
|
|
39
|
-
}, [
|
|
39
|
+
}, [
|
|
40
|
+
accountOverride,
|
|
41
|
+
environment,
|
|
42
|
+
automaticallySetFirstEoa,
|
|
43
|
+
theme,
|
|
44
|
+
clientType,
|
|
45
|
+
partnerId,
|
|
46
|
+
stripePublishableKey,
|
|
47
|
+
createClientReferenceId,
|
|
48
|
+
enableTurnkey,
|
|
49
|
+
defaultPermissions,
|
|
50
|
+
setConfig,
|
|
51
|
+
]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
40
52
|
// Initialize Google Analytics on mount
|
|
41
53
|
useEffect(() => {
|
|
42
54
|
loadGA4Script();
|
|
@@ -4,8 +4,8 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
4
4
|
import { viemToThirdwebChain } from "../../../shared/constants/chains/b3Chain.js";
|
|
5
5
|
import { getChainById } from "../../../shared/utils/chains.js";
|
|
6
6
|
import { client } from "../../../shared/utils/thirdweb.js";
|
|
7
|
-
import { getWalletBalance } from "thirdweb/wallets";
|
|
8
7
|
import invariant from "invariant";
|
|
8
|
+
import { getWalletBalance } from "thirdweb/wallets";
|
|
9
9
|
export function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
|
|
10
10
|
// Normalize chains to array
|
|
11
11
|
const chainIds = Array.isArray(chainsIds) ? chainsIds : [chainsIds];
|
|
@@ -46,7 +46,9 @@ export function useTokenBalancesByChain({ address, chainsIds, enabled = true, })
|
|
|
46
46
|
staleTime: 30000, // Consider data fresh for 30 seconds
|
|
47
47
|
gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes
|
|
48
48
|
retry: 2, // Limit retries on failure
|
|
49
|
-
|
|
49
|
+
// Enable structural sharing to prevent infinite loops
|
|
50
|
+
// This ensures we only get new references when data actually changes
|
|
51
|
+
structuralSharing: true,
|
|
50
52
|
});
|
|
51
53
|
return {
|
|
52
54
|
nativeTokens: combinedData?.nativeTokens ?? [],
|
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ export function B3Provider({
|
|
|
67
67
|
}) {
|
|
68
68
|
const setConfig = useB3ConfigStore(state => state.setConfig);
|
|
69
69
|
|
|
70
|
-
// Initialize config store on mount
|
|
70
|
+
// Initialize config store on mount
|
|
71
71
|
useEffect(() => {
|
|
72
72
|
setConfig({
|
|
73
73
|
accountOverride,
|
|
@@ -81,7 +81,19 @@ export function B3Provider({
|
|
|
81
81
|
enableTurnkey,
|
|
82
82
|
defaultPermissions,
|
|
83
83
|
});
|
|
84
|
-
}, [
|
|
84
|
+
}, [
|
|
85
|
+
accountOverride,
|
|
86
|
+
environment,
|
|
87
|
+
automaticallySetFirstEoa,
|
|
88
|
+
theme,
|
|
89
|
+
clientType,
|
|
90
|
+
partnerId,
|
|
91
|
+
stripePublishableKey,
|
|
92
|
+
createClientReferenceId,
|
|
93
|
+
enableTurnkey,
|
|
94
|
+
defaultPermissions,
|
|
95
|
+
setConfig,
|
|
96
|
+
]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
85
97
|
|
|
86
98
|
// Initialize Google Analytics on mount
|
|
87
99
|
useEffect(() => {
|
|
@@ -6,8 +6,8 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
6
6
|
import { viemToThirdwebChain } from "@b3dotfun/sdk/shared/constants/chains/b3Chain";
|
|
7
7
|
import { getChainById } from "@b3dotfun/sdk/shared/utils/chains";
|
|
8
8
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
9
|
-
import { getWalletBalance } from "thirdweb/wallets";
|
|
10
9
|
import invariant from "invariant";
|
|
10
|
+
import { getWalletBalance } from "thirdweb/wallets";
|
|
11
11
|
|
|
12
12
|
type GetWalletBalanceResult = {
|
|
13
13
|
value: bigint;
|
|
@@ -83,7 +83,9 @@ export function useTokenBalancesByChain({
|
|
|
83
83
|
staleTime: 30000, // Consider data fresh for 30 seconds
|
|
84
84
|
gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes
|
|
85
85
|
retry: 2, // Limit retries on failure
|
|
86
|
-
|
|
86
|
+
// Enable structural sharing to prevent infinite loops
|
|
87
|
+
// This ensures we only get new references when data actually changes
|
|
88
|
+
structuralSharing: true,
|
|
87
89
|
});
|
|
88
90
|
|
|
89
91
|
return {
|