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

    Class Table

    The Table class provides methods for querying table items on the Supra network.

    Hierarchy (View Summary)

    Index
    • The constructor function takes a NetworkConfig object as a parameter and assigns it to the networkInformation property.

      Parameters

      • networkInformation: NetworkConfig

        A NetworkConfig object that contains information about the network on which the Supra client is running.

      Returns Table

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

      const supra = new SupraClient({ network: Network.TESTNET });
    • Query a table item on Supra.

      Type Parameters

      • T

        The type of the response data to be returned.

      Parameters

      Returns Promise<T>

      A Promise that resolves to the table item's value as the node returns it, without type conversion.

      When the node rejects the handle, the key or the types (HTTP 400) or has no such item.

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

      const supra = new SupraClient({ network: Network.TESTNET });

      async function runExample() {
      const handle = "0x1";
      const key = "0x1";
      const keyType = "address";
      const valueType = "u64";
      const tableItem = await supra.table.getTableItem({ handle: handle, data: { key_type: keyType, value_type: valueType, key: key }});
      console.log(tableItem);
      }

      runExample().catch(console.error);