@xchainjs/xchain-thorchain-amm 0.3.21 → 0.3.23

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
@@ -97,7 +97,7 @@ class EthHelper {
97
97
  expiry,
98
98
  ];
99
99
  const routerContract = new ethers.Contract(inboundAsgard.router, abi.router);
100
- const gasLimit = '80000';
100
+ const gasLimit = '160000';
101
101
  const unsignedTx = yield routerContract.populateTransaction.depositWithExpiry(...depositParams, {
102
102
  from: address,
103
103
  value: 0,
@@ -196,7 +196,7 @@ class EvmHelper {
196
196
  expiry,
197
197
  ];
198
198
  const routerContract = new ethers.Contract(inboundAsgard.router, abi$1.router);
199
- const gasLimit = '80000';
199
+ const gasLimit = '160000';
200
200
  const unsignedTx = yield routerContract.populateTransaction.depositWithExpiry(...depositParams, {
201
201
  from: address,
202
202
  value: 0,
@@ -339,6 +339,9 @@ class Wallet {
339
339
  errors.push(`affiliateAddress ${affiliateAddress} is not a valid THOR address`);
340
340
  }
341
341
  }
342
+ // if input == synth return errors.
343
+ if (swap.input.asset.synth)
344
+ return errors;
342
345
  if (swap.input.asset.chain === ETHChain) {
343
346
  if (eqAsset(swap.input.asset, AssetETH) !== true) {
344
347
  const isApprovedResult = yield this.ethHelper.isTCRouterApprovedToSpend(swap.input.asset, swap.input.baseAmount, swap.walletIndex);
@@ -959,6 +962,36 @@ class ThorchainAMM {
959
962
  });
960
963
  });
961
964
  }
965
+ /**
966
+ *
967
+ * @param addAssetAmount
968
+ * @returns
969
+ */
970
+ estimateAddSaver(addAssetAmount) {
971
+ return __awaiter(this, void 0, void 0, function* () {
972
+ return yield this.thorchainQuery.estimateAddSaver(addAssetAmount);
973
+ });
974
+ }
975
+ /**
976
+ *
977
+ * @param withdrawParams
978
+ * @returns
979
+ */
980
+ estimateWithdrawSaver(withdrawParams) {
981
+ return __awaiter(this, void 0, void 0, function* () {
982
+ return yield this.thorchainQuery.estimateWithdrawSaver(withdrawParams);
983
+ });
984
+ }
985
+ /**
986
+ *
987
+ * @param getsaver
988
+ * @returns
989
+ */
990
+ getSaverPosition(getsaver) {
991
+ return __awaiter(this, void 0, void 0, function* () {
992
+ return yield this.thorchainQuery.getSaverPosition(getsaver);
993
+ });
994
+ }
962
995
  /**
963
996
  *
964
997
  * @param wallet - wallet needed to execute tx
package/lib/index.js CHANGED
@@ -101,7 +101,7 @@ class EthHelper {
101
101
  expiry,
102
102
  ];
103
103
  const routerContract = new ethers.ethers.Contract(inboundAsgard.router, xchainEthereum.abi.router);
104
- const gasLimit = '80000';
104
+ const gasLimit = '160000';
105
105
  const unsignedTx = yield routerContract.populateTransaction.depositWithExpiry(...depositParams, {
106
106
  from: address,
107
107
  value: 0,
@@ -200,7 +200,7 @@ class EvmHelper {
200
200
  expiry,
201
201
  ];
202
202
  const routerContract = new ethers.ethers.Contract(inboundAsgard.router, xchainEvm.abi.router);
203
- const gasLimit = '80000';
203
+ const gasLimit = '160000';
204
204
  const unsignedTx = yield routerContract.populateTransaction.depositWithExpiry(...depositParams, {
205
205
  from: address,
206
206
  value: 0,
@@ -343,6 +343,9 @@ class Wallet {
343
343
  errors.push(`affiliateAddress ${affiliateAddress} is not a valid THOR address`);
344
344
  }
345
345
  }
346
+ // if input == synth return errors.
347
+ if (swap.input.asset.synth)
348
+ return errors;
346
349
  if (swap.input.asset.chain === xchainEthereum.ETHChain) {
347
350
  if (xchainUtil.eqAsset(swap.input.asset, xchainEthereum.AssetETH) !== true) {
348
351
  const isApprovedResult = yield this.ethHelper.isTCRouterApprovedToSpend(swap.input.asset, swap.input.baseAmount, swap.walletIndex);
@@ -963,6 +966,36 @@ class ThorchainAMM {
963
966
  });
964
967
  });
965
968
  }
969
+ /**
970
+ *
971
+ * @param addAssetAmount
972
+ * @returns
973
+ */
974
+ estimateAddSaver(addAssetAmount) {
975
+ return __awaiter(this, void 0, void 0, function* () {
976
+ return yield this.thorchainQuery.estimateAddSaver(addAssetAmount);
977
+ });
978
+ }
979
+ /**
980
+ *
981
+ * @param withdrawParams
982
+ * @returns
983
+ */
984
+ estimateWithdrawSaver(withdrawParams) {
985
+ return __awaiter(this, void 0, void 0, function* () {
986
+ return yield this.thorchainQuery.estimateWithdrawSaver(withdrawParams);
987
+ });
988
+ }
989
+ /**
990
+ *
991
+ * @param getsaver
992
+ * @returns
993
+ */
994
+ getSaverPosition(getsaver) {
995
+ return __awaiter(this, void 0, void 0, function* () {
996
+ return yield this.thorchainQuery.getSaverPosition(getsaver);
997
+ });
998
+ }
966
999
  /**
967
1000
  *
968
1001
  * @param wallet - wallet needed to execute tx
@@ -1,4 +1,4 @@
1
- import { AddliquidityPosition, CryptoAmount, EstimateAddLP, EstimateSwapParams, EstimateWithdrawLP, SaversWithdraw, ThorchainQuery, TxDetails, WithdrawLiquidityPosition } from '@xchainjs/xchain-thorchain-query';
1
+ import { AddliquidityPosition, CryptoAmount, EstimateAddLP, EstimateAddSaver, EstimateSwapParams, EstimateWithdrawLP, EstimateWithdrawSaver, SaversPosition, SaversWithdraw, ThorchainQuery, TxDetails, WithdrawLiquidityPosition, getSaver } from '@xchainjs/xchain-thorchain-query';
2
2
  import { TxSubmitted } from './types';
3
3
  import { Wallet } from './wallet';
4
4
  export declare type AmmEstimateSwapParams = EstimateSwapParams & {
@@ -62,6 +62,24 @@ export declare class ThorchainAMM {
62
62
  * @return
63
63
  */
64
64
  withdrawLiquidityPosition(wallet: Wallet, params: WithdrawLiquidityPosition): Promise<TxSubmitted[]>;
65
+ /**
66
+ *
67
+ * @param addAssetAmount
68
+ * @returns
69
+ */
70
+ estimateAddSaver(addAssetAmount: CryptoAmount): Promise<EstimateAddSaver>;
71
+ /**
72
+ *
73
+ * @param withdrawParams
74
+ * @returns
75
+ */
76
+ estimateWithdrawSaver(withdrawParams: SaversWithdraw): Promise<EstimateWithdrawSaver>;
77
+ /**
78
+ *
79
+ * @param getsaver
80
+ * @returns
81
+ */
82
+ getSaverPosition(getsaver: getSaver): Promise<SaversPosition>;
65
83
  /**
66
84
  *
67
85
  * @param wallet - wallet needed to execute tx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thorchain-amm",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "module that exposes estimating & swappping cryptocurrency assets on thorchain",
5
5
  "keywords": [
6
6
  "THORChain",
@@ -39,24 +39,24 @@
39
39
  "@binance-chain/javascript-sdk": "^4.2.0",
40
40
  "@cosmos-client/core": "0.46.1",
41
41
  "@psf/bitcoincashjs-lib": "^4.0.2",
42
- "@xchainjs/xchain-avax": "^0.1.5",
43
- "@xchainjs/xchain-bsc": "^0.1.2",
44
- "@xchainjs/xchain-binance": "^5.6.7",
45
- "@xchainjs/xchain-bitcoin": "^0.21.2",
46
- "@xchainjs/xchain-bitcoincash": "^0.15.9",
47
- "@xchainjs/xchain-client": "^0.13.6",
48
- "@xchainjs/xchain-cosmos": "^0.20.8",
42
+ "@xchainjs/xchain-avax": "^0.1.8",
43
+ "@xchainjs/xchain-bsc": "^0.1.3",
44
+ "@xchainjs/xchain-binance": "^5.6.8",
45
+ "@xchainjs/xchain-bitcoin": "^0.21.4",
46
+ "@xchainjs/xchain-bitcoincash": "^0.15.11",
47
+ "@xchainjs/xchain-client": "^0.13.7",
48
+ "@xchainjs/xchain-cosmos": "^0.20.9",
49
49
  "@xchainjs/xchain-crypto": "^0.2.6",
50
- "@xchainjs/xchain-doge": "^0.5.11",
51
- "@xchainjs/xchain-ethereum": "^0.27.7",
52
- "@xchainjs/xchain-evm": "^0.1.4",
53
- "@xchainjs/xchain-litecoin": "^0.11.2",
50
+ "@xchainjs/xchain-doge": "^0.5.13",
51
+ "@xchainjs/xchain-ethereum": "^0.27.8",
52
+ "@xchainjs/xchain-evm": "^0.1.5",
53
+ "@xchainjs/xchain-litecoin": "^0.11.4",
54
54
  "@xchainjs/xchain-midgard": "0.4.3",
55
55
  "@xchainjs/xchain-thorchain": "^0.27.9",
56
56
  "@xchainjs/xchain-thorchain-query": "^0.2.2",
57
- "@xchainjs/xchain-thornode": "^0.2.1",
57
+ "@xchainjs/xchain-thornode": "^0.2.2",
58
58
  "@xchainjs/xchain-util": "^0.12.0",
59
- "@xchainjs/xchain-utxo-providers": "^0.1.1",
59
+ "@xchainjs/xchain-utxo-providers": "^0.1.2",
60
60
  "axios": "^0.25.0",
61
61
  "axios-retry": "^3.2.5",
62
62
  "bchaddrjs": "^0.5.2",
@@ -74,24 +74,24 @@
74
74
  "@binance-chain/javascript-sdk": "^4.2.0",
75
75
  "@cosmos-client/core": "0.46.1",
76
76
  "@psf/bitcoincashjs-lib": "^4.0.2",
77
- "@xchainjs/xchain-avax": "^0.1.5",
77
+ "@xchainjs/xchain-avax": "^0.1.8",
78
78
  "@xchainjs/xchain-bsc": "^0.1.2",
79
79
  "@xchainjs/xchain-binance": "^5.6.7",
80
- "@xchainjs/xchain-bitcoin": "^0.21.1",
81
- "@xchainjs/xchain-bitcoincash": "^0.15.9",
82
- "@xchainjs/xchain-client": "^0.13.6",
80
+ "@xchainjs/xchain-bitcoin": "^0.21.4",
81
+ "@xchainjs/xchain-bitcoincash": "^0.15.11",
82
+ "@xchainjs/xchain-client": "^0.13.7",
83
83
  "@xchainjs/xchain-cosmos": "^0.20.8",
84
84
  "@xchainjs/xchain-crypto": "^0.2.6",
85
- "@xchainjs/xchain-doge": "^0.5.10",
85
+ "@xchainjs/xchain-doge": "^0.5.13",
86
86
  "@xchainjs/xchain-ethereum": "^0.27.7",
87
87
  "@xchainjs/xchain-evm": "^0.1.4",
88
- "@xchainjs/xchain-litecoin": "^0.11.1",
88
+ "@xchainjs/xchain-litecoin": "^0.11.4",
89
89
  "@xchainjs/xchain-midgard": "0.4.3",
90
90
  "@xchainjs/xchain-thorchain": "^0.27.9",
91
91
  "@xchainjs/xchain-thorchain-query": "^0.2.2",
92
- "@xchainjs/xchain-thornode": "^0.2.1",
92
+ "@xchainjs/xchain-thornode": "^0.2.2",
93
93
  "@xchainjs/xchain-util": "^0.12.0",
94
- "@xchainjs/xchain-utxo-providers": "^0.1.1",
94
+ "@xchainjs/xchain-utxo-providers": "^0.1.2",
95
95
  "axios": "^0.25.0",
96
96
  "axios-retry": "^3.2.5",
97
97
  "bchaddrjs": "^0.5.2",