@xchainjs/xchain-mayachain-query 2.1.6 → 2.1.7

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 CHANGED
@@ -662,6 +662,8 @@ class MayachainQuery {
662
662
  name: MAYAName,
663
663
  owner: details.owner,
664
664
  expireBlockHeight: Number(details.expire),
665
+ preferredAsset: details.preferred_asset || '',
666
+ affiliateCollectorCacao: '0',
665
667
  aliases: details.entries,
666
668
  };
667
669
  });
@@ -863,7 +865,7 @@ class MayachainQuery {
863
865
  * @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
864
866
  */
865
867
  estimateMAYAName(_a) {
866
- return __awaiter(this, arguments, void 0, function* ({ name, owner, isUpdate, expiry, chain, chainAddress, }) {
868
+ return __awaiter(this, arguments, void 0, function* ({ name, owner, isUpdate, expiry, chain, chainAddress, preferredAsset, }) {
867
869
  const details = yield this.getMAYANameDetails(name);
868
870
  if (!details && isUpdate) {
869
871
  throw Error('Can not update an unregistered MAYAName');
@@ -884,11 +886,11 @@ class MayachainQuery {
884
886
  const oneTimeFee = isUpdate
885
887
  ? baseAmount(0, assetDecimals[assetToString(CacaoAsset)])
886
888
  : baseAmount(constantsDetails['TNSREGISTERFEE'], assetDecimals[assetToString(CacaoAsset)]);
887
- const totalFeePerBlock = baseAmount(constantsDetails['TNSFEEPERBLOCK']).times(numberOfBlocksToAddToExpiry > 0 ? numberOfBlocksToAddToExpiry : 0);
889
+ const totalFeePerBlock = baseAmount(constantsDetails['TNSFEEPERBLOCK'], assetDecimals[assetToString(CacaoAsset)]).times(numberOfBlocksToAddToExpiry > 0 ? numberOfBlocksToAddToExpiry : 0);
888
890
  const txFee = baseAmount(constantsDetails['NATIVETRANSACTIONFEE'], assetDecimals[assetToString(CacaoAsset)]);
889
891
  return {
890
892
  value: new AssetCryptoAmount(oneTimeFee.plus(totalFeePerBlock).plus(txFee), CacaoAsset),
891
- memo: `~:${name}:${isUpdate ? chain || (details === null || details === void 0 ? void 0 : details.aliases[0].chain) : chain}:${isUpdate ? chainAddress || (details === null || details === void 0 ? void 0 : details.aliases[0].address) : chainAddress}:${isUpdate ? owner || (details === null || details === void 0 ? void 0 : details.owner) : owner}:MAYA.CACAO`,
893
+ memo: `~:${name}:${isUpdate ? chain || (details === null || details === void 0 ? void 0 : details.aliases[0].chain) : chain}:${isUpdate ? chainAddress || (details === null || details === void 0 ? void 0 : details.aliases[0].address) : chainAddress}:${isUpdate ? owner || (details === null || details === void 0 ? void 0 : details.owner) : owner}:${preferredAsset ? assetToString(preferredAsset) : 'MAYA.CACAO'}`,
892
894
  };
893
895
  });
894
896
  }
package/lib/index.js CHANGED
@@ -670,6 +670,8 @@ class MayachainQuery {
670
670
  name: MAYAName,
671
671
  owner: details.owner,
672
672
  expireBlockHeight: Number(details.expire),
673
+ preferredAsset: details.preferred_asset || '',
674
+ affiliateCollectorCacao: '0',
673
675
  aliases: details.entries,
674
676
  };
675
677
  });
@@ -871,7 +873,7 @@ class MayachainQuery {
871
873
  * @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
872
874
  */
873
875
  estimateMAYAName(_a) {
874
- return __awaiter(this, arguments, void 0, function* ({ name, owner, isUpdate, expiry, chain, chainAddress, }) {
876
+ return __awaiter(this, arguments, void 0, function* ({ name, owner, isUpdate, expiry, chain, chainAddress, preferredAsset, }) {
875
877
  const details = yield this.getMAYANameDetails(name);
876
878
  if (!details && isUpdate) {
877
879
  throw Error('Can not update an unregistered MAYAName');
@@ -892,11 +894,11 @@ class MayachainQuery {
892
894
  const oneTimeFee = isUpdate
893
895
  ? xchainUtil.baseAmount(0, assetDecimals[xchainUtil.assetToString(CacaoAsset)])
894
896
  : xchainUtil.baseAmount(constantsDetails['TNSREGISTERFEE'], assetDecimals[xchainUtil.assetToString(CacaoAsset)]);
895
- const totalFeePerBlock = xchainUtil.baseAmount(constantsDetails['TNSFEEPERBLOCK']).times(numberOfBlocksToAddToExpiry > 0 ? numberOfBlocksToAddToExpiry : 0);
897
+ const totalFeePerBlock = xchainUtil.baseAmount(constantsDetails['TNSFEEPERBLOCK'], assetDecimals[xchainUtil.assetToString(CacaoAsset)]).times(numberOfBlocksToAddToExpiry > 0 ? numberOfBlocksToAddToExpiry : 0);
896
898
  const txFee = xchainUtil.baseAmount(constantsDetails['NATIVETRANSACTIONFEE'], assetDecimals[xchainUtil.assetToString(CacaoAsset)]);
897
899
  return {
898
900
  value: new xchainUtil.AssetCryptoAmount(oneTimeFee.plus(totalFeePerBlock).plus(txFee), CacaoAsset),
899
- memo: `~:${name}:${isUpdate ? chain || (details === null || details === void 0 ? void 0 : details.aliases[0].chain) : chain}:${isUpdate ? chainAddress || (details === null || details === void 0 ? void 0 : details.aliases[0].address) : chainAddress}:${isUpdate ? owner || (details === null || details === void 0 ? void 0 : details.owner) : owner}:MAYA.CACAO`,
901
+ memo: `~:${name}:${isUpdate ? chain || (details === null || details === void 0 ? void 0 : details.aliases[0].chain) : chain}:${isUpdate ? chainAddress || (details === null || details === void 0 ? void 0 : details.aliases[0].address) : chainAddress}:${isUpdate ? owner || (details === null || details === void 0 ? void 0 : details.owner) : owner}:${preferredAsset ? xchainUtil.assetToString(preferredAsset) : 'MAYA.CACAO'}`,
900
902
  };
901
903
  });
902
904
  }
@@ -97,7 +97,7 @@ export declare class MayachainQuery {
97
97
  * @param {QuoteMAYANameParams} params Params to make the update or the registration
98
98
  * @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
99
99
  */
100
- estimateMAYAName({ name, owner, isUpdate, expiry, chain, chainAddress, }: QuoteMAYANameParams): Promise<QuoteMAYAName>;
100
+ estimateMAYAName({ name, owner, isUpdate, expiry, chain, chainAddress, preferredAsset, }: QuoteMAYANameParams): Promise<QuoteMAYAName>;
101
101
  /**
102
102
  * Get trade asset units
103
103
  * @param {TradeAssetUnitsParams} params Trade asset units params
package/lib/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TxHash } from '@xchainjs/xchain-client';
2
- import { Address, Asset, AssetCryptoAmount, Chain, CryptoAmount, SynthAsset, TokenAsset, TradeAsset, TradeCryptoAmount } from '@xchainjs/xchain-util';
2
+ import { Address, Asset, AssetCryptoAmount, Chain, CryptoAmount, SecuredAsset, SynthAsset, TokenAsset, TradeAsset, TradeCryptoAmount } from '@xchainjs/xchain-util';
3
3
  import type BigNumber from 'bignumber.js';
4
- export type CompatibleAsset = Asset | TokenAsset | SynthAsset | TradeAsset;
4
+ export type CompatibleAsset = Asset | TokenAsset | SynthAsset | TradeAsset | SecuredAsset;
5
5
  /**
6
6
  * Represents fees associated with a swap.
7
7
  */
@@ -167,6 +167,14 @@ export type MAYANameDetails = {
167
167
  * The owner of the MAYAName
168
168
  */
169
169
  owner: string;
170
+ /**
171
+ * The preferred asset
172
+ */
173
+ preferredAsset?: string;
174
+ /**
175
+ * The affiliate collector CACAO
176
+ */
177
+ affiliateCollectorCacao?: string;
170
178
  /**
171
179
  * List of MAYAName aliases
172
180
  */
@@ -196,6 +204,10 @@ export type RegisterMAYAName = {
196
204
  * Address of the chain provided to create the alias of the MAYAName
197
205
  */
198
206
  chainAddress: Address;
207
+ /**
208
+ * Preferred asset for the MAYAName owner to receive fees in
209
+ */
210
+ preferredAsset?: Asset;
199
211
  };
200
212
  /**
201
213
  * Update MAYAName parameters
@@ -221,6 +233,10 @@ export type UpdateMAYAName = {
221
233
  * Address of the chain provided to update the alias of the MAYAName, if not provided, memo response will have the address of the chain returned
222
234
  */
223
235
  chainAddress?: Address;
236
+ /**
237
+ * Preferred asset for the MAYAName owner to receive fees in
238
+ */
239
+ preferredAsset?: Asset;
224
240
  };
225
241
  export type QuoteMAYANameParams = (RegisterMAYAName & {
226
242
  isUpdate?: false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-mayachain-query",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
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": [
@@ -34,9 +34,9 @@
34
34
  },
35
35
  "dependencies": {
36
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",
37
+ "@xchainjs/xchain-mayamidgard": "1.1.0",
38
+ "@xchainjs/xchain-mayamidgard-query": "1.0.12",
39
+ "@xchainjs/xchain-mayanode": "1.2.0",
40
40
  "@xchainjs/xchain-util": "2.0.5",
41
41
  "axios": "1.13.5",
42
42
  "axios-retry": "3.2.5",