@renegade-fi/core
Version:
VanillaJS library for Renegade
31 lines (24 loc) • 864 B
text/typescript
import { ADMIN_GET_ORDER_MATCHING_POOL_ROUTE } from "../constants.js";
import type { Config } from "../createConfig.js";
import { getRelayerWithAdmin } from "../utils/http.js";
export type GetOrderMatchingPoolParameters = {
orderId: string;
};
export type GetOrderMatchingPoolReturnType = string;
export async function getOrderMatchingPool(
config: Config,
parameters: GetOrderMatchingPoolParameters,
): Promise<GetOrderMatchingPoolReturnType> {
const { orderId } = parameters;
const { getBaseUrl } = config;
try {
const res = await getRelayerWithAdmin(
config,
getBaseUrl(ADMIN_GET_ORDER_MATCHING_POOL_ROUTE(orderId)),
);
return res.matching_pool;
} catch (error) {
console.error(`Failed to get matching pool for order ${orderId}`, { error });
throw error;
}
}