capi icon indicating copy to clipboard operation
capi copied to clipboard

key page pagination happy path

Open harrysolovay opened this issue 1 year ago • 4 comments

How might we approach simplifying iterating over key pages / pagination? Ideally, one wouldn't need manually track the offset. What's the ideal DX? Maybe...

const count = 100
const p = paginator(System.Account, count)

p.next() // `Promise<[Uint8Array][]>`

for await (const keyPage of p) {
  keyPage // [Uint8Array][]
}

In this case, p stores state about the current offset (outside of the effect system).

harrysolovay avatar Feb 12 '23 20:02 harrysolovay