@b3dotfun/sdk 0.0.89 → 0.0.90-test.1
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/anyspend/react/components/AnySpend.js +4 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -13
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +0 -3
- package/dist/esm/anyspend/react/components/AnySpend.js +4 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -13
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +0 -3
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +5 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +2 -13
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +0 -3
|
@@ -107,7 +107,10 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
107
107
|
defaultToken: defaultSrcToken,
|
|
108
108
|
prefix: "from",
|
|
109
109
|
});
|
|
110
|
-
|
|
110
|
+
// When sourceChainId prop is explicitly provided and differs from URL token's chain,
|
|
111
|
+
// use the default token for the new chain (handles chain selection in AnySpendDeposit)
|
|
112
|
+
const effectiveSrcToken = sourceChainId && srcTokenFromUrl.chainId !== sourceChainId ? defaultSrcToken : srcTokenFromUrl;
|
|
113
|
+
const [selectedSrcToken, setSelectedSrcToken] = (0, react_4.useState)(effectiveSrcToken);
|
|
111
114
|
const { data: srcTokenMetadata } = (0, react_2.useTokenData)(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
112
115
|
const [srcAmount, setSrcAmount] = (0, react_4.useState)(searchParams.get("fromAmount") || "0");
|
|
113
116
|
// State for onramp amount
|
|
@@ -151,7 +151,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
151
151
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
152
152
|
const router = (0, react_2.useRouter)();
|
|
153
153
|
const [activePanel, setActivePanel] = (0, react_5.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
|
|
154
|
-
const [activeTab, setActiveTab] = (0, react_5.useState)(activeTabProps);
|
|
154
|
+
const [activeTab, setActiveTab] = (0, react_5.useState)(forceFiatPayment ? "fiat" : activeTabProps);
|
|
155
155
|
// Payment method state with dual-state system (auto + explicit user selection)
|
|
156
156
|
// Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
|
|
157
157
|
const { setSelectedCryptoPaymentMethod, effectiveCryptoPaymentMethod, resetPaymentMethods } = (0, useCryptoPaymentMethodState_1.useCryptoPaymentMethodState)();
|
|
@@ -42,19 +42,8 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
42
42
|
enableTurnkey,
|
|
43
43
|
defaultPermissions,
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
|
|
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
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
}, []);
|
|
58
47
|
// Initialize Google Analytics on mount
|
|
59
48
|
(0, react_2.useEffect)(() => {
|
|
60
49
|
(0, analytics_1.loadGA4Script)();
|
|
@@ -52,9 +52,6 @@ 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
|
-
// Enable structural sharing to prevent infinite loops
|
|
56
|
-
// This ensures we only get new references when data actually changes
|
|
57
|
-
structuralSharing: true,
|
|
58
55
|
});
|
|
59
56
|
return {
|
|
60
57
|
nativeTokens: combinedData?.nativeTokens ?? [],
|
|
@@ -100,7 +100,10 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
100
100
|
defaultToken: defaultSrcToken,
|
|
101
101
|
prefix: "from",
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
// When sourceChainId prop is explicitly provided and differs from URL token's chain,
|
|
104
|
+
// use the default token for the new chain (handles chain selection in AnySpendDeposit)
|
|
105
|
+
const effectiveSrcToken = sourceChainId && srcTokenFromUrl.chainId !== sourceChainId ? defaultSrcToken : srcTokenFromUrl;
|
|
106
|
+
const [selectedSrcToken, setSelectedSrcToken] = useState(effectiveSrcToken);
|
|
104
107
|
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
105
108
|
const [srcAmount, setSrcAmount] = useState(searchParams.get("fromAmount") || "0");
|
|
106
109
|
// State for onramp amount
|
|
@@ -112,7 +112,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
112
112
|
const searchParams = useSearchParamsSSR();
|
|
113
113
|
const router = useRouter();
|
|
114
114
|
const [activePanel, setActivePanel] = useState(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
|
|
115
|
-
const [activeTab, setActiveTab] = useState(activeTabProps);
|
|
115
|
+
const [activeTab, setActiveTab] = useState(forceFiatPayment ? "fiat" : activeTabProps);
|
|
116
116
|
// Payment method state with dual-state system (auto + explicit user selection)
|
|
117
117
|
// Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
|
|
118
118
|
const { setSelectedCryptoPaymentMethod, effectiveCryptoPaymentMethod, resetPaymentMethods } = useCryptoPaymentMethodState();
|
|
@@ -36,19 +36,8 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
36
36
|
enableTurnkey,
|
|
37
37
|
defaultPermissions,
|
|
38
38
|
});
|
|
39
|
-
|
|
40
|
-
|
|
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
|
|
39
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
+
}, []);
|
|
52
41
|
// Initialize Google Analytics on mount
|
|
53
42
|
useEffect(() => {
|
|
54
43
|
loadGA4Script();
|
|
@@ -46,9 +46,6 @@ 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
|
-
// Enable structural sharing to prevent infinite loops
|
|
50
|
-
// This ensures we only get new references when data actually changes
|
|
51
|
-
structuralSharing: true,
|
|
52
49
|
});
|
|
53
50
|
return {
|
|
54
51
|
nativeTokens: combinedData?.nativeTokens ?? [],
|
package/package.json
CHANGED
|
@@ -249,7 +249,11 @@ function AnySpendInner({
|
|
|
249
249
|
defaultToken: defaultSrcToken,
|
|
250
250
|
prefix: "from",
|
|
251
251
|
});
|
|
252
|
-
|
|
252
|
+
// When sourceChainId prop is explicitly provided and differs from URL token's chain,
|
|
253
|
+
// use the default token for the new chain (handles chain selection in AnySpendDeposit)
|
|
254
|
+
const effectiveSrcToken =
|
|
255
|
+
sourceChainId && srcTokenFromUrl.chainId !== sourceChainId ? defaultSrcToken : srcTokenFromUrl;
|
|
256
|
+
const [selectedSrcToken, setSelectedSrcToken] = useState<components["schemas"]["Token"]>(effectiveSrcToken);
|
|
253
257
|
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
254
258
|
const [srcAmount, setSrcAmount] = useState<string>(searchParams.get("fromAmount") || "0");
|
|
255
259
|
|
|
@@ -253,7 +253,7 @@ function AnySpendCustomInner({
|
|
|
253
253
|
const [activePanel, setActivePanel] = useState<PanelView>(
|
|
254
254
|
loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER,
|
|
255
255
|
);
|
|
256
|
-
const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(activeTabProps);
|
|
256
|
+
const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(forceFiatPayment ? "fiat" : activeTabProps);
|
|
257
257
|
|
|
258
258
|
// Payment method state with dual-state system (auto + explicit user selection)
|
|
259
259
|
// Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
|
|
@@ -81,19 +81,8 @@ export function B3Provider({
|
|
|
81
81
|
enableTurnkey,
|
|
82
82
|
defaultPermissions,
|
|
83
83
|
});
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|
84
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
|
+
}, []);
|
|
97
86
|
|
|
98
87
|
// Initialize Google Analytics on mount
|
|
99
88
|
useEffect(() => {
|
|
@@ -83,9 +83,6 @@ 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
|
-
// Enable structural sharing to prevent infinite loops
|
|
87
|
-
// This ensures we only get new references when data actually changes
|
|
88
|
-
structuralSharing: true,
|
|
89
86
|
});
|
|
90
87
|
|
|
91
88
|
return {
|