@xchainjs/xchain-thorchain-query 0.4.4 → 0.4.5
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/lib/index.esm.js +17 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +17 -2
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +3 -0
- package/package.json +2 -2
package/lib/index.esm.js
CHANGED
|
@@ -1388,6 +1388,10 @@ class ThorchainQuery {
|
|
|
1388
1388
|
const response = JSON.parse(JSON.stringify(swapQuote));
|
|
1389
1389
|
if (response.error)
|
|
1390
1390
|
errors.push(`Thornode request quote: ${response.error}`);
|
|
1391
|
+
//The recommended minimum inbound amount for this transaction type & inbound asset.
|
|
1392
|
+
// Sending less than this amount could result in failed refunds
|
|
1393
|
+
if (swapQuote.recommended_min_amount_in && inputAmount.toNumber() < +swapQuote.recommended_min_amount_in)
|
|
1394
|
+
errors.push(`Error amount in: ${inputAmount.toNumber()} is less than reccommended Min Amount: ${swapQuote.recommended_min_amount_in}`);
|
|
1391
1395
|
if (errors.length > 0) {
|
|
1392
1396
|
return {
|
|
1393
1397
|
memo: ``,
|
|
@@ -1424,6 +1428,7 @@ class ThorchainQuery {
|
|
|
1424
1428
|
netOutput: new CryptoAmount(baseAmount(swapQuote.expected_amount_out), destinationAsset),
|
|
1425
1429
|
outboundDelaySeconds: swapQuote.outbound_delay_seconds,
|
|
1426
1430
|
inboundConfirmationSeconds: swapQuote.inbound_confirmation_seconds,
|
|
1431
|
+
recommendedMinAmountIn: swapQuote.recommended_min_amount_in,
|
|
1427
1432
|
canSwap: true,
|
|
1428
1433
|
errors,
|
|
1429
1434
|
},
|
|
@@ -1849,6 +1854,11 @@ class ThorchainQuery {
|
|
|
1849
1854
|
const response = JSON.parse(JSON.stringify(depositQuote));
|
|
1850
1855
|
if (response.error)
|
|
1851
1856
|
errors.push(`Thornode request quote failed: ${response.error}`);
|
|
1857
|
+
//The recommended minimum inbound amount for this transaction type & inbound asset.
|
|
1858
|
+
// Sending less than this amount could result in failed refunds
|
|
1859
|
+
if (depositQuote.recommended_min_amount_in &&
|
|
1860
|
+
addAmount.baseAmount.amount().toNumber() < +depositQuote.recommended_min_amount_in)
|
|
1861
|
+
errors.push(`Error amount in: ${addAmount.baseAmount.amount().toNumber()} is less than reccommended Min Amount: ${depositQuote.recommended_min_amount_in}`);
|
|
1852
1862
|
// Return errors if there is any
|
|
1853
1863
|
if (errors.length > 0) {
|
|
1854
1864
|
return {
|
|
@@ -1865,6 +1875,7 @@ class ThorchainQuery {
|
|
|
1865
1875
|
saverCapFilledPercent: -1,
|
|
1866
1876
|
estimatedWaitTime: -1,
|
|
1867
1877
|
slipBasisPoints: -1,
|
|
1878
|
+
recommendedMinAmountIn: depositQuote.recommended_min_amount_in,
|
|
1868
1879
|
canAddSaver: false,
|
|
1869
1880
|
errors,
|
|
1870
1881
|
};
|
|
@@ -1898,6 +1909,7 @@ class ThorchainQuery {
|
|
|
1898
1909
|
canAddSaver: errors.length === 0,
|
|
1899
1910
|
slipBasisPoints: depositQuote.slippage_bps,
|
|
1900
1911
|
saverCapFilledPercent,
|
|
1912
|
+
recommendedMinAmountIn: depositQuote.recommended_min_amount_in,
|
|
1901
1913
|
errors,
|
|
1902
1914
|
};
|
|
1903
1915
|
return estimateAddSaver;
|
|
@@ -2060,6 +2072,9 @@ class ThorchainQuery {
|
|
|
2060
2072
|
const response = JSON.parse(JSON.stringify(loanOpenResp));
|
|
2061
2073
|
if (response.error)
|
|
2062
2074
|
errors.push(`Thornode request quote failed: ${response.error}`);
|
|
2075
|
+
if (loanOpenResp.recommended_min_amount_in &&
|
|
2076
|
+
amount.baseAmount.amount().toNumber() < +loanOpenResp.recommended_min_amount_in)
|
|
2077
|
+
errors.push(`Error amount in: ${amount.baseAmount.amount().toNumber()} is less than reccommended Min Amount: ${loanOpenResp.recommended_min_amount_in}`);
|
|
2063
2078
|
if (errors.length > 0) {
|
|
2064
2079
|
return {
|
|
2065
2080
|
inboundAddress: '',
|
|
@@ -2079,7 +2094,7 @@ class ThorchainQuery {
|
|
|
2079
2094
|
warning: '',
|
|
2080
2095
|
notes: '',
|
|
2081
2096
|
dustThreshold: undefined,
|
|
2082
|
-
recommendedMinAmountIn:
|
|
2097
|
+
recommendedMinAmountIn: loanOpenResp.recommended_min_amount_in,
|
|
2083
2098
|
memo: undefined,
|
|
2084
2099
|
expectedAmountOut: '',
|
|
2085
2100
|
expectedCollateralizationRatio: '',
|
|
@@ -2148,7 +2163,7 @@ class ThorchainQuery {
|
|
|
2148
2163
|
warning: '',
|
|
2149
2164
|
notes: '',
|
|
2150
2165
|
dustThreshold: undefined,
|
|
2151
|
-
recommendedMinAmountIn:
|
|
2166
|
+
recommendedMinAmountIn: loanCloseResp.recommended_min_amount_in,
|
|
2152
2167
|
memo: undefined,
|
|
2153
2168
|
expectedAmountOut: '',
|
|
2154
2169
|
expectedCollateralDown: '',
|