@moonwell-fi/moonwell-sdk
Version:
TypeScript Interface for Moonwell
27 lines • 919 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildMarketId = buildMarketId;
exports.parseMarketId = parseMarketId;
exports.buildTokenId = buildTokenId;
exports.parseTokenId = parseTokenId;
function buildMarketId(chainId, marketAddress) {
return `${chainId}-${marketAddress.toLowerCase()}`;
}
function parseMarketId(marketId) {
const [chainIdStr, ...addressParts] = marketId.split("-");
return {
chainId: Number.parseInt(chainIdStr, 10),
marketAddress: addressParts.join("-"),
};
}
function buildTokenId(chainId, tokenAddress) {
return `${chainId}-${tokenAddress.toLowerCase()}`;
}
function parseTokenId(tokenId) {
const [chainIdStr, ...addressParts] = tokenId.split("-");
return {
chainId: Number.parseInt(chainIdStr, 10),
tokenAddress: addressParts.join("-"),
};
}
//# sourceMappingURL=lunar-indexer-helpers.js.map