@xchainjs/xchain-thorchain-query 0.7.14 → 0.7.16
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 +6 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +6 -5
- package/lib/index.js.map +1 -1
- package/lib/thorchain-query.d.ts +2 -5
- package/lib/types.d.ts +70 -12
- package/package.json +5 -5
package/lib/index.esm.js
CHANGED
|
@@ -2140,7 +2140,7 @@ class ThorchainQuery {
|
|
|
2140
2140
|
estimateThorname(params) {
|
|
2141
2141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2142
2142
|
// Check if THORName already exists
|
|
2143
|
-
const thornameDetails = yield this.getThornameDetails(params.
|
|
2143
|
+
const thornameDetails = yield this.getThornameDetails(params.name);
|
|
2144
2144
|
if (thornameDetails.owner !== '' && !params.isUpdate) {
|
|
2145
2145
|
throw Error('Thorname already registered');
|
|
2146
2146
|
}
|
|
@@ -2153,9 +2153,9 @@ class ThorchainQuery {
|
|
|
2153
2153
|
// Default expiry
|
|
2154
2154
|
let numberOfBlocksToAddToExpirity = params.isUpdate ? 0 : 5259600; // One year by default
|
|
2155
2155
|
// Compute expiry height
|
|
2156
|
-
if (params.
|
|
2156
|
+
if (params.expiry) {
|
|
2157
2157
|
const currentTimestamp = Math.floor(Date.now() / 1000);
|
|
2158
|
-
const expirityTimestamp = Math.floor(params.
|
|
2158
|
+
const expirityTimestamp = Math.floor(params.expiry.getTime() / 1000);
|
|
2159
2159
|
const numberOfSecondsToExpire = expirityTimestamp - currentTimestamp;
|
|
2160
2160
|
const numberOfBlocks = Math.round(numberOfSecondsToExpire / 6);
|
|
2161
2161
|
const newHeightExpirity = currentThorchainHeight + numberOfBlocks;
|
|
@@ -2167,8 +2167,9 @@ class ThorchainQuery {
|
|
|
2167
2167
|
const constantsDetails = yield this.thorchainCache.thornode.getTcConstants();
|
|
2168
2168
|
const oneTimeFee = params.isUpdate ? baseAmount(0) : baseAmount(constantsDetails['TNSRegisterFee']);
|
|
2169
2169
|
const totalFeePerBlock = baseAmount(constantsDetails['TNSFeePerBlock']).times(numberOfBlocksToAddToExpirity > 0 ? numberOfBlocksToAddToExpirity : 0);
|
|
2170
|
-
const
|
|
2171
|
-
const
|
|
2170
|
+
const txFee = baseAmount(constantsDetails['NativeTransactionFee'], THORCHAIN_DECIMAL);
|
|
2171
|
+
const totalCost = new CryptoAmount(oneTimeFee.plus(totalFeePerBlock).plus(txFee), AssetRuneNative);
|
|
2172
|
+
const thornameMemo = `~:${params.name}:${params.isUpdate ? params.chain || (thornameDetails === null || thornameDetails === void 0 ? void 0 : thornameDetails.aliases[0].chain) : params.chain}:${params.isUpdate ? params.chainAddress || (thornameDetails === null || thornameDetails === void 0 ? void 0 : thornameDetails.aliases[0].address) : params.chainAddress}:${params.owner ? params.owner : ''}:${params.preferredAsset ? assetToString(params.preferredAsset) : ''}:${params.isUpdate ? '' : currentHeightForExpirity + numberOfBlocksToAddToExpirity}`.replace(/^:+|:+$/g, '');
|
|
2172
2173
|
return {
|
|
2173
2174
|
memo: thornameMemo,
|
|
2174
2175
|
value: totalCost,
|