Skip to main content

getTransaction

Callable

  • getTransaction<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, transactionHash: Bytes, 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.getTransaction('0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc').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.getTransaction(
    <Buffer 30 78 37 33 61 65 61 37 30 65 39 36 39 39 34 31 66 32 33 66 39 64 32 34 31 30 33 65 39 31 61 61 31 66 35 35 63 37 39 36 34 65 62 31 33 64 61 66 31 63 ... >,
    { 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'
    }