Socket
Socket
Sign inDemoInstall

@parsiq/tsunami-client

Package Overview
Dependencies
13
Maintainers
6
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @parsiq/tsunami-client

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


Version published
Weekly downloads
130
increased by1525%
Maintainers
6
Created
Weekly downloads
 

Readme

Source

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/

Keywords

FAQs

Last updated on 26 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc