Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Files

Latest commit

af40ab2 · Apr 9, 2024

History

History

api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 9, 2024
Nov 30, 2021
Sep 22, 2022
Apr 9, 2024
Mar 9, 2022

license

@astar-network api

This library provides additional typing information for user to access Astar's modules by using polkadot.js

Getting Started

More documentation and examples on wiki

  • Install dependencies
yarn add @polkadot/api @astar-network/astar-api@beta
  • Create API instance
import { ApiPromise } from '@polkadot/api';
import { WsProvider } from '@polkadot/rpc-provider';
import { options } from '@astar-network/astar-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())

Packages

  • api
    • Contains necessary options to create a polkadot.js API instance
  • type-definitions
    • Polkadot.js type definitions for Astar Network.
  • types
    • Polkadot.js auto-generated types for Astar Network.