UNPKG

@bluefin-exchange/bluefin7k-aggregator-sdk

Version:
22 lines (21 loc) 832 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSwapHistory = getSwapHistory; const fetchClient_1 = require("../../config/fetchClient"); const apiEndpoints_1 = require("../../constants/apiEndpoints"); const url_1 = require("../../libs/url"); async function getSwapHistory({ owner, offset = 0, limit = 10, tokenPair, }) { const queryParams = { addr: owner, offset, limit, token_pair: tokenPair, }; const paramsStr = (0, url_1.formatQueryParams)(queryParams); const response = await (0, fetchClient_1.fetchClient)(`${apiEndpoints_1.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; }