diff --git a/packages/orderbook/src/lib/orderbook/orderbook.ts b/packages/orderbook/src/lib/orderbook/orderbook.ts index e088ac8..b65835b 100644 --- a/packages/orderbook/src/lib/orderbook/orderbook.ts +++ b/packages/orderbook/src/lib/orderbook/orderbook.ts @@ -133,17 +133,25 @@ export class Orderbook implements IOrderbook { async getOrders( matched: T, paginationConfig?: PaginationConfig, + address?: string, + tx_hash?: string, ): AsyncResult< PaginatedData, string > { const endPoint = matched ? '/matched' : '/unmatched'; - const url = ConstructUrl( - this.Url.endpoint('orders'), - endPoint, - paginationConfig, - ); - + const params: Record = {}; + if (paginationConfig) { + params['page'] = paginationConfig.page; + params['per_page'] = paginationConfig.per_page; + } + if (address) { + params['address'] = address; + } + if (tx_hash) { + params['tx_hash'] = tx_hash; + } + const url = ConstructUrl(this.Url.endpoint('orders'), endPoint, params); try { const res = await Fetcher.get< APIResponse> diff --git a/packages/orderbook/src/lib/orderbook/orderbook.types.ts b/packages/orderbook/src/lib/orderbook/orderbook.types.ts index 22ff4a2..6d351b9 100644 --- a/packages/orderbook/src/lib/orderbook/orderbook.types.ts +++ b/packages/orderbook/src/lib/orderbook/orderbook.types.ts @@ -136,11 +136,15 @@ export interface IOrderbook { * Get all orders from the orderbook based on the match status. * @param matched - If true, returns matched orders, else returns unmatched orders. * @param paginationConfig - The configuration for the pagination. + * @param address - The address to get the orders for. + * @param tx_hash - The tx hash to get the orders for (initiate_tx_hash, redeem_tx_hash, refund_tx_hash). * @returns {AsyncResult, string>} A promise that resolves to the orders. */ getOrders( matched: T, paginationConfig?: PaginationConfig, + address?: string, + tx_hash?: string, ): AsyncResult< PaginatedData, string