The constructor function takes a NetworkConfig object as a parameter and assigns it to the networkInformation property.
A NetworkConfig object that contains information about the network on which the Supra client is running.
Get the meta information of the most recently finalized and executed block.
A Promise that resolves to a FinalizedBlockHeader object.
Get information about the block that has been finalized at the given height.
The height of the block to retrieve.
Optionaloptions?: { withFinalizedTransactions?: boolean; type?: TransactionQueryType }OptionalwithFinalizedTransactions?: booleanWhether to include the transactions in the block.
Optionaltype?: TransactionQueryTypeInclude only the transactions of this type. "settlement" requires a node from
v12 onwards; older nodes reject it with HTTP 400.
A Promise that resolves to a FinalizedBlockHeader object. Its transactions can contain any
txn_type, including settlement items, which have no header, payload or authenticator.
Get the header and execution output statistics of the block with the given hash.
The hash of the block to retrieve.
A Promise that resolves to a FinalizedBlockHeader object.
HTTP 404 for an unknown block. A hash that is not hexadecimal is HTTP 400 on v12 and HTTP 404 on v11. See "HTTP status codes by node version" in the README.
import { SupraClient,Network } from "supra-ts-sdk";
const supra = new SupraClient({ network: Network.TESTNET });
async function runExample() {
const blockHash = "0x1";
const block = await supra.block.getBlockByHash({ blockHash: blockHash });
console.log(block);
}
runExample().catch(console.error);
Get a list containing the hashes of the transactions that were finalized in the block with the given hash in the order that they were executed.
The hash of the block to retrieve.
Optionaloptions?: { type?: TransactionQueryType }Optionaltype?: TransactionQueryTypeReturn only the hashes of transactions of this type. "settlement" requires a
node from v12 onwards; older nodes reject it with HTTP 400.
A Promise that resolves to a string array.
HTTP 404 for an unknown block. A hash that is not hexadecimal is HTTP 400 on v12 and HTTP 404 on v11. See "HTTP status codes by node version" in the README.
import { SupraClient,Network } from "supra-ts-sdk";
const supra = new SupraClient({ network: Network.TESTNET });
async function runExample() {
const blockHash = "0x1";
const transactions = await supra.block.getTransactionsByBlockHash({ blockHash: blockHash });
console.log(transactions);
}
runExample().catch(console.error);
The Block class provides methods for querying block information on the Supra network.