@xchainjs/xchain-mayachain-query 2.1.3 → 2.1.6
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 +10 -3
- package/lib/index.js +12 -2
- package/lib/mayachain-query.d.ts +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/utils/const.d.ts +3 -0
- package/package.json +6 -6
package/lib/index.esm.js
CHANGED
|
@@ -232,6 +232,7 @@ class Mayanode {
|
|
|
232
232
|
const BtcAsset = assetFromStringEx('BTC.BTC');
|
|
233
233
|
const EthAsset = assetFromStringEx('ETH.ETH');
|
|
234
234
|
const CacaoAsset = assetFromStringEx('MAYA.CACAO');
|
|
235
|
+
const MayaAsset = assetFromStringEx('MAYA.MAYA');
|
|
235
236
|
const RuneAsset = assetFromStringEx('THOR.RUNE');
|
|
236
237
|
const DashAsset = assetFromStringEx('DASH.DASH');
|
|
237
238
|
const KujiraAsset = assetFromStringEx('KUJI.KUJI');
|
|
@@ -248,6 +249,8 @@ const ArbChain = 'ARB';
|
|
|
248
249
|
const XdrChain = 'XRD';
|
|
249
250
|
const ZecChain = 'ZEC';
|
|
250
251
|
const DEFAULT_MAYACHAIN_DECIMALS = 8;
|
|
252
|
+
const MAYA_DECIMAL = 4;
|
|
253
|
+
const CACAO_DECIMAL = 10;
|
|
251
254
|
|
|
252
255
|
const isCacaoAsset = (asset) => assetToString(asset) === assetToString(CacaoAsset);
|
|
253
256
|
const getBaseAmountWithDiffDecimals = (inputAmount, outDecimals) => {
|
|
@@ -967,11 +970,15 @@ class MayachainQuery {
|
|
|
967
970
|
/**
|
|
968
971
|
* Get the hardcoded decimal precision for quote calculations
|
|
969
972
|
* @param asset The asset to get decimals for
|
|
970
|
-
* @returns 10 for Cacao, 8 for other assets (used in quote calculations)
|
|
973
|
+
* @returns 10 for Cacao, 4 for Maya, 8 for other assets (used in quote calculations)
|
|
971
974
|
*/
|
|
972
975
|
getQuoteAssetDecimals(asset) {
|
|
973
|
-
|
|
976
|
+
if (eqAsset(asset, CacaoAsset))
|
|
977
|
+
return CACAO_DECIMAL;
|
|
978
|
+
if (eqAsset(asset, MayaAsset))
|
|
979
|
+
return MAYA_DECIMAL;
|
|
980
|
+
return DEFAULT_MAYACHAIN_DECIMALS;
|
|
974
981
|
}
|
|
975
982
|
}
|
|
976
983
|
|
|
977
|
-
export { ArbAsset, ArbChain, BtcAsset, BtcChain, CacaoAsset, DEFAULT_MAYACHAIN_DECIMALS, DashAsset, DashChain, EthAsset, EthChain, KujiraAsset, KujiraChain, MayaChain, MayachainCache, MayachainQuery, Mayanode, RuneAsset, ThorChain, XdrAsset, XdrChain, ZecAsset, ZecChain, getBaseAmountWithDiffDecimals, getCryptoAmountWithNotation, isCacaoAsset };
|
|
984
|
+
export { ArbAsset, ArbChain, BtcAsset, BtcChain, CACAO_DECIMAL, CacaoAsset, DEFAULT_MAYACHAIN_DECIMALS, DashAsset, DashChain, EthAsset, EthChain, KujiraAsset, KujiraChain, MAYA_DECIMAL, MayaAsset, MayaChain, MayachainCache, MayachainQuery, Mayanode, RuneAsset, ThorChain, XdrAsset, XdrChain, ZecAsset, ZecChain, getBaseAmountWithDiffDecimals, getCryptoAmountWithNotation, isCacaoAsset };
|
package/lib/index.js
CHANGED
|
@@ -240,6 +240,7 @@ class Mayanode {
|
|
|
240
240
|
const BtcAsset = xchainUtil.assetFromStringEx('BTC.BTC');
|
|
241
241
|
const EthAsset = xchainUtil.assetFromStringEx('ETH.ETH');
|
|
242
242
|
const CacaoAsset = xchainUtil.assetFromStringEx('MAYA.CACAO');
|
|
243
|
+
const MayaAsset = xchainUtil.assetFromStringEx('MAYA.MAYA');
|
|
243
244
|
const RuneAsset = xchainUtil.assetFromStringEx('THOR.RUNE');
|
|
244
245
|
const DashAsset = xchainUtil.assetFromStringEx('DASH.DASH');
|
|
245
246
|
const KujiraAsset = xchainUtil.assetFromStringEx('KUJI.KUJI');
|
|
@@ -256,6 +257,8 @@ const ArbChain = 'ARB';
|
|
|
256
257
|
const XdrChain = 'XRD';
|
|
257
258
|
const ZecChain = 'ZEC';
|
|
258
259
|
const DEFAULT_MAYACHAIN_DECIMALS = 8;
|
|
260
|
+
const MAYA_DECIMAL = 4;
|
|
261
|
+
const CACAO_DECIMAL = 10;
|
|
259
262
|
|
|
260
263
|
const isCacaoAsset = (asset) => xchainUtil.assetToString(asset) === xchainUtil.assetToString(CacaoAsset);
|
|
261
264
|
const getBaseAmountWithDiffDecimals = (inputAmount, outDecimals) => {
|
|
@@ -975,10 +978,14 @@ class MayachainQuery {
|
|
|
975
978
|
/**
|
|
976
979
|
* Get the hardcoded decimal precision for quote calculations
|
|
977
980
|
* @param asset The asset to get decimals for
|
|
978
|
-
* @returns 10 for Cacao, 8 for other assets (used in quote calculations)
|
|
981
|
+
* @returns 10 for Cacao, 4 for Maya, 8 for other assets (used in quote calculations)
|
|
979
982
|
*/
|
|
980
983
|
getQuoteAssetDecimals(asset) {
|
|
981
|
-
|
|
984
|
+
if (xchainUtil.eqAsset(asset, CacaoAsset))
|
|
985
|
+
return CACAO_DECIMAL;
|
|
986
|
+
if (xchainUtil.eqAsset(asset, MayaAsset))
|
|
987
|
+
return MAYA_DECIMAL;
|
|
988
|
+
return DEFAULT_MAYACHAIN_DECIMALS;
|
|
982
989
|
}
|
|
983
990
|
}
|
|
984
991
|
|
|
@@ -986,6 +993,7 @@ exports.ArbAsset = ArbAsset;
|
|
|
986
993
|
exports.ArbChain = ArbChain;
|
|
987
994
|
exports.BtcAsset = BtcAsset;
|
|
988
995
|
exports.BtcChain = BtcChain;
|
|
996
|
+
exports.CACAO_DECIMAL = CACAO_DECIMAL;
|
|
989
997
|
exports.CacaoAsset = CacaoAsset;
|
|
990
998
|
exports.DEFAULT_MAYACHAIN_DECIMALS = DEFAULT_MAYACHAIN_DECIMALS;
|
|
991
999
|
exports.DashAsset = DashAsset;
|
|
@@ -994,6 +1002,8 @@ exports.EthAsset = EthAsset;
|
|
|
994
1002
|
exports.EthChain = EthChain;
|
|
995
1003
|
exports.KujiraAsset = KujiraAsset;
|
|
996
1004
|
exports.KujiraChain = KujiraChain;
|
|
1005
|
+
exports.MAYA_DECIMAL = MAYA_DECIMAL;
|
|
1006
|
+
exports.MayaAsset = MayaAsset;
|
|
997
1007
|
exports.MayaChain = MayaChain;
|
|
998
1008
|
exports.MayachainCache = MayachainCache;
|
|
999
1009
|
exports.MayachainQuery = MayachainQuery;
|
package/lib/mayachain-query.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ export declare class MayachainQuery {
|
|
|
125
125
|
/**
|
|
126
126
|
* Get the hardcoded decimal precision for quote calculations
|
|
127
127
|
* @param asset The asset to get decimals for
|
|
128
|
-
* @returns 10 for Cacao, 8 for other assets (used in quote calculations)
|
|
128
|
+
* @returns 10 for Cacao, 4 for Maya, 8 for other assets (used in quote calculations)
|
|
129
129
|
*/
|
|
130
130
|
private getQuoteAssetDecimals;
|
|
131
131
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TxHash } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Address, Asset, AssetCryptoAmount, Chain, CryptoAmount, SynthAsset, TokenAsset, TradeAsset, TradeCryptoAmount } from '@xchainjs/xchain-util';
|
|
3
3
|
import type BigNumber from 'bignumber.js';
|
|
4
|
-
export type CompatibleAsset = Asset | TokenAsset | SynthAsset;
|
|
4
|
+
export type CompatibleAsset = Asset | TokenAsset | SynthAsset | TradeAsset;
|
|
5
5
|
/**
|
|
6
6
|
* Represents fees associated with a swap.
|
|
7
7
|
*/
|
package/lib/utils/const.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Asset } from '@xchainjs/xchain-util';
|
|
|
2
2
|
export declare const BtcAsset: Asset;
|
|
3
3
|
export declare const EthAsset: Asset;
|
|
4
4
|
export declare const CacaoAsset: Asset;
|
|
5
|
+
export declare const MayaAsset: Asset;
|
|
5
6
|
export declare const RuneAsset: Asset;
|
|
6
7
|
export declare const DashAsset: Asset;
|
|
7
8
|
export declare const KujiraAsset: Asset;
|
|
@@ -18,3 +19,5 @@ export declare const ArbChain = "ARB";
|
|
|
18
19
|
export declare const XdrChain = "XRD";
|
|
19
20
|
export declare const ZecChain = "ZEC";
|
|
20
21
|
export declare const DEFAULT_MAYACHAIN_DECIMALS = 8;
|
|
22
|
+
export declare const MAYA_DECIMAL = 4;
|
|
23
|
+
export declare const CACAO_DECIMAL = 10;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-mayachain-query",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Mayachain query module that is responsible for estimating swap calculations and add/remove liquidity for thorchain",
|
|
6
6
|
"keywords": [
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"postversion": "git push --follow-tags"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@xchainjs/xchain-client": "2.0.
|
|
37
|
-
"@xchainjs/xchain-mayamidgard": "1.0.
|
|
38
|
-
"@xchainjs/xchain-mayamidgard-query": "1.0.
|
|
39
|
-
"@xchainjs/xchain-mayanode": "1.1.
|
|
36
|
+
"@xchainjs/xchain-client": "2.0.10",
|
|
37
|
+
"@xchainjs/xchain-mayamidgard": "1.0.5",
|
|
38
|
+
"@xchainjs/xchain-mayamidgard-query": "1.0.11",
|
|
39
|
+
"@xchainjs/xchain-mayanode": "1.1.1",
|
|
40
40
|
"@xchainjs/xchain-util": "2.0.5",
|
|
41
|
-
"axios": "1.
|
|
41
|
+
"axios": "1.13.5",
|
|
42
42
|
"axios-retry": "3.2.5",
|
|
43
43
|
"bignumber.js": "^9.1.2"
|
|
44
44
|
},
|