UNPKG

@bluefin-exchange/bluefin7k-aggregator-sdk

Version:
24 lines (23 loc) 856 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDcaOrderExecutions = getDcaOrderExecutions; const fetchClient_1 = require("../../config/fetchClient"); const url_1 = require("../../libs/url"); const constants_1 = require("./constants"); async function getDcaOrderExecutions({ owner, orderId, offset = 0, limit = 10, }) { const queryParams = { owner, orderId, statuses: ["SUCCESS"], offset, limit, orderType: "DCA", }; 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 dca order executions"); } const orders = (await response.json()); return orders; }