Web3 module to interact with the Ethereum blockchain and smart contracts.
67
A small utility for summarizing block headers and drilling into transactions from an Ethereum JSON-RPC endpoint.
includeTransactions: true, returns at least the first transaction object (hash, from, to, value) and a transaction count that matches the number of returned transactions. @test@generates
export interface BlockSummaryOptions {
includeTransactions?: boolean;
}
export interface TransactionDetails {
hash: string;
from: string;
to?: string | null;
value: bigint;
}
export interface BlockSummary {
blockNumber: bigint;
blockHash: string;
miner: string;
transactionCount: number;
transactions: (string | TransactionDetails)[];
}
export interface TransactionLookup {
hash: string;
blockNumber: bigint;
from: string;
to?: string | null;
value: bigint;
receiptStatus: boolean;
}
export interface BlockTransactionRef {
block: number | string;
index: number;
}
export class BlockLookupService {
constructor(endpointOrClient: unknown);
fetchBlockSummary(blockRef?: number | string, options?: BlockSummaryOptions): Promise<BlockSummary>;
fetchTransactionByHash(hash: string): Promise<TransactionLookup | null>;
fetchTransactionFromBlock(ref: BlockTransactionRef): Promise<TransactionLookup | null>;
}Provides Ethereum JSON-RPC access for block and transaction queries.
Install with Tessl CLI
npx tessl i tessl/npm-web3-ethdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10