Skip to main content

getTransactionFromBlock

Callable

  • getTransactionFromBlock<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block?: string | number | bigint | Buffer | ArrayBuffer | Uint8Array, transactionIndex: Numbers, returnFormat: ReturnFormat): Promise<undefined | { accessList: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: null | string; transactionIndex?: string; type: string; value: string; yParity: string } | { accessList: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; nonce: string; r: string; s: string; to?: null | string; transactionIndex?: string; type: string; value: string; yParity: string } | { blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; nonce: string; r: string; s: string; to?: null | string; transactionIndex?: string; type: string; v: string; value: string }>

  • Type parameters

    Parameters

    Returns Promise<undefined | { accessList: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: null | string; transactionIndex?: string; type: string; value: string; yParity: string } | { accessList: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; nonce: string; r: string; s: string; to?: null | string; transactionIndex?: string; type: string; value: string; yParity: string } | { blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; nonce: string; r: string; s: string; to?: null | string; transactionIndex?: string; type: string; v: string; value: string }>

    The desired transaction object.

    web3.eth.getTransactionFromBlock('0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00', 0).then(console.log);
    {
    hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
    type: 0n,
    nonce: 0n,
    blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
    blockNumber: 1n,
    transactionIndex: 0n,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1n,
    gas: 90000n,
    gasPrice: 2000000000n,
    input: '0x',
    v: 2709n,
    r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
    s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
    }

    web3.eth.getTransactionFromBlock(
    <Buffer 30 78 34 33 32 30 32 62 64 31 36 62 36 62 64 35 34 62 65 61 31 62 33 31 30 37 33 36 62 64 37 38 62 64 62 65 39 33 61 36 34 61 64 39 34 30 66 37 35 38 ... >,
    0,
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    {
    hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
    type: 0,
    nonce: 0,
    blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
    blockNumber: 1,
    transactionIndex: 0,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1,
    gas: 90000,
    gasPrice: 2000000000,
    input: '0x',
    v: 2709,
    r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
    s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
    }