@xchainjs/xchain-thorchain-query 0.6.3 → 0.6.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 +14 -17
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +14 -17
- package/lib/index.js.map +1 -1
- package/lib/thorchain-query.d.ts +1 -1
- package/lib/utils/thornode.d.ts +2 -2
- package/package.json +6 -6
package/lib/index.esm.js
CHANGED
|
@@ -893,9 +893,7 @@ class Thornode {
|
|
|
893
893
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
894
894
|
}
|
|
895
895
|
catch (e) {
|
|
896
|
-
if (e.response.status == 404)
|
|
897
|
-
return undefined;
|
|
898
|
-
}
|
|
896
|
+
if (e.response.status == 404) ;
|
|
899
897
|
}
|
|
900
898
|
}
|
|
901
899
|
throw new Error(`THORNode is not responding`);
|
|
@@ -2003,8 +2001,7 @@ class ThorchainQuery {
|
|
|
2003
2001
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2004
2002
|
const errors = [];
|
|
2005
2003
|
const thornameResp = yield this.thorchainCache.thornode.getThornameDetails(thorname, height);
|
|
2006
|
-
const
|
|
2007
|
-
const response = JSON.parse(JSON.stringify(thorname));
|
|
2004
|
+
const response = JSON.parse(JSON.stringify(thornameResp));
|
|
2008
2005
|
if (response.error)
|
|
2009
2006
|
errors.push(`Thornode request quote failed: ${response.error}`);
|
|
2010
2007
|
if (errors.length > 0) {
|
|
@@ -2019,19 +2016,19 @@ class ThorchainQuery {
|
|
|
2019
2016
|
};
|
|
2020
2017
|
return errorResp;
|
|
2021
2018
|
}
|
|
2022
|
-
const thornameAliases =
|
|
2019
|
+
const thornameAliases = thornameResp.aliases.map((alias) => ({
|
|
2023
2020
|
chain: alias.chain,
|
|
2024
2021
|
address: alias.address,
|
|
2025
2022
|
}));
|
|
2026
2023
|
const thornameDetails = {
|
|
2027
|
-
name:
|
|
2028
|
-
expireBlockHeight:
|
|
2029
|
-
owner:
|
|
2030
|
-
preferredAsset:
|
|
2031
|
-
affiliateCollectorRune:
|
|
2032
|
-
aliases: thornameAliases,
|
|
2024
|
+
name: thornameResp.name || '',
|
|
2025
|
+
expireBlockHeight: thornameResp.expire_block_height || 0,
|
|
2026
|
+
owner: thornameResp.owner || '',
|
|
2027
|
+
preferredAsset: thornameResp.preferred_asset || '',
|
|
2028
|
+
affiliateCollectorRune: thornameResp.affiliate_collector_rune || '',
|
|
2029
|
+
aliases: thornameAliases || [],
|
|
2033
2030
|
};
|
|
2034
|
-
return thornameDetails;
|
|
2031
|
+
return thornameDetails;
|
|
2035
2032
|
});
|
|
2036
2033
|
}
|
|
2037
2034
|
/**
|
|
@@ -2050,7 +2047,7 @@ class ThorchainQuery {
|
|
|
2050
2047
|
// CHECK IF ALREADY EXISTS
|
|
2051
2048
|
const thornameDetails = (yield this.thorchainCache.thornode.getThornameDetails(params.thorname)); // TODO: Until integrate THORNode PR
|
|
2052
2049
|
if (thornameDetails && !params.isUpdate) {
|
|
2053
|
-
throw Error('Thorname already
|
|
2050
|
+
throw Error('Thorname already registered');
|
|
2054
2051
|
}
|
|
2055
2052
|
const blockData = yield this.thorchainCache.thornode.getLastBlock();
|
|
2056
2053
|
const currentThorchainHeight = blockData[0].thorchain;
|
|
@@ -2247,8 +2244,8 @@ class TransactionStage {
|
|
|
2247
2244
|
const assetIn = assetFromStringEx((_b = txData.tx.tx.coins) === null || _b === void 0 ? void 0 : _b[0].asset);
|
|
2248
2245
|
const inboundAmount = (_c = txData.tx.tx.coins) === null || _c === void 0 ? void 0 : _c[0].amount;
|
|
2249
2246
|
const fromAddress = (_d = txData.tx.tx.from_address) !== null && _d !== void 0 ? _d : 'unknkown';
|
|
2250
|
-
const block = txData.tx.tx.chain == THORChain ? Number(txData.finalised_height) : Number(txData.
|
|
2251
|
-
const finalizeBlock = txData.tx.tx.chain == THORChain ? Number(txData.finalised_height) : Number(txData.
|
|
2247
|
+
const block = txData.tx.tx.chain == THORChain ? Number(txData.finalised_height) : Number(txData.consensus_height);
|
|
2248
|
+
const finalizeBlock = txData.tx.tx.chain == THORChain ? Number(txData.finalised_height) : Number(txData.finalised_height);
|
|
2252
2249
|
const status = txData.tx.status === 'done' ? InboundStatus.Observed_Consensus : InboundStatus.Observed_Incomplete;
|
|
2253
2250
|
if (operation.match(/swap|s|=/gi))
|
|
2254
2251
|
progress.txType = TxType.Swap;
|
|
@@ -2464,7 +2461,7 @@ class TransactionStage {
|
|
|
2464
2461
|
let blockDifference;
|
|
2465
2462
|
const currentHeight = lastBlockObj.find((obj) => obj.chain == chain);
|
|
2466
2463
|
const chainHeight = Number(`${currentHeight === null || currentHeight === void 0 ? void 0 : currentHeight.last_observed_in}`);
|
|
2467
|
-
const recordedChainHeight = Number(`${txData.
|
|
2464
|
+
const recordedChainHeight = Number(`${txData.consensus_height}`);
|
|
2468
2465
|
// If outbound time is required
|
|
2469
2466
|
if (outboundBlock) {
|
|
2470
2467
|
const currentHeight = lastBlockObj.find((obj) => obj);
|