@b3dotfun/sdk 0.1.63-alpha.2 → 0.1.63-alpha.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.
@@ -200,14 +200,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
200
200
  // Prefill destination amount if provided (for fixed amount mode)
201
201
  const appliedDestinationAmount = (0, react_4.useRef)(false);
202
202
  (0, react_4.useEffect)(() => {
203
- if (destinationTokenAmount && !appliedDestinationAmount.current) {
203
+ // Only apply when we have real metadata (not default decimals)
204
+ if (destinationTokenAmount && dstTokenMetadata?.decimals && !appliedDestinationAmount.current) {
204
205
  appliedDestinationAmount.current = true;
205
- // Convert wei to human-readable format
206
- const formattedAmount = (0, viem_1.formatUnits)(BigInt(destinationTokenAmount), selectedDstToken.decimals);
206
+ const formattedAmount = (0, viem_1.formatUnits)(BigInt(destinationTokenAmount), dstTokenMetadata.decimals);
207
207
  setDstAmount(formattedAmount);
208
208
  setIsSrcInputDirty(false); // Switch to EXACT_OUTPUT mode
209
209
  }
210
- }, [destinationTokenAmount, selectedDstToken.decimals]);
210
+ }, [destinationTokenAmount, dstTokenMetadata?.decimals]);
211
211
  // Load swap configuration from URL on initial render
212
212
  (0, react_4.useEffect)(() => {
213
213
  // Skip if we've already processed the URL, if we have an order to load, or if URL param management is disabled
@@ -193,14 +193,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
193
193
  // Prefill destination amount if provided (for fixed amount mode)
194
194
  const appliedDestinationAmount = useRef(false);
195
195
  useEffect(() => {
196
- if (destinationTokenAmount && !appliedDestinationAmount.current) {
196
+ // Only apply when we have real metadata (not default decimals)
197
+ if (destinationTokenAmount && dstTokenMetadata?.decimals && !appliedDestinationAmount.current) {
197
198
  appliedDestinationAmount.current = true;
198
- // Convert wei to human-readable format
199
- const formattedAmount = formatUnits(BigInt(destinationTokenAmount), selectedDstToken.decimals);
199
+ const formattedAmount = formatUnits(BigInt(destinationTokenAmount), dstTokenMetadata.decimals);
200
200
  setDstAmount(formattedAmount);
201
201
  setIsSrcInputDirty(false); // Switch to EXACT_OUTPUT mode
202
202
  }
203
- }, [destinationTokenAmount, selectedDstToken.decimals]);
203
+ }, [destinationTokenAmount, dstTokenMetadata?.decimals]);
204
204
  // Load swap configuration from URL on initial render
205
205
  useEffect(() => {
206
206
  // Skip if we've already processed the URL, if we have an order to load, or if URL param management is disabled
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.1.63-alpha.2",
3
+ "version": "0.1.63-alpha.3",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -375,14 +375,14 @@ function AnySpendInner({
375
375
  // Prefill destination amount if provided (for fixed amount mode)
376
376
  const appliedDestinationAmount = useRef(false);
377
377
  useEffect(() => {
378
- if (destinationTokenAmount && !appliedDestinationAmount.current) {
378
+ // Only apply when we have real metadata (not default decimals)
379
+ if (destinationTokenAmount && dstTokenMetadata?.decimals && !appliedDestinationAmount.current) {
379
380
  appliedDestinationAmount.current = true;
380
- // Convert wei to human-readable format
381
- const formattedAmount = formatUnits(BigInt(destinationTokenAmount), selectedDstToken.decimals);
381
+ const formattedAmount = formatUnits(BigInt(destinationTokenAmount), dstTokenMetadata.decimals);
382
382
  setDstAmount(formattedAmount);
383
383
  setIsSrcInputDirty(false); // Switch to EXACT_OUTPUT mode
384
384
  }
385
- }, [destinationTokenAmount, selectedDstToken.decimals]);
385
+ }, [destinationTokenAmount, dstTokenMetadata?.decimals]);
386
386
 
387
387
  // Load swap configuration from URL on initial render
388
388
  useEffect(() => {