Guide

Transactions

getTxHistory and getTxDetail, the Transaction shape, paging options, OP_RETURN payloads, and what raw is for.

Two reads, one shape

const history = await provider.getTxHistory(address, "ethereum", { limit: 10 });
const one = await provider.getTxDetail?.(hash, "ethereum");

getTxHistory is required on every provider and pages through an address. getTxDetail is optional and reads one hash; TONAPI, Blockberry and Aptos do not have it. Both return Transaction:

interface Transaction {
  hash: string;
  blockNumber: number;
  timestamp?: string; // ISO
  from: string;
  to: string | null; // null for contract creation
  value: string; // smallest native unit
  valueFormatted: string;
  gasUsed?: string;
  gasPrice?: string;
  fee?: string; // smallest native unit
  status: "success" | "failed" | "pending";
  methodId?: string; // first four bytes of the input
  functionName?: string; // when the explorer decoded it
  isContractInteraction: boolean;
  tokenTransfers: TokenTransfer[]; // the fungible transfers inside this transaction
  opReturn?: OpReturnPayload[]; // Bitcoin family, from mempool
  raw?: Record<string, unknown>; // the explorer's own answer
}

to is null for contract creation and nothing else. A missing recipient on Arweave is an empty string, because there it means a data upload, not a deployment.

Options

interface TxHistoryOptions {
  startBlock?: number; // inclusive
  endBlock?: number; // inclusive
  sort?: "asc" | "desc";
  limit?: number; // provider caps apply, 100 on most
  page?: number; // 1-indexed
}

clampMaxResults(limit, max) is what every provider runs the limit through: a missing or zero limit means the provider's maximum, anything else is rounded and kept between 1 and that maximum. Which options a provider honours is on its page; the Arweave gateway, for one, caps the window at page * limit <= 1000 and wants block bounds for older history.

OP_RETURN

Bitcoin, Litecoin and Pepecoin transactions from Mempool carry their OP_RETURN outputs in opReturn. Each payload has the pushed bytes as lowercase hex, and text only when those bytes are printable UTF-8. Runes, Omni and other binary carriers keep the hex and skip the text, so you never get mojibake handed to you as a message. The CLI prints the text when there is one and the hex otherwise.

Token transfers inside

tokenTransfers lists the fungible transfers the explorer attributed to this transaction, each with contract, symbol, decimals, value, valueFormatted, from, to and the txHash. Etherscan and Blockscout fill it on EVM chains, TONAPI fills it with Jetton transfers and omits the failed ones, Koios with Cardano native assets. An address that only ever received tokens from third parties has an empty native history and a full transfer history, which is why that read exists on its own.

raw

The explorer's own answer, untouched, on the transaction that produced it. Not part of the contract and different on every provider, but there for the day you need a field nobody normalized. The docs worker drops it before an answer leaves, so the Explorer never shows it; a script gets it in full.

Ambiguity

A 64-hex string is a hash on Ethereum, on the Bitcoin family, TRON and Cardano. A base58 string of 64 to 88 characters is a hash on Solana, 43 or 44 on Sui. Arweave addresses and transaction ids share a shape, so getTxDetail there needs you to know what you hold; the CLI's -m detail is that statement.

@agntn/explorers·MIT license· Read-only. Addresses you type go to a public explorer API, never to a wallet.