@mento-protocol/mento-sdk 1.16.0-beta.0 → 1.17.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/dist/cjs/mento.d.ts +3 -2
- package/dist/cjs/mento.js +16 -8
- package/dist/esm/mento.d.ts +3 -2
- package/dist/esm/mento.js +16 -8
- package/package.json +1 -1
package/dist/cjs/mento.d.ts
CHANGED
|
@@ -253,10 +253,11 @@ export declare class Mento {
|
|
|
253
253
|
*/
|
|
254
254
|
getRateFeedTradingMode(rateFeedId: Address): Promise<TradingMode>;
|
|
255
255
|
/**
|
|
256
|
-
* Checks if a trading pair is currently tradable (i.e.,
|
|
256
|
+
* Checks if a trading pair is currently tradable (i.e., all rate feeds in the path are in BIDIRECTIONAL mode)
|
|
257
|
+
* For multi-hop routes (e.g., CELO → cUSD → USDT), checks that all intermediate rate feeds are tradable
|
|
257
258
|
* @param tokenIn the address of the token to sell
|
|
258
259
|
* @param tokenOut the address of the token to buy
|
|
259
|
-
* @returns true if the pair is tradable (
|
|
260
|
+
* @returns true if the pair is tradable (all rate feeds in BIDIRECTIONAL mode), false otherwise
|
|
260
261
|
*/
|
|
261
262
|
isPairTradable(tokenIn: Address, tokenOut: Address): Promise<boolean>;
|
|
262
263
|
/**
|
package/dist/cjs/mento.js
CHANGED
|
@@ -609,19 +609,27 @@ class Mento {
|
|
|
609
609
|
});
|
|
610
610
|
}
|
|
611
611
|
/**
|
|
612
|
-
* Checks if a trading pair is currently tradable (i.e.,
|
|
612
|
+
* Checks if a trading pair is currently tradable (i.e., all rate feeds in the path are in BIDIRECTIONAL mode)
|
|
613
|
+
* For multi-hop routes (e.g., CELO → cUSD → USDT), checks that all intermediate rate feeds are tradable
|
|
613
614
|
* @param tokenIn the address of the token to sell
|
|
614
615
|
* @param tokenOut the address of the token to buy
|
|
615
|
-
* @returns true if the pair is tradable (
|
|
616
|
+
* @returns true if the pair is tradable (all rate feeds in BIDIRECTIONAL mode), false otherwise
|
|
616
617
|
*/
|
|
617
618
|
isPairTradable(tokenIn, tokenOut) {
|
|
618
619
|
return __awaiter(this, void 0, void 0, function* () {
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
|
|
620
|
+
// Find the tradable pair (which includes the routing path)
|
|
621
|
+
const pair = yield this.findPairForTokens(tokenIn, tokenOut);
|
|
622
|
+
// For each hop in the path, check if the rate feed is tradable
|
|
623
|
+
const biPoolManager = mento_core_ts_1.BiPoolManager__factory.connect(pair.path[0].providerAddr, this.signerOrProvider);
|
|
624
|
+
// Get all rate feed IDs for each hop in the path
|
|
625
|
+
const rateFeedChecks = yield Promise.all(pair.path.map((hop) => __awaiter(this, void 0, void 0, function* () {
|
|
626
|
+
const exchangeConfig = yield biPoolManager.getPoolExchange(hop.id);
|
|
627
|
+
const rateFeedId = exchangeConfig.config.referenceRateFeedID;
|
|
628
|
+
const tradingMode = yield this.getRateFeedTradingMode(rateFeedId);
|
|
629
|
+
return tradingMode === enums_1.TradingMode.BIDIRECTIONAL;
|
|
630
|
+
})));
|
|
631
|
+
// All rate feeds must be in BIDIRECTIONAL mode for the pair to be tradable
|
|
632
|
+
return rateFeedChecks.every((isTradable) => isTradable);
|
|
625
633
|
});
|
|
626
634
|
}
|
|
627
635
|
/**
|
package/dist/esm/mento.d.ts
CHANGED
|
@@ -253,10 +253,11 @@ export declare class Mento {
|
|
|
253
253
|
*/
|
|
254
254
|
getRateFeedTradingMode(rateFeedId: Address): Promise<TradingMode>;
|
|
255
255
|
/**
|
|
256
|
-
* Checks if a trading pair is currently tradable (i.e.,
|
|
256
|
+
* Checks if a trading pair is currently tradable (i.e., all rate feeds in the path are in BIDIRECTIONAL mode)
|
|
257
|
+
* For multi-hop routes (e.g., CELO → cUSD → USDT), checks that all intermediate rate feeds are tradable
|
|
257
258
|
* @param tokenIn the address of the token to sell
|
|
258
259
|
* @param tokenOut the address of the token to buy
|
|
259
|
-
* @returns true if the pair is tradable (
|
|
260
|
+
* @returns true if the pair is tradable (all rate feeds in BIDIRECTIONAL mode), false otherwise
|
|
260
261
|
*/
|
|
261
262
|
isPairTradable(tokenIn: Address, tokenOut: Address): Promise<boolean>;
|
|
262
263
|
/**
|
package/dist/esm/mento.js
CHANGED
|
@@ -582,19 +582,27 @@ export class Mento {
|
|
|
582
582
|
});
|
|
583
583
|
}
|
|
584
584
|
/**
|
|
585
|
-
* Checks if a trading pair is currently tradable (i.e.,
|
|
585
|
+
* Checks if a trading pair is currently tradable (i.e., all rate feeds in the path are in BIDIRECTIONAL mode)
|
|
586
|
+
* For multi-hop routes (e.g., CELO → cUSD → USDT), checks that all intermediate rate feeds are tradable
|
|
586
587
|
* @param tokenIn the address of the token to sell
|
|
587
588
|
* @param tokenOut the address of the token to buy
|
|
588
|
-
* @returns true if the pair is tradable (
|
|
589
|
+
* @returns true if the pair is tradable (all rate feeds in BIDIRECTIONAL mode), false otherwise
|
|
589
590
|
*/
|
|
590
591
|
isPairTradable(tokenIn, tokenOut) {
|
|
591
592
|
return __awaiter(this, void 0, void 0, function* () {
|
|
592
|
-
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
593
|
+
// Find the tradable pair (which includes the routing path)
|
|
594
|
+
const pair = yield this.findPairForTokens(tokenIn, tokenOut);
|
|
595
|
+
// For each hop in the path, check if the rate feed is tradable
|
|
596
|
+
const biPoolManager = BiPoolManager__factory.connect(pair.path[0].providerAddr, this.signerOrProvider);
|
|
597
|
+
// Get all rate feed IDs for each hop in the path
|
|
598
|
+
const rateFeedChecks = yield Promise.all(pair.path.map((hop) => __awaiter(this, void 0, void 0, function* () {
|
|
599
|
+
const exchangeConfig = yield biPoolManager.getPoolExchange(hop.id);
|
|
600
|
+
const rateFeedId = exchangeConfig.config.referenceRateFeedID;
|
|
601
|
+
const tradingMode = yield this.getRateFeedTradingMode(rateFeedId);
|
|
602
|
+
return tradingMode === TradingMode.BIDIRECTIONAL;
|
|
603
|
+
})));
|
|
604
|
+
// All rate feeds must be in BIDIRECTIONAL mode for the pair to be tradable
|
|
605
|
+
return rateFeedChecks.every((isTradable) => isTradable);
|
|
598
606
|
});
|
|
599
607
|
}
|
|
600
608
|
/**
|