@xchainjs/xchain-midgard-query 2.0.7 → 2.0.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 +10 -6
- package/lib/index.js +10 -6
- package/lib/midgard-query.d.ts +2 -1
- package/lib/types.d.ts +1 -1
- package/package.json +5 -5
package/lib/index.esm.js
CHANGED
|
@@ -69,8 +69,8 @@ class Midgard {
|
|
|
69
69
|
const saverDetails = (yield api.getSaverDetail(address)).data;
|
|
70
70
|
return saverDetails;
|
|
71
71
|
}
|
|
72
|
-
catch (
|
|
73
|
-
// console.error(
|
|
72
|
+
catch (_e) {
|
|
73
|
+
// console.error(_e)
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
throw Error(`Midgard not responding`);
|
|
@@ -86,8 +86,8 @@ class Midgard {
|
|
|
86
86
|
try {
|
|
87
87
|
return (yield api.getPools()).data;
|
|
88
88
|
}
|
|
89
|
-
catch (
|
|
90
|
-
// console.error(
|
|
89
|
+
catch (_e) {
|
|
90
|
+
// console.error(_e)
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
throw new Error(`Midgard not responding`);
|
|
@@ -169,7 +169,7 @@ class Midgard {
|
|
|
169
169
|
const response = yield api.getActions(address, txid, asset, type, txType, affiliate, limit, offset, nextPageToken, timestamp, height, prevPageToken, fromTimestamp, fromHeight);
|
|
170
170
|
return response.data;
|
|
171
171
|
}
|
|
172
|
-
catch (
|
|
172
|
+
catch (_e) { }
|
|
173
173
|
}
|
|
174
174
|
throw new Error(`Midgard not responding`);
|
|
175
175
|
});
|
|
@@ -244,8 +244,9 @@ class MidgardQuery {
|
|
|
244
244
|
* @param midgardCache - An instance of the MidgardCache (could be pointing to stagenet, testnet, mainnet).
|
|
245
245
|
* @returns MidgardQuery
|
|
246
246
|
*/
|
|
247
|
-
constructor(midgardCache = defaultCache) {
|
|
247
|
+
constructor(midgardCache = defaultCache, overrideDecimals = {}) {
|
|
248
248
|
this.midgardCache = midgardCache;
|
|
249
|
+
this.overrideDecimals = overrideDecimals;
|
|
249
250
|
}
|
|
250
251
|
/**
|
|
251
252
|
* Get pool by asset.
|
|
@@ -314,6 +315,9 @@ class MidgardQuery {
|
|
|
314
315
|
*/
|
|
315
316
|
getDecimalForAsset(asset) {
|
|
316
317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
if (this.overrideDecimals[assetToString(asset)]) {
|
|
319
|
+
return this.overrideDecimals[assetToString(asset)];
|
|
320
|
+
}
|
|
317
321
|
if (isAssetRuneNative(asset) || isSynthAsset(asset) || isTradeAsset(asset) || isSecuredAsset(asset))
|
|
318
322
|
return DEFAULT_THORCHAIN_DECIMALS;
|
|
319
323
|
const pool = yield this.getPool(assetToString(asset));
|
package/lib/index.js
CHANGED
|
@@ -76,8 +76,8 @@ class Midgard {
|
|
|
76
76
|
const saverDetails = (yield api.getSaverDetail(address)).data;
|
|
77
77
|
return saverDetails;
|
|
78
78
|
}
|
|
79
|
-
catch (
|
|
80
|
-
// console.error(
|
|
79
|
+
catch (_e) {
|
|
80
|
+
// console.error(_e)
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
throw Error(`Midgard not responding`);
|
|
@@ -93,8 +93,8 @@ class Midgard {
|
|
|
93
93
|
try {
|
|
94
94
|
return (yield api.getPools()).data;
|
|
95
95
|
}
|
|
96
|
-
catch (
|
|
97
|
-
// console.error(
|
|
96
|
+
catch (_e) {
|
|
97
|
+
// console.error(_e)
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
throw new Error(`Midgard not responding`);
|
|
@@ -176,7 +176,7 @@ class Midgard {
|
|
|
176
176
|
const response = yield api.getActions(address, txid, asset, type, txType, affiliate, limit, offset, nextPageToken, timestamp, height, prevPageToken, fromTimestamp, fromHeight);
|
|
177
177
|
return response.data;
|
|
178
178
|
}
|
|
179
|
-
catch (
|
|
179
|
+
catch (_e) { }
|
|
180
180
|
}
|
|
181
181
|
throw new Error(`Midgard not responding`);
|
|
182
182
|
});
|
|
@@ -251,8 +251,9 @@ class MidgardQuery {
|
|
|
251
251
|
* @param midgardCache - An instance of the MidgardCache (could be pointing to stagenet, testnet, mainnet).
|
|
252
252
|
* @returns MidgardQuery
|
|
253
253
|
*/
|
|
254
|
-
constructor(midgardCache = defaultCache) {
|
|
254
|
+
constructor(midgardCache = defaultCache, overrideDecimals = {}) {
|
|
255
255
|
this.midgardCache = midgardCache;
|
|
256
|
+
this.overrideDecimals = overrideDecimals;
|
|
256
257
|
}
|
|
257
258
|
/**
|
|
258
259
|
* Get pool by asset.
|
|
@@ -321,6 +322,9 @@ class MidgardQuery {
|
|
|
321
322
|
*/
|
|
322
323
|
getDecimalForAsset(asset) {
|
|
323
324
|
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
if (this.overrideDecimals[xchainUtil.assetToString(asset)]) {
|
|
326
|
+
return this.overrideDecimals[xchainUtil.assetToString(asset)];
|
|
327
|
+
}
|
|
324
328
|
if (isAssetRuneNative(asset) || xchainUtil.isSynthAsset(asset) || xchainUtil.isTradeAsset(asset) || xchainUtil.isSecuredAsset(asset))
|
|
325
329
|
return DEFAULT_THORCHAIN_DECIMALS;
|
|
326
330
|
const pool = yield this.getPool(xchainUtil.assetToString(asset));
|
package/lib/midgard-query.d.ts
CHANGED
|
@@ -5,13 +5,14 @@ import { ActionHistory, CompatibleAsset, GetActionsParams, SaversPosition, getSa
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class MidgardQuery {
|
|
7
7
|
readonly midgardCache: MidgardCache;
|
|
8
|
+
readonly overrideDecimals: Record<string, number>;
|
|
8
9
|
/**
|
|
9
10
|
* Constructor to create a MidgardQuery.
|
|
10
11
|
*
|
|
11
12
|
* @param midgardCache - An instance of the MidgardCache (could be pointing to stagenet, testnet, mainnet).
|
|
12
13
|
* @returns MidgardQuery
|
|
13
14
|
*/
|
|
14
|
-
constructor(midgardCache?: MidgardCache);
|
|
15
|
+
constructor(midgardCache?: MidgardCache, overrideDecimals?: Record<string, number>);
|
|
15
16
|
/**
|
|
16
17
|
* Get pool by asset.
|
|
17
18
|
*
|
package/lib/types.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type ActionType = 'swap' | 'addLiquidity' | 'withdraw' | 'donate' | 'refu
|
|
|
36
36
|
/**
|
|
37
37
|
* Action Tx type
|
|
38
38
|
*/
|
|
39
|
-
export type ActionTxType = 'unknown' | 'add' | 'withdraw' | '
|
|
39
|
+
export type ActionTxType = 'unknown' | 'add' | 'withdraw' | 'swap' | 'limitOrder' | 'outbound' | 'donate' | 'bond' | 'unbond' | 'leave' | 'yggdrasilFund' | 'yggdrasilReturn' | 'reserve' | 'refund' | 'migrate' | 'ragnarok' | 'switch' | 'noOp' | 'consolidate' | 'thorname' | 'loanOpen' | 'loanRepayment';
|
|
40
40
|
/**
|
|
41
41
|
* Get action params
|
|
42
42
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-midgard-query",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Module that is responsible for get data from Midgard API",
|
|
6
6
|
"keywords": [
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"build:release": "yarn exec rm -rf release && yarn pack && yarn exec \"mkdir release && tar zxvf package.tgz --directory release && rm package.tgz\"",
|
|
29
29
|
"test": "jest",
|
|
30
30
|
"e2e": "jest --config jest.config.e2e.mjs",
|
|
31
|
-
"lint": "eslint \"{src,__tests__}/**/*.ts\" --fix --max-warnings 0",
|
|
31
|
+
"lint": "eslint --config ../../eslint.config.mjs \"{src,__tests__}/**/*.ts\" --fix --max-warnings 0",
|
|
32
32
|
"postversion": "git push --follow-tags"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@xchainjs/xchain-client": "2.0.
|
|
35
|
+
"@xchainjs/xchain-client": "2.0.9",
|
|
36
36
|
"@xchainjs/xchain-midgard": "1.0.4",
|
|
37
|
-
"@xchainjs/xchain-util": "2.0.
|
|
38
|
-
"axios": "
|
|
37
|
+
"@xchainjs/xchain-util": "2.0.5",
|
|
38
|
+
"axios": "1.12.1",
|
|
39
39
|
"axios-retry": "^3.9.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|