@xchainjs/xchain-thorchain-amm 0.3.19 → 0.3.21

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,8 +1,8 @@
1
- import { Client as Client$8, defaultAvaxParams, AVAXChain } from '@xchainjs/xchain-avax';
1
+ import { Client as Client$8, defaultAvaxParams, AVAXChain, AssetAVAX } from '@xchainjs/xchain-avax';
2
2
  import { Client as Client$6 } from '@xchainjs/xchain-binance';
3
3
  import { Client as Client$1 } from '@xchainjs/xchain-bitcoin';
4
4
  import { Client } from '@xchainjs/xchain-bitcoincash';
5
- import { Client as Client$9, defaultBscParams, BSCChain } from '@xchainjs/xchain-bsc';
5
+ import { Client as Client$9, defaultBscParams, BSCChain, AssetBSC } from '@xchainjs/xchain-bsc';
6
6
  import { FeeOption } from '@xchainjs/xchain-client';
7
7
  import { Client as Client$7 } from '@xchainjs/xchain-cosmos';
8
8
  import { Client as Client$2 } from '@xchainjs/xchain-doge';
@@ -270,6 +270,11 @@ class Wallet {
270
270
  this.clients.LTC.setNetwork(settings.network);
271
271
  this.clients.LTC.setPhrase(settings.phrase, 0);
272
272
  this.ethHelper = new EthHelper(this.clients.ETH, this.thorchainQuery.thorchainCache);
273
+ this.evmHelpers = {
274
+ // ETH: new EvmHelper(this.clients.ETH, this.thorchainQuery.thorchainCache),
275
+ BSC: new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache),
276
+ AVAX: new EvmHelper(this.clients.AVAX, this.thorchainQuery.thorchainCache),
277
+ };
273
278
  }
274
279
  /**
275
280
  * Fetch balances for all wallets
@@ -278,18 +283,17 @@ class Wallet {
278
283
  */
279
284
  getAllBalances() {
280
285
  return __awaiter(this, void 0, void 0, function* () {
281
- const clientArray = Object.entries(this.clients);
282
- const allBalances = yield Promise.all(clientArray.map((entry) => __awaiter(this, void 0, void 0, function* () {
283
- const chain = entry[0];
284
- const address = entry[1].getAddress(0);
286
+ const allBalances = [];
287
+ for (const [chain, client] of Object.entries(this.clients)) {
288
+ const address = client.getAddress(0);
285
289
  try {
286
- const balances = yield entry[1].getBalance(address);
287
- return { chain, address, balances };
290
+ const balances = yield client.getBalance(address);
291
+ allBalances.push({ chain, address, balances });
288
292
  }
289
293
  catch (err) {
290
- return { chain, address, balances: err.message };
294
+ allBalances.push({ chain, address, balances: err.message });
291
295
  }
292
- })));
296
+ }
293
297
  return allBalances;
294
298
  });
295
299
  }
@@ -302,7 +306,7 @@ class Wallet {
302
306
  */
303
307
  executeSwap(swap) {
304
308
  return __awaiter(this, void 0, void 0, function* () {
305
- this.validateSwap(swap);
309
+ yield this.validateSwap(swap);
306
310
  if (swap.input.asset.chain === THORChain || swap.input.asset.synth) {
307
311
  return yield this.swapRuneTo(swap);
308
312
  }
@@ -316,25 +320,54 @@ class Wallet {
316
320
  * @param swap - swap parameters
317
321
  */
318
322
  validateSwap(swap) {
319
- const errors = [];
320
- const isThorchainDestinationAsset = swap.destinationAsset.synth || swap.destinationAsset.chain === THORChain;
321
- const chain = isThorchainDestinationAsset ? THORChain : swap.destinationAsset.chain;
322
- if (!this.clients[chain].validateAddress(swap.destinationAddress)) {
323
- errors.push(`destinationAddress ${swap.destinationAddress} is not a valid address`);
324
- }
325
- // Affiliate address should be THORName or THORAddress
326
- const checkAffiliateAddress = swap.memo.split(':');
327
- if (checkAffiliateAddress.length > 4) {
328
- const affiliateAddress = checkAffiliateAddress[4];
329
- if (affiliateAddress.length > 0) {
330
- const isValidThorchainAddress = this.clients[THORChain].validateAddress(affiliateAddress);
331
- const isValidThorname = this.isThorname(affiliateAddress);
332
- if (!(isValidThorchainAddress || isValidThorname))
333
- errors.push(`affiliateAddress ${affiliateAddress} is not a valid THOR address`);
334
- }
335
- }
336
- if (errors.length > 0)
337
- throw Error(errors.join('\n'));
323
+ return __awaiter(this, void 0, void 0, function* () {
324
+ const errors = [];
325
+ const isThorchainDestinationAsset = swap.destinationAsset.synth || swap.destinationAsset.chain === THORChain;
326
+ const chain = isThorchainDestinationAsset ? THORChain : swap.destinationAsset.chain;
327
+ // check address
328
+ if (!this.clients[chain].validateAddress(swap.destinationAddress)) {
329
+ errors.push(`destinationAddress ${swap.destinationAddress} is not a valid address`);
330
+ }
331
+ // Affiliate address should be THORName or THORAddress
332
+ const checkAffiliateAddress = swap.memo.split(':');
333
+ if (checkAffiliateAddress.length > 4) {
334
+ const affiliateAddress = checkAffiliateAddress[4];
335
+ if (affiliateAddress.length > 0) {
336
+ const isValidThorchainAddress = this.clients[THORChain].validateAddress(affiliateAddress);
337
+ const isValidThorname = this.isThorname(affiliateAddress);
338
+ if (!(isValidThorchainAddress || isValidThorname))
339
+ errors.push(`affiliateAddress ${affiliateAddress} is not a valid THOR address`);
340
+ }
341
+ }
342
+ if (swap.input.asset.chain === ETHChain) {
343
+ if (eqAsset(swap.input.asset, AssetETH) !== true) {
344
+ const isApprovedResult = yield this.ethHelper.isTCRouterApprovedToSpend(swap.input.asset, swap.input.baseAmount, swap.walletIndex);
345
+ console.log(isApprovedResult);
346
+ if (!isApprovedResult) {
347
+ errors.push('TC router has not been approved to spend this amount');
348
+ }
349
+ }
350
+ }
351
+ else if (swap.input.asset.chain === AVAXChain) {
352
+ if (eqAsset(swap.input.asset, AssetAVAX) !== true) {
353
+ const isApprovedResult = yield this.evmHelpers[`AVAX`].isTCRouterApprovedToSpend(swap.input.asset, swap.input.baseAmount, swap.walletIndex);
354
+ console.log(isApprovedResult);
355
+ if (!isApprovedResult) {
356
+ errors.push('TC router has not been approved to spend this amount');
357
+ }
358
+ }
359
+ }
360
+ else if (swap.input.asset.chain === BSCChain) {
361
+ if (eqAsset(swap.input.asset, AssetBSC) !== true) {
362
+ const isApprovedResult = yield this.evmHelpers[`BSC`].isTCRouterApprovedToSpend(swap.input.asset, swap.input.baseAmount, swap.walletIndex);
363
+ console.log(isApprovedResult);
364
+ if (!isApprovedResult) {
365
+ errors.push('TC router has not been approved to spend this amount');
366
+ }
367
+ }
368
+ }
369
+ return errors;
370
+ });
338
371
  }
339
372
  isThorname(name) {
340
373
  return __awaiter(this, void 0, void 0, function* () {
@@ -390,8 +423,7 @@ class Wallet {
390
423
  feeOption: swap.feeOption || FeeOption.Fast,
391
424
  memo: swap.memo,
392
425
  };
393
- const evmHelper = new EvmHelper(this.clients.AVAX, this.thorchainQuery.thorchainCache);
394
- const hash = yield evmHelper.sendDeposit(params);
426
+ const hash = yield this.evmHelpers['AVAX'].sendDeposit(params);
395
427
  return { hash, url: client.getExplorerTxUrl(hash), waitTimeSeconds };
396
428
  }
397
429
  else if (swap.input.asset.chain === BSCChain) {
@@ -402,8 +434,7 @@ class Wallet {
402
434
  feeOption: swap.feeOption || FeeOption.Fast,
403
435
  memo: swap.memo,
404
436
  };
405
- const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
406
- const hash = yield evmHelper.sendDeposit(params);
437
+ const hash = yield this.evmHelpers['BSC'].sendDeposit(params);
407
438
  return { hash, url: client.getExplorerTxUrl(hash), waitTimeSeconds };
408
439
  }
409
440
  else {
@@ -814,9 +845,21 @@ class ThorchainAMM {
814
845
 
815
846
  * @returns The SwapEstimate
816
847
  */
817
- estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress = '', interfaceID = `555`, affiliateFeeBasisPoints = 0, slipLimit, }) {
848
+ estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress = '', interfaceID = `555`, affiliateFeeBasisPoints = 0, slipLimit, wallet, walletIndex, }) {
818
849
  return __awaiter(this, void 0, void 0, function* () {
819
- return yield this.thorchainQuery.estimateSwap({
850
+ let errors = [];
851
+ if (wallet) {
852
+ const params = {
853
+ input,
854
+ destinationAsset,
855
+ destinationAddress,
856
+ memo: '',
857
+ waitTimeSeconds: 100,
858
+ walletIndex,
859
+ };
860
+ errors = yield wallet.validateSwap(params);
861
+ }
862
+ const estimate = yield this.thorchainQuery.estimateSwap({
820
863
  input,
821
864
  destinationAsset,
822
865
  destinationAddress,
@@ -825,6 +868,9 @@ class ThorchainAMM {
825
868
  affiliateFeeBasisPoints,
826
869
  slipLimit,
827
870
  });
871
+ estimate.txEstimate.errors.push(...errors);
872
+ estimate.txEstimate.canSwap = errors.length == 0;
873
+ return estimate;
828
874
  });
829
875
  }
830
876
  /**
@@ -847,6 +893,8 @@ class ThorchainAMM {
847
893
  destinationAddress: params.destinationAddress,
848
894
  memo: txDetails.memo,
849
895
  waitTimeSeconds: txDetails.txEstimate.waitTimeSeconds,
896
+ walletIndex: params.walletIndex,
897
+ feeOption: params.feeOption,
850
898
  });
851
899
  });
852
900
  }
package/lib/index.js CHANGED
@@ -274,6 +274,11 @@ class Wallet {
274
274
  this.clients.LTC.setNetwork(settings.network);
275
275
  this.clients.LTC.setPhrase(settings.phrase, 0);
276
276
  this.ethHelper = new EthHelper(this.clients.ETH, this.thorchainQuery.thorchainCache);
277
+ this.evmHelpers = {
278
+ // ETH: new EvmHelper(this.clients.ETH, this.thorchainQuery.thorchainCache),
279
+ BSC: new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache),
280
+ AVAX: new EvmHelper(this.clients.AVAX, this.thorchainQuery.thorchainCache),
281
+ };
277
282
  }
278
283
  /**
279
284
  * Fetch balances for all wallets
@@ -282,18 +287,17 @@ class Wallet {
282
287
  */
283
288
  getAllBalances() {
284
289
  return __awaiter(this, void 0, void 0, function* () {
285
- const clientArray = Object.entries(this.clients);
286
- const allBalances = yield Promise.all(clientArray.map((entry) => __awaiter(this, void 0, void 0, function* () {
287
- const chain = entry[0];
288
- const address = entry[1].getAddress(0);
290
+ const allBalances = [];
291
+ for (const [chain, client] of Object.entries(this.clients)) {
292
+ const address = client.getAddress(0);
289
293
  try {
290
- const balances = yield entry[1].getBalance(address);
291
- return { chain, address, balances };
294
+ const balances = yield client.getBalance(address);
295
+ allBalances.push({ chain, address, balances });
292
296
  }
293
297
  catch (err) {
294
- return { chain, address, balances: err.message };
298
+ allBalances.push({ chain, address, balances: err.message });
295
299
  }
296
- })));
300
+ }
297
301
  return allBalances;
298
302
  });
299
303
  }
@@ -306,7 +310,7 @@ class Wallet {
306
310
  */
307
311
  executeSwap(swap) {
308
312
  return __awaiter(this, void 0, void 0, function* () {
309
- this.validateSwap(swap);
313
+ yield this.validateSwap(swap);
310
314
  if (swap.input.asset.chain === xchainThorchain.THORChain || swap.input.asset.synth) {
311
315
  return yield this.swapRuneTo(swap);
312
316
  }
@@ -320,25 +324,54 @@ class Wallet {
320
324
  * @param swap - swap parameters
321
325
  */
322
326
  validateSwap(swap) {
323
- const errors = [];
324
- const isThorchainDestinationAsset = swap.destinationAsset.synth || swap.destinationAsset.chain === xchainThorchain.THORChain;
325
- const chain = isThorchainDestinationAsset ? xchainThorchain.THORChain : swap.destinationAsset.chain;
326
- if (!this.clients[chain].validateAddress(swap.destinationAddress)) {
327
- errors.push(`destinationAddress ${swap.destinationAddress} is not a valid address`);
328
- }
329
- // Affiliate address should be THORName or THORAddress
330
- const checkAffiliateAddress = swap.memo.split(':');
331
- if (checkAffiliateAddress.length > 4) {
332
- const affiliateAddress = checkAffiliateAddress[4];
333
- if (affiliateAddress.length > 0) {
334
- const isValidThorchainAddress = this.clients[xchainThorchain.THORChain].validateAddress(affiliateAddress);
335
- const isValidThorname = this.isThorname(affiliateAddress);
336
- if (!(isValidThorchainAddress || isValidThorname))
337
- errors.push(`affiliateAddress ${affiliateAddress} is not a valid THOR address`);
338
- }
339
- }
340
- if (errors.length > 0)
341
- throw Error(errors.join('\n'));
327
+ return __awaiter(this, void 0, void 0, function* () {
328
+ const errors = [];
329
+ const isThorchainDestinationAsset = swap.destinationAsset.synth || swap.destinationAsset.chain === xchainThorchain.THORChain;
330
+ const chain = isThorchainDestinationAsset ? xchainThorchain.THORChain : swap.destinationAsset.chain;
331
+ // check address
332
+ if (!this.clients[chain].validateAddress(swap.destinationAddress)) {
333
+ errors.push(`destinationAddress ${swap.destinationAddress} is not a valid address`);
334
+ }
335
+ // Affiliate address should be THORName or THORAddress
336
+ const checkAffiliateAddress = swap.memo.split(':');
337
+ if (checkAffiliateAddress.length > 4) {
338
+ const affiliateAddress = checkAffiliateAddress[4];
339
+ if (affiliateAddress.length > 0) {
340
+ const isValidThorchainAddress = this.clients[xchainThorchain.THORChain].validateAddress(affiliateAddress);
341
+ const isValidThorname = this.isThorname(affiliateAddress);
342
+ if (!(isValidThorchainAddress || isValidThorname))
343
+ errors.push(`affiliateAddress ${affiliateAddress} is not a valid THOR address`);
344
+ }
345
+ }
346
+ if (swap.input.asset.chain === xchainEthereum.ETHChain) {
347
+ if (xchainUtil.eqAsset(swap.input.asset, xchainEthereum.AssetETH) !== true) {
348
+ const isApprovedResult = yield this.ethHelper.isTCRouterApprovedToSpend(swap.input.asset, swap.input.baseAmount, swap.walletIndex);
349
+ console.log(isApprovedResult);
350
+ if (!isApprovedResult) {
351
+ errors.push('TC router has not been approved to spend this amount');
352
+ }
353
+ }
354
+ }
355
+ else if (swap.input.asset.chain === xchainAvax.AVAXChain) {
356
+ if (xchainUtil.eqAsset(swap.input.asset, xchainAvax.AssetAVAX) !== true) {
357
+ const isApprovedResult = yield this.evmHelpers[`AVAX`].isTCRouterApprovedToSpend(swap.input.asset, swap.input.baseAmount, swap.walletIndex);
358
+ console.log(isApprovedResult);
359
+ if (!isApprovedResult) {
360
+ errors.push('TC router has not been approved to spend this amount');
361
+ }
362
+ }
363
+ }
364
+ else if (swap.input.asset.chain === xchainBsc.BSCChain) {
365
+ if (xchainUtil.eqAsset(swap.input.asset, xchainBsc.AssetBSC) !== true) {
366
+ const isApprovedResult = yield this.evmHelpers[`BSC`].isTCRouterApprovedToSpend(swap.input.asset, swap.input.baseAmount, swap.walletIndex);
367
+ console.log(isApprovedResult);
368
+ if (!isApprovedResult) {
369
+ errors.push('TC router has not been approved to spend this amount');
370
+ }
371
+ }
372
+ }
373
+ return errors;
374
+ });
342
375
  }
343
376
  isThorname(name) {
344
377
  return __awaiter(this, void 0, void 0, function* () {
@@ -394,8 +427,7 @@ class Wallet {
394
427
  feeOption: swap.feeOption || xchainClient.FeeOption.Fast,
395
428
  memo: swap.memo,
396
429
  };
397
- const evmHelper = new EvmHelper(this.clients.AVAX, this.thorchainQuery.thorchainCache);
398
- const hash = yield evmHelper.sendDeposit(params);
430
+ const hash = yield this.evmHelpers['AVAX'].sendDeposit(params);
399
431
  return { hash, url: client.getExplorerTxUrl(hash), waitTimeSeconds };
400
432
  }
401
433
  else if (swap.input.asset.chain === xchainBsc.BSCChain) {
@@ -406,8 +438,7 @@ class Wallet {
406
438
  feeOption: swap.feeOption || xchainClient.FeeOption.Fast,
407
439
  memo: swap.memo,
408
440
  };
409
- const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
410
- const hash = yield evmHelper.sendDeposit(params);
441
+ const hash = yield this.evmHelpers['BSC'].sendDeposit(params);
411
442
  return { hash, url: client.getExplorerTxUrl(hash), waitTimeSeconds };
412
443
  }
413
444
  else {
@@ -818,9 +849,21 @@ class ThorchainAMM {
818
849
 
819
850
  * @returns The SwapEstimate
820
851
  */
821
- estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress = '', interfaceID = `555`, affiliateFeeBasisPoints = 0, slipLimit, }) {
852
+ estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress = '', interfaceID = `555`, affiliateFeeBasisPoints = 0, slipLimit, wallet, walletIndex, }) {
822
853
  return __awaiter(this, void 0, void 0, function* () {
823
- return yield this.thorchainQuery.estimateSwap({
854
+ let errors = [];
855
+ if (wallet) {
856
+ const params = {
857
+ input,
858
+ destinationAsset,
859
+ destinationAddress,
860
+ memo: '',
861
+ waitTimeSeconds: 100,
862
+ walletIndex,
863
+ };
864
+ errors = yield wallet.validateSwap(params);
865
+ }
866
+ const estimate = yield this.thorchainQuery.estimateSwap({
824
867
  input,
825
868
  destinationAsset,
826
869
  destinationAddress,
@@ -829,6 +872,9 @@ class ThorchainAMM {
829
872
  affiliateFeeBasisPoints,
830
873
  slipLimit,
831
874
  });
875
+ estimate.txEstimate.errors.push(...errors);
876
+ estimate.txEstimate.canSwap = errors.length == 0;
877
+ return estimate;
832
878
  });
833
879
  }
834
880
  /**
@@ -851,6 +897,8 @@ class ThorchainAMM {
851
897
  destinationAddress: params.destinationAddress,
852
898
  memo: txDetails.memo,
853
899
  waitTimeSeconds: txDetails.txEstimate.waitTimeSeconds,
900
+ walletIndex: params.walletIndex,
901
+ feeOption: params.feeOption,
854
902
  });
855
903
  });
856
904
  }
@@ -1,6 +1,10 @@
1
1
  import { AddliquidityPosition, CryptoAmount, EstimateAddLP, EstimateSwapParams, EstimateWithdrawLP, SaversWithdraw, ThorchainQuery, TxDetails, WithdrawLiquidityPosition } from '@xchainjs/xchain-thorchain-query';
2
2
  import { TxSubmitted } from './types';
3
3
  import { Wallet } from './wallet';
4
+ export declare type AmmEstimateSwapParams = EstimateSwapParams & {
5
+ wallet: Wallet;
6
+ walletIndex: number;
7
+ };
4
8
  /**
5
9
  * THORChain Class for interacting with THORChain.
6
10
  * Recommended main class to use for swapping with THORChain
@@ -23,7 +27,7 @@ export declare class ThorchainAMM {
23
27
 
24
28
  * @returns The SwapEstimate
25
29
  */
26
- estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress, interfaceID, affiliateFeeBasisPoints, slipLimit, }: EstimateSwapParams): Promise<TxDetails>;
30
+ estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress, interfaceID, affiliateFeeBasisPoints, slipLimit, wallet, walletIndex, }: AmmEstimateSwapParams): Promise<TxDetails>;
27
31
  /**
28
32
  * Conducts a swap with the given inputs. Should be called after estimateSwap() to ensure the swap is valid
29
33
  *
@@ -31,7 +35,7 @@ export declare class ThorchainAMM {
31
35
  * @param params - swap params
32
36
  * @returns {SwapSubmitted} - Tx Hash, URL of BlockExplorer and expected wait time.
33
37
  */
34
- doSwap(wallet: Wallet, params: EstimateSwapParams): Promise<TxSubmitted>;
38
+ doSwap(wallet: Wallet, params: AmmEstimateSwapParams): Promise<TxSubmitted>;
35
39
  /**
36
40
  * Wraps estimate from thorchain query
37
41
  * @param params - estimate add liquidity
package/lib/types.d.ts CHANGED
@@ -1,6 +1,11 @@
1
- import { FeeOption } from '@xchainjs/xchain-client';
1
+ import { Balance, FeeOption } from '@xchainjs/xchain-client';
2
2
  import { CryptoAmount, LiquidityPool } from '@xchainjs/xchain-thorchain-query';
3
- import { Address, Asset, BaseAmount } from '@xchainjs/xchain-util';
3
+ import { Address, Asset, BaseAmount, Chain } from '@xchainjs/xchain-util';
4
+ export declare type AllBalances = {
5
+ chain: Chain;
6
+ address: string;
7
+ balances: Balance[] | string;
8
+ };
4
9
  export declare type ExecuteSwap = {
5
10
  input: CryptoAmount;
6
11
  destinationAsset: Asset;
@@ -8,6 +13,7 @@ export declare type ExecuteSwap = {
8
13
  memo: string;
9
14
  feeOption?: FeeOption;
10
15
  waitTimeSeconds: number;
16
+ walletIndex: number;
11
17
  };
12
18
  export declare type TxSubmitted = {
13
19
  hash: string;
package/lib/wallet.d.ts CHANGED
@@ -1,12 +1,8 @@
1
- import { Balance, Network, XChainClient } from '@xchainjs/xchain-client';
1
+ import { Network, XChainClient } from '@xchainjs/xchain-client';
2
2
  import { CryptoAmount, ThorchainQuery } from '@xchainjs/xchain-thorchain-query';
3
- import { Address, Chain } from '@xchainjs/xchain-util';
4
- import { AddLiquidity, ExecuteSwap, TxSubmitted, WithdrawLiquidity } from './types';
5
- declare type AllBalances = {
6
- chain: Chain;
7
- address: string;
8
- balances: Balance[] | string;
9
- };
3
+ import { Address } from '@xchainjs/xchain-util';
4
+ import { AddLiquidity, AllBalances, ExecuteSwap, TxSubmitted, WithdrawLiquidity } from './types';
5
+ import { EvmHelper } from './utils/evm-helper';
10
6
  export declare type NodeUrls = Record<Network, string>;
11
7
  /**
12
8
  * Wallet Class for managing all xchain-* wallets with a mnemonic seed.
@@ -15,6 +11,7 @@ export declare class Wallet {
15
11
  private thorchainQuery;
16
12
  clients: Record<string, XChainClient>;
17
13
  private ethHelper;
14
+ evmHelpers: Record<string, EvmHelper>;
18
15
  /**
19
16
  * Contructor to create a Wallet
20
17
  *
@@ -41,7 +38,7 @@ export declare class Wallet {
41
38
  *
42
39
  * @param swap - swap parameters
43
40
  */
44
- private validateSwap;
41
+ validateSwap(swap: ExecuteSwap): Promise<string[]>;
45
42
  private isThorname;
46
43
  /** Function handles all swaps from Rune to asset
47
44
  *
@@ -118,4 +115,3 @@ export declare class Wallet {
118
115
  */
119
116
  private withdrawRuneLP;
120
117
  }
121
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thorchain-amm",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "module that exposes estimating & swappping cryptocurrency assets on thorchain",
5
5
  "keywords": [
6
6
  "THORChain",
@@ -42,20 +42,21 @@
42
42
  "@xchainjs/xchain-avax": "^0.1.5",
43
43
  "@xchainjs/xchain-bsc": "^0.1.2",
44
44
  "@xchainjs/xchain-binance": "^5.6.7",
45
- "@xchainjs/xchain-bitcoin": "^0.21.0",
46
- "@xchainjs/xchain-bitcoincash": "^0.15.8",
45
+ "@xchainjs/xchain-bitcoin": "^0.21.2",
46
+ "@xchainjs/xchain-bitcoincash": "^0.15.9",
47
47
  "@xchainjs/xchain-client": "^0.13.6",
48
48
  "@xchainjs/xchain-cosmos": "^0.20.8",
49
49
  "@xchainjs/xchain-crypto": "^0.2.6",
50
- "@xchainjs/xchain-doge": "^0.5.8",
50
+ "@xchainjs/xchain-doge": "^0.5.11",
51
51
  "@xchainjs/xchain-ethereum": "^0.27.7",
52
52
  "@xchainjs/xchain-evm": "^0.1.4",
53
- "@xchainjs/xchain-litecoin": "^0.11.0",
53
+ "@xchainjs/xchain-litecoin": "^0.11.2",
54
54
  "@xchainjs/xchain-midgard": "0.4.3",
55
55
  "@xchainjs/xchain-thorchain": "^0.27.9",
56
- "@xchainjs/xchain-thorchain-query": "^0.2.0",
56
+ "@xchainjs/xchain-thorchain-query": "^0.2.2",
57
57
  "@xchainjs/xchain-thornode": "^0.2.1",
58
58
  "@xchainjs/xchain-util": "^0.12.0",
59
+ "@xchainjs/xchain-utxo-providers": "^0.1.1",
59
60
  "axios": "^0.25.0",
60
61
  "axios-retry": "^3.2.5",
61
62
  "bchaddrjs": "^0.5.2",
@@ -76,20 +77,21 @@
76
77
  "@xchainjs/xchain-avax": "^0.1.5",
77
78
  "@xchainjs/xchain-bsc": "^0.1.2",
78
79
  "@xchainjs/xchain-binance": "^5.6.7",
79
- "@xchainjs/xchain-bitcoin": "^0.21.0",
80
- "@xchainjs/xchain-bitcoincash": "^0.15.8",
80
+ "@xchainjs/xchain-bitcoin": "^0.21.1",
81
+ "@xchainjs/xchain-bitcoincash": "^0.15.9",
81
82
  "@xchainjs/xchain-client": "^0.13.6",
82
83
  "@xchainjs/xchain-cosmos": "^0.20.8",
83
84
  "@xchainjs/xchain-crypto": "^0.2.6",
84
- "@xchainjs/xchain-doge": "^0.5.8",
85
+ "@xchainjs/xchain-doge": "^0.5.10",
85
86
  "@xchainjs/xchain-ethereum": "^0.27.7",
86
87
  "@xchainjs/xchain-evm": "^0.1.4",
87
- "@xchainjs/xchain-litecoin": "^0.11.0",
88
+ "@xchainjs/xchain-litecoin": "^0.11.1",
88
89
  "@xchainjs/xchain-midgard": "0.4.3",
89
90
  "@xchainjs/xchain-thorchain": "^0.27.9",
90
- "@xchainjs/xchain-thorchain-query": "^0.2.0",
91
+ "@xchainjs/xchain-thorchain-query": "^0.2.2",
91
92
  "@xchainjs/xchain-thornode": "^0.2.1",
92
93
  "@xchainjs/xchain-util": "^0.12.0",
94
+ "@xchainjs/xchain-utxo-providers": "^0.1.1",
93
95
  "axios": "^0.25.0",
94
96
  "axios-retry": "^3.2.5",
95
97
  "bchaddrjs": "^0.5.2",