@xchainjs/xchain-mayachain-amm 4.1.18 → 4.1.19

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,4 +1,5 @@
1
1
  import { AssetAETH, ARBChain, Client as Client$1, defaultArbParams } from '@xchainjs/xchain-arbitrum';
2
+ import { ADAChain, Client, defaultAdaParams } from '@xchainjs/xchain-cardano';
2
3
  import { ZECChain, Client as Client$2, defaultZECParams } from '@xchainjs/xchain-zcash';
3
4
  import { BTCChain, Client as Client$9, defaultBTCParams } from '@xchainjs/xchain-bitcoin';
4
5
  import { Network, Protocol } from '@xchainjs/xchain-client';
@@ -12,7 +13,6 @@ import { RadixChain, Client as Client$3, AssetXRD, generateAddressParam, generat
12
13
  import { AssetRuneNative, THORChain, Client as Client$5 } from '@xchainjs/xchain-thorchain';
13
14
  import { eqAsset, isSynthAsset, getContractAddressFromAsset, baseAmount, isTradeAsset, CryptoAmount, assetToString, AssetCryptoAmount, AssetType } from '@xchainjs/xchain-util';
14
15
  import { Wallet } from '@xchainjs/xchain-wallet';
15
- import { ADAChain, Client, defaultAdaParams } from '@xchainjs/xchain-cardano';
16
16
  import { getAddress, ZeroAddress, Contract } from 'ethers';
17
17
 
18
18
  /******************************************************************************
@@ -128,12 +128,13 @@ class MayachainAction {
128
128
  });
129
129
  }
130
130
  static makeProtocolAction(_a) {
131
- return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, memo }) {
131
+ return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, memo, walletIndex, }) {
132
132
  const hash = yield wallet.deposit({
133
133
  chain: MAYAChain,
134
134
  asset: assetAmount.asset,
135
135
  amount: assetAmount.baseAmount,
136
136
  memo,
137
+ walletIndex,
137
138
  });
138
139
  return {
139
140
  hash,
@@ -142,15 +143,18 @@ class MayachainAction {
142
143
  });
143
144
  }
144
145
  static makeNonProtocolAction(_a) {
145
- return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, recipient, memo, }) {
146
+ return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, recipient, memo, walletIndex, }) {
146
147
  // Non EVM actions and non Radix action
147
148
  if (!isProtocolEVMChain(assetAmount.asset.chain) && !eqAsset(assetAmount.asset, AssetXRD)) {
148
- if (isProtocolBFTChain(assetAmount.asset.chain)) {
149
+ // BFT/Cosmos chains and Cardano derive their fee internally (Cardano from on-chain
150
+ // protocol params) and do not accept a caller-supplied per-byte feeRate, unlike UTXO chains.
151
+ if (isProtocolBFTChain(assetAmount.asset.chain) || assetAmount.asset.chain === ADAChain) {
149
152
  const hash = yield wallet.transfer({
150
153
  asset: assetAmount.asset,
151
154
  amount: assetAmount.baseAmount,
152
155
  recipient,
153
156
  memo,
157
+ walletIndex,
154
158
  });
155
159
  return {
156
160
  hash,
@@ -164,6 +168,7 @@ class MayachainAction {
164
168
  recipient,
165
169
  memo,
166
170
  feeRate: feeRates.fast,
171
+ walletIndex,
167
172
  });
168
173
  return {
169
174
  hash,
@@ -191,6 +196,7 @@ class MayachainAction {
191
196
  generateStringParam(memo),
192
197
  ],
193
198
  },
199
+ walletIndex,
194
200
  });
195
201
  return {
196
202
  hash,
@@ -223,7 +229,8 @@ class MayachainAction {
223
229
  isMemoEncoded: true,
224
230
  };
225
231
  const gasLimit = yield wallet.estimateGasLimit(tx);
226
- const hash = yield wallet.transfer(Object.assign(Object.assign({}, tx), { gasLimit }));
232
+ const hash = yield wallet.transfer(Object.assign(Object.assign({}, tx), { gasLimit,
233
+ walletIndex }));
227
234
  return {
228
235
  hash,
229
236
  url: yield wallet.getExplorerTxUrl(assetAmount.asset.chain, hash),
@@ -268,6 +275,7 @@ class MayachainAMM {
268
275
  MAYA: new Client$4({ network: Network.Mainnet }),
269
276
  XRD: new Client$3({ network: Network.Mainnet }),
270
277
  ZEC: new Client$2(Object.assign(Object.assign({}, defaultZECParams), { network: Network.Mainnet })),
278
+ ADA: new Client(Object.assign(Object.assign({}, defaultAdaParams), { network: Network.Mainnet })),
271
279
  })) {
272
280
  this.mayachainQuery = mayachainQuery;
273
281
  this.wallet = wallet;
package/lib/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var xchainArbitrum = require('@xchainjs/xchain-arbitrum');
4
+ var xchainCardano = require('@xchainjs/xchain-cardano');
4
5
  var xchainZcash = require('@xchainjs/xchain-zcash');
5
6
  var xchainBitcoin = require('@xchainjs/xchain-bitcoin');
6
7
  var xchainClient = require('@xchainjs/xchain-client');
@@ -14,7 +15,6 @@ var xchainRadix = require('@xchainjs/xchain-radix');
14
15
  var xchainThorchain = require('@xchainjs/xchain-thorchain');
15
16
  var xchainUtil = require('@xchainjs/xchain-util');
16
17
  var xchainWallet = require('@xchainjs/xchain-wallet');
17
- var xchainCardano = require('@xchainjs/xchain-cardano');
18
18
  var ethers = require('ethers');
19
19
 
20
20
  /******************************************************************************
@@ -130,12 +130,13 @@ class MayachainAction {
130
130
  });
131
131
  }
132
132
  static makeProtocolAction(_a) {
133
- return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, memo }) {
133
+ return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, memo, walletIndex, }) {
134
134
  const hash = yield wallet.deposit({
135
135
  chain: xchainMayachain.MAYAChain,
136
136
  asset: assetAmount.asset,
137
137
  amount: assetAmount.baseAmount,
138
138
  memo,
139
+ walletIndex,
139
140
  });
140
141
  return {
141
142
  hash,
@@ -144,15 +145,18 @@ class MayachainAction {
144
145
  });
145
146
  }
146
147
  static makeNonProtocolAction(_a) {
147
- return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, recipient, memo, }) {
148
+ return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, recipient, memo, walletIndex, }) {
148
149
  // Non EVM actions and non Radix action
149
150
  if (!isProtocolEVMChain(assetAmount.asset.chain) && !xchainUtil.eqAsset(assetAmount.asset, xchainRadix.AssetXRD)) {
150
- if (isProtocolBFTChain(assetAmount.asset.chain)) {
151
+ // BFT/Cosmos chains and Cardano derive their fee internally (Cardano from on-chain
152
+ // protocol params) and do not accept a caller-supplied per-byte feeRate, unlike UTXO chains.
153
+ if (isProtocolBFTChain(assetAmount.asset.chain) || assetAmount.asset.chain === xchainCardano.ADAChain) {
151
154
  const hash = yield wallet.transfer({
152
155
  asset: assetAmount.asset,
153
156
  amount: assetAmount.baseAmount,
154
157
  recipient,
155
158
  memo,
159
+ walletIndex,
156
160
  });
157
161
  return {
158
162
  hash,
@@ -166,6 +170,7 @@ class MayachainAction {
166
170
  recipient,
167
171
  memo,
168
172
  feeRate: feeRates.fast,
173
+ walletIndex,
169
174
  });
170
175
  return {
171
176
  hash,
@@ -193,6 +198,7 @@ class MayachainAction {
193
198
  xchainRadix.generateStringParam(memo),
194
199
  ],
195
200
  },
201
+ walletIndex,
196
202
  });
197
203
  return {
198
204
  hash,
@@ -225,7 +231,8 @@ class MayachainAction {
225
231
  isMemoEncoded: true,
226
232
  };
227
233
  const gasLimit = yield wallet.estimateGasLimit(tx);
228
- const hash = yield wallet.transfer(Object.assign(Object.assign({}, tx), { gasLimit }));
234
+ const hash = yield wallet.transfer(Object.assign(Object.assign({}, tx), { gasLimit,
235
+ walletIndex }));
229
236
  return {
230
237
  hash,
231
238
  url: yield wallet.getExplorerTxUrl(assetAmount.asset.chain, hash),
@@ -270,6 +277,7 @@ class MayachainAMM {
270
277
  MAYA: new xchainMayachain.Client({ network: xchainClient.Network.Mainnet }),
271
278
  XRD: new xchainRadix.Client({ network: xchainClient.Network.Mainnet }),
272
279
  ZEC: new xchainZcash.Client(Object.assign(Object.assign({}, xchainZcash.defaultZECParams), { network: xchainClient.Network.Mainnet })),
280
+ ADA: new xchainCardano.Client(Object.assign(Object.assign({}, xchainCardano.defaultAdaParams), { network: xchainClient.Network.Mainnet })),
273
281
  })) {
274
282
  this.mayachainQuery = mayachainQuery;
275
283
  this.wallet = wallet;
@@ -7,11 +7,13 @@ export type NonProtocolActionParams = {
7
7
  assetAmount: CryptoAmount<Asset | TokenAsset>;
8
8
  recipient: Address;
9
9
  memo: string;
10
+ walletIndex?: number;
10
11
  };
11
12
  export type ProtocolActionParams = {
12
13
  wallet: Wallet;
13
14
  assetAmount: CryptoAmount<CompatibleAsset>;
14
15
  memo: string;
16
+ walletIndex?: number;
15
17
  };
16
18
  export type ActionParams = ProtocolActionParams | NonProtocolActionParams;
17
19
  export declare class MayachainAction {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-mayachain-amm",
3
- "version": "4.1.18",
3
+ "version": "4.1.19",
4
4
  "description": "module that exposes estimating & swapping cryptocurrency assets on mayachain",
5
5
  "keywords": [
6
6
  "MAYAChain",
@@ -36,27 +36,27 @@
36
36
  "url": "https://github.com/xchainjs/xchainjs-lib/issues"
37
37
  },
38
38
  "dependencies": {
39
- "@xchainjs/xchain-arbitrum": "2.1.3",
40
- "@xchainjs/xchain-bitcoin": "2.2.4",
41
- "@xchainjs/xchain-cardano": "1.2.0",
42
- "@xchainjs/xchain-client": "2.0.13",
39
+ "@xchainjs/xchain-arbitrum": "2.1.4",
40
+ "@xchainjs/xchain-bitcoin": "2.2.5",
41
+ "@xchainjs/xchain-cardano": "1.2.1",
42
+ "@xchainjs/xchain-client": "2.0.14",
43
43
  "@xchainjs/xchain-crypto": "1.0.6",
44
- "@xchainjs/xchain-dash": "2.2.4",
45
- "@xchainjs/xchain-ethereum": "2.0.18",
46
- "@xchainjs/xchain-evm": "2.0.17",
47
- "@xchainjs/xchain-kujira": "2.0.13",
48
- "@xchainjs/xchain-mayachain": "4.1.4",
49
- "@xchainjs/xchain-mayachain-query": "2.1.10",
50
- "@xchainjs/xchain-radix": "2.0.14",
51
- "@xchainjs/xchain-thorchain": "3.0.17",
44
+ "@xchainjs/xchain-dash": "2.2.5",
45
+ "@xchainjs/xchain-ethereum": "2.0.19",
46
+ "@xchainjs/xchain-evm": "2.0.18",
47
+ "@xchainjs/xchain-kujira": "2.0.14",
48
+ "@xchainjs/xchain-mayachain": "4.1.5",
49
+ "@xchainjs/xchain-mayachain-query": "2.1.11",
50
+ "@xchainjs/xchain-radix": "2.0.15",
51
+ "@xchainjs/xchain-thorchain": "3.0.18",
52
52
  "@xchainjs/xchain-util": "2.0.7",
53
- "@xchainjs/xchain-wallet": "2.0.27",
54
- "@xchainjs/xchain-zcash": "1.3.5",
53
+ "@xchainjs/xchain-wallet": "2.0.28",
54
+ "@xchainjs/xchain-zcash": "1.3.6",
55
55
  "ethers": "^6.14.3"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@ledgerhq/hw-transport-node-hid": "^6.28.6",
59
- "axios": "1.15.2",
59
+ "axios": "1.16.1",
60
60
  "axios-mock-adapter": "^2.1.0"
61
61
  },
62
62
  "publishConfig": {