@xchainjs/xchain-mayachain-amm 1.0.12 → 1.0.14
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 +32 -4
- package/lib/index.js +32 -4
- package/package.json +5 -5
package/lib/index.esm.js
CHANGED
|
@@ -508878,6 +508878,34 @@ class Wallet {
|
|
|
508878
508878
|
throw Error(`getFeeRates method not supported in ${chain} chain`);
|
|
508879
508879
|
});
|
|
508880
508880
|
}
|
|
508881
|
+
/**
|
|
508882
|
+
* Estimate transfer fees
|
|
508883
|
+
* @param {UtxoTxParams | EvmTxParams} params to make the transfer estimation
|
|
508884
|
+
* @returns {Fees} Estimated fees
|
|
508885
|
+
*/
|
|
508886
|
+
estimateTransferFees(params) {
|
|
508887
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
508888
|
+
const client = this.getClient(params.asset.chain);
|
|
508889
|
+
if (this.isEvmClient(client)) {
|
|
508890
|
+
if (!this.isEvmTxParams(params))
|
|
508891
|
+
throw Error(`Invalid params for estimating ${params.asset.chain} transfer`);
|
|
508892
|
+
return client.getFees(params);
|
|
508893
|
+
}
|
|
508894
|
+
if (this.isUtxoClient(client)) {
|
|
508895
|
+
if (!this.isUtxoTxParams(params))
|
|
508896
|
+
throw Error(`Invalid params for estimating ${params.asset.chain} transfer`);
|
|
508897
|
+
let sender;
|
|
508898
|
+
try {
|
|
508899
|
+
sender = yield this.getAddress(params.asset.chain);
|
|
508900
|
+
}
|
|
508901
|
+
catch (_a) {
|
|
508902
|
+
/* Empty */
|
|
508903
|
+
}
|
|
508904
|
+
return client.getFees({ sender, memo: params.memo });
|
|
508905
|
+
}
|
|
508906
|
+
return client.getFees();
|
|
508907
|
+
});
|
|
508908
|
+
}
|
|
508881
508909
|
/**
|
|
508882
508910
|
* Make a transaction
|
|
508883
508911
|
* @param {TxParams} txParams txParams - The parameters to make the transfer
|
|
@@ -508925,11 +508953,11 @@ class Wallet {
|
|
|
508925
508953
|
* @returns {string} the hash of the deposit
|
|
508926
508954
|
* @throws {Error} if cannot make deposit with the asset
|
|
508927
508955
|
*/
|
|
508928
|
-
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, }) {
|
|
508956
|
+
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, chain, }) {
|
|
508929
508957
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
508930
|
-
const client = this.getClient(
|
|
508958
|
+
const client = this.getClient(chain);
|
|
508931
508959
|
if (!('deposit' in client))
|
|
508932
|
-
throw Error(`Can not deposit with ${
|
|
508960
|
+
throw Error(`Can not deposit with ${chain} client`);
|
|
508933
508961
|
return client.deposit({ asset, amount, memo, walletIndex, sequence, gasLimit });
|
|
508934
508962
|
});
|
|
508935
508963
|
}
|
|
@@ -509238,7 +509266,7 @@ class MayachainAMM {
|
|
|
509238
509266
|
doProtocolAssetSwap(amount, memo) {
|
|
509239
509267
|
return __awaiter$8(this, void 0, void 0, function* () {
|
|
509240
509268
|
// Deposit the amount and return transaction hash and URL
|
|
509241
|
-
const hash = yield this.wallet.deposit({ asset: amount.asset, amount: amount.baseAmount, memo });
|
|
509269
|
+
const hash = yield this.wallet.deposit({ chain: MAYAChain, asset: amount.asset, amount: amount.baseAmount, memo });
|
|
509242
509270
|
return {
|
|
509243
509271
|
hash,
|
|
509244
509272
|
url: yield this.wallet.getExplorerTxUrl(amount.asset.chain, hash),
|
package/lib/index.js
CHANGED
|
@@ -508909,6 +508909,34 @@ class Wallet {
|
|
|
508909
508909
|
throw Error(`getFeeRates method not supported in ${chain} chain`);
|
|
508910
508910
|
});
|
|
508911
508911
|
}
|
|
508912
|
+
/**
|
|
508913
|
+
* Estimate transfer fees
|
|
508914
|
+
* @param {UtxoTxParams | EvmTxParams} params to make the transfer estimation
|
|
508915
|
+
* @returns {Fees} Estimated fees
|
|
508916
|
+
*/
|
|
508917
|
+
estimateTransferFees(params) {
|
|
508918
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
508919
|
+
const client = this.getClient(params.asset.chain);
|
|
508920
|
+
if (this.isEvmClient(client)) {
|
|
508921
|
+
if (!this.isEvmTxParams(params))
|
|
508922
|
+
throw Error(`Invalid params for estimating ${params.asset.chain} transfer`);
|
|
508923
|
+
return client.getFees(params);
|
|
508924
|
+
}
|
|
508925
|
+
if (this.isUtxoClient(client)) {
|
|
508926
|
+
if (!this.isUtxoTxParams(params))
|
|
508927
|
+
throw Error(`Invalid params for estimating ${params.asset.chain} transfer`);
|
|
508928
|
+
let sender;
|
|
508929
|
+
try {
|
|
508930
|
+
sender = yield this.getAddress(params.asset.chain);
|
|
508931
|
+
}
|
|
508932
|
+
catch (_a) {
|
|
508933
|
+
/* Empty */
|
|
508934
|
+
}
|
|
508935
|
+
return client.getFees({ sender, memo: params.memo });
|
|
508936
|
+
}
|
|
508937
|
+
return client.getFees();
|
|
508938
|
+
});
|
|
508939
|
+
}
|
|
508912
508940
|
/**
|
|
508913
508941
|
* Make a transaction
|
|
508914
508942
|
* @param {TxParams} txParams txParams - The parameters to make the transfer
|
|
@@ -508956,11 +508984,11 @@ class Wallet {
|
|
|
508956
508984
|
* @returns {string} the hash of the deposit
|
|
508957
508985
|
* @throws {Error} if cannot make deposit with the asset
|
|
508958
508986
|
*/
|
|
508959
|
-
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, }) {
|
|
508987
|
+
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, chain, }) {
|
|
508960
508988
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
508961
|
-
const client = this.getClient(
|
|
508989
|
+
const client = this.getClient(chain);
|
|
508962
508990
|
if (!('deposit' in client))
|
|
508963
|
-
throw Error(`Can not deposit with ${
|
|
508991
|
+
throw Error(`Can not deposit with ${chain} client`);
|
|
508964
508992
|
return client.deposit({ asset, amount, memo, walletIndex, sequence, gasLimit });
|
|
508965
508993
|
});
|
|
508966
508994
|
}
|
|
@@ -509269,7 +509297,7 @@ class MayachainAMM {
|
|
|
509269
509297
|
doProtocolAssetSwap(amount, memo) {
|
|
509270
509298
|
return __awaiter$8(this, void 0, void 0, function* () {
|
|
509271
509299
|
// Deposit the amount and return transaction hash and URL
|
|
509272
|
-
const hash = yield this.wallet.deposit({ asset: amount.asset, amount: amount.baseAmount, memo });
|
|
509300
|
+
const hash = yield this.wallet.deposit({ chain: MAYAChain, asset: amount.asset, amount: amount.baseAmount, memo });
|
|
509273
509301
|
return {
|
|
509274
509302
|
hash,
|
|
509275
509303
|
url: yield this.wallet.getExplorerTxUrl(amount.asset.chain, hash),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-mayachain-amm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "module that exposes estimating & swapping cryptocurrency assets on mayachain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MAYAChain",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@xchainjs/xchain-ethereum": "0.31.6",
|
|
40
40
|
"@xchainjs/xchain-kujira": "0.1.12",
|
|
41
|
-
"@xchainjs/xchain-mayachain-query": "0.1.
|
|
41
|
+
"@xchainjs/xchain-mayachain-query": "0.1.9",
|
|
42
42
|
"@xchainjs/xchain-mayachain": "1.0.1",
|
|
43
43
|
"@xchainjs/xchain-thorchain": "1.0.4",
|
|
44
|
-
"@xchainjs/xchain-wallet": "0.1.
|
|
44
|
+
"@xchainjs/xchain-wallet": "0.1.8"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@cosmos-client/core": "0.46.1",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@xchainjs/xchain-crypto": "^0.3.1",
|
|
52
52
|
"@xchainjs/xchain-dash": "^0.2.12",
|
|
53
53
|
"@xchainjs/xchain-mayanode": "^0.1.3",
|
|
54
|
-
"@xchainjs/xchain-mayachain-query": "^0.1.
|
|
54
|
+
"@xchainjs/xchain-mayachain-query": "^0.1.9",
|
|
55
55
|
"@xchainjs/xchain-evm": "^0.4.5",
|
|
56
56
|
"@xchainjs/xchain-mayamidgard": "^0.1.1",
|
|
57
57
|
"@xchainjs/xchain-util": "^0.13.3",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@xchainjs/xchain-crypto": "^0.3.1",
|
|
76
76
|
"@xchainjs/xchain-dash": "^0.2.12",
|
|
77
77
|
"@xchainjs/xchain-mayanode": "^0.1.3",
|
|
78
|
-
"@xchainjs/xchain-mayachain-query": "^0.1.
|
|
78
|
+
"@xchainjs/xchain-mayachain-query": "^0.1.9",
|
|
79
79
|
"@xchainjs/xchain-evm": "^0.4.5",
|
|
80
80
|
"@xchainjs/xchain-mayamidgard": "^0.1.1",
|
|
81
81
|
"@xchainjs/xchain-util": "^0.13.3",
|