Initializes a new instance of the Thor
class.
The Thor instance used to interact with the VeChain blockchain API.
Optional
options: BlocksModuleOptions(Optional) Other optional parameters for polling and error handling.
Readonly
httpThe Thor instance used to interact with the VeChain blockchain API.
Optional
onError handler for block-related errors.
Retrieves all addresses involved in a given block. This includes beneficiary, signer, clauses, gas payer, origin, contract addresses, event addresses, and transfer recipients and senders.
The block object to extract addresses from.
Retrieves details of the latest block.
A promise that resolves to an object containing the compressed block details.
Retrieves details of the latest block.
A promise that resolves to an object containing the expanded block details.
Asynchronously retrieves a reference to the best block in the blockchain.
This method first calls getBestBlockCompressed()
to obtain the current best block. If no block is found (i.e., if getBestBlockCompressed()
returns null
),
the method returns null
indicating that there's no block to reference. Otherwise, it extracts and returns the first 18 characters of the
block's ID, providing the ref to the best block.
A promise that resolves to either a string representing the first 18 characters of the best block's ID,
or null
if no best block is found.
@Example:
const blockRef = await getBestBlockRef();
if (blockRef) {
console.log(Reference to the best block: ${blockRef}
);
} else {
console.log("No best block found.");
}
Retrieves details of a compressed specific block identified by its revision (block number or ID).
The block number or ID to query details for.
A promise that resolves to an object containing the details of the compressed block.
Retrieves details of an expanded specific block identified by its revision (block number or ID).
The block number or ID to query details for.
A promise that resolves to an object containing the details of the expanded block.
Retrieves the finalized block.
A promise that resolves to an object containing the finalized block.
Retrieves details of the finalized block.
A promise that resolves to an object containing the finalized block details.
Retrieves details of the genesis block.
A promise that resolves to an object containing the block details of the genesis block.
Returns the head block (best block).
The head block (best block).
Synchronously waits for a specific block revision using polling.
The block number to wait for.
Optional
options: WaitForBlockOptions(Optional) Allows to specify timeout and interval in milliseconds
A promise that resolves to an object containing the compressed block.
Synchronously waits for a specific expanded block revision using polling.
The block number to wait for.
Optional
options: WaitForBlockOptions(Optional) Allows to specify timeout and interval in milliseconds
A promise that resolves to an object containing the expanded block details.
The
BlocksModule
class encapsulates functionality for interacting with blocks on the VeChainThor blockchain.