@xchainjs/xchain-thorchain-amm 0.3.17 → 0.3.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 +14 -6
- package/lib/index.js +14 -6
- package/lib/utils/index.d.ts +2 -0
- package/lib/wallet.d.ts +3 -2
- package/package.json +24 -24
package/lib/index.esm.js
CHANGED
|
@@ -83,7 +83,7 @@ class EthHelper {
|
|
|
83
83
|
//erc-20 must be depsited to the router
|
|
84
84
|
const isApprovedResult = yield this.isTCRouterApprovedToSpend(params.asset, params.amount, params.walletIndex);
|
|
85
85
|
if (!isApprovedResult) {
|
|
86
|
-
throw new Error('
|
|
86
|
+
throw new Error('TC router has not been approved to spend this amount');
|
|
87
87
|
}
|
|
88
88
|
const contractAddress = getContractAddressFromAsset(params.asset);
|
|
89
89
|
const checkSummedContractAddress = ethers.utils.getAddress(contractAddress);
|
|
@@ -246,14 +246,14 @@ class Wallet {
|
|
|
246
246
|
* @param thorchainCache - an instance of the ThorchainCache (could be pointing to stagenet,testnet,mainnet)
|
|
247
247
|
* @returns Wallet
|
|
248
248
|
*/
|
|
249
|
-
constructor(phrase, thorchainQuery
|
|
249
|
+
constructor(phrase, thorchainQuery) {
|
|
250
250
|
this.thorchainQuery = thorchainQuery;
|
|
251
251
|
const settings = { network: thorchainQuery.thorchainCache.midgard.network, phrase };
|
|
252
252
|
this.clients = {
|
|
253
|
-
BCH: new Client(
|
|
254
|
-
BTC: new Client$1(
|
|
255
|
-
DOGE: new Client$2(
|
|
256
|
-
LTC: new Client$3(
|
|
253
|
+
BCH: new Client(),
|
|
254
|
+
BTC: new Client$1(),
|
|
255
|
+
DOGE: new Client$2(),
|
|
256
|
+
LTC: new Client$3(),
|
|
257
257
|
ETH: new Client$4(settings),
|
|
258
258
|
THOR: new Client$5(settings),
|
|
259
259
|
BNB: new Client$6(settings),
|
|
@@ -261,6 +261,14 @@ class Wallet {
|
|
|
261
261
|
AVAX: new Client$8(Object.assign(Object.assign({}, defaultAvaxParams), { network: settings.network, phrase })),
|
|
262
262
|
BSC: new Client$9(Object.assign(Object.assign({}, defaultBscParams), { network: settings.network, phrase })),
|
|
263
263
|
};
|
|
264
|
+
this.clients.BCH.setNetwork(settings.network);
|
|
265
|
+
this.clients.BCH.setPhrase(settings.phrase, 0);
|
|
266
|
+
this.clients.BTC.setNetwork(settings.network);
|
|
267
|
+
this.clients.BTC.setPhrase(settings.phrase, 0);
|
|
268
|
+
this.clients.DOGE.setNetwork(settings.network);
|
|
269
|
+
this.clients.DOGE.setPhrase(settings.phrase, 0);
|
|
270
|
+
this.clients.LTC.setNetwork(settings.network);
|
|
271
|
+
this.clients.LTC.setPhrase(settings.phrase, 0);
|
|
264
272
|
this.ethHelper = new EthHelper(this.clients.ETH, this.thorchainQuery.thorchainCache);
|
|
265
273
|
}
|
|
266
274
|
/**
|
package/lib/index.js
CHANGED
|
@@ -87,7 +87,7 @@ class EthHelper {
|
|
|
87
87
|
//erc-20 must be depsited to the router
|
|
88
88
|
const isApprovedResult = yield this.isTCRouterApprovedToSpend(params.asset, params.amount, params.walletIndex);
|
|
89
89
|
if (!isApprovedResult) {
|
|
90
|
-
throw new Error('
|
|
90
|
+
throw new Error('TC router has not been approved to spend this amount');
|
|
91
91
|
}
|
|
92
92
|
const contractAddress = xchainUtil.getContractAddressFromAsset(params.asset);
|
|
93
93
|
const checkSummedContractAddress = ethers.ethers.utils.getAddress(contractAddress);
|
|
@@ -250,14 +250,14 @@ class Wallet {
|
|
|
250
250
|
* @param thorchainCache - an instance of the ThorchainCache (could be pointing to stagenet,testnet,mainnet)
|
|
251
251
|
* @returns Wallet
|
|
252
252
|
*/
|
|
253
|
-
constructor(phrase, thorchainQuery
|
|
253
|
+
constructor(phrase, thorchainQuery) {
|
|
254
254
|
this.thorchainQuery = thorchainQuery;
|
|
255
255
|
const settings = { network: thorchainQuery.thorchainCache.midgard.network, phrase };
|
|
256
256
|
this.clients = {
|
|
257
|
-
BCH: new xchainBitcoincash.Client(
|
|
258
|
-
BTC: new xchainBitcoin.Client(
|
|
259
|
-
DOGE: new xchainDoge.Client(
|
|
260
|
-
LTC: new xchainLitecoin.Client(
|
|
257
|
+
BCH: new xchainBitcoincash.Client(),
|
|
258
|
+
BTC: new xchainBitcoin.Client(),
|
|
259
|
+
DOGE: new xchainDoge.Client(),
|
|
260
|
+
LTC: new xchainLitecoin.Client(),
|
|
261
261
|
ETH: new xchainEthereum.Client(settings),
|
|
262
262
|
THOR: new xchainThorchain.Client(settings),
|
|
263
263
|
BNB: new xchainBinance.Client(settings),
|
|
@@ -265,6 +265,14 @@ class Wallet {
|
|
|
265
265
|
AVAX: new xchainAvax.Client(Object.assign(Object.assign({}, xchainAvax.defaultAvaxParams), { network: settings.network, phrase })),
|
|
266
266
|
BSC: new xchainBsc.Client(Object.assign(Object.assign({}, xchainBsc.defaultBscParams), { network: settings.network, phrase })),
|
|
267
267
|
};
|
|
268
|
+
this.clients.BCH.setNetwork(settings.network);
|
|
269
|
+
this.clients.BCH.setPhrase(settings.phrase, 0);
|
|
270
|
+
this.clients.BTC.setNetwork(settings.network);
|
|
271
|
+
this.clients.BTC.setPhrase(settings.phrase, 0);
|
|
272
|
+
this.clients.DOGE.setNetwork(settings.network);
|
|
273
|
+
this.clients.DOGE.setPhrase(settings.phrase, 0);
|
|
274
|
+
this.clients.LTC.setNetwork(settings.network);
|
|
275
|
+
this.clients.LTC.setPhrase(settings.phrase, 0);
|
|
268
276
|
this.ethHelper = new EthHelper(this.clients.ETH, this.thorchainQuery.thorchainCache);
|
|
269
277
|
}
|
|
270
278
|
/**
|
package/lib/wallet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Balance, XChainClient } from '@xchainjs/xchain-client';
|
|
1
|
+
import { Balance, Network, XChainClient } from '@xchainjs/xchain-client';
|
|
2
2
|
import { CryptoAmount, ThorchainQuery } from '@xchainjs/xchain-thorchain-query';
|
|
3
3
|
import { Address, Chain } from '@xchainjs/xchain-util';
|
|
4
4
|
import { AddLiquidity, ExecuteSwap, TxSubmitted, WithdrawLiquidity } from './types';
|
|
@@ -7,6 +7,7 @@ declare type AllBalances = {
|
|
|
7
7
|
address: string;
|
|
8
8
|
balances: Balance[] | string;
|
|
9
9
|
};
|
|
10
|
+
export declare type NodeUrls = Record<Network, string>;
|
|
10
11
|
/**
|
|
11
12
|
* Wallet Class for managing all xchain-* wallets with a mnemonic seed.
|
|
12
13
|
*/
|
|
@@ -21,7 +22,7 @@ export declare class Wallet {
|
|
|
21
22
|
* @param thorchainCache - an instance of the ThorchainCache (could be pointing to stagenet,testnet,mainnet)
|
|
22
23
|
* @returns Wallet
|
|
23
24
|
*/
|
|
24
|
-
constructor(phrase: string, thorchainQuery: ThorchainQuery
|
|
25
|
+
constructor(phrase: string, thorchainQuery: ThorchainQuery);
|
|
25
26
|
/**
|
|
26
27
|
* Fetch balances for all wallets
|
|
27
28
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain-amm",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "module that exposes estimating & swappping cryptocurrency assets on thorchain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -39,22 +39,22 @@
|
|
|
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.
|
|
43
|
-
"@xchainjs/xchain-bsc": "^0.1.
|
|
42
|
+
"@xchainjs/xchain-avax": "^0.1.5",
|
|
43
|
+
"@xchainjs/xchain-bsc": "^0.1.2",
|
|
44
44
|
"@xchainjs/xchain-binance": "^5.6.7",
|
|
45
|
-
"@xchainjs/xchain-bitcoin": "^0.
|
|
46
|
-
"@xchainjs/xchain-bitcoincash": "^0.15.
|
|
47
|
-
"@xchainjs/xchain-client": "^0.13.
|
|
45
|
+
"@xchainjs/xchain-bitcoin": "^0.21.0",
|
|
46
|
+
"@xchainjs/xchain-bitcoincash": "^0.15.8",
|
|
47
|
+
"@xchainjs/xchain-client": "^0.13.6",
|
|
48
48
|
"@xchainjs/xchain-cosmos": "^0.20.8",
|
|
49
49
|
"@xchainjs/xchain-crypto": "^0.2.6",
|
|
50
50
|
"@xchainjs/xchain-doge": "^0.5.8",
|
|
51
51
|
"@xchainjs/xchain-ethereum": "^0.27.7",
|
|
52
|
-
"@xchainjs/xchain-evm": "^0.1.
|
|
53
|
-
"@xchainjs/xchain-litecoin": "^0.
|
|
54
|
-
"@xchainjs/xchain-midgard": "0.4.
|
|
55
|
-
"@xchainjs/xchain-thorchain": "^0.27.
|
|
56
|
-
"@xchainjs/xchain-thorchain-query": "^0.
|
|
57
|
-
"@xchainjs/xchain-thornode": "^0.2.
|
|
52
|
+
"@xchainjs/xchain-evm": "^0.1.4",
|
|
53
|
+
"@xchainjs/xchain-litecoin": "^0.11.0",
|
|
54
|
+
"@xchainjs/xchain-midgard": "0.4.3",
|
|
55
|
+
"@xchainjs/xchain-thorchain": "^0.27.9",
|
|
56
|
+
"@xchainjs/xchain-thorchain-query": "^0.2.0",
|
|
57
|
+
"@xchainjs/xchain-thornode": "^0.2.1",
|
|
58
58
|
"@xchainjs/xchain-util": "^0.12.0",
|
|
59
59
|
"axios": "^0.25.0",
|
|
60
60
|
"axios-retry": "^3.2.5",
|
|
@@ -73,22 +73,22 @@
|
|
|
73
73
|
"@binance-chain/javascript-sdk": "^4.2.0",
|
|
74
74
|
"@cosmos-client/core": "0.46.1",
|
|
75
75
|
"@psf/bitcoincashjs-lib": "^4.0.2",
|
|
76
|
-
"@xchainjs/xchain-avax": "^0.1.
|
|
77
|
-
"@xchainjs/xchain-bsc": "^0.1.
|
|
76
|
+
"@xchainjs/xchain-avax": "^0.1.5",
|
|
77
|
+
"@xchainjs/xchain-bsc": "^0.1.2",
|
|
78
78
|
"@xchainjs/xchain-binance": "^5.6.7",
|
|
79
|
-
"@xchainjs/xchain-bitcoin": "^0.
|
|
80
|
-
"@xchainjs/xchain-bitcoincash": "^0.15.
|
|
81
|
-
"@xchainjs/xchain-client": "^0.13.
|
|
82
|
-
"@xchainjs/xchain-cosmos": "^0.20.
|
|
79
|
+
"@xchainjs/xchain-bitcoin": "^0.21.0",
|
|
80
|
+
"@xchainjs/xchain-bitcoincash": "^0.15.8",
|
|
81
|
+
"@xchainjs/xchain-client": "^0.13.6",
|
|
82
|
+
"@xchainjs/xchain-cosmos": "^0.20.8",
|
|
83
83
|
"@xchainjs/xchain-crypto": "^0.2.6",
|
|
84
84
|
"@xchainjs/xchain-doge": "^0.5.8",
|
|
85
85
|
"@xchainjs/xchain-ethereum": "^0.27.7",
|
|
86
|
-
"@xchainjs/xchain-evm": "^0.1.
|
|
87
|
-
"@xchainjs/xchain-litecoin": "^0.
|
|
88
|
-
"@xchainjs/xchain-midgard": "0.4.
|
|
89
|
-
"@xchainjs/xchain-thorchain": "^0.27.
|
|
90
|
-
"@xchainjs/xchain-thorchain-query": "^0.
|
|
91
|
-
"@xchainjs/xchain-thornode": "^0.2.
|
|
86
|
+
"@xchainjs/xchain-evm": "^0.1.4",
|
|
87
|
+
"@xchainjs/xchain-litecoin": "^0.11.0",
|
|
88
|
+
"@xchainjs/xchain-midgard": "0.4.3",
|
|
89
|
+
"@xchainjs/xchain-thorchain": "^0.27.9",
|
|
90
|
+
"@xchainjs/xchain-thorchain-query": "^0.2.0",
|
|
91
|
+
"@xchainjs/xchain-thornode": "^0.2.1",
|
|
92
92
|
"@xchainjs/xchain-util": "^0.12.0",
|
|
93
93
|
"axios": "^0.25.0",
|
|
94
94
|
"axios-retry": "^3.2.5",
|