@xchainjs/xchain-thorchain-query 0.4.8 → 0.4.9
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 +11 -9
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +11 -9
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +4 -4
- package/package.json +4 -4
package/lib/index.esm.js
CHANGED
|
@@ -1888,6 +1888,7 @@ class ThorchainQuery {
|
|
|
1888
1888
|
errors = yield this.getAddSaversEstimateErrors(addAmount);
|
|
1889
1889
|
// request param amount should always be in 1e8 which is why we pass in adjusted decimals if chain decimals != 8
|
|
1890
1890
|
const newAddAmount = addAmount.baseAmount.decimal != 8 ? getBaseAmountWithDiffDecimals(addAmount, 8) : addAmount.baseAmount.amount();
|
|
1891
|
+
console.log(assetToString(addAmount.asset));
|
|
1891
1892
|
// Fetch quote
|
|
1892
1893
|
const depositQuote = yield this.thorchainCache.thornode.getSaversDepositQuote(assetToString(addAmount.asset), newAddAmount.toNumber());
|
|
1893
1894
|
// error handling
|
|
@@ -2137,7 +2138,8 @@ class ThorchainQuery {
|
|
|
2137
2138
|
if (pool.status.toLowerCase() !== 'available')
|
|
2138
2139
|
errors.push(`Pool is not available for this asset ${assetToString(addAmount.asset)}`);
|
|
2139
2140
|
const inboundFee = calcNetworkFee(addAmount.asset, inboundDetails[addAmount.asset.chain]);
|
|
2140
|
-
|
|
2141
|
+
const inboundFeeInAddAmountAsset = yield this.convert(inboundFee, addAmount.asset); // to make sure maths is being done on same assets
|
|
2142
|
+
if (addAmount.lte(inboundFeeInAddAmountAsset))
|
|
2141
2143
|
errors.push(`Add amount does not cover fees`);
|
|
2142
2144
|
return errors;
|
|
2143
2145
|
});
|
|
@@ -2180,8 +2182,8 @@ class ThorchainQuery {
|
|
|
2180
2182
|
memo: undefined,
|
|
2181
2183
|
expectedAmountOut: '',
|
|
2182
2184
|
expectedCollateralizationRatio: '',
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
+
expectedCollateralDeposited: '',
|
|
2186
|
+
expectedDebtIssued: '',
|
|
2185
2187
|
errors: errors,
|
|
2186
2188
|
};
|
|
2187
2189
|
}
|
|
@@ -2207,8 +2209,8 @@ class ThorchainQuery {
|
|
|
2207
2209
|
memo: loanOpenResp.memo,
|
|
2208
2210
|
expectedAmountOut: loanOpenResp.expected_amount_out,
|
|
2209
2211
|
expectedCollateralizationRatio: loanOpenResp.expected_collateralization_ratio,
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
+
expectedCollateralDeposited: loanOpenResp.expected_collateral_deposited,
|
|
2213
|
+
expectedDebtIssued: loanOpenResp.expected_debt_issued,
|
|
2212
2214
|
errors: errors,
|
|
2213
2215
|
};
|
|
2214
2216
|
return loanOpenQuote;
|
|
@@ -2248,8 +2250,8 @@ class ThorchainQuery {
|
|
|
2248
2250
|
recommendedMinAmountIn: loanCloseResp.recommended_min_amount_in,
|
|
2249
2251
|
memo: undefined,
|
|
2250
2252
|
expectedAmountOut: '',
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
+
expectedCollateralWithdrawn: '',
|
|
2254
|
+
expectedDebtRepaid: '',
|
|
2253
2255
|
errors: errors,
|
|
2254
2256
|
};
|
|
2255
2257
|
}
|
|
@@ -2274,8 +2276,8 @@ class ThorchainQuery {
|
|
|
2274
2276
|
recommendedMinAmountIn: loanCloseResp.recommended_min_amount_in,
|
|
2275
2277
|
memo: loanCloseResp.memo,
|
|
2276
2278
|
expectedAmountOut: loanCloseResp.expected_amount_out,
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
+
expectedCollateralWithdrawn: loanCloseResp.expected_collateral_withdrawn,
|
|
2280
|
+
expectedDebtRepaid: loanCloseResp.expected_debt_repaid,
|
|
2279
2281
|
errors: errors,
|
|
2280
2282
|
};
|
|
2281
2283
|
return loanCloseQuote;
|