@bluefin-exchange/bluefin7k-aggregator-sdk
Version:
21 lines (20 loc) • 693 B
JavaScript
import { fetchClient } from "../../config/fetchClient";
import { formatQueryParams } from "../../libs/url";
import { LO_DCA_API } from "./constants";
export async function getClosedDcaOrders({ owner, offset = 0, limit = 10, tokenPair, }) {
const queryParams = {
owner,
statuses: ["SUCCESS"],
offset,
limit,
orderType: "DCA",
tokenPair,
};
const paramsStr = formatQueryParams(queryParams);
const response = await fetchClient(`${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;
}