@xchainjs/xchain-thorchain-amm 0.1.0-beta2 → 0.1.0-beta4
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 +15 -10
- package/lib/index.js +15 -10
- package/lib/thorchain-amm.d.ts +3 -6
- package/package.json +5 -5
package/lib/index.esm.js
CHANGED
|
@@ -767,20 +767,25 @@ class ThorchainAMM {
|
|
|
767
767
|
|
|
768
768
|
* @returns The SwapEstimate
|
|
769
769
|
*/
|
|
770
|
-
estimateSwap(
|
|
771
|
-
return this.thorchainQuery.estimateSwap(
|
|
770
|
+
estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress = '', interfaceID = 999, affiliateFeePercent = 0, slipLimit, }) {
|
|
771
|
+
return this.thorchainQuery.estimateSwap({
|
|
772
|
+
input,
|
|
773
|
+
destinationAsset,
|
|
774
|
+
destinationAddress,
|
|
775
|
+
affiliateAddress,
|
|
776
|
+
interfaceID,
|
|
777
|
+
affiliateFeePercent,
|
|
778
|
+
slipLimit,
|
|
779
|
+
});
|
|
772
780
|
}
|
|
773
781
|
/**
|
|
774
782
|
* Conducts a swap with the given inputs. Should be called after estimateSwap() to ensure the swap is valid
|
|
775
783
|
*
|
|
776
784
|
* @param wallet - wallet to use
|
|
777
|
-
* @param params - swap
|
|
778
|
-
* @param destinationAddress - where to send the output of the swap
|
|
779
|
-
* @param affiliateAddress - were to send the affilate Address, should be a THOR address (optional)
|
|
780
|
-
* @param interfaceID - id if the calling interface (optional)
|
|
785
|
+
* @param params - swap params
|
|
781
786
|
* @returns {SwapSubmitted} - Tx Hash, URL of BlockExplorer and expected wait time.
|
|
782
787
|
*/
|
|
783
|
-
doSwap(wallet, params
|
|
788
|
+
doSwap(wallet, params) {
|
|
784
789
|
return __awaiter(this, void 0, void 0, function* () {
|
|
785
790
|
// TODO validate all input fields
|
|
786
791
|
const txDetails = yield this.thorchainQuery.estimateSwap(params);
|
|
@@ -800,10 +805,10 @@ class ThorchainAMM {
|
|
|
800
805
|
input: params.input,
|
|
801
806
|
destinationAsset: params.destinationAsset,
|
|
802
807
|
limit: limAssetAmount.baseAmount,
|
|
803
|
-
destinationAddress,
|
|
804
|
-
affiliateAddress,
|
|
808
|
+
destinationAddress: params.destinationAddress,
|
|
809
|
+
affiliateAddress: params.affiliateAddress || '',
|
|
805
810
|
affiliateFee,
|
|
806
|
-
interfaceID,
|
|
811
|
+
interfaceID: params.interfaceID || 999,
|
|
807
812
|
waitTimeSeconds,
|
|
808
813
|
});
|
|
809
814
|
});
|
package/lib/index.js
CHANGED
|
@@ -771,20 +771,25 @@ class ThorchainAMM {
|
|
|
771
771
|
|
|
772
772
|
* @returns The SwapEstimate
|
|
773
773
|
*/
|
|
774
|
-
estimateSwap(
|
|
775
|
-
return this.thorchainQuery.estimateSwap(
|
|
774
|
+
estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress = '', interfaceID = 999, affiliateFeePercent = 0, slipLimit, }) {
|
|
775
|
+
return this.thorchainQuery.estimateSwap({
|
|
776
|
+
input,
|
|
777
|
+
destinationAsset,
|
|
778
|
+
destinationAddress,
|
|
779
|
+
affiliateAddress,
|
|
780
|
+
interfaceID,
|
|
781
|
+
affiliateFeePercent,
|
|
782
|
+
slipLimit,
|
|
783
|
+
});
|
|
776
784
|
}
|
|
777
785
|
/**
|
|
778
786
|
* Conducts a swap with the given inputs. Should be called after estimateSwap() to ensure the swap is valid
|
|
779
787
|
*
|
|
780
788
|
* @param wallet - wallet to use
|
|
781
|
-
* @param params - swap
|
|
782
|
-
* @param destinationAddress - where to send the output of the swap
|
|
783
|
-
* @param affiliateAddress - were to send the affilate Address, should be a THOR address (optional)
|
|
784
|
-
* @param interfaceID - id if the calling interface (optional)
|
|
789
|
+
* @param params - swap params
|
|
785
790
|
* @returns {SwapSubmitted} - Tx Hash, URL of BlockExplorer and expected wait time.
|
|
786
791
|
*/
|
|
787
|
-
doSwap(wallet, params
|
|
792
|
+
doSwap(wallet, params) {
|
|
788
793
|
return __awaiter(this, void 0, void 0, function* () {
|
|
789
794
|
// TODO validate all input fields
|
|
790
795
|
const txDetails = yield this.thorchainQuery.estimateSwap(params);
|
|
@@ -804,10 +809,10 @@ class ThorchainAMM {
|
|
|
804
809
|
input: params.input,
|
|
805
810
|
destinationAsset: params.destinationAsset,
|
|
806
811
|
limit: limAssetAmount.baseAmount,
|
|
807
|
-
destinationAddress,
|
|
808
|
-
affiliateAddress,
|
|
812
|
+
destinationAddress: params.destinationAddress,
|
|
813
|
+
affiliateAddress: params.affiliateAddress || '',
|
|
809
814
|
affiliateFee,
|
|
810
|
-
interfaceID,
|
|
815
|
+
interfaceID: params.interfaceID || 999,
|
|
811
816
|
waitTimeSeconds,
|
|
812
817
|
});
|
|
813
818
|
});
|
package/lib/thorchain-amm.d.ts
CHANGED
|
@@ -23,16 +23,13 @@ export declare class ThorchainAMM {
|
|
|
23
23
|
|
|
24
24
|
* @returns The SwapEstimate
|
|
25
25
|
*/
|
|
26
|
-
estimateSwap(
|
|
26
|
+
estimateSwap({ input, destinationAsset, destinationAddress, affiliateAddress, interfaceID, affiliateFeePercent, slipLimit, }: EstimateSwapParams): Promise<TxDetails>;
|
|
27
27
|
/**
|
|
28
28
|
* Conducts a swap with the given inputs. Should be called after estimateSwap() to ensure the swap is valid
|
|
29
29
|
*
|
|
30
30
|
* @param wallet - wallet to use
|
|
31
|
-
* @param params - swap
|
|
32
|
-
* @param destinationAddress - where to send the output of the swap
|
|
33
|
-
* @param affiliateAddress - were to send the affilate Address, should be a THOR address (optional)
|
|
34
|
-
* @param interfaceID - id if the calling interface (optional)
|
|
31
|
+
* @param params - swap params
|
|
35
32
|
* @returns {SwapSubmitted} - Tx Hash, URL of BlockExplorer and expected wait time.
|
|
36
33
|
*/
|
|
37
|
-
doSwap(wallet: Wallet, params: EstimateSwapParams
|
|
34
|
+
doSwap(wallet: Wallet, params: EstimateSwapParams): Promise<SwapSubmitted>;
|
|
38
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain-amm",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-beta4",
|
|
4
4
|
"description": "module that exposes estimating & swappping cryptocurrency assets on thorchain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"@xchainjs/xchain-cosmos": "^0.20.0",
|
|
48
48
|
"@xchainjs/xchain-crypto": "^0.2.6",
|
|
49
49
|
"@xchainjs/xchain-doge": "^0.5.0",
|
|
50
|
-
"@xchainjs/xchain-ethereum": "^0.
|
|
50
|
+
"@xchainjs/xchain-ethereum": "^0.27.0",
|
|
51
51
|
"@xchainjs/xchain-evm": "^0.1.0-alpha2",
|
|
52
52
|
"@xchainjs/xchain-avax": "^0.1.0-alpha2",
|
|
53
53
|
"@xchainjs/xchain-litecoin": "^0.10.0",
|
|
54
54
|
"@xchainjs/xchain-midgard": "0.1.0-alpha2",
|
|
55
55
|
"@xchainjs/xchain-terra": "^0.3.0",
|
|
56
56
|
"@xchainjs/xchain-thorchain": "^0.26.0",
|
|
57
|
-
"@xchainjs/xchain-thorchain-query": "^0.1.0-
|
|
57
|
+
"@xchainjs/xchain-thorchain-query": "^0.1.0-beta",
|
|
58
58
|
"@xchainjs/xchain-util": "^0.9.0",
|
|
59
59
|
"axios": "^0.25.0",
|
|
60
60
|
"axios-retry": "^3.2.5",
|
|
@@ -81,14 +81,14 @@
|
|
|
81
81
|
"@xchainjs/xchain-cosmos": "^0.20.0",
|
|
82
82
|
"@xchainjs/xchain-crypto": "^0.2.6",
|
|
83
83
|
"@xchainjs/xchain-doge": "^0.5.0",
|
|
84
|
-
"@xchainjs/xchain-ethereum": "^0.
|
|
84
|
+
"@xchainjs/xchain-ethereum": "^0.27.0",
|
|
85
85
|
"@xchainjs/xchain-evm": "^0.1.0-alpha2",
|
|
86
86
|
"@xchainjs/xchain-avax": "^0.1.0-alpha2",
|
|
87
87
|
"@xchainjs/xchain-litecoin": "^0.10.0",
|
|
88
88
|
"@xchainjs/xchain-midgard": "0.1.0-alpha2",
|
|
89
89
|
"@xchainjs/xchain-terra": "^0.3.0",
|
|
90
90
|
"@xchainjs/xchain-thorchain": "^0.26.0",
|
|
91
|
-
"@xchainjs/xchain-thorchain-query":"^0.1.0-
|
|
91
|
+
"@xchainjs/xchain-thorchain-query":"^0.1.0-alpha1",
|
|
92
92
|
"@xchainjs/xchain-util": "^0.9.0",
|
|
93
93
|
"axios": "^0.25.0",
|
|
94
94
|
"axios-retry": "^3.2.5",
|