@bluefin-exchange/bluefin7k-aggregator-sdk
Version:
24 lines (23 loc) • 848 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClosedDcaOrders = getClosedDcaOrders;
const fetchClient_1 = require("../../config/fetchClient");
const url_1 = require("../../libs/url");
const constants_1 = require("./constants");
async function getClosedDcaOrders({ owner, offset = 0, limit = 10, tokenPair, }) {
const queryParams = {
owner,
statuses: ["SUCCESS"],
offset,
limit,
orderType: "DCA",
tokenPair,
};
const paramsStr = (0, url_1.formatQueryParams)(queryParams);
const response = await (0, fetchClient_1.fetchClient)(`${constants_1.LO_DCA_API}/order-executions?${paramsStr}`);
if (!response.ok) {
throw new Error("Failed to fetch closed dca orders");
}
const orders = (await response.json());
return orders;
}
;