The constructor function takes a NetworkConfig object as a parameter and assigns it to the networkInformation property.
A NetworkConfig object that contains information about the network on which the Supra client is running.
Get the events of the given type.
SUPRA deposits are 0x1::coin::CoinDeposit events (field account) where SUPRA is held in a CoinStore, and
0x1::fungible_asset::Deposit events (field store, the fungible store, not the account) where it is held in
a primary fungible store.
Type of event
The options object is required and can be empty.
OptionalstartHeight?: numberStarting block height (inclusive)
OptionalendHeight?: numberEnding block height (exclusive)
Optionallimit?: numberMaximum number of events to return. Defaults to 20, max 100.
Optionalstart?: stringThe cursor of the previous page, a hex string. Omit it, or pass undefined, for the first page.
A Promise that resolves to an array of events, with the cursor of the next page. cursor is
undefined when there are no more events; a page can hold fewer than limit events and still carry a
cursor. See PaginatedResponse.
import { SupraClient,Network } from "supra-ts-sdk";
const supra = new SupraClient({ network: Network.TESTNET });
async function runExample() {
const eventType = "0x1::coin::CoinDeposit";
const {response: events, cursor} = await supra.events.getEventsByType({ eventType: eventType, options: {} });
console.log(events);
}
runExample().catch(console.error);
The Events class provides methods for fetching events on the Supra network.