@moonwell-fi/moonwell-sdk
Version:
TypeScript Interface for Moonwell
15 lines • 581 B
JavaScript
import { getEnvironmentFromArgs } from "../../../common/index.js";
import { getMarketsData } from "./common.js";
export async function getMarket(client, args) {
let { marketAddress, market } = args;
const environment = getEnvironmentFromArgs(client, args);
if (!environment) {
return undefined;
}
if (!marketAddress) {
marketAddress = environment.markets[market].address;
}
const markets = await getMarketsData(environment);
return markets.find((m) => m.marketToken.address === marketAddress);
}
//# sourceMappingURL=getMarket.js.map