supra-ts-sdk - v2.0.0
    Preparing search index...

    Interface PaginatedResponse<T>

    One page of a feed, with the cursor of the next page.

    Read a feed to its end by passing cursor back as the method's start (or cursor) option until it is undefined:

    import { Network, SupraClient } from "supra-ts-sdk";

    const supra = new SupraClient({ network: Network.TESTNET });
    const accountAddress = "0x1";

    let cursor: string | undefined;
    do {
    const page = await supra.account.getAccountResources({ accountAddress, options: { start: cursor } });
    console.log(page.response.length);
    cursor = page.cursor;
    } while (cursor !== undefined);
    • cursor is undefined exactly when the feed has no further items. The SDK reads the end of the feed the same way from every node version: v12 nodes omit the x-supra-cursor header, and v11 nodes send an empty header, "0" or the request's own cursor on an empty page. For getAccountCoinTransactions and getAccountFaTransactions, an ascending read with a type filter and no start that returns an empty page with "0" continues with "0", because the node's first row can have the cursor 0.
    • A page can be empty and still carry a cursor, for example when a type filter excluded every transaction the node read for the page. Continue from the cursor; only undefined ends the feed.
    • The last page that lists items usually carries a cursor, and the request that continues from it returns an empty page with cursor undefined.
    • A cursor is opaque. Pass it back unchanged, to the same method with the same filters and order.
    interface PaginatedResponse<T> {
        response: T;
        cursor?: string;
    }

    Type Parameters

    • T

      The type of the response data to be returned.

    Hierarchy (View Summary)

    Index
    response: T

    The items of this page. It can be empty when cursor is defined.

    cursor?: string

    The cursor of the next page, or undefined when there are no more results.