@xchainjs/xchain-thorchain-query 2.0.3 → 2.0.4
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 -1
- package/lib/index.js +12 -0
- package/lib/utils/const.d.ts +2 -0
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -84,6 +84,10 @@ const DefaultChainAttributes = {
|
|
|
84
84
|
blockReward: 0,
|
|
85
85
|
avgBlockTimeInSecs: 2, // Average block time for Base in seconds
|
|
86
86
|
},
|
|
87
|
+
XRP: {
|
|
88
|
+
blockReward: 0,
|
|
89
|
+
avgBlockTimeInSecs: 4, // Average block time for xrp in seconds
|
|
90
|
+
},
|
|
87
91
|
};
|
|
88
92
|
|
|
89
93
|
/**
|
|
@@ -126,6 +130,7 @@ const AssetRuneNative = assetFromStringEx('THOR.RUNE');
|
|
|
126
130
|
const assetUSDC = assetFromStringEx('ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48');
|
|
127
131
|
const AssetBNB = assetFromStringEx('BSC.BNB');
|
|
128
132
|
const AssetBASE = assetFromStringEx('BASE.ETH');
|
|
133
|
+
const AssetXRP = assetFromStringEx('XRP.XRP');
|
|
129
134
|
const BNBChain = 'BNB';
|
|
130
135
|
const BTCChain = 'BTC';
|
|
131
136
|
const BCHChain = 'BCH';
|
|
@@ -138,6 +143,7 @@ const MAYAChain = 'MAYA';
|
|
|
138
143
|
const BSCChain = 'BSC';
|
|
139
144
|
const THORChain = 'THOR';
|
|
140
145
|
const BASEChain = 'BASE';
|
|
146
|
+
const XRPChain = 'XRP';
|
|
141
147
|
const THORCHAIN_DECIMAL = 8;
|
|
142
148
|
const isAssetRuneNative = (asset) => assetToString(asset) === assetToString(AssetRuneNative);
|
|
143
149
|
|
|
@@ -182,6 +188,8 @@ const getChainAsset = (chain) => {
|
|
|
182
188
|
return AssetMAYA;
|
|
183
189
|
case BASEChain:
|
|
184
190
|
return AssetBASE;
|
|
191
|
+
case XRPChain:
|
|
192
|
+
return AssetXRP;
|
|
185
193
|
default:
|
|
186
194
|
throw Error('Unknown chain');
|
|
187
195
|
}
|
|
@@ -239,6 +247,8 @@ const calcNetworkFee = (asset, inbound) => {
|
|
|
239
247
|
return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetMAYA);
|
|
240
248
|
case BASEChain:
|
|
241
249
|
return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetBASE);
|
|
250
|
+
case XRPChain:
|
|
251
|
+
return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetXRP);
|
|
242
252
|
}
|
|
243
253
|
throw new Error(`could not calculate inbound fee for ${asset.chain}`);
|
|
244
254
|
};
|
|
@@ -3155,4 +3165,4 @@ class TransactionStage {
|
|
|
3155
3165
|
}
|
|
3156
3166
|
}
|
|
3157
3167
|
|
|
3158
|
-
export { AVAXChain, AddLpStatus, AddSaverStatus, AssetATOM, AssetAVAX, AssetBASE, AssetBCH, AssetBNB, AssetBSC, AssetBTC, AssetDOGE, AssetETH, AssetLTC, AssetMAYA, AssetRuneNative, BASEChain, BCHChain, BNBChain, BSCChain, BTCChain, DOGEChain, DefaultChainAttributes, ETHChain, GAIAChain, InboundStatus, LTCChain, LiquidityPool, MAYAChain, RefundStatus, SwapStatus, THORCHAIN_DECIMAL, THORChain, ThorchainCache, ThorchainQuery, Thornode, TransactionStage, TxType, WithdrawStatus, assetUSDC, calcNetworkFee, getCryptoAmountWithNotation, getLiquidityProtectionData, getLiquidityUnits, getPoolShare, getSlipOnLiquidity, isAssetRuneNative };
|
|
3168
|
+
export { AVAXChain, AddLpStatus, AddSaverStatus, AssetATOM, AssetAVAX, AssetBASE, AssetBCH, AssetBNB, AssetBSC, AssetBTC, AssetDOGE, AssetETH, AssetLTC, AssetMAYA, AssetRuneNative, AssetXRP, BASEChain, BCHChain, BNBChain, BSCChain, BTCChain, DOGEChain, DefaultChainAttributes, ETHChain, GAIAChain, InboundStatus, LTCChain, LiquidityPool, MAYAChain, RefundStatus, SwapStatus, THORCHAIN_DECIMAL, THORChain, ThorchainCache, ThorchainQuery, Thornode, TransactionStage, TxType, WithdrawStatus, XRPChain, assetUSDC, calcNetworkFee, getCryptoAmountWithNotation, getLiquidityProtectionData, getLiquidityUnits, getPoolShare, getSlipOnLiquidity, isAssetRuneNative };
|
package/lib/index.js
CHANGED
|
@@ -91,6 +91,10 @@ const DefaultChainAttributes = {
|
|
|
91
91
|
blockReward: 0,
|
|
92
92
|
avgBlockTimeInSecs: 2, // Average block time for Base in seconds
|
|
93
93
|
},
|
|
94
|
+
XRP: {
|
|
95
|
+
blockReward: 0,
|
|
96
|
+
avgBlockTimeInSecs: 4, // Average block time for xrp in seconds
|
|
97
|
+
},
|
|
94
98
|
};
|
|
95
99
|
|
|
96
100
|
/**
|
|
@@ -133,6 +137,7 @@ const AssetRuneNative = xchainUtil.assetFromStringEx('THOR.RUNE');
|
|
|
133
137
|
const assetUSDC = xchainUtil.assetFromStringEx('ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48');
|
|
134
138
|
const AssetBNB = xchainUtil.assetFromStringEx('BSC.BNB');
|
|
135
139
|
const AssetBASE = xchainUtil.assetFromStringEx('BASE.ETH');
|
|
140
|
+
const AssetXRP = xchainUtil.assetFromStringEx('XRP.XRP');
|
|
136
141
|
const BNBChain = 'BNB';
|
|
137
142
|
const BTCChain = 'BTC';
|
|
138
143
|
const BCHChain = 'BCH';
|
|
@@ -145,6 +150,7 @@ const MAYAChain = 'MAYA';
|
|
|
145
150
|
const BSCChain = 'BSC';
|
|
146
151
|
const THORChain = 'THOR';
|
|
147
152
|
const BASEChain = 'BASE';
|
|
153
|
+
const XRPChain = 'XRP';
|
|
148
154
|
const THORCHAIN_DECIMAL = 8;
|
|
149
155
|
const isAssetRuneNative = (asset) => xchainUtil.assetToString(asset) === xchainUtil.assetToString(AssetRuneNative);
|
|
150
156
|
|
|
@@ -189,6 +195,8 @@ const getChainAsset = (chain) => {
|
|
|
189
195
|
return AssetMAYA;
|
|
190
196
|
case BASEChain:
|
|
191
197
|
return AssetBASE;
|
|
198
|
+
case XRPChain:
|
|
199
|
+
return AssetXRP;
|
|
192
200
|
default:
|
|
193
201
|
throw Error('Unknown chain');
|
|
194
202
|
}
|
|
@@ -246,6 +254,8 @@ const calcNetworkFee = (asset, inbound) => {
|
|
|
246
254
|
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetMAYA);
|
|
247
255
|
case BASEChain:
|
|
248
256
|
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetBASE);
|
|
257
|
+
case XRPChain:
|
|
258
|
+
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetXRP);
|
|
249
259
|
}
|
|
250
260
|
throw new Error(`could not calculate inbound fee for ${asset.chain}`);
|
|
251
261
|
};
|
|
@@ -3175,6 +3185,7 @@ exports.AssetETH = AssetETH;
|
|
|
3175
3185
|
exports.AssetLTC = AssetLTC;
|
|
3176
3186
|
exports.AssetMAYA = AssetMAYA;
|
|
3177
3187
|
exports.AssetRuneNative = AssetRuneNative;
|
|
3188
|
+
exports.AssetXRP = AssetXRP;
|
|
3178
3189
|
exports.BASEChain = BASEChain;
|
|
3179
3190
|
exports.BCHChain = BCHChain;
|
|
3180
3191
|
exports.BNBChain = BNBChain;
|
|
@@ -3193,6 +3204,7 @@ exports.ThorchainCache = ThorchainCache;
|
|
|
3193
3204
|
exports.ThorchainQuery = ThorchainQuery;
|
|
3194
3205
|
exports.Thornode = Thornode;
|
|
3195
3206
|
exports.TransactionStage = TransactionStage;
|
|
3207
|
+
exports.XRPChain = XRPChain;
|
|
3196
3208
|
exports.assetUSDC = assetUSDC;
|
|
3197
3209
|
exports.calcNetworkFee = calcNetworkFee;
|
|
3198
3210
|
exports.getCryptoAmountWithNotation = getCryptoAmountWithNotation;
|
package/lib/utils/const.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const AssetRuneNative: Asset;
|
|
|
12
12
|
export declare const assetUSDC: TokenAsset;
|
|
13
13
|
export declare const AssetBNB: Asset;
|
|
14
14
|
export declare const AssetBASE: Asset;
|
|
15
|
+
export declare const AssetXRP: Asset;
|
|
15
16
|
export declare const BNBChain = "BNB";
|
|
16
17
|
export declare const BTCChain = "BTC";
|
|
17
18
|
export declare const BCHChain = "BCH";
|
|
@@ -24,5 +25,6 @@ export declare const MAYAChain = "MAYA";
|
|
|
24
25
|
export declare const BSCChain = "BSC";
|
|
25
26
|
export declare const THORChain = "THOR";
|
|
26
27
|
export declare const BASEChain = "BASE";
|
|
28
|
+
export declare const XRPChain = "XRP";
|
|
27
29
|
export declare const THORCHAIN_DECIMAL = 8;
|
|
28
30
|
export declare const isAssetRuneNative: (asset: AnyAsset) => boolean;
|
package/package.json
CHANGED