@b3dotfun/sdk 0.1.70-alpha.14 → 0.1.70-alpha.15

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.
@@ -559,12 +559,15 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
559
559
  anyspendQuote.data.currencyOut?.amount &&
560
560
  anyspendQuote.data.currencyOut?.currency?.decimals) {
561
561
  if (isSrcInputDirty) {
562
- // Don't override dstAmount if we have a fixed destinationTokenAmount
563
- if (!destinationTokenAmount) {
564
- const amount = anyspendQuote.data.currencyOut.amount;
565
- const decimals = anyspendQuote.data.currencyOut.currency.decimals;
566
- setDstAmount((0, number_1.formatTokenAmount)(BigInt(amount), decimals, 6, false));
567
- }
562
+ // The user is driving the SOURCE (exact-in): reflect the quote's OUTPUT even
563
+ // when a fixed destinationTokenAmount pre-filled the receive. That lock only
564
+ // governs the INITIAL exact-out state (untouched source → compute the pay for
565
+ // the fixed receive). Once the user edits the pay, keeping the receive pinned
566
+ // shows a value that doesn't match the quote — the URL amount "overrides" the
567
+ // real output, an invalid mismatched swap.
568
+ const amount = anyspendQuote.data.currencyOut.amount;
569
+ const decimals = anyspendQuote.data.currencyOut.currency.decimals;
570
+ setDstAmount((0, number_1.formatTokenAmount)(BigInt(amount), decimals, 6, false));
568
571
  }
569
572
  else {
570
573
  const amount = anyspendQuote.data.currencyIn.amount;
@@ -574,16 +577,13 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
574
577
  }
575
578
  else {
576
579
  if (isSrcInputDirty) {
577
- // Don't reset dstAmount if we have a fixed destinationTokenAmount
578
- if (!destinationTokenAmount) {
579
- setDstAmount("");
580
- }
580
+ setDstAmount("");
581
581
  }
582
582
  else {
583
583
  setSrcAmount("");
584
584
  }
585
585
  }
586
- }, [anyspendQuote, isSrcInputDirty, destinationTokenAmount]);
586
+ }, [anyspendQuote, isSrcInputDirty]);
587
587
  // Call onSuccess when order is executed
588
588
  (0, useOnOrderSuccess_1.useOnOrderSuccess)({ orderData: oat, orderId, onSuccess });
589
589
  // Clear all persisted selection state once an order is submitted — next open starts fresh
@@ -552,12 +552,15 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
552
552
  anyspendQuote.data.currencyOut?.amount &&
553
553
  anyspendQuote.data.currencyOut?.currency?.decimals) {
554
554
  if (isSrcInputDirty) {
555
- // Don't override dstAmount if we have a fixed destinationTokenAmount
556
- if (!destinationTokenAmount) {
557
- const amount = anyspendQuote.data.currencyOut.amount;
558
- const decimals = anyspendQuote.data.currencyOut.currency.decimals;
559
- setDstAmount(formatTokenAmount(BigInt(amount), decimals, 6, false));
560
- }
555
+ // The user is driving the SOURCE (exact-in): reflect the quote's OUTPUT even
556
+ // when a fixed destinationTokenAmount pre-filled the receive. That lock only
557
+ // governs the INITIAL exact-out state (untouched source → compute the pay for
558
+ // the fixed receive). Once the user edits the pay, keeping the receive pinned
559
+ // shows a value that doesn't match the quote — the URL amount "overrides" the
560
+ // real output, an invalid mismatched swap.
561
+ const amount = anyspendQuote.data.currencyOut.amount;
562
+ const decimals = anyspendQuote.data.currencyOut.currency.decimals;
563
+ setDstAmount(formatTokenAmount(BigInt(amount), decimals, 6, false));
561
564
  }
562
565
  else {
563
566
  const amount = anyspendQuote.data.currencyIn.amount;
@@ -567,16 +570,13 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
567
570
  }
568
571
  else {
569
572
  if (isSrcInputDirty) {
570
- // Don't reset dstAmount if we have a fixed destinationTokenAmount
571
- if (!destinationTokenAmount) {
572
- setDstAmount("");
573
- }
573
+ setDstAmount("");
574
574
  }
575
575
  else {
576
576
  setSrcAmount("");
577
577
  }
578
578
  }
579
- }, [anyspendQuote, isSrcInputDirty, destinationTokenAmount]);
579
+ }, [anyspendQuote, isSrcInputDirty]);
580
580
  // Call onSuccess when order is executed
581
581
  useOnOrderSuccess({ orderData: oat, orderId, onSuccess });
582
582
  // Clear all persisted selection state once an order is submitted — next open starts fresh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.1.70-alpha.14",
3
+ "version": "0.1.70-alpha.15",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -807,12 +807,15 @@ function AnySpendInner({
807
807
  anyspendQuote.data.currencyOut?.currency?.decimals
808
808
  ) {
809
809
  if (isSrcInputDirty) {
810
- // Don't override dstAmount if we have a fixed destinationTokenAmount
811
- if (!destinationTokenAmount) {
812
- const amount = anyspendQuote.data.currencyOut.amount;
813
- const decimals = anyspendQuote.data.currencyOut.currency.decimals;
814
- setDstAmount(formatTokenAmount(BigInt(amount), decimals, 6, false));
815
- }
810
+ // The user is driving the SOURCE (exact-in): reflect the quote's OUTPUT even
811
+ // when a fixed destinationTokenAmount pre-filled the receive. That lock only
812
+ // governs the INITIAL exact-out state (untouched source → compute the pay for
813
+ // the fixed receive). Once the user edits the pay, keeping the receive pinned
814
+ // shows a value that doesn't match the quote — the URL amount "overrides" the
815
+ // real output, an invalid mismatched swap.
816
+ const amount = anyspendQuote.data.currencyOut.amount;
817
+ const decimals = anyspendQuote.data.currencyOut.currency.decimals;
818
+ setDstAmount(formatTokenAmount(BigInt(amount), decimals, 6, false));
816
819
  } else {
817
820
  const amount = anyspendQuote.data.currencyIn.amount;
818
821
  const decimals = anyspendQuote.data.currencyIn.currency.decimals;
@@ -820,15 +823,12 @@ function AnySpendInner({
820
823
  }
821
824
  } else {
822
825
  if (isSrcInputDirty) {
823
- // Don't reset dstAmount if we have a fixed destinationTokenAmount
824
- if (!destinationTokenAmount) {
825
- setDstAmount("");
826
- }
826
+ setDstAmount("");
827
827
  } else {
828
828
  setSrcAmount("");
829
829
  }
830
830
  }
831
- }, [anyspendQuote, isSrcInputDirty, destinationTokenAmount]);
831
+ }, [anyspendQuote, isSrcInputDirty]);
832
832
 
833
833
  // Call onSuccess when order is executed
834
834
  useOnOrderSuccess({ orderData: oat, orderId, onSuccess });