Code Monkey home page Code Monkey logo

huang-lei1 / setheum.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from setheum-js/setheum.js

1.0 1.0 0.0 3.14 MB

Promise and RxJS APIs around Setheum and related Substrate-based chain RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata and tuned with SetheumJS and Setters.JS for Setheum Networks. Full documentation & examples available

License: Apache License 2.0

JavaScript 0.39% TypeScript 99.61%

setheum.js's Introduction

license npm

@setheum-js

Promise and RxJS APIs around Setheum RPC calls. This library provides additional typing for users to access Setheum networks by using setheum.js.

Getting Started

More documentation and examples on setheum.js.org.

  • Install dependencies
yarn add @polkadot/api @setheum-js/api@beta
  • Create API instance
import { ApiPromise } from '@polkadot/api';
import { WsProvider } from '@polkadot/rpc-provider';
import { options } from '@setheum-js/api';

async function main() {
    const provider = new WsProvider('ws://127.0.0.1:9944');
    const api = new ApiPromise(options({ provider }));
    await api.isReady;

    // use api
}

main()
  • Use api to interact with node
// query and display account data
const data = await api.query.system.account('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY');
console.log(data.toHuman())

overview

The API is split up into a number of internal packages -

  • @setheum-js/api The API library, providing both Promise and RxJS Observable-based interfaces. This is the main user-facing entry point.
  • @setheum-js/api-derive Additional polkadot.js derives for Setheum Network. Derived results that are injected into the API, allowing for combinations of various query results (only used internally and exposed on the Api instances via api.derive.*)
  • @setheum-js/app-util
    • Utilities to work with Setheum
  • @setheum-js/types Codecs for all Polkadot.js type definations for Setheum primitives

setheum.js's People

Contributors

huang-lei1 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.