@xchainjs/xchain-thorchain-amm 0.3.5 → 0.3.7
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 +16 -33
- package/lib/index.js +15 -32
- package/package.json +2 -2
package/lib/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Client as Client$8, defaultAvaxParams } 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 {
|
|
5
|
+
import { FeeOption } from '@xchainjs/xchain-client';
|
|
6
6
|
import { Client as Client$7 } from '@xchainjs/xchain-cosmos';
|
|
7
7
|
import { Client as Client$2 } from '@xchainjs/xchain-doge';
|
|
8
8
|
import { MAX_APPROVAL, ETH_DECIMAL, Client as Client$3 } from '@xchainjs/xchain-ethereum';
|
|
@@ -590,25 +590,6 @@ class EvmHelper {
|
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
-
const chainIds = {
|
|
594
|
-
[Network.Mainnet]: 'thorchain-mainnet-v1',
|
|
595
|
-
[Network.Stagenet]: 'chain-id-stagenet',
|
|
596
|
-
[Network.Testnet]: 'deprecated',
|
|
597
|
-
};
|
|
598
|
-
const clientUrl = {
|
|
599
|
-
[Network.Stagenet]: {
|
|
600
|
-
node: 'https://stagenet-thornode.ninerealms.com',
|
|
601
|
-
rpc: 'https://stagenet-rpc.ninerealms.com',
|
|
602
|
-
},
|
|
603
|
-
[Network.Mainnet]: {
|
|
604
|
-
node: 'https://thornode.ninerealms.com',
|
|
605
|
-
rpc: 'https://rpc.ninerealms.com',
|
|
606
|
-
},
|
|
607
|
-
[Network.Testnet]: {
|
|
608
|
-
node: 'deprecated',
|
|
609
|
-
rpc: 'deprecated',
|
|
610
|
-
},
|
|
611
|
-
};
|
|
612
593
|
/**
|
|
613
594
|
* Wallet Class for managing all xchain-* wallets with a mnemonic seed.
|
|
614
595
|
*/
|
|
@@ -628,7 +609,7 @@ class Wallet {
|
|
|
628
609
|
BTC: new Client$1(settings),
|
|
629
610
|
DOGE: new Client$2(settings),
|
|
630
611
|
ETH: new Client$3(settings),
|
|
631
|
-
THOR: new Client$4(
|
|
612
|
+
THOR: new Client$4(settings),
|
|
632
613
|
LTC: new Client$5(settings),
|
|
633
614
|
BNB: new Client$6(settings),
|
|
634
615
|
GAIA: new Client$7(settings),
|
|
@@ -1016,14 +997,16 @@ class ThorchainAMM {
|
|
|
1016
997
|
* @returns The SwapEstimate
|
|
1017
998
|
*/
|
|
1018
999
|
estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress = '', interfaceID = `555`, affiliateFeeBasisPoints = 0, slipLimit, }) {
|
|
1019
|
-
return this
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1000
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1001
|
+
return yield this.thorchainQuery.estimateSwap({
|
|
1002
|
+
input,
|
|
1003
|
+
destinationAsset,
|
|
1004
|
+
destinationAddress,
|
|
1005
|
+
affiliateAddress,
|
|
1006
|
+
interfaceID,
|
|
1007
|
+
affiliateFeeBasisPoints,
|
|
1008
|
+
slipLimit,
|
|
1009
|
+
});
|
|
1027
1010
|
});
|
|
1028
1011
|
}
|
|
1029
1012
|
/**
|
|
@@ -1056,7 +1039,7 @@ class ThorchainAMM {
|
|
|
1056
1039
|
*/
|
|
1057
1040
|
estimateAddLiquidity(params) {
|
|
1058
1041
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1059
|
-
return this.thorchainQuery.estimateAddLP(params);
|
|
1042
|
+
return yield this.thorchainQuery.estimateAddLP(params);
|
|
1060
1043
|
});
|
|
1061
1044
|
}
|
|
1062
1045
|
/**
|
|
@@ -1066,7 +1049,7 @@ class ThorchainAMM {
|
|
|
1066
1049
|
*/
|
|
1067
1050
|
estimateWithdrawLiquidity(params) {
|
|
1068
1051
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1069
|
-
return this.thorchainQuery.estimateWithdrawLP(params);
|
|
1052
|
+
return yield this.thorchainQuery.estimateWithdrawLP(params);
|
|
1070
1053
|
});
|
|
1071
1054
|
}
|
|
1072
1055
|
/**
|
|
@@ -1081,7 +1064,7 @@ class ThorchainAMM {
|
|
|
1081
1064
|
const checkLPAdd = yield this.thorchainQuery.estimateAddLP(params);
|
|
1082
1065
|
if (!checkLPAdd.canAdd)
|
|
1083
1066
|
throw Error(`${checkLPAdd.errors}`);
|
|
1084
|
-
return wallet.addLiquidity({
|
|
1067
|
+
return yield wallet.addLiquidity({
|
|
1085
1068
|
asset: params.asset,
|
|
1086
1069
|
rune: params.rune,
|
|
1087
1070
|
waitTimeSeconds: checkLPAdd.estimatedWaitSeconds,
|
|
@@ -1099,7 +1082,7 @@ class ThorchainAMM {
|
|
|
1099
1082
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1100
1083
|
// Caution Dust Limits: BTC,BCH,LTC chains 10k sats; DOGE 1m Sats; ETH 0 wei; THOR 0 RUNE.
|
|
1101
1084
|
const withdrawParams = yield this.thorchainQuery.estimateWithdrawLP(params);
|
|
1102
|
-
return wallet.withdrawLiquidity({
|
|
1085
|
+
return yield wallet.withdrawLiquidity({
|
|
1103
1086
|
assetFee: withdrawParams.inbound.fees.asset,
|
|
1104
1087
|
runeFee: withdrawParams.inbound.fees.rune,
|
|
1105
1088
|
waitTimeSeconds: withdrawParams.estimatedWaitSeconds,
|
package/lib/index.js
CHANGED
|
@@ -594,25 +594,6 @@ class EvmHelper {
|
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
|
|
597
|
-
const chainIds = {
|
|
598
|
-
[xchainClient.Network.Mainnet]: 'thorchain-mainnet-v1',
|
|
599
|
-
[xchainClient.Network.Stagenet]: 'chain-id-stagenet',
|
|
600
|
-
[xchainClient.Network.Testnet]: 'deprecated',
|
|
601
|
-
};
|
|
602
|
-
const clientUrl = {
|
|
603
|
-
[xchainClient.Network.Stagenet]: {
|
|
604
|
-
node: 'https://stagenet-thornode.ninerealms.com',
|
|
605
|
-
rpc: 'https://stagenet-rpc.ninerealms.com',
|
|
606
|
-
},
|
|
607
|
-
[xchainClient.Network.Mainnet]: {
|
|
608
|
-
node: 'https://thornode.ninerealms.com',
|
|
609
|
-
rpc: 'https://rpc.ninerealms.com',
|
|
610
|
-
},
|
|
611
|
-
[xchainClient.Network.Testnet]: {
|
|
612
|
-
node: 'deprecated',
|
|
613
|
-
rpc: 'deprecated',
|
|
614
|
-
},
|
|
615
|
-
};
|
|
616
597
|
/**
|
|
617
598
|
* Wallet Class for managing all xchain-* wallets with a mnemonic seed.
|
|
618
599
|
*/
|
|
@@ -632,7 +613,7 @@ class Wallet {
|
|
|
632
613
|
BTC: new xchainBitcoin.Client(settings),
|
|
633
614
|
DOGE: new xchainDoge.Client(settings),
|
|
634
615
|
ETH: new xchainEthereum.Client(settings),
|
|
635
|
-
THOR: new xchainThorchain.Client(
|
|
616
|
+
THOR: new xchainThorchain.Client(settings),
|
|
636
617
|
LTC: new xchainLitecoin.Client(settings),
|
|
637
618
|
BNB: new xchainBinance.Client(settings),
|
|
638
619
|
GAIA: new xchainCosmos.Client(settings),
|
|
@@ -1020,14 +1001,16 @@ class ThorchainAMM {
|
|
|
1020
1001
|
* @returns The SwapEstimate
|
|
1021
1002
|
*/
|
|
1022
1003
|
estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress = '', interfaceID = `555`, affiliateFeeBasisPoints = 0, slipLimit, }) {
|
|
1023
|
-
return this
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1004
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1005
|
+
return yield this.thorchainQuery.estimateSwap({
|
|
1006
|
+
input,
|
|
1007
|
+
destinationAsset,
|
|
1008
|
+
destinationAddress,
|
|
1009
|
+
affiliateAddress,
|
|
1010
|
+
interfaceID,
|
|
1011
|
+
affiliateFeeBasisPoints,
|
|
1012
|
+
slipLimit,
|
|
1013
|
+
});
|
|
1031
1014
|
});
|
|
1032
1015
|
}
|
|
1033
1016
|
/**
|
|
@@ -1060,7 +1043,7 @@ class ThorchainAMM {
|
|
|
1060
1043
|
*/
|
|
1061
1044
|
estimateAddLiquidity(params) {
|
|
1062
1045
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1063
|
-
return this.thorchainQuery.estimateAddLP(params);
|
|
1046
|
+
return yield this.thorchainQuery.estimateAddLP(params);
|
|
1064
1047
|
});
|
|
1065
1048
|
}
|
|
1066
1049
|
/**
|
|
@@ -1070,7 +1053,7 @@ class ThorchainAMM {
|
|
|
1070
1053
|
*/
|
|
1071
1054
|
estimateWithdrawLiquidity(params) {
|
|
1072
1055
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1073
|
-
return this.thorchainQuery.estimateWithdrawLP(params);
|
|
1056
|
+
return yield this.thorchainQuery.estimateWithdrawLP(params);
|
|
1074
1057
|
});
|
|
1075
1058
|
}
|
|
1076
1059
|
/**
|
|
@@ -1085,7 +1068,7 @@ class ThorchainAMM {
|
|
|
1085
1068
|
const checkLPAdd = yield this.thorchainQuery.estimateAddLP(params);
|
|
1086
1069
|
if (!checkLPAdd.canAdd)
|
|
1087
1070
|
throw Error(`${checkLPAdd.errors}`);
|
|
1088
|
-
return wallet.addLiquidity({
|
|
1071
|
+
return yield wallet.addLiquidity({
|
|
1089
1072
|
asset: params.asset,
|
|
1090
1073
|
rune: params.rune,
|
|
1091
1074
|
waitTimeSeconds: checkLPAdd.estimatedWaitSeconds,
|
|
@@ -1103,7 +1086,7 @@ class ThorchainAMM {
|
|
|
1103
1086
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1104
1087
|
// Caution Dust Limits: BTC,BCH,LTC chains 10k sats; DOGE 1m Sats; ETH 0 wei; THOR 0 RUNE.
|
|
1105
1088
|
const withdrawParams = yield this.thorchainQuery.estimateWithdrawLP(params);
|
|
1106
|
-
return wallet.withdrawLiquidity({
|
|
1089
|
+
return yield wallet.withdrawLiquidity({
|
|
1107
1090
|
assetFee: withdrawParams.inbound.fees.asset,
|
|
1108
1091
|
runeFee: withdrawParams.inbound.fees.rune,
|
|
1109
1092
|
waitTimeSeconds: withdrawParams.estimatedWaitSeconds,
|
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.7",
|
|
4
4
|
"description": "module that exposes estimating & swappping cryptocurrency assets on thorchain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@xchainjs/xchain-avax": "^0.1.0",
|
|
53
53
|
"@xchainjs/xchain-litecoin": "^0.10.5",
|
|
54
54
|
"@xchainjs/xchain-midgard": "0.2.0",
|
|
55
|
-
"@xchainjs/xchain-thorchain": "^0.27.
|
|
55
|
+
"@xchainjs/xchain-thorchain": "^0.27.2",
|
|
56
56
|
"@xchainjs/xchain-thorchain-query": "^0.1.6",
|
|
57
57
|
"@xchainjs/xchain-thornode": "^0.1.1",
|
|
58
58
|
"@xchainjs/xchain-util": "^0.11.0",
|