@xchainjs/xchain-mayachain-amm 4.0.13 → 4.0.15
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 +14 -14
- package/lib/index.js +14 -14
- package/package.json +19 -19
package/lib/index.esm.js
CHANGED
|
@@ -124,8 +124,8 @@ class MayachainAction {
|
|
|
124
124
|
: this.makeProtocolAction(actionParams);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
static makeProtocolAction(
|
|
128
|
-
return __awaiter(this,
|
|
127
|
+
static makeProtocolAction(_a) {
|
|
128
|
+
return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, memo }) {
|
|
129
129
|
const hash = yield wallet.deposit({
|
|
130
130
|
chain: MAYAChain,
|
|
131
131
|
asset: assetAmount.asset,
|
|
@@ -138,8 +138,8 @@ class MayachainAction {
|
|
|
138
138
|
};
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
static makeNonProtocolAction(
|
|
142
|
-
return __awaiter(this,
|
|
141
|
+
static makeNonProtocolAction(_a) {
|
|
142
|
+
return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, recipient, memo, }) {
|
|
143
143
|
// Non EVM actions and non Radix action
|
|
144
144
|
if (!isProtocolEVMChain(assetAmount.asset.chain) && !eqAsset(assetAmount.asset, AssetXRD)) {
|
|
145
145
|
if (isProtocolBFTChain(assetAmount.asset.chain)) {
|
|
@@ -276,8 +276,8 @@ class MayachainAMM {
|
|
|
276
276
|
* @param {QuoteSwapParams} quoteSwapParams Swap parameters.
|
|
277
277
|
* @returns {QuoteSwap} Quote swap result. If swap cannot be done, it returns an empty QuoteSwap with reasons.
|
|
278
278
|
*/
|
|
279
|
-
estimateSwap(
|
|
280
|
-
return __awaiter(this,
|
|
279
|
+
estimateSwap(_a) {
|
|
280
|
+
return __awaiter(this, arguments, void 0, function* ({ fromAsset, fromAddress, amount, destinationAsset, destinationAddress, affiliateAddress, affiliateBps, toleranceBps, streamingInterval, streamingQuantity, }) {
|
|
281
281
|
const errors = yield this.validateSwap({
|
|
282
282
|
fromAsset,
|
|
283
283
|
fromAddress,
|
|
@@ -334,8 +334,8 @@ class MayachainAMM {
|
|
|
334
334
|
* @param {QuoteSwapParams} quoteSwapParams Swap parameters.
|
|
335
335
|
* @returns {string[]} Reasons the swap cannot be executed. Empty array if the swap is valid.
|
|
336
336
|
*/
|
|
337
|
-
validateSwap(
|
|
338
|
-
return __awaiter(this,
|
|
337
|
+
validateSwap(_a) {
|
|
338
|
+
return __awaiter(this, arguments, void 0, function* ({ fromAsset, fromAddress, destinationAsset, destinationAddress, amount, affiliateAddress, affiliateBps, streamingInterval, streamingQuantity, }) {
|
|
339
339
|
const errors = [];
|
|
340
340
|
// Validate destination address if provided
|
|
341
341
|
if (destinationAddress &&
|
|
@@ -381,8 +381,8 @@ class MayachainAMM {
|
|
|
381
381
|
* @param {QuoteSwapParams} quoteSwapParams Swap parameters
|
|
382
382
|
* @returns {TxSubmitted} Transaction hash and URL of the swap
|
|
383
383
|
*/
|
|
384
|
-
doSwap(
|
|
385
|
-
return __awaiter(this,
|
|
384
|
+
doSwap(_a) {
|
|
385
|
+
return __awaiter(this, arguments, void 0, function* ({ fromAsset, fromAddress, amount, destinationAsset, destinationAddress, affiliateAddress, affiliateBps, toleranceBps, streamingInterval, streamingQuantity, }) {
|
|
386
386
|
const quoteSwap = yield this.estimateSwap({
|
|
387
387
|
fromAsset,
|
|
388
388
|
fromAddress,
|
|
@@ -411,8 +411,8 @@ class MayachainAMM {
|
|
|
411
411
|
* @param {ApproveParams} approveParams Parameters for approving the router to spend
|
|
412
412
|
* @returns {Promise<TxSubmitted>} Transaction hash and URL
|
|
413
413
|
*/
|
|
414
|
-
approveRouterToSpend(
|
|
415
|
-
return __awaiter(this,
|
|
414
|
+
approveRouterToSpend(_a) {
|
|
415
|
+
return __awaiter(this, arguments, void 0, function* ({ asset, amount }) {
|
|
416
416
|
// Get inbound details for the asset chain
|
|
417
417
|
const inboundDetails = yield this.mayachainQuery.getChainInboundDetails(asset.chain);
|
|
418
418
|
if (!inboundDetails.router)
|
|
@@ -431,8 +431,8 @@ class MayachainAMM {
|
|
|
431
431
|
* @param {IsApprovedParams} isApprovedParams Parameters for checking approval.
|
|
432
432
|
* @returns {string[]} Reasons the asset router is not allowed to spend the amount. Empty array if the router is approved.
|
|
433
433
|
*/
|
|
434
|
-
isRouterApprovedToSpend(
|
|
435
|
-
return __awaiter(this,
|
|
434
|
+
isRouterApprovedToSpend(_a) {
|
|
435
|
+
return __awaiter(this, arguments, void 0, function* ({ asset, amount, address }) {
|
|
436
436
|
const errors = [];
|
|
437
437
|
if (!isProtocolERC20Asset(asset)) {
|
|
438
438
|
errors.push('Asset should be ERC20');
|
package/lib/index.js
CHANGED
|
@@ -126,8 +126,8 @@ class MayachainAction {
|
|
|
126
126
|
: this.makeProtocolAction(actionParams);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
static makeProtocolAction(
|
|
130
|
-
return __awaiter(this,
|
|
129
|
+
static makeProtocolAction(_a) {
|
|
130
|
+
return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, memo }) {
|
|
131
131
|
const hash = yield wallet.deposit({
|
|
132
132
|
chain: xchainMayachain.MAYAChain,
|
|
133
133
|
asset: assetAmount.asset,
|
|
@@ -140,8 +140,8 @@ class MayachainAction {
|
|
|
140
140
|
};
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
static makeNonProtocolAction(
|
|
144
|
-
return __awaiter(this,
|
|
143
|
+
static makeNonProtocolAction(_a) {
|
|
144
|
+
return __awaiter(this, arguments, void 0, function* ({ wallet, assetAmount, recipient, memo, }) {
|
|
145
145
|
// Non EVM actions and non Radix action
|
|
146
146
|
if (!isProtocolEVMChain(assetAmount.asset.chain) && !xchainUtil.eqAsset(assetAmount.asset, xchainRadix.AssetXRD)) {
|
|
147
147
|
if (isProtocolBFTChain(assetAmount.asset.chain)) {
|
|
@@ -278,8 +278,8 @@ class MayachainAMM {
|
|
|
278
278
|
* @param {QuoteSwapParams} quoteSwapParams Swap parameters.
|
|
279
279
|
* @returns {QuoteSwap} Quote swap result. If swap cannot be done, it returns an empty QuoteSwap with reasons.
|
|
280
280
|
*/
|
|
281
|
-
estimateSwap(
|
|
282
|
-
return __awaiter(this,
|
|
281
|
+
estimateSwap(_a) {
|
|
282
|
+
return __awaiter(this, arguments, void 0, function* ({ fromAsset, fromAddress, amount, destinationAsset, destinationAddress, affiliateAddress, affiliateBps, toleranceBps, streamingInterval, streamingQuantity, }) {
|
|
283
283
|
const errors = yield this.validateSwap({
|
|
284
284
|
fromAsset,
|
|
285
285
|
fromAddress,
|
|
@@ -336,8 +336,8 @@ class MayachainAMM {
|
|
|
336
336
|
* @param {QuoteSwapParams} quoteSwapParams Swap parameters.
|
|
337
337
|
* @returns {string[]} Reasons the swap cannot be executed. Empty array if the swap is valid.
|
|
338
338
|
*/
|
|
339
|
-
validateSwap(
|
|
340
|
-
return __awaiter(this,
|
|
339
|
+
validateSwap(_a) {
|
|
340
|
+
return __awaiter(this, arguments, void 0, function* ({ fromAsset, fromAddress, destinationAsset, destinationAddress, amount, affiliateAddress, affiliateBps, streamingInterval, streamingQuantity, }) {
|
|
341
341
|
const errors = [];
|
|
342
342
|
// Validate destination address if provided
|
|
343
343
|
if (destinationAddress &&
|
|
@@ -383,8 +383,8 @@ class MayachainAMM {
|
|
|
383
383
|
* @param {QuoteSwapParams} quoteSwapParams Swap parameters
|
|
384
384
|
* @returns {TxSubmitted} Transaction hash and URL of the swap
|
|
385
385
|
*/
|
|
386
|
-
doSwap(
|
|
387
|
-
return __awaiter(this,
|
|
386
|
+
doSwap(_a) {
|
|
387
|
+
return __awaiter(this, arguments, void 0, function* ({ fromAsset, fromAddress, amount, destinationAsset, destinationAddress, affiliateAddress, affiliateBps, toleranceBps, streamingInterval, streamingQuantity, }) {
|
|
388
388
|
const quoteSwap = yield this.estimateSwap({
|
|
389
389
|
fromAsset,
|
|
390
390
|
fromAddress,
|
|
@@ -413,8 +413,8 @@ class MayachainAMM {
|
|
|
413
413
|
* @param {ApproveParams} approveParams Parameters for approving the router to spend
|
|
414
414
|
* @returns {Promise<TxSubmitted>} Transaction hash and URL
|
|
415
415
|
*/
|
|
416
|
-
approveRouterToSpend(
|
|
417
|
-
return __awaiter(this,
|
|
416
|
+
approveRouterToSpend(_a) {
|
|
417
|
+
return __awaiter(this, arguments, void 0, function* ({ asset, amount }) {
|
|
418
418
|
// Get inbound details for the asset chain
|
|
419
419
|
const inboundDetails = yield this.mayachainQuery.getChainInboundDetails(asset.chain);
|
|
420
420
|
if (!inboundDetails.router)
|
|
@@ -433,8 +433,8 @@ class MayachainAMM {
|
|
|
433
433
|
* @param {IsApprovedParams} isApprovedParams Parameters for checking approval.
|
|
434
434
|
* @returns {string[]} Reasons the asset router is not allowed to spend the amount. Empty array if the router is approved.
|
|
435
435
|
*/
|
|
436
|
-
isRouterApprovedToSpend(
|
|
437
|
-
return __awaiter(this,
|
|
436
|
+
isRouterApprovedToSpend(_a) {
|
|
437
|
+
return __awaiter(this, arguments, void 0, function* ({ asset, amount, address }) {
|
|
438
438
|
const errors = [];
|
|
439
439
|
if (!isProtocolERC20Asset(asset)) {
|
|
440
440
|
errors.push('Asset should be ERC20');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-mayachain-amm",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.15",
|
|
4
4
|
"description": "module that exposes estimating & swapping cryptocurrency assets on mayachain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MAYAChain",
|
|
@@ -36,27 +36,27 @@
|
|
|
36
36
|
"url": "https://github.com/xchainjs/xchainjs-lib/issues"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xchainjs/xchain-arbitrum": "2.0.
|
|
40
|
-
"@xchainjs/xchain-bitcoin": "2.0.
|
|
41
|
-
"@xchainjs/xchain-client": "2.0.
|
|
42
|
-
"@xchainjs/xchain-crypto": "1.0.
|
|
43
|
-
"@xchainjs/xchain-dash": "2.0.
|
|
44
|
-
"@xchainjs/xchain-ethereum": "2.0.
|
|
45
|
-
"@xchainjs/xchain-evm": "2.0.
|
|
46
|
-
"@xchainjs/xchain-kujira": "2.0.
|
|
47
|
-
"@xchainjs/xchain-mayachain": "3.0.
|
|
48
|
-
"@xchainjs/xchain-mayachain-query": "2.0.
|
|
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.0.
|
|
39
|
+
"@xchainjs/xchain-arbitrum": "2.0.9",
|
|
40
|
+
"@xchainjs/xchain-bitcoin": "2.0.6",
|
|
41
|
+
"@xchainjs/xchain-client": "2.0.6",
|
|
42
|
+
"@xchainjs/xchain-crypto": "1.0.4",
|
|
43
|
+
"@xchainjs/xchain-dash": "2.0.6",
|
|
44
|
+
"@xchainjs/xchain-ethereum": "2.0.10",
|
|
45
|
+
"@xchainjs/xchain-evm": "2.0.9",
|
|
46
|
+
"@xchainjs/xchain-kujira": "2.0.6",
|
|
47
|
+
"@xchainjs/xchain-mayachain": "3.0.6",
|
|
48
|
+
"@xchainjs/xchain-mayachain-query": "2.0.8",
|
|
49
|
+
"@xchainjs/xchain-radix": "2.0.6",
|
|
50
|
+
"@xchainjs/xchain-thorchain": "3.0.10",
|
|
51
|
+
"@xchainjs/xchain-util": "2.0.4",
|
|
52
|
+
"@xchainjs/xchain-wallet": "2.0.13",
|
|
53
|
+
"@xchainjs/xchain-zcash": "1.0.7",
|
|
54
54
|
"ethers": "^6.14.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@ledgerhq/hw-transport-node-hid": "6.28.6",
|
|
58
|
-
"axios": "1.8.4",
|
|
59
|
-
"axios-mock-adapter": "2.1.0"
|
|
57
|
+
"@ledgerhq/hw-transport-node-hid": "^6.28.6",
|
|
58
|
+
"axios": "^1.8.4",
|
|
59
|
+
"axios-mock-adapter": "^2.1.0"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public",
|