@parsiq/tsunami-client
TypeScript icon, indicating that this package has built-in type declarations

1.1.11 • Public • Published

PARSIQ Tsunami API JS client

Easy access to PARSIQ Tsunami API, using this JS client.

Getting Started

Install via npm:

$ npm i @parsiq/tsunami-client

Set credentials and select a chain to query:

import { ChainId, TsunamiApiClient } from '@parsiq/tsunami-client';

const tsunami = new TsunamiApiClient(process.env.TSUNAMI_API_KEY, ChainId.ETH_MAINNET);

Don't forget to pass TSUNAMI_API_KEY environment variable to your script.

Usage

Run requests to Tsunami API:

console.log((await tsunami.getLatestBlock()).number);

Fetch events:

for await (const event of tsunami.getEvents(
  { contract: ['0x1e2fbe6be9eb39fc894d38be976111f332172d83'] },
  { block_number_start: 0, block_number_end: 'latest' },
)) {
  console.log(event);
}

Switch to another chain:

tsunami.setChain(ChainId.AVALANCHE_MAINNET);
console.log((await tsunami.getLatestBlock()).number);

More documentation

Documentation and examples are available at https://docs.parsiq.net/

/@parsiq/tsunami-client/

    Package Sidebar

    Install

    npm i @parsiq/tsunami-client

    Weekly Downloads

    211

    Version

    1.1.11

    License

    MIT

    Unpacked Size

    66.9 kB

    Total Files

    129

    Last publish

    Collaborators

    • discovan
    • daniilparsiq
    • pavelslepins
    • zorato
    • cavitas
    • timurrassolov