@webb-tools/sdk-core

the core of webb tools sdk

Usage no npm install needed!

<script type="module">
  import webbToolsSdkCore from 'https://cdn.skypack.dev/@webb-tools/sdk-core';
</script>

README

license npm

@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

Packages

  • api
    • Contains necessary options to create a polkadot.js API instance
  • app-util
    • Utilities to work with Webb Network
  • types
    • Polkadot.js type definations for Webb Network.