Explorer

Example code snippets to query the indexer for explorer module related data.

Using gRPC

Fetch transaction by hash

import { IndexerGrpcExplorerApi } from '@injectivelabs/sdk-ts'
import { getNetworkEndpoints, Network } from '@injectivelabs/networks'

const endpoints = getNetworkEndpoints(Network.Testnet)
const indexerGrpcExplorerApi = new IndexerGrpcExplorerApi(endpoints.explorer)

const txsHash = '...'

const transaction = await indexerGrpcExplorerApi.fetchTxByHash(txsHash)

console.log(transaction)

Fetch an account transaction by address

import { IndexerGrpcExplorerApi } from '@injectivelabs/sdk-ts'
import { getNetworkEndpoints, Network } from '@injectivelabs/networks'

const endpoints = getNetworkEndpoints(Network.Testnet)
const indexerGrpcExplorerApi = new IndexerGrpcExplorerApi(endpoints.explorer)

const injectiveAddress = 'inj...'

const account = await indexerGrpcExplorerApi.fetchAccountTx({
  injectiveAddress,
})

console.log(account)

Fetch a validator by address

Fetch a validator's uptime by address

Fetch a validator's uptime by address

Fetch Peggy deposit transactions from Ethereum

Fetch Peggy withdrawal transactions to Ethereum

Fetch blocks

Fetch block by height

Fetch transactions

Fetch IBC transfer transactions

Using HTTP REST

Fetch a block and details

Fetch blocks and details

Fetch blocks with transaction details

Fetch transactions

Fetch transactions for an address

Fetch transaction using transaction hash

Fetch validators

Fetch validator uptime

Fetch a contract by contract address

Fetch contracts

Fetch contract transactions

Fetch cosmwasm code details

Fetch wasm codes and details

Fetch cw20 balances

Last updated