squarefi-bff-api-module 1.24.15 → 1.24.17
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/api/types/types.d.ts +27 -2
- package/dist/hooks/useCalc.d.ts +6 -1
- package/dist/hooks/useCalc.js +8 -6
- package/package.json +1 -1
- package/src/api/types/types.ts +30 -5
- package/src/hooks/useCalc.ts +23 -8
|
@@ -1303,7 +1303,7 @@ export declare namespace API {
|
|
|
1303
1303
|
namespace WITHDRAWAL_CRYPTO {
|
|
1304
1304
|
type Request = {
|
|
1305
1305
|
amount: number;
|
|
1306
|
-
|
|
1306
|
+
is_subtract: boolean;
|
|
1307
1307
|
wallet_uuid: string;
|
|
1308
1308
|
crypto_uuid: string;
|
|
1309
1309
|
to_address: string;
|
|
@@ -1425,7 +1425,8 @@ export declare namespace API {
|
|
|
1425
1425
|
from_currency_id: string;
|
|
1426
1426
|
to_currency_id: string;
|
|
1427
1427
|
amount: number;
|
|
1428
|
-
is_reverse
|
|
1428
|
+
is_reverse: boolean;
|
|
1429
|
+
is_subtract: boolean;
|
|
1429
1430
|
signal?: AbortSignal;
|
|
1430
1431
|
}
|
|
1431
1432
|
export interface WithdrawCryptoRequest extends CommonRequestParams {
|
|
@@ -1465,6 +1466,8 @@ export declare namespace API {
|
|
|
1465
1466
|
to_wallet_uuid: string;
|
|
1466
1467
|
amount: number;
|
|
1467
1468
|
request_id: string;
|
|
1469
|
+
is_subtract?: boolean;
|
|
1470
|
+
is_reverse?: boolean;
|
|
1468
1471
|
}
|
|
1469
1472
|
type Response = null;
|
|
1470
1473
|
}
|
|
@@ -1476,6 +1479,8 @@ export declare namespace API {
|
|
|
1476
1479
|
wallet_id: string;
|
|
1477
1480
|
from_currency_id: string;
|
|
1478
1481
|
to_currency_id: string;
|
|
1482
|
+
is_subtract?: boolean;
|
|
1483
|
+
is_reverse?: boolean;
|
|
1479
1484
|
}
|
|
1480
1485
|
interface Response {
|
|
1481
1486
|
order_uuid: string;
|
|
@@ -1510,6 +1515,8 @@ export declare namespace API {
|
|
|
1510
1515
|
wallet_id: string;
|
|
1511
1516
|
from_currency_id: string;
|
|
1512
1517
|
to_currency_id: string;
|
|
1518
|
+
is_subtract?: boolean;
|
|
1519
|
+
is_reverse?: boolean;
|
|
1513
1520
|
}
|
|
1514
1521
|
interface Response {
|
|
1515
1522
|
order_uuid: string;
|
|
@@ -1544,6 +1551,8 @@ export declare namespace API {
|
|
|
1544
1551
|
wallet_id: string;
|
|
1545
1552
|
from_currency_id: string;
|
|
1546
1553
|
to_currency_id: string;
|
|
1554
|
+
is_subtract?: boolean;
|
|
1555
|
+
is_reverse?: boolean;
|
|
1547
1556
|
}
|
|
1548
1557
|
interface Response {
|
|
1549
1558
|
order_uuid: string;
|
|
@@ -1580,6 +1589,8 @@ export declare namespace API {
|
|
|
1580
1589
|
to_currency_id: string;
|
|
1581
1590
|
refference?: string;
|
|
1582
1591
|
note?: string;
|
|
1592
|
+
is_subtract?: boolean;
|
|
1593
|
+
is_reverse?: boolean;
|
|
1583
1594
|
}
|
|
1584
1595
|
interface Response {
|
|
1585
1596
|
order_uuid: string;
|
|
@@ -1616,6 +1627,8 @@ export declare namespace API {
|
|
|
1616
1627
|
to_currency_id: string;
|
|
1617
1628
|
refference?: string;
|
|
1618
1629
|
note?: string;
|
|
1630
|
+
is_subtract?: boolean;
|
|
1631
|
+
is_reverse?: boolean;
|
|
1619
1632
|
}
|
|
1620
1633
|
interface Response {
|
|
1621
1634
|
order_uuid: string;
|
|
@@ -1652,6 +1665,8 @@ export declare namespace API {
|
|
|
1652
1665
|
to_currency_id: string;
|
|
1653
1666
|
refference?: string;
|
|
1654
1667
|
note?: string;
|
|
1668
|
+
is_subtract?: boolean;
|
|
1669
|
+
is_reverse?: boolean;
|
|
1655
1670
|
}
|
|
1656
1671
|
interface Response {
|
|
1657
1672
|
order_uuid: string;
|
|
@@ -1686,6 +1701,8 @@ export declare namespace API {
|
|
|
1686
1701
|
wallet_id: string;
|
|
1687
1702
|
from_currency_id: string;
|
|
1688
1703
|
to_currency_id: string;
|
|
1704
|
+
is_subtract?: boolean;
|
|
1705
|
+
is_reverse?: boolean;
|
|
1689
1706
|
}
|
|
1690
1707
|
interface Response {
|
|
1691
1708
|
order_uuid: string;
|
|
@@ -1721,6 +1738,8 @@ export declare namespace API {
|
|
|
1721
1738
|
wallet_account_id: string;
|
|
1722
1739
|
from_currency_id: string;
|
|
1723
1740
|
note?: string;
|
|
1741
|
+
is_subtract?: boolean;
|
|
1742
|
+
is_reverse?: boolean;
|
|
1724
1743
|
}
|
|
1725
1744
|
interface Response {
|
|
1726
1745
|
created_at: string;
|
|
@@ -1758,6 +1777,8 @@ export declare namespace API {
|
|
|
1758
1777
|
wallet_account_id: string;
|
|
1759
1778
|
from_currency_id: string;
|
|
1760
1779
|
note?: string;
|
|
1780
|
+
is_subtract?: boolean;
|
|
1781
|
+
is_reverse?: boolean;
|
|
1761
1782
|
}
|
|
1762
1783
|
interface Response {
|
|
1763
1784
|
created_at: string;
|
|
@@ -1795,6 +1816,8 @@ export declare namespace API {
|
|
|
1795
1816
|
wallet_account_id: string;
|
|
1796
1817
|
from_currency_id: string;
|
|
1797
1818
|
note?: string;
|
|
1819
|
+
is_subtract?: boolean;
|
|
1820
|
+
is_reverse?: boolean;
|
|
1798
1821
|
}
|
|
1799
1822
|
interface Response {
|
|
1800
1823
|
created_at: string;
|
|
@@ -1831,6 +1854,8 @@ export declare namespace API {
|
|
|
1831
1854
|
wallet_id: string;
|
|
1832
1855
|
from_currency_id: string;
|
|
1833
1856
|
to_currency_id: string;
|
|
1857
|
+
is_subtract?: boolean;
|
|
1858
|
+
is_reverse?: boolean;
|
|
1834
1859
|
}
|
|
1835
1860
|
interface Response {
|
|
1836
1861
|
order_uuid: string;
|
package/dist/hooks/useCalc.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { API } from '../api/types/types';
|
|
2
|
+
type CalcData = API.Orders.V2.Calc.Response & {
|
|
3
|
+
is_subtract: boolean;
|
|
4
|
+
is_reverse: boolean;
|
|
5
|
+
};
|
|
2
6
|
export type OrderCalcHandlerProps = Omit<API.Orders.V2.Calc.Request, 'order_type'>;
|
|
3
7
|
export type UseOrderCalcProps = {
|
|
4
8
|
from_currency_id: string | null | undefined;
|
|
@@ -8,7 +12,7 @@ export type UseOrderCalcProps = {
|
|
|
8
12
|
to_address?: string;
|
|
9
13
|
};
|
|
10
14
|
export type UseOrderCalcData = {
|
|
11
|
-
calcData:
|
|
15
|
+
calcData: CalcData | null;
|
|
12
16
|
sellingAmount: number;
|
|
13
17
|
setSellingAmount: (value: number) => void;
|
|
14
18
|
buyingAmount: number;
|
|
@@ -18,3 +22,4 @@ export type UseOrderCalcData = {
|
|
|
18
22
|
};
|
|
19
23
|
export type UseOrderCalc = (props: UseOrderCalcProps) => UseOrderCalcData;
|
|
20
24
|
export declare const useOrderCalc: UseOrderCalc;
|
|
25
|
+
export {};
|
package/dist/hooks/useCalc.js
CHANGED
|
@@ -36,7 +36,7 @@ const useOrderCalc = (props) => {
|
|
|
36
36
|
abortControllerRef.current.abort();
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
const updateCalculations = (_a) => __awaiter(void 0, [_a], void 0, function* ({ is_reverse
|
|
39
|
+
const updateCalculations = (_a) => __awaiter(void 0, [_a], void 0, function* ({ is_reverse, is_subtract }) {
|
|
40
40
|
if (disableCalculation) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
@@ -53,6 +53,7 @@ const useOrderCalc = (props) => {
|
|
|
53
53
|
to_currency_id,
|
|
54
54
|
amount: is_reverse ? buyingAmount : sellingAmount,
|
|
55
55
|
is_reverse,
|
|
56
|
+
is_subtract,
|
|
56
57
|
to_address,
|
|
57
58
|
signal: abortControllerRef.current.signal,
|
|
58
59
|
};
|
|
@@ -63,7 +64,8 @@ const useOrderCalc = (props) => {
|
|
|
63
64
|
try {
|
|
64
65
|
is_reverse ? setIsSellingValuePending(true) : setIsBuyingValuePending(true);
|
|
65
66
|
const data = yield calcHandler(calcParams);
|
|
66
|
-
setCalcData(data)
|
|
67
|
+
setCalcData(Object.assign(Object.assign({}, data), { is_reverse,
|
|
68
|
+
is_subtract }));
|
|
67
69
|
setSellingAmount(data.from_amount);
|
|
68
70
|
setBuyingAmount(data.result_amount);
|
|
69
71
|
abortControllerRef.current = null;
|
|
@@ -84,20 +86,20 @@ const useOrderCalc = (props) => {
|
|
|
84
86
|
});
|
|
85
87
|
const onSellingValueUpdate = (0, lodash_debounce_1.default)((value) => {
|
|
86
88
|
if (value !== (calcData === null || calcData === void 0 ? void 0 : calcData.from_amount) || isBuyingValuePending) {
|
|
87
|
-
updateCalculations({ is_reverse: false });
|
|
89
|
+
updateCalculations({ is_reverse: false, is_subtract: true });
|
|
88
90
|
}
|
|
89
91
|
}, ((_a = abortControllerRef.current) === null || _a === void 0 ? void 0 : _a.signal) ? undefined : 1000);
|
|
90
92
|
const onBuyingValueUpdate = (0, lodash_debounce_1.default)((value) => {
|
|
91
93
|
if (value !== (calcData === null || calcData === void 0 ? void 0 : calcData.result_amount) || isSellingValuePending) {
|
|
92
|
-
updateCalculations({ is_reverse: true });
|
|
94
|
+
updateCalculations({ is_reverse: true, is_subtract: false });
|
|
93
95
|
}
|
|
94
96
|
}, ((_b = abortControllerRef.current) === null || _b === void 0 ? void 0 : _b.signal) ? undefined : 1000);
|
|
95
97
|
const onToAddressUpdate = (0, lodash_debounce_1.default)(() => {
|
|
96
|
-
updateCalculations({ is_reverse: false });
|
|
98
|
+
updateCalculations({ is_reverse: false, is_subtract: true });
|
|
97
99
|
}, ((_c = abortControllerRef.current) === null || _c === void 0 ? void 0 : _c.signal) ? undefined : 1000);
|
|
98
100
|
(0, react_1.useEffect)(() => {
|
|
99
101
|
abortCurrentCalculation();
|
|
100
|
-
updateCalculations({ is_reverse: false });
|
|
102
|
+
updateCalculations({ is_reverse: false, is_subtract: true });
|
|
101
103
|
}, [from_currency_id, to_currency_id]);
|
|
102
104
|
(0, react_1.useEffect)(() => {
|
|
103
105
|
abortCurrentCalculation();
|
package/package.json
CHANGED
package/src/api/types/types.ts
CHANGED
|
@@ -1509,7 +1509,7 @@ export namespace API {
|
|
|
1509
1509
|
export namespace WITHDRAWAL_CRYPTO {
|
|
1510
1510
|
export type Request = {
|
|
1511
1511
|
amount: number;
|
|
1512
|
-
|
|
1512
|
+
is_subtract: boolean;
|
|
1513
1513
|
wallet_uuid: string;
|
|
1514
1514
|
crypto_uuid: string;
|
|
1515
1515
|
to_address: string;
|
|
@@ -1646,7 +1646,7 @@ export namespace API {
|
|
|
1646
1646
|
// crypto_uuid: string;
|
|
1647
1647
|
// fiat_uuid: string;
|
|
1648
1648
|
// card_number: string;
|
|
1649
|
-
//
|
|
1649
|
+
// is_subtract: boolean;
|
|
1650
1650
|
// }
|
|
1651
1651
|
// export type Response = Item;
|
|
1652
1652
|
// }
|
|
@@ -1676,7 +1676,7 @@ export namespace API {
|
|
|
1676
1676
|
// wallet_uuid: string;
|
|
1677
1677
|
// crypto_uuid: string;
|
|
1678
1678
|
// card_id: string;
|
|
1679
|
-
//
|
|
1679
|
+
// is_subtract: boolean;
|
|
1680
1680
|
// };
|
|
1681
1681
|
// export interface Response {
|
|
1682
1682
|
// id: number;
|
|
@@ -1702,7 +1702,7 @@ export namespace API {
|
|
|
1702
1702
|
// wallet_uuid: string;
|
|
1703
1703
|
// crypto_uuid: string;
|
|
1704
1704
|
// fiat_account_id: string;
|
|
1705
|
-
//
|
|
1705
|
+
// is_subtract: boolean;
|
|
1706
1706
|
// };
|
|
1707
1707
|
|
|
1708
1708
|
// export interface Response {
|
|
@@ -1730,7 +1730,8 @@ export namespace API {
|
|
|
1730
1730
|
from_currency_id: string;
|
|
1731
1731
|
to_currency_id: string;
|
|
1732
1732
|
amount: number;
|
|
1733
|
-
is_reverse
|
|
1733
|
+
is_reverse: boolean;
|
|
1734
|
+
is_subtract: boolean;
|
|
1734
1735
|
signal?: AbortSignal;
|
|
1735
1736
|
}
|
|
1736
1737
|
|
|
@@ -1777,6 +1778,8 @@ export namespace API {
|
|
|
1777
1778
|
to_wallet_uuid: string;
|
|
1778
1779
|
amount: number;
|
|
1779
1780
|
request_id: string;
|
|
1781
|
+
is_subtract?: boolean;
|
|
1782
|
+
is_reverse?: boolean;
|
|
1780
1783
|
}
|
|
1781
1784
|
|
|
1782
1785
|
export type Response = null;
|
|
@@ -1790,6 +1793,8 @@ export namespace API {
|
|
|
1790
1793
|
wallet_id: string;
|
|
1791
1794
|
from_currency_id: string;
|
|
1792
1795
|
to_currency_id: string;
|
|
1796
|
+
is_subtract?: boolean;
|
|
1797
|
+
is_reverse?: boolean;
|
|
1793
1798
|
}
|
|
1794
1799
|
|
|
1795
1800
|
export interface Response {
|
|
@@ -1827,6 +1832,8 @@ export namespace API {
|
|
|
1827
1832
|
wallet_id: string;
|
|
1828
1833
|
from_currency_id: string;
|
|
1829
1834
|
to_currency_id: string;
|
|
1835
|
+
is_subtract?: boolean;
|
|
1836
|
+
is_reverse?: boolean;
|
|
1830
1837
|
}
|
|
1831
1838
|
|
|
1832
1839
|
export interface Response {
|
|
@@ -1864,6 +1871,8 @@ export namespace API {
|
|
|
1864
1871
|
wallet_id: string;
|
|
1865
1872
|
from_currency_id: string;
|
|
1866
1873
|
to_currency_id: string;
|
|
1874
|
+
is_subtract?: boolean;
|
|
1875
|
+
is_reverse?: boolean;
|
|
1867
1876
|
}
|
|
1868
1877
|
|
|
1869
1878
|
export interface Response {
|
|
@@ -1902,6 +1911,8 @@ export namespace API {
|
|
|
1902
1911
|
to_currency_id: string;
|
|
1903
1912
|
refference?: string;
|
|
1904
1913
|
note?: string;
|
|
1914
|
+
is_subtract?: boolean;
|
|
1915
|
+
is_reverse?: boolean;
|
|
1905
1916
|
}
|
|
1906
1917
|
|
|
1907
1918
|
export interface Response {
|
|
@@ -1940,6 +1951,8 @@ export namespace API {
|
|
|
1940
1951
|
to_currency_id: string;
|
|
1941
1952
|
refference?: string;
|
|
1942
1953
|
note?: string;
|
|
1954
|
+
is_subtract?: boolean;
|
|
1955
|
+
is_reverse?: boolean;
|
|
1943
1956
|
}
|
|
1944
1957
|
|
|
1945
1958
|
export interface Response {
|
|
@@ -1978,6 +1991,8 @@ export namespace API {
|
|
|
1978
1991
|
to_currency_id: string;
|
|
1979
1992
|
refference?: string;
|
|
1980
1993
|
note?: string;
|
|
1994
|
+
is_subtract?: boolean;
|
|
1995
|
+
is_reverse?: boolean;
|
|
1981
1996
|
}
|
|
1982
1997
|
|
|
1983
1998
|
export interface Response {
|
|
@@ -2013,6 +2028,8 @@ export namespace API {
|
|
|
2013
2028
|
wallet_id: string;
|
|
2014
2029
|
from_currency_id: string;
|
|
2015
2030
|
to_currency_id: string;
|
|
2031
|
+
is_subtract?: boolean;
|
|
2032
|
+
is_reverse?: boolean;
|
|
2016
2033
|
}
|
|
2017
2034
|
|
|
2018
2035
|
export interface Response {
|
|
@@ -2050,6 +2067,8 @@ export namespace API {
|
|
|
2050
2067
|
wallet_account_id: string;
|
|
2051
2068
|
from_currency_id: string;
|
|
2052
2069
|
note?: string;
|
|
2070
|
+
is_subtract?: boolean;
|
|
2071
|
+
is_reverse?: boolean;
|
|
2053
2072
|
}
|
|
2054
2073
|
|
|
2055
2074
|
export interface Response {
|
|
@@ -2088,6 +2107,8 @@ export namespace API {
|
|
|
2088
2107
|
wallet_account_id: string;
|
|
2089
2108
|
from_currency_id: string;
|
|
2090
2109
|
note?: string;
|
|
2110
|
+
is_subtract?: boolean;
|
|
2111
|
+
is_reverse?: boolean;
|
|
2091
2112
|
}
|
|
2092
2113
|
|
|
2093
2114
|
export interface Response {
|
|
@@ -2126,6 +2147,8 @@ export namespace API {
|
|
|
2126
2147
|
wallet_account_id: string;
|
|
2127
2148
|
from_currency_id: string;
|
|
2128
2149
|
note?: string;
|
|
2150
|
+
is_subtract?: boolean;
|
|
2151
|
+
is_reverse?: boolean;
|
|
2129
2152
|
}
|
|
2130
2153
|
|
|
2131
2154
|
export interface Response {
|
|
@@ -2163,6 +2186,8 @@ export namespace API {
|
|
|
2163
2186
|
wallet_id: string;
|
|
2164
2187
|
from_currency_id: string;
|
|
2165
2188
|
to_currency_id: string;
|
|
2189
|
+
is_subtract?: boolean;
|
|
2190
|
+
is_reverse?: boolean;
|
|
2166
2191
|
}
|
|
2167
2192
|
|
|
2168
2193
|
export interface Response {
|
package/src/hooks/useCalc.ts
CHANGED
|
@@ -2,8 +2,18 @@ import debounce from 'lodash.debounce';
|
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { API } from '../api/types/types';
|
|
4
4
|
|
|
5
|
+
type CalcData = API.Orders.V2.Calc.Response & {
|
|
6
|
+
is_subtract: boolean;
|
|
7
|
+
is_reverse: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
5
10
|
export type OrderCalcHandlerProps = Omit<API.Orders.V2.Calc.Request, 'order_type'>;
|
|
6
11
|
|
|
12
|
+
type UpdateCalculationsProps = {
|
|
13
|
+
is_reverse: boolean;
|
|
14
|
+
is_subtract: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
7
17
|
export type UseOrderCalcProps = {
|
|
8
18
|
from_currency_id: string | null | undefined;
|
|
9
19
|
to_currency_id: string | null | undefined;
|
|
@@ -13,7 +23,7 @@ export type UseOrderCalcProps = {
|
|
|
13
23
|
};
|
|
14
24
|
|
|
15
25
|
export type UseOrderCalcData = {
|
|
16
|
-
calcData:
|
|
26
|
+
calcData: CalcData | null;
|
|
17
27
|
sellingAmount: number;
|
|
18
28
|
setSellingAmount: (value: number) => void;
|
|
19
29
|
buyingAmount: number;
|
|
@@ -29,7 +39,7 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
29
39
|
|
|
30
40
|
const [sellingAmount, setSellingAmount] = useState(0);
|
|
31
41
|
const [buyingAmount, setBuyingAmount] = useState(0);
|
|
32
|
-
const [calcData, setCalcData] = useState<
|
|
42
|
+
const [calcData, setCalcData] = useState<CalcData | null>(null);
|
|
33
43
|
const [isSellingValuePending, setIsSellingValuePending] = useState(false);
|
|
34
44
|
const [isBuyingValuePending, setIsBuyingValuePending] = useState(false);
|
|
35
45
|
|
|
@@ -49,7 +59,7 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
49
59
|
}
|
|
50
60
|
};
|
|
51
61
|
|
|
52
|
-
const updateCalculations = async ({ is_reverse
|
|
62
|
+
const updateCalculations = async ({ is_reverse, is_subtract }: UpdateCalculationsProps) => {
|
|
53
63
|
if (disableCalculation) {
|
|
54
64
|
return;
|
|
55
65
|
}
|
|
@@ -70,6 +80,7 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
70
80
|
to_currency_id,
|
|
71
81
|
amount: is_reverse ? buyingAmount : sellingAmount,
|
|
72
82
|
is_reverse,
|
|
83
|
+
is_subtract,
|
|
73
84
|
to_address,
|
|
74
85
|
signal: abortControllerRef.current.signal,
|
|
75
86
|
};
|
|
@@ -82,7 +93,11 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
82
93
|
try {
|
|
83
94
|
is_reverse ? setIsSellingValuePending(true) : setIsBuyingValuePending(true);
|
|
84
95
|
const data = await calcHandler(calcParams);
|
|
85
|
-
setCalcData(
|
|
96
|
+
setCalcData({
|
|
97
|
+
...data,
|
|
98
|
+
is_reverse,
|
|
99
|
+
is_subtract,
|
|
100
|
+
});
|
|
86
101
|
|
|
87
102
|
setSellingAmount(data.from_amount);
|
|
88
103
|
|
|
@@ -109,7 +124,7 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
109
124
|
const onSellingValueUpdate = debounce(
|
|
110
125
|
(value: number) => {
|
|
111
126
|
if (value !== calcData?.from_amount || isBuyingValuePending) {
|
|
112
|
-
updateCalculations({ is_reverse: false });
|
|
127
|
+
updateCalculations({ is_reverse: false, is_subtract: true });
|
|
113
128
|
}
|
|
114
129
|
},
|
|
115
130
|
abortControllerRef.current?.signal ? undefined : 1000
|
|
@@ -118,7 +133,7 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
118
133
|
const onBuyingValueUpdate = debounce(
|
|
119
134
|
(value: number) => {
|
|
120
135
|
if (value !== calcData?.result_amount || isSellingValuePending) {
|
|
121
|
-
updateCalculations({ is_reverse: true });
|
|
136
|
+
updateCalculations({ is_reverse: true, is_subtract: false });
|
|
122
137
|
}
|
|
123
138
|
},
|
|
124
139
|
abortControllerRef.current?.signal ? undefined : 1000
|
|
@@ -126,14 +141,14 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
126
141
|
|
|
127
142
|
const onToAddressUpdate = debounce(
|
|
128
143
|
() => {
|
|
129
|
-
updateCalculations({ is_reverse: false });
|
|
144
|
+
updateCalculations({ is_reverse: false, is_subtract: true });
|
|
130
145
|
},
|
|
131
146
|
abortControllerRef.current?.signal ? undefined : 1000
|
|
132
147
|
);
|
|
133
148
|
|
|
134
149
|
useEffect(() => {
|
|
135
150
|
abortCurrentCalculation();
|
|
136
|
-
updateCalculations({ is_reverse: false });
|
|
151
|
+
updateCalculations({ is_reverse: false, is_subtract: true });
|
|
137
152
|
}, [from_currency_id, to_currency_id]);
|
|
138
153
|
|
|
139
154
|
useEffect(() => {
|