@xchainjs/xchain-mayachain-amm 3.0.7 → 3.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 CHANGED
@@ -1,16 +1,16 @@
1
- import { AssetAETH, Client as Client$7, defaultArbParams } from '@xchainjs/xchain-arbitrum';
2
- import { BTCChain, Client as Client$6, defaultBTCParams } from '@xchainjs/xchain-bitcoin';
1
+ import { AssetAETH, ARBChain, Client, defaultArbParams } from '@xchainjs/xchain-arbitrum';
2
+ import { BTCChain, Client as Client$7, defaultBTCParams } from '@xchainjs/xchain-bitcoin';
3
3
  import { Network } from '@xchainjs/xchain-client';
4
- import { DASHChain, Client as Client$4, defaultDashParams } from '@xchainjs/xchain-dash';
5
- import { AssetETH as AssetETH$1, ETHChain, Client as Client$5, defaultEthParams } from '@xchainjs/xchain-ethereum';
4
+ import { DASHChain, Client as Client$5, defaultDashParams } from '@xchainjs/xchain-dash';
5
+ import { AssetETH as AssetETH$1, ETHChain, Client as Client$6, defaultEthParams } from '@xchainjs/xchain-ethereum';
6
6
  import 'crypto';
7
7
  import require$$0$4$1 from 'buffer';
8
8
  import { ethers } from 'ethers';
9
- import { KUJIChain, Client as Client$3, defaultKujiParams, AssetKUJI } from '@xchainjs/xchain-kujira';
10
- import { MAYAChain, Client as Client$1, AssetCacao, CACAO_DECIMAL } from '@xchainjs/xchain-mayachain';
9
+ import { KUJIChain, Client as Client$4, defaultKujiParams, AssetKUJI } from '@xchainjs/xchain-kujira';
10
+ import { MAYAChain, Client as Client$2, AssetCacao, CACAO_DECIMAL } from '@xchainjs/xchain-mayachain';
11
11
  import { MayachainQuery } from '@xchainjs/xchain-mayachain-query';
12
- import { RadixChain, Client, generateAddressParam, AssetXRD, generateBucketParam, generateStringParam } from '@xchainjs/xchain-radix';
13
- import { THORChain, Client as Client$2, AssetRuneNative } from '@xchainjs/xchain-thorchain';
12
+ import { RadixChain, Client as Client$1, generateAddressParam, AssetXRD, generateBucketParam, generateStringParam } from '@xchainjs/xchain-radix';
13
+ import { THORChain, Client as Client$3, AssetRuneNative } from '@xchainjs/xchain-thorchain';
14
14
  import { Wallet as Wallet$1 } from '@xchainjs/xchain-wallet';
15
15
 
16
16
  /******************************************************************************
@@ -8917,6 +8917,27 @@ const AssetETH = { chain: 'ETH', symbol: 'ETH', ticker: 'ETH', type: AssetType.N
8917
8917
  * @returns {boolean} `true` or `false`
8918
8918
  */
8919
8919
  const isSynthAsset = (asset) => asset.type === AssetType.SYNTH;
8920
+ /**
8921
+ * Creates an `Asset` by a given string
8922
+ *
8923
+ * This helper function expects a string with following naming convention:
8924
+ * `AAA.BBB-CCC`
8925
+ * where
8926
+ * chain: `AAA`
8927
+ * ticker (optional): `BBB`
8928
+ * symbol: `BBB-CCC` or `CCC` (if no ticker available)
8929
+ *
8930
+ * @see https://docs.thorchain.org/developers/transaction-memos#asset-notation
8931
+ *
8932
+ * If the naming convention fails, it returns null
8933
+ *
8934
+ * @param {string} s The given string.
8935
+ * @returns {Asset|null} The asset from the given string.
8936
+ */
8937
+ new Map([
8938
+ ['KUJI.USK', { chain: 'KUJI', symbol: 'USK', ticker: 'USK', type: AssetType.TOKEN }],
8939
+ ['MAYA.MAYA', { chain: 'MAYA', symbol: 'MAYA', ticker: 'MAYA', type: AssetType.TOKEN }],
8940
+ ]);
8920
8941
  /**
8921
8942
  * Returns an `Asset` as a string using following naming convention:
8922
8943
  *
@@ -89620,19 +89641,21 @@ const isRadixChain = (chain) => {
89620
89641
  const validateAddress = (network, chain, address) => {
89621
89642
  switch (chain) {
89622
89643
  case BTCChain:
89623
- return new Client$6(Object.assign(Object.assign({}, defaultBTCParams), { network })).validateAddress(address);
89644
+ return new Client$7(Object.assign(Object.assign({}, defaultBTCParams), { network })).validateAddress(address);
89624
89645
  case ETHChain:
89625
- return new Client$5(Object.assign(Object.assign({}, defaultEthParams), { network })).validateAddress(address);
89646
+ return new Client$6(Object.assign(Object.assign({}, defaultEthParams), { network })).validateAddress(address);
89626
89647
  case DASHChain:
89627
- return new Client$4(Object.assign(Object.assign({}, defaultDashParams), { network })).validateAddress(address);
89648
+ return new Client$5(Object.assign(Object.assign({}, defaultDashParams), { network })).validateAddress(address);
89628
89649
  case KUJIChain:
89629
- return new Client$3(Object.assign(Object.assign({}, defaultKujiParams), { network })).validateAddress(address);
89650
+ return new Client$4(Object.assign(Object.assign({}, defaultKujiParams), { network })).validateAddress(address);
89630
89651
  case THORChain:
89631
- return new Client$2({ network }).validateAddress(address);
89652
+ return new Client$3({ network }).validateAddress(address);
89632
89653
  case MAYAChain:
89633
- return new Client$1({ network }).validateAddress(address);
89654
+ return new Client$2({ network }).validateAddress(address);
89634
89655
  case RadixChain:
89635
- return new Client({ network }).validateAddress(address);
89656
+ return new Client$1({ network }).validateAddress(address);
89657
+ case ARBChain:
89658
+ return new Client(Object.assign(Object.assign({}, defaultArbParams), { network: Network.Mainnet })).validateAddress(address);
89636
89659
  default:
89637
89660
  throw Error('Unsupported chain');
89638
89661
  }
@@ -89778,14 +89801,14 @@ class MayachainAMM {
89778
89801
  * @returns {MayachainAMM} Returns the MayachainAMM instance.
89779
89802
  */
89780
89803
  constructor(mayachainQuery = new MayachainQuery(), wallet = new Wallet$1({
89781
- BTC: new Client$6(Object.assign(Object.assign({}, defaultBTCParams), { network: Network.Mainnet })),
89782
- ETH: new Client$5(Object.assign(Object.assign({}, defaultEthParams), { network: Network.Mainnet })),
89783
- DASH: new Client$4(Object.assign(Object.assign({}, defaultDashParams), { network: Network.Mainnet })),
89784
- KUJI: new Client$3(Object.assign(Object.assign({}, defaultKujiParams), { network: Network.Mainnet })),
89785
- ARB: new Client$7(Object.assign(Object.assign({}, defaultArbParams), { network: Network.Mainnet })),
89786
- THOR: new Client$2({ network: Network.Mainnet }),
89787
- MAYA: new Client$1({ network: Network.Mainnet }),
89788
- XRD: new Client({ network: Network.Mainnet }),
89804
+ BTC: new Client$7(Object.assign(Object.assign({}, defaultBTCParams), { network: Network.Mainnet })),
89805
+ ETH: new Client$6(Object.assign(Object.assign({}, defaultEthParams), { network: Network.Mainnet })),
89806
+ DASH: new Client$5(Object.assign(Object.assign({}, defaultDashParams), { network: Network.Mainnet })),
89807
+ KUJI: new Client$4(Object.assign(Object.assign({}, defaultKujiParams), { network: Network.Mainnet })),
89808
+ ARB: new Client(Object.assign(Object.assign({}, defaultArbParams), { network: Network.Mainnet })),
89809
+ THOR: new Client$3({ network: Network.Mainnet }),
89810
+ MAYA: new Client$2({ network: Network.Mainnet }),
89811
+ XRD: new Client$1({ network: Network.Mainnet }),
89789
89812
  })) {
89790
89813
  this.mayachainQuery = mayachainQuery;
89791
89814
  this.wallet = wallet;
package/lib/index.js CHANGED
@@ -8925,6 +8925,27 @@ const AssetETH = { chain: 'ETH', symbol: 'ETH', ticker: 'ETH', type: AssetType.N
8925
8925
  * @returns {boolean} `true` or `false`
8926
8926
  */
8927
8927
  const isSynthAsset = (asset) => asset.type === AssetType.SYNTH;
8928
+ /**
8929
+ * Creates an `Asset` by a given string
8930
+ *
8931
+ * This helper function expects a string with following naming convention:
8932
+ * `AAA.BBB-CCC`
8933
+ * where
8934
+ * chain: `AAA`
8935
+ * ticker (optional): `BBB`
8936
+ * symbol: `BBB-CCC` or `CCC` (if no ticker available)
8937
+ *
8938
+ * @see https://docs.thorchain.org/developers/transaction-memos#asset-notation
8939
+ *
8940
+ * If the naming convention fails, it returns null
8941
+ *
8942
+ * @param {string} s The given string.
8943
+ * @returns {Asset|null} The asset from the given string.
8944
+ */
8945
+ new Map([
8946
+ ['KUJI.USK', { chain: 'KUJI', symbol: 'USK', ticker: 'USK', type: AssetType.TOKEN }],
8947
+ ['MAYA.MAYA', { chain: 'MAYA', symbol: 'MAYA', ticker: 'MAYA', type: AssetType.TOKEN }],
8948
+ ]);
8928
8949
  /**
8929
8950
  * Returns an `Asset` as a string using following naming convention:
8930
8951
  *
@@ -89641,6 +89662,8 @@ const validateAddress = (network, chain, address) => {
89641
89662
  return new xchainMayachain.Client({ network }).validateAddress(address);
89642
89663
  case xchainRadix.RadixChain:
89643
89664
  return new xchainRadix.Client({ network }).validateAddress(address);
89665
+ case xchainArbitrum.ARBChain:
89666
+ return new xchainArbitrum.Client(Object.assign(Object.assign({}, xchainArbitrum.defaultArbParams), { network: xchainClient.Network.Mainnet })).validateAddress(address);
89644
89667
  default:
89645
89668
  throw Error('Unsupported chain');
89646
89669
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-mayachain-amm",
3
- "version": "3.0.7",
3
+ "version": "3.0.9",
4
4
  "description": "module that exposes estimating & swapping cryptocurrency assets on mayachain",
5
5
  "keywords": [
6
6
  "MAYAChain",
@@ -36,17 +36,17 @@
36
36
  "url": "https://github.com/xchainjs/xchainjs-lib/issues"
37
37
  },
38
38
  "dependencies": {
39
- "@xchainjs/xchain-arbitrum": "1.0.6",
40
- "@xchainjs/xchain-bitcoin": "1.0.3",
41
- "@xchainjs/xchain-client": "1.0.3",
42
- "@xchainjs/xchain-dash": "1.0.3",
43
- "@xchainjs/xchain-ethereum": "1.0.6",
44
- "@xchainjs/xchain-kujira": "1.0.4",
45
- "@xchainjs/xchain-mayachain": "2.0.4",
46
- "@xchainjs/xchain-mayachain-query": "1.0.4",
47
- "@xchainjs/xchain-radix": "1.1.0",
48
- "@xchainjs/xchain-thorchain": "2.0.5",
49
- "@xchainjs/xchain-wallet": "1.0.7",
39
+ "@xchainjs/xchain-arbitrum": "1.0.8",
40
+ "@xchainjs/xchain-bitcoin": "1.0.4",
41
+ "@xchainjs/xchain-client": "1.0.4",
42
+ "@xchainjs/xchain-dash": "1.0.4",
43
+ "@xchainjs/xchain-ethereum": "1.0.8",
44
+ "@xchainjs/xchain-kujira": "1.0.5",
45
+ "@xchainjs/xchain-mayachain": "2.0.5",
46
+ "@xchainjs/xchain-mayachain-query": "1.0.5",
47
+ "@xchainjs/xchain-radix": "1.1.1",
48
+ "@xchainjs/xchain-thorchain": "2.0.6",
49
+ "@xchainjs/xchain-wallet": "1.0.9",
50
50
  "ethers": "5.7.2"
51
51
  },
52
52
  "devDependencies": {