@xchainjs/xchain-thorchain-amm 0.3.16 → 0.3.17
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 +62 -0
- package/lib/index.js +62 -0
- package/package.json +3 -1
package/lib/index.esm.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Client as Client$8, defaultAvaxParams, AVAXChain } from '@xchainjs/xcha
|
|
|
2
2
|
import { Client as Client$6 } from '@xchainjs/xchain-binance';
|
|
3
3
|
import { Client as Client$1 } from '@xchainjs/xchain-bitcoin';
|
|
4
4
|
import { Client } from '@xchainjs/xchain-bitcoincash';
|
|
5
|
+
import { Client as Client$9, defaultBscParams, BSCChain } from '@xchainjs/xchain-bsc';
|
|
5
6
|
import { FeeOption } from '@xchainjs/xchain-client';
|
|
6
7
|
import { Client as Client$7 } from '@xchainjs/xchain-cosmos';
|
|
7
8
|
import { Client as Client$2 } from '@xchainjs/xchain-doge';
|
|
@@ -258,6 +259,7 @@ class Wallet {
|
|
|
258
259
|
BNB: new Client$6(settings),
|
|
259
260
|
GAIA: new Client$7(settings),
|
|
260
261
|
AVAX: new Client$8(Object.assign(Object.assign({}, defaultAvaxParams), { network: settings.network, phrase })),
|
|
262
|
+
BSC: new Client$9(Object.assign(Object.assign({}, defaultBscParams), { network: settings.network, phrase })),
|
|
261
263
|
};
|
|
262
264
|
this.ethHelper = new EthHelper(this.clients.ETH, this.thorchainQuery.thorchainCache);
|
|
263
265
|
}
|
|
@@ -384,6 +386,18 @@ class Wallet {
|
|
|
384
386
|
const hash = yield evmHelper.sendDeposit(params);
|
|
385
387
|
return { hash, url: client.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
386
388
|
}
|
|
389
|
+
else if (swap.input.asset.chain === BSCChain) {
|
|
390
|
+
const params = {
|
|
391
|
+
walletIndex: 0,
|
|
392
|
+
asset: swap.input.asset,
|
|
393
|
+
amount: swap.input.baseAmount,
|
|
394
|
+
feeOption: swap.feeOption || FeeOption.Fast,
|
|
395
|
+
memo: swap.memo,
|
|
396
|
+
};
|
|
397
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
398
|
+
const hash = yield evmHelper.sendDeposit(params);
|
|
399
|
+
return { hash, url: client.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
400
|
+
}
|
|
387
401
|
else {
|
|
388
402
|
const params = {
|
|
389
403
|
walletIndex: 0,
|
|
@@ -504,6 +518,18 @@ class Wallet {
|
|
|
504
518
|
const hash = yield evmHelper.sendDeposit(addParams);
|
|
505
519
|
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
506
520
|
}
|
|
521
|
+
else if (assetAmount.asset.chain === BSCChain) {
|
|
522
|
+
const addParams = {
|
|
523
|
+
wallIndex: 0,
|
|
524
|
+
asset: assetAmount.asset,
|
|
525
|
+
amount: assetAmount.baseAmount,
|
|
526
|
+
feeOption: FeeOption.Fast,
|
|
527
|
+
memo: memo,
|
|
528
|
+
};
|
|
529
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
530
|
+
const hash = yield evmHelper.sendDeposit(addParams);
|
|
531
|
+
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
532
|
+
}
|
|
507
533
|
else {
|
|
508
534
|
const addParams = {
|
|
509
535
|
wallIndex: 0,
|
|
@@ -556,6 +582,18 @@ class Wallet {
|
|
|
556
582
|
const hash = yield evmHelper.sendDeposit(addParams);
|
|
557
583
|
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
558
584
|
}
|
|
585
|
+
else if (dustAssetAmount.asset.chain === BSCChain) {
|
|
586
|
+
const addParams = {
|
|
587
|
+
wallIndex: 0,
|
|
588
|
+
asset: dustAssetAmount.asset,
|
|
589
|
+
amount: dustAssetAmount.baseAmount,
|
|
590
|
+
feeOption: FeeOption.Fast,
|
|
591
|
+
memo: memo,
|
|
592
|
+
};
|
|
593
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
594
|
+
const hash = yield evmHelper.sendDeposit(addParams);
|
|
595
|
+
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
596
|
+
}
|
|
559
597
|
else {
|
|
560
598
|
const addParams = {
|
|
561
599
|
wallIndex: 0,
|
|
@@ -609,6 +647,18 @@ class Wallet {
|
|
|
609
647
|
const hash = yield evmHelper.sendDeposit(addParams);
|
|
610
648
|
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
611
649
|
}
|
|
650
|
+
else if (params.asset.asset.chain === BSCChain) {
|
|
651
|
+
const addParams = {
|
|
652
|
+
wallIndex: 0,
|
|
653
|
+
asset: params.asset.asset,
|
|
654
|
+
amount: params.asset.baseAmount,
|
|
655
|
+
feeOption: FeeOption.Fast,
|
|
656
|
+
memo: constructedMemo,
|
|
657
|
+
};
|
|
658
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
659
|
+
const hash = yield evmHelper.sendDeposit(addParams);
|
|
660
|
+
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
661
|
+
}
|
|
612
662
|
else {
|
|
613
663
|
const addParams = {
|
|
614
664
|
wallIndex: 0,
|
|
@@ -663,6 +713,18 @@ class Wallet {
|
|
|
663
713
|
const hash = yield evmHelper.sendDeposit(withdrawParams);
|
|
664
714
|
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
665
715
|
}
|
|
716
|
+
else if (params.assetFee.asset.chain === BSCChain) {
|
|
717
|
+
const withdrawParams = {
|
|
718
|
+
wallIndex: 0,
|
|
719
|
+
asset: params.assetFee.asset,
|
|
720
|
+
amount: params.assetFee.baseAmount,
|
|
721
|
+
feeOption: FeeOption.Fast,
|
|
722
|
+
memo: constructedMemo,
|
|
723
|
+
};
|
|
724
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
725
|
+
const hash = yield evmHelper.sendDeposit(withdrawParams);
|
|
726
|
+
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
727
|
+
}
|
|
666
728
|
else {
|
|
667
729
|
const withdrawParams = {
|
|
668
730
|
wallIndex: 0,
|
package/lib/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var xchainAvax = require('@xchainjs/xchain-avax');
|
|
|
6
6
|
var xchainBinance = require('@xchainjs/xchain-binance');
|
|
7
7
|
var xchainBitcoin = require('@xchainjs/xchain-bitcoin');
|
|
8
8
|
var xchainBitcoincash = require('@xchainjs/xchain-bitcoincash');
|
|
9
|
+
var xchainBsc = require('@xchainjs/xchain-bsc');
|
|
9
10
|
var xchainClient = require('@xchainjs/xchain-client');
|
|
10
11
|
var xchainCosmos = require('@xchainjs/xchain-cosmos');
|
|
11
12
|
var xchainDoge = require('@xchainjs/xchain-doge');
|
|
@@ -262,6 +263,7 @@ class Wallet {
|
|
|
262
263
|
BNB: new xchainBinance.Client(settings),
|
|
263
264
|
GAIA: new xchainCosmos.Client(settings),
|
|
264
265
|
AVAX: new xchainAvax.Client(Object.assign(Object.assign({}, xchainAvax.defaultAvaxParams), { network: settings.network, phrase })),
|
|
266
|
+
BSC: new xchainBsc.Client(Object.assign(Object.assign({}, xchainBsc.defaultBscParams), { network: settings.network, phrase })),
|
|
265
267
|
};
|
|
266
268
|
this.ethHelper = new EthHelper(this.clients.ETH, this.thorchainQuery.thorchainCache);
|
|
267
269
|
}
|
|
@@ -388,6 +390,18 @@ class Wallet {
|
|
|
388
390
|
const hash = yield evmHelper.sendDeposit(params);
|
|
389
391
|
return { hash, url: client.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
390
392
|
}
|
|
393
|
+
else if (swap.input.asset.chain === xchainBsc.BSCChain) {
|
|
394
|
+
const params = {
|
|
395
|
+
walletIndex: 0,
|
|
396
|
+
asset: swap.input.asset,
|
|
397
|
+
amount: swap.input.baseAmount,
|
|
398
|
+
feeOption: swap.feeOption || xchainClient.FeeOption.Fast,
|
|
399
|
+
memo: swap.memo,
|
|
400
|
+
};
|
|
401
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
402
|
+
const hash = yield evmHelper.sendDeposit(params);
|
|
403
|
+
return { hash, url: client.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
404
|
+
}
|
|
391
405
|
else {
|
|
392
406
|
const params = {
|
|
393
407
|
walletIndex: 0,
|
|
@@ -508,6 +522,18 @@ class Wallet {
|
|
|
508
522
|
const hash = yield evmHelper.sendDeposit(addParams);
|
|
509
523
|
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
510
524
|
}
|
|
525
|
+
else if (assetAmount.asset.chain === xchainBsc.BSCChain) {
|
|
526
|
+
const addParams = {
|
|
527
|
+
wallIndex: 0,
|
|
528
|
+
asset: assetAmount.asset,
|
|
529
|
+
amount: assetAmount.baseAmount,
|
|
530
|
+
feeOption: xchainClient.FeeOption.Fast,
|
|
531
|
+
memo: memo,
|
|
532
|
+
};
|
|
533
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
534
|
+
const hash = yield evmHelper.sendDeposit(addParams);
|
|
535
|
+
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
536
|
+
}
|
|
511
537
|
else {
|
|
512
538
|
const addParams = {
|
|
513
539
|
wallIndex: 0,
|
|
@@ -560,6 +586,18 @@ class Wallet {
|
|
|
560
586
|
const hash = yield evmHelper.sendDeposit(addParams);
|
|
561
587
|
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
562
588
|
}
|
|
589
|
+
else if (dustAssetAmount.asset.chain === xchainBsc.BSCChain) {
|
|
590
|
+
const addParams = {
|
|
591
|
+
wallIndex: 0,
|
|
592
|
+
asset: dustAssetAmount.asset,
|
|
593
|
+
amount: dustAssetAmount.baseAmount,
|
|
594
|
+
feeOption: xchainClient.FeeOption.Fast,
|
|
595
|
+
memo: memo,
|
|
596
|
+
};
|
|
597
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
598
|
+
const hash = yield evmHelper.sendDeposit(addParams);
|
|
599
|
+
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
600
|
+
}
|
|
563
601
|
else {
|
|
564
602
|
const addParams = {
|
|
565
603
|
wallIndex: 0,
|
|
@@ -613,6 +651,18 @@ class Wallet {
|
|
|
613
651
|
const hash = yield evmHelper.sendDeposit(addParams);
|
|
614
652
|
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
615
653
|
}
|
|
654
|
+
else if (params.asset.asset.chain === xchainBsc.BSCChain) {
|
|
655
|
+
const addParams = {
|
|
656
|
+
wallIndex: 0,
|
|
657
|
+
asset: params.asset.asset,
|
|
658
|
+
amount: params.asset.baseAmount,
|
|
659
|
+
feeOption: xchainClient.FeeOption.Fast,
|
|
660
|
+
memo: constructedMemo,
|
|
661
|
+
};
|
|
662
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
663
|
+
const hash = yield evmHelper.sendDeposit(addParams);
|
|
664
|
+
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
665
|
+
}
|
|
616
666
|
else {
|
|
617
667
|
const addParams = {
|
|
618
668
|
wallIndex: 0,
|
|
@@ -667,6 +717,18 @@ class Wallet {
|
|
|
667
717
|
const hash = yield evmHelper.sendDeposit(withdrawParams);
|
|
668
718
|
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
669
719
|
}
|
|
720
|
+
else if (params.assetFee.asset.chain === xchainBsc.BSCChain) {
|
|
721
|
+
const withdrawParams = {
|
|
722
|
+
wallIndex: 0,
|
|
723
|
+
asset: params.assetFee.asset,
|
|
724
|
+
amount: params.assetFee.baseAmount,
|
|
725
|
+
feeOption: xchainClient.FeeOption.Fast,
|
|
726
|
+
memo: constructedMemo,
|
|
727
|
+
};
|
|
728
|
+
const evmHelper = new EvmHelper(this.clients.BSC, this.thorchainQuery.thorchainCache);
|
|
729
|
+
const hash = yield evmHelper.sendDeposit(withdrawParams);
|
|
730
|
+
return { hash, url: assetClient.getExplorerTxUrl(hash), waitTimeSeconds };
|
|
731
|
+
}
|
|
670
732
|
else {
|
|
671
733
|
const withdrawParams = {
|
|
672
734
|
wallIndex: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain-amm",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"description": "module that exposes estimating & swappping cryptocurrency assets on thorchain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@cosmos-client/core": "0.46.1",
|
|
41
41
|
"@psf/bitcoincashjs-lib": "^4.0.2",
|
|
42
42
|
"@xchainjs/xchain-avax": "^0.1.4",
|
|
43
|
+
"@xchainjs/xchain-bsc": "^0.1.0",
|
|
43
44
|
"@xchainjs/xchain-binance": "^5.6.7",
|
|
44
45
|
"@xchainjs/xchain-bitcoin": "^0.20.9",
|
|
45
46
|
"@xchainjs/xchain-bitcoincash": "^0.15.7",
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
"@cosmos-client/core": "0.46.1",
|
|
74
75
|
"@psf/bitcoincashjs-lib": "^4.0.2",
|
|
75
76
|
"@xchainjs/xchain-avax": "^0.1.4",
|
|
77
|
+
"@xchainjs/xchain-bsc": "^0.1.0",
|
|
76
78
|
"@xchainjs/xchain-binance": "^5.6.7",
|
|
77
79
|
"@xchainjs/xchain-bitcoin": "^0.20.9",
|
|
78
80
|
"@xchainjs/xchain-bitcoincash": "^0.15.7",
|