UNPKG

@moonwell-fi/moonwell-sdk

Version:

TypeScript Interface for Moonwell

26 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findTokenByAddress = exports.findMarketByAddress = void 0; const findMarketByAddress = (environment, address) => { const marketKey = Object.keys(environment.markets || {}).find((key) => { return (environment.markets[key]?.address.toLowerCase() === address.toLowerCase()); }); if (marketKey) { const marketConfig = environment.config.markets?.[marketKey]; const marketToken = environment.config.tokens[marketConfig.marketToken]; const underlyingToken = environment.config.tokens[marketConfig.underlyingToken]; return { marketKey, marketConfig, marketToken, underlyingToken, }; } else { return; } }; exports.findMarketByAddress = findMarketByAddress; const findTokenByAddress = (environment, token) => Object.values(environment.config.tokens).find((r) => r.address.toLowerCase() === token.toLowerCase()); exports.findTokenByAddress = findTokenByAddress; //# sourceMappingURL=index.js.map