@moonwell-fi/moonwell-sdk
Version:
TypeScript Interface for Moonwell
27 lines • 1.06 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMorphoMarketUserPosition = getMorphoMarketUserPosition;
const lodash_1 = __importDefault(require("lodash"));
const { first } = lodash_1.default;
const index_js_1 = require("../../../common/index.js");
const common_js_1 = require("./common.js");
async function getMorphoMarketUserPosition(client, args) {
const environment = (0, index_js_1.getEnvironmentFromArgs)(client, args);
if (!environment) {
return undefined;
}
let { marketId, market } = args;
if (!marketId) {
marketId = environment.config.morphoMarkets[market].id;
}
const userPositions = await (0, common_js_1.getMorphoMarketUserPositionsData)({
environment,
account: args.userAddress,
markets: [marketId],
});
return first(userPositions);
}
//# sourceMappingURL=getMorphoMarketUserPosition.js.map