UNPKG

@moonwell-fi/moonwell-sdk

Version:

TypeScript Interface for Moonwell

23 lines 849 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getUserPosition = getUserPosition; const index_js_1 = require("../../../common/index.js"); const common_js_1 = require("./common.js"); async function getUserPosition(client, args) { let { marketAddress, userAddress } = args; const environment = (0, index_js_1.getEnvironmentFromArgs)(client, args); if (!environment) { return undefined; } if (!marketAddress) { const { market } = args; marketAddress = environment.markets[market].address; } const userPosition = await (0, common_js_1.getUserPositionData)({ environment, account: userAddress, markets: [marketAddress], }); return userPosition?.length > 0 ? userPosition[0] : undefined; } //# sourceMappingURL=getUserPosition.js.map