@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
|
-
//
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
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
|
-
|
|
578
|
-
if (!destinationTokenAmount) {
|
|
579
|
-
setDstAmount("");
|
|
580
|
-
}
|
|
580
|
+
setDstAmount("");
|
|
581
581
|
}
|
|
582
582
|
else {
|
|
583
583
|
setSrcAmount("");
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
|
-
}, [anyspendQuote, isSrcInputDirty
|
|
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
|
-
//
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
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
|
-
|
|
571
|
-
if (!destinationTokenAmount) {
|
|
572
|
-
setDstAmount("");
|
|
573
|
-
}
|
|
573
|
+
setDstAmount("");
|
|
574
574
|
}
|
|
575
575
|
else {
|
|
576
576
|
setSrcAmount("");
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
}, [anyspendQuote, isSrcInputDirty
|
|
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
|
@@ -807,12 +807,15 @@ function AnySpendInner({
|
|
|
807
807
|
anyspendQuote.data.currencyOut?.currency?.decimals
|
|
808
808
|
) {
|
|
809
809
|
if (isSrcInputDirty) {
|
|
810
|
-
//
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
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
|
-
|
|
824
|
-
if (!destinationTokenAmount) {
|
|
825
|
-
setDstAmount("");
|
|
826
|
-
}
|
|
826
|
+
setDstAmount("");
|
|
827
827
|
} else {
|
|
828
828
|
setSrcAmount("");
|
|
829
829
|
}
|
|
830
830
|
}
|
|
831
|
-
}, [anyspendQuote, isSrcInputDirty
|
|
831
|
+
}, [anyspendQuote, isSrcInputDirty]);
|
|
832
832
|
|
|
833
833
|
// Call onSuccess when order is executed
|
|
834
834
|
useOnOrderSuccess({ orderData: oat, orderId, onSuccess });
|