This version (v0.7) has not been published to npm yet.
Skip to content

Pagination ​

Listings accept { page, perPage } and return a Page<T>:

ts
interface Page<T> {
  items: T[]
  page: number       // starts at 1
  perPage: number
  totalPages: number
  totalItems: number
}

In the SDK the name is always page/perPage; the SDK translates it to what each gateway route expects. The other listings send per_page; in wallet.listTransactions, deposits.list, withdrawals.list and notifications.list, perPage goes as limit on the wire. You never pass limit to the SDK: it only shows up when inspecting the request (hooks.onRequest, the browser's network tab).

On those four limit routes, perPage goes from 1 to 100; outside that (or omitted), the gateway uses 20 (notifications.list rejects out-of-range values with CONFIGURATION_ERROR).

ts
let page = await enginex.wallet.listTransactions({ page: 1, perPage: 20 })
while (page.page < page.totalPages) {
  page = await enginex.wallet.listTransactions({ page: page.page + 1, perPage: 20 })
}

Cursor pagination ​

Some listings (e.g. the bonus campaigns in @getenginex/sdk-igaming) are cursor-paginated: they accept { cursor?, pageSize? } (CursorPageInput) and return a CursorPage<T>:

ts
interface CursorPage<T> {
  items: T[]
  nextCursor?: string // absent on the last page
}
ts
let cursor: string | undefined
do {
  const page = await igaming.bonus.listOffers({ cursor, pageSize: 20 })
  render(page.items)
  cursor = page.nextCursor
} while (cursor)

The cursor is opaque: do not build or alter it, just pass along the nextCursor you received.