@polkadot-api/cli 0.0.1-ff4e99b70602ea882d2c55b6adafc6b6ec8a0da2.1.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +129 -1
  2. package/bin/main.js +321 -1135
  3. package/bin/main.js.map +1 -1
  4. package/package.json +20 -24
package/README.md CHANGED
@@ -1 +1,129 @@
1
- # cli
1
+ # Polkadot API CLI
2
+
3
+ ## Getting Started
4
+
5
+ Add a chain by using the add command
6
+
7
+ ```sh
8
+ polkadot-api add ksm -n ksmcc3
9
+ ```
10
+
11
+ 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.
12
+
13
+ Then you can run the CLI without arguments to generate the descriptor files
14
+
15
+ ```sh
16
+ polkadot-api
17
+ ```
18
+
19
+ Files are generated into a `@polkadot-api/descriptors` package.
20
+
21
+ ## General Usage
22
+
23
+ ```sh
24
+ polkadot-api --help
25
+ ```
26
+
27
+ ```sh
28
+ Usage: polkadot-api [options] [command]
29
+
30
+ Polkadot API CLI
31
+
32
+ Options:
33
+ -h, --help display help for command
34
+
35
+ Commands:
36
+ generate [options] Generate file descriptors
37
+ add [options] <key> [dest] Add a new chain spec to the list
38
+ update [options] [keys] Update the metadata files
39
+ remove [options] <key> Remove a chain spec to the list
40
+ help [command] display help for command
41
+ ```
42
+
43
+ ## Configuration file
44
+
45
+ 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.
46
+
47
+ All the arguments of the CLI accept an option `--config {file}` to use a different configuration file.
48
+
49
+ Optionally you can have this configuration in the `package.json` file, which will be added under the `polkadot-api` subpath.
50
+
51
+ ## Commands
52
+
53
+ ### Generate
54
+
55
+ ```sh
56
+ Usage: polkadot-api generate [options]
57
+
58
+ Generate descriptor files
59
+
60
+ Options:
61
+ --config <filename> Source for the config file
62
+ -k, --key <key> Key of the descriptor to generate
63
+ -h, --help display help for command
64
+ ```
65
+
66
+ 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.
67
+
68
+ ### Add
69
+
70
+ ```sh
71
+ Usage: polkadot-api add [options] <key> [dest]
72
+
73
+ Add a new chain spec to the list
74
+
75
+ Arguments:
76
+ key Key identifier for the chain spec
77
+
78
+ Options:
79
+ --config <filename> Source for the config file
80
+ -f, --file <filename> Source from metadata encoded file
81
+ -w, --wsUrl <URL> Source from websocket url
82
+ -c, --chainSpec <filename> Source from chain spec file
83
+ -n, --name <name> Source from a well-known chain
84
+ --no-persist Do not persist the metadata as a file
85
+ -h, --help display help for command
86
+ ```
87
+
88
+ This command requires one of the options to specify a source:
89
+
90
+ - From a SCALE-encoded metadata file: `-f, --file`
91
+ - From a Websocket URL: `-w, --wsUrl`
92
+ - From a chainSpect: `-c, --chainSpec`
93
+ - From a well-known chain (as of this writing: polkadot, ksmcc3, rococo_v2_2 or westend2): `-n, --name`
94
+
95
+ 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.
96
+
97
+ ### Update
98
+
99
+ ```sh
100
+ Usage: polkadot-api update [options] [keys]
101
+
102
+ Update the metadata files
103
+
104
+ Arguments:
105
+ keys Keys of the metadata files to update, separated by commas. Leave empty for all
106
+
107
+ Options:
108
+ --config <filename> Source for the config file
109
+ -h, --help display help for command
110
+ ```
111
+
112
+ 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.
113
+
114
+ ### Remove
115
+
116
+ ```sh
117
+ Usage: polkadot-api remove [options] <key>
118
+
119
+ Remove a chain spec from the list
120
+
121
+ Arguments:
122
+ key Key identifier for the chain spec
123
+
124
+ Options:
125
+ --config <filename> Source for the config file
126
+ -h, --help display help for command
127
+ ```
128
+
129
+ Removes the specified chain spec from the list. Equivalent as manually removing the entry from the config file.