@bluefin-exchange/bluefin7k-aggregator-sdk
Version:
19 lines (18 loc) • 682 B
JavaScript
import { fetchClient } from "../../config/fetchClient";
import { API_ENDPOINTS } from "../../constants/apiEndpoints";
import { formatQueryParams } from "../../libs/url";
export async function getSwapHistory({ owner, offset = 0, limit = 10, tokenPair, }) {
const queryParams = {
addr: owner,
offset,
limit,
token_pair: tokenPair,
};
const paramsStr = formatQueryParams(queryParams);
const response = await fetchClient(`${API_ENDPOINTS.STATISTIC}/trading-history?${paramsStr}`);
if (!response.ok) {
throw new Error("Failed to fetch open limit orders");
}
const orders = (await response.json());
return orders;
}