Skip to main content
The Transaction API is scoped to a single transaction. It provides normalized events from the indexer (GET /transaction/:id/normalized/events). User-level access (API key) is typically required.

client.tx(transactionId)

const client = alphscan({ apiUrl: "https://api.alphscan.io", apiKey: "sk_..." });
const txApi = client.tx("ba076401862824ef18b7fe436fcf99de9dea4066e91671473205df2ee34619d3");
const result = await txApi.normalizedEvents();

TxApi

MethodReturnsDescription
normalizedEvents()Promise<TxNormalizedEventsResponse>Normalized events for this transaction.

TxNormalizedEventsResponse

FieldTypeDescription
transaction_idstringTransaction hash.
eventsNormalizedEvent[]Array of normalized events (from @alphscan/normalized-events).

Example

import { alphscan } from "@alphscan/sdk";

const client = alphscan({
  apiUrl: "https://api.alphscan.io",
  apiKey: process.env.ALPHSCAN_API_KEY,
});

const txId = "ba076401862824ef18b7fe436fcf99de9dea4066e91671473205df2ee34619d3";
const { transaction_id, events } = await client.tx(txId).normalizedEvents();

console.log(`Transaction ${transaction_id}: ${events.length} events`);
events.forEach((e) => console.log(e.category, e.sub_kind, e.from, e.to));