@f5i23q999d/cow-sdk
Version:
<p align="center"> <img width="400" src="https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png" /> </p>
41 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTargetChainId = exports.isAdditionalTargetChain = exports.isSupportedChain = exports.getChainInfo = void 0;
const const_1 = require("./const/index.js");
/**
* Return the chain info for a given chain id or undefined if the chain is not known (not supported by CoW Protocol or the bridge providers).
* @param chainId
*/
function getChainInfo(chainId) {
if (isSupportedChain(chainId)) {
return const_1.ALL_SUPPORTED_CHAINS_MAP[chainId];
}
if (isAdditionalTargetChain(chainId)) {
return const_1.ADDITIONAL_TARGET_CHAINS_MAP[chainId];
}
// Unknown chain
return undefined;
}
exports.getChainInfo = getChainInfo;
/**
* Check if the chain is supported by CoW Protocol.
*/
function isSupportedChain(chainId) {
return chainId in const_1.ALL_SUPPORTED_CHAINS_MAP;
}
exports.isSupportedChain = isSupportedChain;
/**
* Check if the chain is supported by the bridge providers.
*/
function isAdditionalTargetChain(chainId) {
return chainId in const_1.ADDITIONAL_TARGET_CHAINS_MAP;
}
exports.isAdditionalTargetChain = isAdditionalTargetChain;
/**
* Check if the chain is supported by CoW Swap or the bridge providers.
*/
function isTargetChainId(chainId) {
return isSupportedChain(chainId) || isAdditionalTargetChain(chainId);
}
exports.isTargetChainId = isTargetChainId;
//# sourceMappingURL=utils.js.map