UNPKG

@moonwell-fi/moonwell-sdk

Version:

TypeScript Interface for Moonwell

21 lines 868 B
export 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; } }; export const findTokenByAddress = (environment, token) => Object.values(environment.config.tokens).find((r) => r.address.toLowerCase() === token.toLowerCase()); //# sourceMappingURL=index.js.map