@xchainjs/xchain-aggregator 0.2.6 → 1.0.0
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 -6
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +13 -5
- package/lib/index.js.map +1 -1
- package/lib/protocols/chainflip/chainflipProtocol.d.ts +2 -2
- package/lib/protocols/chainflip/types.d.ts +2 -0
- package/lib/protocols/chainflip/utils.d.ts +3 -3
- package/lib/protocols/mayachain/mayachainProtocol.d.ts +2 -2
- package/lib/protocols/mayachain/types.d.ts +2 -0
- package/lib/protocols/thorchain/thorchainProtocol.d.ts +2 -2
- package/lib/types.d.ts +10 -10
- package/package.json +15 -15
package/lib/index.js
CHANGED
|
@@ -25434,7 +25434,7 @@ class ChainflipProtocol {
|
|
|
25434
25434
|
*/
|
|
25435
25435
|
isAssetSupported(asset) {
|
|
25436
25436
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25437
|
-
if (xchainUtil.isSynthAsset(asset))
|
|
25437
|
+
if (xchainUtil.isSynthAsset(asset) || xchainUtil.isTradeAsset(asset))
|
|
25438
25438
|
return false;
|
|
25439
25439
|
try {
|
|
25440
25440
|
yield this.getAssetData(asset);
|
|
@@ -25571,6 +25571,12 @@ class ChainflipProtocol {
|
|
|
25571
25571
|
*/
|
|
25572
25572
|
getAssetData(asset) {
|
|
25573
25573
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25574
|
+
if (xchainUtil.isSynthAsset(asset)) {
|
|
25575
|
+
throw Error('Synth asset not supported in Chainflip protocol');
|
|
25576
|
+
}
|
|
25577
|
+
if (xchainUtil.isTradeAsset(asset)) {
|
|
25578
|
+
throw Error('Trade asset not supported in Chainflip protocol');
|
|
25579
|
+
}
|
|
25574
25580
|
const chainAssets = yield this.assetsData.getValue();
|
|
25575
25581
|
const assetData = chainAssets.find((chainAsset) => {
|
|
25576
25582
|
var _a;
|
|
@@ -25599,7 +25605,9 @@ class MayachainProtocol {
|
|
|
25599
25605
|
*/
|
|
25600
25606
|
isAssetSupported(asset) {
|
|
25601
25607
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25602
|
-
if (xchainUtil.
|
|
25608
|
+
if (xchainUtil.isTradeAsset(asset))
|
|
25609
|
+
return false;
|
|
25610
|
+
if (xchainUtil.eqAsset(asset, xchainMayachain.AssetCacao) || xchainUtil.isSynthAsset(asset))
|
|
25603
25611
|
return true;
|
|
25604
25612
|
const pools = yield this.mayachainQuery.getPools();
|
|
25605
25613
|
return (pools.findIndex((pool) => pool.status === 'available' && xchainUtil.eqAsset(asset, xchainUtil.assetFromStringEx(pool.asset))) !== -1);
|
|
@@ -25624,7 +25632,7 @@ class MayachainProtocol {
|
|
|
25624
25632
|
estimateSwap(params) {
|
|
25625
25633
|
var _a, _b;
|
|
25626
25634
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25627
|
-
const estimatedSwap = yield this.mayachainAmm.estimateSwap(Object.assign(Object.assign({}, params), { affiliateBps: (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.affiliateBps, affiliateAddress: (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.affiliateAddress }));
|
|
25635
|
+
const estimatedSwap = yield this.mayachainAmm.estimateSwap(Object.assign(Object.assign({}, params), { fromAsset: params.fromAsset, destinationAsset: params.destinationAsset, amount: params.amount, affiliateBps: (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.affiliateBps, affiliateAddress: (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.affiliateAddress }));
|
|
25628
25636
|
return {
|
|
25629
25637
|
protocol: this.name,
|
|
25630
25638
|
toAddress: estimatedSwap.toAddress,
|
|
@@ -25648,7 +25656,7 @@ class MayachainProtocol {
|
|
|
25648
25656
|
doSwap(params) {
|
|
25649
25657
|
var _a, _b;
|
|
25650
25658
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25651
|
-
return this.mayachainAmm.doSwap(Object.assign(Object.assign({}, params), { affiliateBps: (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.affiliateBps, affiliateAddress: (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.affiliateAddress }));
|
|
25659
|
+
return this.mayachainAmm.doSwap(Object.assign(Object.assign({}, params), { fromAsset: params.fromAsset, destinationAsset: params.destinationAsset, amount: params.amount, affiliateBps: (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.affiliateBps, affiliateAddress: (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.affiliateAddress }));
|
|
25652
25660
|
});
|
|
25653
25661
|
}
|
|
25654
25662
|
/**
|
|
@@ -25685,7 +25693,7 @@ class ThorchainProtocol {
|
|
|
25685
25693
|
*/
|
|
25686
25694
|
isAssetSupported(asset) {
|
|
25687
25695
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25688
|
-
if (xchainUtil.eqAsset(asset, xchainThorchain.AssetRuneNative))
|
|
25696
|
+
if (xchainUtil.eqAsset(asset, xchainThorchain.AssetRuneNative) || xchainUtil.isTradeAsset(asset) || xchainUtil.isSynthAsset(asset))
|
|
25689
25697
|
return true;
|
|
25690
25698
|
const pools = yield this.thorchainQuery.thorchainCache.getPools();
|
|
25691
25699
|
return (Object.values(pools).findIndex((pool) => pool.isAvailable() && xchainUtil.assetToString(asset) === pool.assetString) !== -1);
|