@xchainjs/xchain-mayachain-amm 4.1.16 → 4.1.18
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 -34
- package/lib/index.js +4 -6
- package/package.json +17 -16
package/lib/index.esm.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { AssetAETH, ARBChain, Client, defaultArbParams } from '@xchainjs/xchain-arbitrum';
|
|
2
|
-
import { ZECChain, Client as Client$
|
|
3
|
-
import { BTCChain, Client as Client$
|
|
4
|
-
import { Network } from '@xchainjs/xchain-client';
|
|
5
|
-
import { DASHChain, Client as Client$
|
|
6
|
-
import { AssetETH, ETHChain, Client as Client$
|
|
1
|
+
import { AssetAETH, ARBChain, Client as Client$1, defaultArbParams } from '@xchainjs/xchain-arbitrum';
|
|
2
|
+
import { ZECChain, Client as Client$2, defaultZECParams } from '@xchainjs/xchain-zcash';
|
|
3
|
+
import { BTCChain, Client as Client$9, defaultBTCParams } from '@xchainjs/xchain-bitcoin';
|
|
4
|
+
import { Network, Protocol } from '@xchainjs/xchain-client';
|
|
5
|
+
import { DASHChain, Client as Client$7, defaultDashParams } from '@xchainjs/xchain-dash';
|
|
6
|
+
import { AssetETH, ETHChain, Client as Client$8, defaultEthParams } from '@xchainjs/xchain-ethereum';
|
|
7
7
|
import { abi, MAX_APPROVAL } from '@xchainjs/xchain-evm';
|
|
8
|
-
import { AssetKUJI, KUJIChain, Client as Client$
|
|
9
|
-
import { MAYAChain, Client as Client$
|
|
8
|
+
import { AssetKUJI, KUJIChain, Client as Client$6, defaultKujiParams } from '@xchainjs/xchain-kujira';
|
|
9
|
+
import { MAYAChain, Client as Client$4, AssetCacao, CACAO_DECIMAL } from '@xchainjs/xchain-mayachain';
|
|
10
10
|
import { MayachainQuery } from '@xchainjs/xchain-mayachain-query';
|
|
11
|
-
import { RadixChain, Client as Client$
|
|
12
|
-
import { AssetRuneNative, THORChain, Client as Client$
|
|
11
|
+
import { RadixChain, Client as Client$3, AssetXRD, generateAddressParam, generateBucketParam, generateStringParam } from '@xchainjs/xchain-radix';
|
|
12
|
+
import { AssetRuneNative, THORChain, Client as Client$5 } from '@xchainjs/xchain-thorchain';
|
|
13
13
|
import { eqAsset, isSynthAsset, getContractAddressFromAsset, baseAmount, isTradeAsset, CryptoAmount, assetToString, AssetCryptoAmount, AssetType } from '@xchainjs/xchain-util';
|
|
14
14
|
import { Wallet } from '@xchainjs/xchain-wallet';
|
|
15
|
+
import { ADAChain, Client, defaultAdaParams } from '@xchainjs/xchain-cardano';
|
|
15
16
|
import { getAddress, ZeroAddress, Contract } from 'ethers';
|
|
16
17
|
|
|
17
18
|
/******************************************************************************
|
|
@@ -94,23 +95,25 @@ const isRadixChain = (chain) => {
|
|
|
94
95
|
const validateAddress = (network, chain, address) => {
|
|
95
96
|
switch (chain) {
|
|
96
97
|
case BTCChain:
|
|
97
|
-
return new Client$
|
|
98
|
+
return new Client$9(Object.assign(Object.assign({}, defaultBTCParams), { network })).validateAddress(address);
|
|
98
99
|
case ETHChain:
|
|
99
|
-
return new Client$
|
|
100
|
+
return new Client$8(Object.assign(Object.assign({}, defaultEthParams), { network })).validateAddress(address);
|
|
100
101
|
case DASHChain:
|
|
101
|
-
return new Client$
|
|
102
|
+
return new Client$7(Object.assign(Object.assign({}, defaultDashParams), { network })).validateAddress(address);
|
|
102
103
|
case KUJIChain:
|
|
103
|
-
return new Client$
|
|
104
|
+
return new Client$6(Object.assign(Object.assign({}, defaultKujiParams), { network })).validateAddress(address);
|
|
104
105
|
case THORChain:
|
|
105
|
-
return new Client$
|
|
106
|
+
return new Client$5({ network }).validateAddress(address);
|
|
106
107
|
case MAYAChain:
|
|
107
|
-
return new Client$
|
|
108
|
+
return new Client$4({ network }).validateAddress(address);
|
|
108
109
|
case RadixChain:
|
|
109
|
-
return new Client$
|
|
110
|
+
return new Client$3({ network }).validateAddress(address);
|
|
110
111
|
case ZECChain:
|
|
111
|
-
return new Client$
|
|
112
|
+
return new Client$2(Object.assign(Object.assign({}, defaultZECParams), { network })).validateAddress(address);
|
|
112
113
|
case ARBChain:
|
|
113
|
-
return new Client(Object.assign(Object.assign({}, defaultArbParams), { network: Network.Mainnet })).validateAddress(address);
|
|
114
|
+
return new Client$1(Object.assign(Object.assign({}, defaultArbParams), { network: Network.Mainnet })).validateAddress(address);
|
|
115
|
+
case ADAChain:
|
|
116
|
+
return new Client(Object.assign(Object.assign({}, defaultAdaParams), { network })).validateAddress(address);
|
|
114
117
|
default:
|
|
115
118
|
throw Error('Unsupported chain');
|
|
116
119
|
}
|
|
@@ -154,12 +157,7 @@ class MayachainAction {
|
|
|
154
157
|
url: yield wallet.getExplorerTxUrl(assetAmount.asset.chain, hash),
|
|
155
158
|
};
|
|
156
159
|
}
|
|
157
|
-
const feeRates = yield wallet.
|
|
158
|
-
asset: assetAmount.asset,
|
|
159
|
-
amount: assetAmount.baseAmount,
|
|
160
|
-
recipient,
|
|
161
|
-
memo,
|
|
162
|
-
});
|
|
160
|
+
const feeRates = yield wallet.getFeeRates(assetAmount.asset.chain, Protocol.MAYACHAIN);
|
|
163
161
|
const hash = yield wallet.transfer({
|
|
164
162
|
asset: assetAmount.asset,
|
|
165
163
|
amount: assetAmount.baseAmount,
|
|
@@ -261,15 +259,15 @@ class MayachainAMM {
|
|
|
261
259
|
* @returns {MayachainAMM} Returns the MayachainAMM instance.
|
|
262
260
|
*/
|
|
263
261
|
constructor(mayachainQuery = new MayachainQuery(), wallet = new Wallet({
|
|
264
|
-
BTC: new Client$
|
|
265
|
-
ETH: new Client$
|
|
266
|
-
DASH: new Client$
|
|
267
|
-
KUJI: new Client$
|
|
268
|
-
ARB: new Client(Object.assign(Object.assign({}, defaultArbParams), { network: Network.Mainnet })),
|
|
269
|
-
THOR: new Client$
|
|
270
|
-
MAYA: new Client$
|
|
271
|
-
XRD: new Client$
|
|
272
|
-
ZEC: new Client$
|
|
262
|
+
BTC: new Client$9(Object.assign(Object.assign({}, defaultBTCParams), { network: Network.Mainnet })),
|
|
263
|
+
ETH: new Client$8(Object.assign(Object.assign({}, defaultEthParams), { network: Network.Mainnet })),
|
|
264
|
+
DASH: new Client$7(Object.assign(Object.assign({}, defaultDashParams), { network: Network.Mainnet })),
|
|
265
|
+
KUJI: new Client$6(Object.assign(Object.assign({}, defaultKujiParams), { network: Network.Mainnet })),
|
|
266
|
+
ARB: new Client$1(Object.assign(Object.assign({}, defaultArbParams), { network: Network.Mainnet })),
|
|
267
|
+
THOR: new Client$5({ network: Network.Mainnet }),
|
|
268
|
+
MAYA: new Client$4({ network: Network.Mainnet }),
|
|
269
|
+
XRD: new Client$3({ network: Network.Mainnet }),
|
|
270
|
+
ZEC: new Client$2(Object.assign(Object.assign({}, defaultZECParams), { network: Network.Mainnet })),
|
|
273
271
|
})) {
|
|
274
272
|
this.mayachainQuery = mayachainQuery;
|
|
275
273
|
this.wallet = wallet;
|
package/lib/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var xchainRadix = require('@xchainjs/xchain-radix');
|
|
|
14
14
|
var xchainThorchain = require('@xchainjs/xchain-thorchain');
|
|
15
15
|
var xchainUtil = require('@xchainjs/xchain-util');
|
|
16
16
|
var xchainWallet = require('@xchainjs/xchain-wallet');
|
|
17
|
+
var xchainCardano = require('@xchainjs/xchain-cardano');
|
|
17
18
|
var ethers = require('ethers');
|
|
18
19
|
|
|
19
20
|
/******************************************************************************
|
|
@@ -113,6 +114,8 @@ const validateAddress = (network, chain, address) => {
|
|
|
113
114
|
return new xchainZcash.Client(Object.assign(Object.assign({}, xchainZcash.defaultZECParams), { network })).validateAddress(address);
|
|
114
115
|
case xchainArbitrum.ARBChain:
|
|
115
116
|
return new xchainArbitrum.Client(Object.assign(Object.assign({}, xchainArbitrum.defaultArbParams), { network: xchainClient.Network.Mainnet })).validateAddress(address);
|
|
117
|
+
case xchainCardano.ADAChain:
|
|
118
|
+
return new xchainCardano.Client(Object.assign(Object.assign({}, xchainCardano.defaultAdaParams), { network })).validateAddress(address);
|
|
116
119
|
default:
|
|
117
120
|
throw Error('Unsupported chain');
|
|
118
121
|
}
|
|
@@ -156,12 +159,7 @@ class MayachainAction {
|
|
|
156
159
|
url: yield wallet.getExplorerTxUrl(assetAmount.asset.chain, hash),
|
|
157
160
|
};
|
|
158
161
|
}
|
|
159
|
-
const feeRates = yield wallet.
|
|
160
|
-
asset: assetAmount.asset,
|
|
161
|
-
amount: assetAmount.baseAmount,
|
|
162
|
-
recipient,
|
|
163
|
-
memo,
|
|
164
|
-
});
|
|
162
|
+
const feeRates = yield wallet.getFeeRates(assetAmount.asset.chain, xchainClient.Protocol.MAYACHAIN);
|
|
165
163
|
const hash = yield wallet.transfer({
|
|
166
164
|
asset: assetAmount.asset,
|
|
167
165
|
amount: assetAmount.baseAmount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-mayachain-amm",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.18",
|
|
4
4
|
"description": "module that exposes estimating & swapping cryptocurrency assets on mayachain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MAYAChain",
|
|
@@ -36,26 +36,27 @@
|
|
|
36
36
|
"url": "https://github.com/xchainjs/xchainjs-lib/issues"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xchainjs/xchain-arbitrum": "2.1.
|
|
40
|
-
"@xchainjs/xchain-bitcoin": "2.2.
|
|
41
|
-
"@xchainjs/xchain-
|
|
39
|
+
"@xchainjs/xchain-arbitrum": "2.1.3",
|
|
40
|
+
"@xchainjs/xchain-bitcoin": "2.2.4",
|
|
41
|
+
"@xchainjs/xchain-cardano": "1.2.0",
|
|
42
|
+
"@xchainjs/xchain-client": "2.0.13",
|
|
42
43
|
"@xchainjs/xchain-crypto": "1.0.6",
|
|
43
|
-
"@xchainjs/xchain-dash": "2.2.
|
|
44
|
-
"@xchainjs/xchain-ethereum": "2.0.
|
|
45
|
-
"@xchainjs/xchain-evm": "2.0.
|
|
46
|
-
"@xchainjs/xchain-kujira": "2.0.
|
|
47
|
-
"@xchainjs/xchain-mayachain": "4.1.
|
|
48
|
-
"@xchainjs/xchain-mayachain-query": "2.1.
|
|
49
|
-
"@xchainjs/xchain-radix": "2.0.
|
|
50
|
-
"@xchainjs/xchain-thorchain": "3.0.
|
|
51
|
-
"@xchainjs/xchain-util": "2.0.
|
|
52
|
-
"@xchainjs/xchain-wallet": "2.0.
|
|
53
|
-
"@xchainjs/xchain-zcash": "1.3.
|
|
44
|
+
"@xchainjs/xchain-dash": "2.2.4",
|
|
45
|
+
"@xchainjs/xchain-ethereum": "2.0.18",
|
|
46
|
+
"@xchainjs/xchain-evm": "2.0.17",
|
|
47
|
+
"@xchainjs/xchain-kujira": "2.0.13",
|
|
48
|
+
"@xchainjs/xchain-mayachain": "4.1.4",
|
|
49
|
+
"@xchainjs/xchain-mayachain-query": "2.1.10",
|
|
50
|
+
"@xchainjs/xchain-radix": "2.0.14",
|
|
51
|
+
"@xchainjs/xchain-thorchain": "3.0.17",
|
|
52
|
+
"@xchainjs/xchain-util": "2.0.7",
|
|
53
|
+
"@xchainjs/xchain-wallet": "2.0.27",
|
|
54
|
+
"@xchainjs/xchain-zcash": "1.3.5",
|
|
54
55
|
"ethers": "^6.14.3"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@ledgerhq/hw-transport-node-hid": "^6.28.6",
|
|
58
|
-
"axios": "1.
|
|
59
|
+
"axios": "1.15.2",
|
|
59
60
|
"axios-mock-adapter": "^2.1.0"
|
|
60
61
|
},
|
|
61
62
|
"publishConfig": {
|