nomad-xyz/monorepo

bug: indexer should use default of 0 for page

Closed this issue · 1 comments

Right now, it's actually skipping the first size transactions

async getMessages(req: MsgRequest): Promise<NomadMessage[]> {
  const take = req.size || 15;
  const page = req.page || 1;
  const skip = (page || -1) * take; // equals 15

  this.metrics.incDbRequests(DbRequestType.Select);
  const messages = await this.client.messages.findMany({
    where: {
      sender: req.sender,
      recipient: req.recipient,
      origin: req.origin,
      destination: req.destination,
    },
    take,
    skip,
  });

fixed in the latest PR. pages are 1,2,3...