JavaScript Libraries
An overview of the JavaScript APIs available for interacting with Quai Network.
Overview
Every application built on top of Quai Network requires a connection to the network in order to interact with smart contracts, send transactions, or sign messages on behalf of a user. Using the direct client JSON-RPC API is possible, but the methods can be quite verbose for use in application interfaces.
JavaScript APIs and SDKs offer a simplified interface for web applications to interact with Quai Network via one-line methods, conversion utils, and smart contract wrappers. The available libraries can be found below.
quais.js
A complete Quai Network interaction library for JavaScript and TypeScript.
Library Features
Connect to Quai Nodes
Abstract providers make it easy to connect to, read data from, and broadcast transactions to Quai Network nodes. Providers are composable, so you can connect to remote endpoints, local nodes, or even custom infrastructure.
Providers can query any zone chain in the network for:
- Block data
- Transaction data and gas estimates
- Account balances
- Smart contract data
- And more…
Smart Contract Functionality
Libraries like Quais.js provide smart contract wrappers that make it easy to call smart contract functions, return event data, and read state variables.
Smart contract wrappers serve as JavaScript interpreters for contract ABIs, allowing you to call functions and read data from smart contracts without having to interface with Solidity directly.
Smart contract wrappers also provide a number of useful features, including:
- Transaction simulation
- Raw transaction generation
- Event filtering
Utilities
Quais.js ships with a number of small but powerful utilities that make working with Quai Network simple. They provide useful shortcuts for converting units, getting shard information, and formatting data.
Other useful utilities include:
- Unit conversion and parsing
- Data encoding and formatting
- Address validation
Was this page helpful?