README
@webb-tools
This library provides additional typing information for user to access Webb's modules by using polkadot.js
Getting Started
More documentation and examples on wiki
- Install dependencies
yarn add @polkadot/api @webb-tools/api@beta
- Create API instance
import { ApiPromise } from '@polkadot/api';
import { WsProvider } from '@polkadot/rpc-provider';
import { options } from '@webb-tools/api';
async function main() {
const provider = new WsProvider('wss://localhost:9944');
const api = new ApiPromise(options({ provider }));
await api.isReady;
// use the api
//..
}
main()
- Use api to interact with node
// query and display account data
const data = await api.query.system.account('5F98oWfz2r5rcRVnP9VCndg33DAAsky3iuoBSpaPUbgN9AJn');
console.log(data.toHuman())
Scripts
You will also find a number of scripts inside this API. To run the scripts, you will want to use the following command:
yarn script <PATH_TO_SCRIPT>
For example, if you want to generate a quadratic distribution of all balances on Edgeware at some block hash, you can run the following command:
yarn script scripts/edgeware/getQuadraticDistribution.ts