Skip to content
LogoLogo

getTransaction

Returns information about a Transaction given a hash or block identifier.

Usage

import {  } from './client'
 
const  = await .({ 
  : '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d'
})
 
}

Returns

Transaction

The transaction information.

Parameters

hash (optional)

  • Type: '0x${string}'

Get information about a transaction given a transaction hash.

const  = await .({
  : '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d'
})

blockHash (optional)

  • Type: '0x${string}'

Get information about a transaction given a block hash (and index).

const  = await .({
  : '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', 
  : 0
})

blockNumber (optional)

  • Type: '0x${string}'

Get information about a transaction given a block number (and index).

const  = await .({
  : 69420n, 
  : 0
})

blockTag (optional)

  • Type: 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'

Get information about a transaction given a block tag (and index).

const  = await .({
  : 'safe', 
  : 0
})

index (optional)

  • Type: number

An index to be used with a block identifier (number, hash or tag).

const  = await .({
  : 'safe',
  : 0
})

Example

Check out the usage of getTransaction in the live Fetching Transactions Example below.

JSON-RPC Method

eth_getTransactionByHash