Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
@polkadot-api/cli
Advanced tools
Add a chain by using the add command
polkadot-api add ksm -n ksmcc3
In this example, ksm
is the key to be used to reference this chain, -n ksmcc3
is to source from the "well-known chain" Kusama.
Then you can run the CLI without arguments to generate the descriptor files
polkadot-api
Files are generated into a @polkadot-api/descriptors
package.
polkadot-api --help
Usage: polkadot-api [options] [command]
Polkadot API CLI
Options:
-h, --help display help for command
Commands:
generate [options] Generate descriptor files
add [options] <key> Add a new chain spec to the list
update [options] [keys] Update the metadata files
remove [options] <key> Remove a chain spec from the list
help [command] display help for command
By default, the Polkadot API configuration file is polkadot-api.json
, located at the project's root folder. This file contains a record of the added chains, their sources, and the destination folders for each one of them.
All the arguments of the CLI accept an option --config {file}
to use a different configuration file.
Optionally you can have this configuration in the package.json
file, which will be added under the polkadot-api
subpath.
Usage: polkadot-api generate [options]
Generate descriptor files
Options:
--config <filename> Source for the config file
-k, --key <key> Key of the descriptor to generate
-h, --help display help for command
By default, it generates the descriptor files for all of the chains defined in the config file. To generate only the ones for a specific chain, use the -k, --key
parameter.
Usage: polkadot-api add [options] <key>
Add a new chain spec to the list
Arguments:
key Key identifier for the chain spec
Options:
--config <filename> Source for the config file
-f, --file <filename> Source from metadata encoded file
-w, --wsUrl <URL> Source from websocket url
-c, --chainSpec <filename> Source from chain spec file
-n, --name <name> Source from a well-known chain
--no-persist Do not persist the metadata as a file
-h, --help display help for command
This command requires one of the options to specify a source:
-f, --file
-w, --wsUrl
-c, --chainSpec
-n, --name
For the external sources (-w
, -c
and -n
), the CLI automatically downloads the metadata and stores it as a file {key}.scale
so that it can be added to source control, which is recommended. In case you want to re-fetch in on the fly every time you generate the descriptors, there's the option --no-persist
which wil not create the metadata file.
Usage: polkadot-api update [options] [keys]
Update the metadata files
Arguments:
keys Keys of the metadata files to update, separated by commas. Leave
empty for all
Options:
--config <filename> Source for the config file
-h, --help display help for command
For the chains with both an external source (added with -w
, -c
or -n
) and a persisted file it re-fetches the metadata and updates the encoded metadata file.
Usage: polkadot-api remove [options] <key>
Remove a chain spec from the list
Arguments:
key Key identifier for the chain spec
Options:
--config <filename> Source for the config file
-h, --help display help for command
Removes the specified chain spec from the list. Equivalent as manually removing the entry from the config file.
FAQs
## Getting Started
The npm package @polkadot-api/cli receives a total of 2,572 weekly downloads. As such, @polkadot-api/cli popularity was classified as popular.
We found that @polkadot-api/cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.