@b3dotfun/sdk 0.0.89-alpha.1 → 0.0.89-alpha.2
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.
|
@@ -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
|
|
@@ -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
|
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
|
|