@xchainjs/xchain-mayachain-amm 2.0.11 → 2.0.12
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/README.md +54 -51
- package/lib/index.esm.js +114 -1
- package/lib/index.js +113 -0
- package/lib/mayachain-amm.d.ts +26 -2
- package/lib/types.d.ts +14 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,70 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1 align="center">MAYAChain AMM</h1>
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href='https://www.npmjs.com/package/@xchainjs/xchain-mayachain-amm' target='_blank'>
|
|
6
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/%40xchainjs%2Fxchain-mayachain-amm" />
|
|
7
|
+
</a>
|
|
8
|
+
<a href='https://www.npmjs.com/package/@xchainjs/xchain-mayachain-amm' target='_blank'>
|
|
9
|
+
<img alt="NPM Downloads" src="https://img.shields.io/npm/d18m/%40xchainjs%2Fxchain-mayachain-amm" />
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
<br />
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
MAYAChain AMM is a module that allows users and developers to interact with the MAYAChain protocol without having to worry about the underlining particularities of the protocol.
|
|
6
18
|
|
|
7
19
|
## Installation
|
|
8
20
|
|
|
9
|
-
```
|
|
21
|
+
```sh
|
|
10
22
|
yarn add @xchainjs/xchain-mayachain-amm
|
|
11
23
|
```
|
|
12
24
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@cosmos-client/core": "0.46.1",
|
|
18
|
-
"@psf/bitcoincashjs-lib": "^4.0.3",
|
|
19
|
-
"@xchainjs/xchain-bitcoin": "^0.23.6",
|
|
20
|
-
"@xchainjs/xchain-client": "^0.15.4",
|
|
21
|
-
"@xchainjs/xchain-cosmos-sdk": "^0.1.3",
|
|
22
|
-
"@xchainjs/xchain-crypto": "^0.3.0",
|
|
23
|
-
"@xchainjs/xchain-dash": "^0.2.5",
|
|
24
|
-
"@xchainjs/xchain-ethereum": "^0.31.1",
|
|
25
|
-
"@xchainjs/xchain-mayanode": "^0.1.2",
|
|
26
|
-
"@xchainjs/xchain-mayachain-query": "^0.1.0",
|
|
27
|
-
"@xchainjs/xchain-evm": "^0.4.1",
|
|
28
|
-
"@xchainjs/xchain-kujira": "^0.1.2",
|
|
29
|
-
"@xchainjs/xchain-mayachain": "^0.2.10",
|
|
30
|
-
"@xchainjs/xchain-mayamidgard": "^0.1.0",
|
|
31
|
-
"@xchainjs/xchain-thorchain": "^0.28.13",
|
|
32
|
-
"@xchainjs/xchain-util": "^0.13.1",
|
|
33
|
-
"@xchainjs/xchain-utxo-providers": "^0.2.8",
|
|
34
|
-
"axios": "^1.3.6",
|
|
35
|
-
"axios-retry": "^3.2.5",
|
|
36
|
-
"bignumber.js": "^9.0.0",
|
|
37
|
-
"bitcoinjs-lib": "5.2.0",
|
|
38
|
-
"coininfo": "^5.1.0",
|
|
39
|
-
"coinselect": "^3.1.12",
|
|
40
|
-
"dotenv": "^16.0.0",
|
|
41
|
-
"ethers": "^5.6.6",
|
|
42
|
-
"wif": "^2.0.6"
|
|
43
|
-
}
|
|
25
|
+
or
|
|
44
26
|
|
|
45
|
-
```
|
|
27
|
+
```sh
|
|
28
|
+
npm install @xchainjs/xchain-mayachain-amm
|
|
46
29
|
|
|
47
|
-
|
|
30
|
+
```
|
|
48
31
|
|
|
32
|
+
## Initialization
|
|
49
33
|
|
|
50
|
-
|
|
34
|
+
Using Mayachain AMM, you can initialize the main class of the module in consultation mode if you do not provide any parameters, this means you could retrieve information from the protocol, but you will not be able to make actions the protocol needs you to sign.
|
|
51
35
|
|
|
36
|
+
```ts
|
|
37
|
+
import { MayachainAMM } from '@xchainjs/xchain-mayachain-amm'
|
|
52
38
|
|
|
53
|
-
|
|
39
|
+
const mayachainAmm = new MayachainAMM()
|
|
40
|
+
```
|
|
54
41
|
|
|
55
|
-
|
|
42
|
+
Otherwise, if you want to be able make actions the protocol needs you to sign, you will need to initialize the main class of the protocol as follows
|
|
56
43
|
|
|
57
44
|
```ts
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
45
|
+
import { MayachainAMM } from '@xchainjs/xchain-mayachain-amm'
|
|
46
|
+
import { MayachainQuery } from '@xchainjs/xchain-mayachain-query'
|
|
47
|
+
import { Wallet } from '@xchainjs/xchain-wallet'
|
|
48
|
+
|
|
49
|
+
const mayaChainQuery = new MayachainQuery()
|
|
50
|
+
const wallet = new Wallet({
|
|
51
|
+
// Your XChainJS clients
|
|
52
|
+
})
|
|
53
|
+
const mayachainAmm = new MayachainAMM(mayaChainQuery, wallet)
|
|
68
54
|
```
|
|
69
55
|
|
|
70
|
-
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
Using MAYAChain AMM package, you could easily implement the following features
|
|
59
|
+
|
|
60
|
+
### Swaps
|
|
61
|
+
|
|
62
|
+
- Estimate swaps
|
|
63
|
+
- Do swaps
|
|
64
|
+
- Approve MAYAChain router to spend to be able to do ERC-20 swaps
|
|
65
|
+
|
|
66
|
+
### MAYANames
|
|
67
|
+
|
|
68
|
+
- Get MAYAName details
|
|
69
|
+
- Get MAYANames by owner
|
|
70
|
+
|
|
71
|
+
## Examples
|
|
72
|
+
|
|
73
|
+
You can find examples using the MAYAChain AMM package in the [mayachain-amm](https://github.com/xchainjs/xchainjs-lib/tree/master/examples/mayachain-amm) examples folder.
|
package/lib/index.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import 'crypto';
|
|
|
7
7
|
import require$$0$4$1 from 'buffer';
|
|
8
8
|
import { ethers } from 'ethers';
|
|
9
9
|
import { KUJIChain, Client as Client$2, defaultKujiParams, AssetKUJI } from '@xchainjs/xchain-kujira';
|
|
10
|
-
import { MAYAChain, Client } from '@xchainjs/xchain-mayachain';
|
|
10
|
+
import { MAYAChain, Client, AssetCacao, CACAO_DECIMAL } from '@xchainjs/xchain-mayachain';
|
|
11
11
|
import { MayachainQuery } from '@xchainjs/xchain-mayachain-query';
|
|
12
12
|
import { THORChain, Client as Client$1, AssetRuneNative } from '@xchainjs/xchain-thorchain';
|
|
13
13
|
import { Wallet as Wallet$1 } from '@xchainjs/xchain-wallet';
|
|
@@ -89870,6 +89870,119 @@ class MayachainAMM {
|
|
|
89870
89870
|
return this.mayachainQuery.getMAYANamesByOwner(owner);
|
|
89871
89871
|
});
|
|
89872
89872
|
}
|
|
89873
|
+
/**
|
|
89874
|
+
* Estimate the cost of a MAYAName registration
|
|
89875
|
+
* @param {RegisterMAYAName} params Params to make the registration
|
|
89876
|
+
* @returns {QuoteMAYAName} Memo to make the registration and the estimation of the operation
|
|
89877
|
+
*/
|
|
89878
|
+
estimateMAYANameRegistration(params) {
|
|
89879
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
89880
|
+
const errors = [];
|
|
89881
|
+
if (!validateAddress(this.mayachainQuery.getNetwork(), params.chain, params.chainAddress)) {
|
|
89882
|
+
errors.push(`Invalid address ${params.chainAddress} for ${params.chain} chain`);
|
|
89883
|
+
}
|
|
89884
|
+
if (!validateAddress(this.mayachainQuery.getNetwork(), MAYAChain, params.owner)) {
|
|
89885
|
+
errors.push(`Invalid owner ${params.owner} due it is not a MAYAChain address`);
|
|
89886
|
+
}
|
|
89887
|
+
if (errors.length) {
|
|
89888
|
+
return {
|
|
89889
|
+
memo: '',
|
|
89890
|
+
errors,
|
|
89891
|
+
value: new CryptoAmount(baseAmount(0, CACAO_DECIMAL), AssetCacao),
|
|
89892
|
+
allowed: false,
|
|
89893
|
+
};
|
|
89894
|
+
}
|
|
89895
|
+
try {
|
|
89896
|
+
const estimated = yield this.mayachainQuery.estimateMAYAName(Object.assign({}, params));
|
|
89897
|
+
return Object.assign(Object.assign({}, estimated), { allowed: true, errors: [] });
|
|
89898
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89899
|
+
}
|
|
89900
|
+
catch (e) {
|
|
89901
|
+
return {
|
|
89902
|
+
memo: '',
|
|
89903
|
+
errors: ['message' in e ? e.message : `Unknown error: ${e}`],
|
|
89904
|
+
value: new CryptoAmount(baseAmount(0, CACAO_DECIMAL), AssetCacao),
|
|
89905
|
+
allowed: false,
|
|
89906
|
+
};
|
|
89907
|
+
}
|
|
89908
|
+
});
|
|
89909
|
+
}
|
|
89910
|
+
/**
|
|
89911
|
+
* Estimate the cost of an update of a MAYAName
|
|
89912
|
+
* @param {QuoteMAYANameParams} params Params to make the update
|
|
89913
|
+
* @returns {QuoteMAYAName} Memo to make the update and the estimation of the operation
|
|
89914
|
+
*/
|
|
89915
|
+
estimateMAYANameUpdate(params) {
|
|
89916
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
89917
|
+
const errors = [];
|
|
89918
|
+
if ((params.chain && !params.chainAddress) || (!params.chain && params.chainAddress)) {
|
|
89919
|
+
errors.push(`Alias not provided correctly`);
|
|
89920
|
+
}
|
|
89921
|
+
if (params.chain &&
|
|
89922
|
+
params.chainAddress &&
|
|
89923
|
+
!validateAddress(this.mayachainQuery.getNetwork(), params.chain, params.chainAddress)) {
|
|
89924
|
+
errors.push(`Invalid alias ${params.chainAddress} for ${params.chain} chain`);
|
|
89925
|
+
}
|
|
89926
|
+
if (params.owner && !validateAddress(this.mayachainQuery.getNetwork(), MAYAChain, params.owner)) {
|
|
89927
|
+
errors.push(`Invalid owner ${params.owner} due it is not a MAYAChain address`);
|
|
89928
|
+
}
|
|
89929
|
+
if (errors.length) {
|
|
89930
|
+
return {
|
|
89931
|
+
memo: '',
|
|
89932
|
+
errors,
|
|
89933
|
+
value: new CryptoAmount(baseAmount(0, CACAO_DECIMAL), AssetCacao),
|
|
89934
|
+
allowed: false,
|
|
89935
|
+
};
|
|
89936
|
+
}
|
|
89937
|
+
try {
|
|
89938
|
+
const estimated = yield this.mayachainQuery.estimateMAYAName(Object.assign(Object.assign({}, params), { isUpdate: true }));
|
|
89939
|
+
return Object.assign(Object.assign({}, estimated), { allowed: true, errors: [] });
|
|
89940
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89941
|
+
}
|
|
89942
|
+
catch (e) {
|
|
89943
|
+
return {
|
|
89944
|
+
memo: '',
|
|
89945
|
+
errors: ['message' in e ? e.message : `Unknown error: ${e}`],
|
|
89946
|
+
value: new CryptoAmount(baseAmount(0, CACAO_DECIMAL), AssetCacao),
|
|
89947
|
+
allowed: false,
|
|
89948
|
+
};
|
|
89949
|
+
}
|
|
89950
|
+
});
|
|
89951
|
+
}
|
|
89952
|
+
/**
|
|
89953
|
+
* Register a MAYAName
|
|
89954
|
+
* @param {RegisterMAYAName} params Params to make the registration
|
|
89955
|
+
* @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
|
|
89956
|
+
*/
|
|
89957
|
+
registerMAYAName(params) {
|
|
89958
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
89959
|
+
const quote = yield this.estimateMAYANameRegistration(params);
|
|
89960
|
+
if (!quote.allowed)
|
|
89961
|
+
throw Error(`Can not register MAYAName. ${quote.errors.join(' ')}`);
|
|
89962
|
+
return MayachainAction.makeAction({
|
|
89963
|
+
wallet: this.wallet,
|
|
89964
|
+
assetAmount: quote.value,
|
|
89965
|
+
memo: quote.memo,
|
|
89966
|
+
});
|
|
89967
|
+
});
|
|
89968
|
+
}
|
|
89969
|
+
/**
|
|
89970
|
+
* Update a MAYAName
|
|
89971
|
+
* @param {QuoteMAYANameParams} params Params to make the update
|
|
89972
|
+
* @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
|
|
89973
|
+
*/
|
|
89974
|
+
updateMAYAName(params) {
|
|
89975
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
89976
|
+
const quote = yield this.estimateMAYANameUpdate(params);
|
|
89977
|
+
if (!quote.allowed)
|
|
89978
|
+
throw Error(`Can not update MAYAName. ${quote.errors.join(' ')}`);
|
|
89979
|
+
return MayachainAction.makeAction({
|
|
89980
|
+
wallet: this.wallet,
|
|
89981
|
+
assetAmount: quote.value,
|
|
89982
|
+
memo: quote.memo,
|
|
89983
|
+
});
|
|
89984
|
+
});
|
|
89985
|
+
}
|
|
89873
89986
|
/**
|
|
89874
89987
|
* Check if a name is a valid MAYAName
|
|
89875
89988
|
* @param {string} name MAYAName to check
|
package/lib/index.js
CHANGED
|
@@ -89878,6 +89878,119 @@ class MayachainAMM {
|
|
|
89878
89878
|
return this.mayachainQuery.getMAYANamesByOwner(owner);
|
|
89879
89879
|
});
|
|
89880
89880
|
}
|
|
89881
|
+
/**
|
|
89882
|
+
* Estimate the cost of a MAYAName registration
|
|
89883
|
+
* @param {RegisterMAYAName} params Params to make the registration
|
|
89884
|
+
* @returns {QuoteMAYAName} Memo to make the registration and the estimation of the operation
|
|
89885
|
+
*/
|
|
89886
|
+
estimateMAYANameRegistration(params) {
|
|
89887
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
89888
|
+
const errors = [];
|
|
89889
|
+
if (!validateAddress(this.mayachainQuery.getNetwork(), params.chain, params.chainAddress)) {
|
|
89890
|
+
errors.push(`Invalid address ${params.chainAddress} for ${params.chain} chain`);
|
|
89891
|
+
}
|
|
89892
|
+
if (!validateAddress(this.mayachainQuery.getNetwork(), xchainMayachain.MAYAChain, params.owner)) {
|
|
89893
|
+
errors.push(`Invalid owner ${params.owner} due it is not a MAYAChain address`);
|
|
89894
|
+
}
|
|
89895
|
+
if (errors.length) {
|
|
89896
|
+
return {
|
|
89897
|
+
memo: '',
|
|
89898
|
+
errors,
|
|
89899
|
+
value: new CryptoAmount(baseAmount(0, xchainMayachain.CACAO_DECIMAL), xchainMayachain.AssetCacao),
|
|
89900
|
+
allowed: false,
|
|
89901
|
+
};
|
|
89902
|
+
}
|
|
89903
|
+
try {
|
|
89904
|
+
const estimated = yield this.mayachainQuery.estimateMAYAName(Object.assign({}, params));
|
|
89905
|
+
return Object.assign(Object.assign({}, estimated), { allowed: true, errors: [] });
|
|
89906
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89907
|
+
}
|
|
89908
|
+
catch (e) {
|
|
89909
|
+
return {
|
|
89910
|
+
memo: '',
|
|
89911
|
+
errors: ['message' in e ? e.message : `Unknown error: ${e}`],
|
|
89912
|
+
value: new CryptoAmount(baseAmount(0, xchainMayachain.CACAO_DECIMAL), xchainMayachain.AssetCacao),
|
|
89913
|
+
allowed: false,
|
|
89914
|
+
};
|
|
89915
|
+
}
|
|
89916
|
+
});
|
|
89917
|
+
}
|
|
89918
|
+
/**
|
|
89919
|
+
* Estimate the cost of an update of a MAYAName
|
|
89920
|
+
* @param {QuoteMAYANameParams} params Params to make the update
|
|
89921
|
+
* @returns {QuoteMAYAName} Memo to make the update and the estimation of the operation
|
|
89922
|
+
*/
|
|
89923
|
+
estimateMAYANameUpdate(params) {
|
|
89924
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
89925
|
+
const errors = [];
|
|
89926
|
+
if ((params.chain && !params.chainAddress) || (!params.chain && params.chainAddress)) {
|
|
89927
|
+
errors.push(`Alias not provided correctly`);
|
|
89928
|
+
}
|
|
89929
|
+
if (params.chain &&
|
|
89930
|
+
params.chainAddress &&
|
|
89931
|
+
!validateAddress(this.mayachainQuery.getNetwork(), params.chain, params.chainAddress)) {
|
|
89932
|
+
errors.push(`Invalid alias ${params.chainAddress} for ${params.chain} chain`);
|
|
89933
|
+
}
|
|
89934
|
+
if (params.owner && !validateAddress(this.mayachainQuery.getNetwork(), xchainMayachain.MAYAChain, params.owner)) {
|
|
89935
|
+
errors.push(`Invalid owner ${params.owner} due it is not a MAYAChain address`);
|
|
89936
|
+
}
|
|
89937
|
+
if (errors.length) {
|
|
89938
|
+
return {
|
|
89939
|
+
memo: '',
|
|
89940
|
+
errors,
|
|
89941
|
+
value: new CryptoAmount(baseAmount(0, xchainMayachain.CACAO_DECIMAL), xchainMayachain.AssetCacao),
|
|
89942
|
+
allowed: false,
|
|
89943
|
+
};
|
|
89944
|
+
}
|
|
89945
|
+
try {
|
|
89946
|
+
const estimated = yield this.mayachainQuery.estimateMAYAName(Object.assign(Object.assign({}, params), { isUpdate: true }));
|
|
89947
|
+
return Object.assign(Object.assign({}, estimated), { allowed: true, errors: [] });
|
|
89948
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89949
|
+
}
|
|
89950
|
+
catch (e) {
|
|
89951
|
+
return {
|
|
89952
|
+
memo: '',
|
|
89953
|
+
errors: ['message' in e ? e.message : `Unknown error: ${e}`],
|
|
89954
|
+
value: new CryptoAmount(baseAmount(0, xchainMayachain.CACAO_DECIMAL), xchainMayachain.AssetCacao),
|
|
89955
|
+
allowed: false,
|
|
89956
|
+
};
|
|
89957
|
+
}
|
|
89958
|
+
});
|
|
89959
|
+
}
|
|
89960
|
+
/**
|
|
89961
|
+
* Register a MAYAName
|
|
89962
|
+
* @param {RegisterMAYAName} params Params to make the registration
|
|
89963
|
+
* @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
|
|
89964
|
+
*/
|
|
89965
|
+
registerMAYAName(params) {
|
|
89966
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
89967
|
+
const quote = yield this.estimateMAYANameRegistration(params);
|
|
89968
|
+
if (!quote.allowed)
|
|
89969
|
+
throw Error(`Can not register MAYAName. ${quote.errors.join(' ')}`);
|
|
89970
|
+
return MayachainAction.makeAction({
|
|
89971
|
+
wallet: this.wallet,
|
|
89972
|
+
assetAmount: quote.value,
|
|
89973
|
+
memo: quote.memo,
|
|
89974
|
+
});
|
|
89975
|
+
});
|
|
89976
|
+
}
|
|
89977
|
+
/**
|
|
89978
|
+
* Update a MAYAName
|
|
89979
|
+
* @param {QuoteMAYANameParams} params Params to make the update
|
|
89980
|
+
* @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
|
|
89981
|
+
*/
|
|
89982
|
+
updateMAYAName(params) {
|
|
89983
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
89984
|
+
const quote = yield this.estimateMAYANameUpdate(params);
|
|
89985
|
+
if (!quote.allowed)
|
|
89986
|
+
throw Error(`Can not update MAYAName. ${quote.errors.join(' ')}`);
|
|
89987
|
+
return MayachainAction.makeAction({
|
|
89988
|
+
wallet: this.wallet,
|
|
89989
|
+
assetAmount: quote.value,
|
|
89990
|
+
memo: quote.memo,
|
|
89991
|
+
});
|
|
89992
|
+
});
|
|
89993
|
+
}
|
|
89881
89994
|
/**
|
|
89882
89995
|
* Check if a name is a valid MAYAName
|
|
89883
89996
|
* @param {string} name MAYAName to check
|
package/lib/mayachain-amm.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MAYANameDetails, MayachainQuery, QuoteSwap, QuoteSwapParams } from '@xchainjs/xchain-mayachain-query';
|
|
1
|
+
import { MAYANameDetails, MayachainQuery, QuoteSwap, QuoteSwapParams, RegisterMAYAName, UpdateMAYAName } from '@xchainjs/xchain-mayachain-query';
|
|
2
2
|
import { Address } from '@xchainjs/xchain-util';
|
|
3
3
|
import { Wallet } from '@xchainjs/xchain-wallet';
|
|
4
|
-
import { ApproveParams, IsApprovedParams, TxSubmitted } from './types';
|
|
4
|
+
import { ApproveParams, IsApprovedParams, QuoteMAYAName, TxSubmitted } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Mayachain Automated Market Maker (AMM) class.
|
|
7
7
|
* MAYAChainAMM class for interacting with THORChain.
|
|
@@ -63,6 +63,30 @@ export declare class MayachainAMM {
|
|
|
63
63
|
* @returns {MAYANameDetails[]} List of MAYANames owned by the address
|
|
64
64
|
*/
|
|
65
65
|
getMAYANamesByOwner(owner: Address): Promise<MAYANameDetails[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Estimate the cost of a MAYAName registration
|
|
68
|
+
* @param {RegisterMAYAName} params Params to make the registration
|
|
69
|
+
* @returns {QuoteMAYAName} Memo to make the registration and the estimation of the operation
|
|
70
|
+
*/
|
|
71
|
+
estimateMAYANameRegistration(params: RegisterMAYAName): Promise<QuoteMAYAName>;
|
|
72
|
+
/**
|
|
73
|
+
* Estimate the cost of an update of a MAYAName
|
|
74
|
+
* @param {QuoteMAYANameParams} params Params to make the update
|
|
75
|
+
* @returns {QuoteMAYAName} Memo to make the update and the estimation of the operation
|
|
76
|
+
*/
|
|
77
|
+
estimateMAYANameUpdate(params: UpdateMAYAName): Promise<QuoteMAYAName>;
|
|
78
|
+
/**
|
|
79
|
+
* Register a MAYAName
|
|
80
|
+
* @param {RegisterMAYAName} params Params to make the registration
|
|
81
|
+
* @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
|
|
82
|
+
*/
|
|
83
|
+
registerMAYAName(params: RegisterMAYAName): Promise<TxSubmitted>;
|
|
84
|
+
/**
|
|
85
|
+
* Update a MAYAName
|
|
86
|
+
* @param {QuoteMAYANameParams} params Params to make the update
|
|
87
|
+
* @returns {QuoteMAYAName} Memo to make the update or the registration and the estimation of the operation
|
|
88
|
+
*/
|
|
89
|
+
updateMAYAName(params: UpdateMAYAName): Promise<TxSubmitted>;
|
|
66
90
|
/**
|
|
67
91
|
* Check if a name is a valid MAYAName
|
|
68
92
|
* @param {string} name MAYAName to check
|
package/lib/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QuoteMAYAName as BaseQuoteMAYAName } from '@xchainjs/xchain-mayachain-query';
|
|
1
2
|
import { Address, Asset, CryptoAmount } from '@xchainjs/xchain-util';
|
|
2
3
|
export type TxSubmitted = {
|
|
3
4
|
hash: string;
|
|
@@ -12,3 +13,16 @@ export type IsApprovedParams = {
|
|
|
12
13
|
amount: CryptoAmount;
|
|
13
14
|
address: Address;
|
|
14
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* MAYAName quote parameters
|
|
18
|
+
*/
|
|
19
|
+
export type QuoteMAYAName = BaseQuoteMAYAName & {
|
|
20
|
+
/**
|
|
21
|
+
* If the action can be or not can be done
|
|
22
|
+
*/
|
|
23
|
+
allowed: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* If any, list of errors with the reason the operation is not allowed
|
|
26
|
+
*/
|
|
27
|
+
errors: string[];
|
|
28
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-mayachain-amm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"description": "module that exposes estimating & swapping cryptocurrency assets on mayachain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MAYAChain",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@xchainjs/xchain-ethereum": "0.32.6",
|
|
44
44
|
"@xchainjs/xchain-kujira": "0.1.21",
|
|
45
45
|
"@xchainjs/xchain-mayachain": "1.0.11",
|
|
46
|
-
"@xchainjs/xchain-mayachain-query": "0.1.
|
|
46
|
+
"@xchainjs/xchain-mayachain-query": "0.1.19",
|
|
47
47
|
"@xchainjs/xchain-thorchain": "1.1.1",
|
|
48
48
|
"@xchainjs/xchain-wallet": "0.1.19",
|
|
49
49
|
"ethers": "5.7.2"
|