Skip to main content
Version: 2.4.0

fetchEvents

function fetchEvents(
queryInputs: EventsQueryInputs,
graphqlEndpoint?: string,
headers?: HeadersInit): Promise<{
blockHash: string;
blockHeight: UInt32;
chainStatus: string;
events: {
data: string[];
transactionInfo: {
hash: string;
memo: string;
status: string;
};
}[];
globalSlot: UInt32;
parentBlockHash: string;
}[]>

Defined in: lib/mina/v1/fetch.ts:642

Asynchronously fetches event data for an account from the Mina Archive Node GraphQL API.

Parameters

queryInputs

EventsQueryInputs

graphqlEndpoint?

string = networkConfig.archiveEndpoint

The GraphQL endpoint to query. Defaults to the Archive Node GraphQL API.

headers?

HeadersInit

Optional headers to pass to the fetch request

Returns

Promise<{ blockHash: string; blockHeight: UInt32; chainStatus: string; events: { data: string[]; transactionInfo: { hash: string; memo: string; status: string; }; }[]; globalSlot: UInt32; parentBlockHash: string; }[]>

A promise that resolves to an array of objects containing event data, block information and transaction information for the account.

Throws

If the GraphQL request fails or the response is invalid.

Example

const accountInfo = { publicKey: 'B62qiwmXrWn7Cok5VhhB3KvCwyZ7NHHstFGbiU5n7m8s2RqqNW1p1wF' };
const events = await fetchEvents(accountInfo);
console.log(events);