npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@foysavas/substrate-api-cli

v0.45.2-0

Published

A commandline API interface for interacting with a chain

Downloads

1

Readme

@polkadot/api-cli

A simple cli interface to the @polkadot/api.

Usage

Commands are of the form,

yarn run:api [options] <type> <...params>

Where type is the type of query to be made, this takes the form of <type>.<section>.<method> where type is one of consts, derive, query, rpc tx (mapping to the API) and the section and method are available calls.

For instance to make a query to retrieve Alice's balances, you can do

yarn run:api query.system.account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY

To do the same, running as a subscription and streaming results

yarn run:api query.system.account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY --sub

To make a transfer from Alice to Bob, the following can be used -

yarn run:api tx.balances.transfer 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 12345 --seed "//Alice"

Files as Parameters

It is often desirable to include large binary blobs as transaction parameters. These blobs are often already present in the local filesystem. Therefore, the CLI has special syntax to make life easier: any transaction parameter whose initial character is @ is treated as a path to a binary file; its contents are automatically converted into appropriate hex form before sending the tx.

The sudo example demonstrates this.

Sudo

Some transactions require superuser access. For example, to change the runtime code, you can do

yarn run:api --sudo --seed "//Alice" tx.system.setCode @test.wasm

In all cases when sudoing, the seed provided should be that of the superuser. For most development nets, that is "//Alice".

Global Installation

$ yarn global add @polkadot/api-cli
$ polkadot-js-api ...

Other options

The --ws param can be used to connect to other Websocket endpoints, when submitting transactions, you can use the --seed <seed> to specify an account seed. To read documentation on a call, use the --info command.

To specify types for a specific chain, you can use the --types <types.json> param, injecting the specified types into the API on construction.

For a complete list of available commands, you can use --help