quais-by-example
is collection of example scripts for the quais sdk. The quais sdk is a fork of ethers v5.7.2 with added functionality for Quai Network's multi-chain architecture.
While each one of the examples in this repository has its own dependency list, they all depend on the following packages:
- quais - quais sdk
- quais-polling - polling provider for quais
Each example is an individually packaged example with its own package.json
that contains relevant dependencies. To configure an example, simply navigate to an example directory with:
cd <example-name>
and install the dependencies with:
npm install
To run an example, you can use the node
command:
node <example-script-name>.js
This repository has four main categories of examples:
- Utilities: basic encoding and address utils
- Queries: querying data from any Quai chain
- Transactions: sending internal and external transactions
- Contracts: single and multi-chain contracts
- util-bytes - basic encoding and decoding of bytes
- util-encoding - base58, base64, and RLP encoding
- util-grind-address - grind a smart contract address to be valid in a specific Quai shard
- util-shard-from-address - get the shard name from the byte prefix of an address
- query-balance - query the balance of an address on any Quai chain
- query-block - query a block on any Quai chain
- query-logs - query logs for smart contracts, transactions, or blocks
- query-event - query smart contract event logs
- send-transaction - send an internal transaction
- send-etx - send an external transaction to any Quai chain
- contract-erc20 - deploy and interact with ERC20 token
- 1_deploy_erc20.js - deploy a ERC20 token
- 2_interact_erc20.js - interact with a ERC20 token
- contract-erc721 - deploy and interact with a ERC721 token
- 1_deploy_erc721.js - deploy a ERC721 token
- 2_interact_erc721.js - interact with a ERC721 token
- contract-qrc20 - deploy, interact, and multi-chain deploy a QRC20 token
- 1_deploy_and_link_qrc20.js - multi-chain deploy a QRC20 token
- 2_interact_qrc20.js - interact with a QRC20 token
- contract-qrc721 - deploy, interact, and multi-chain deploy a QRC721 token
- 1_deploy_and_link_qrc721.js - multi-chain deploy a QRC721 token
- 2_interact_qrc721.js - interact with a QRC721 token