@inversealtruism/cairn-cli 0.3.2 → 0.3.6
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.
- package/README.md +39 -9
- package/dist/cli.js +575 -80
- package/dist/lib/api.js +84 -0
- package/dist/lib/cairnx.js +110 -0
- package/dist/lib/config.js +15 -5
- package/dist/lib/csd.js +134 -7
- package/dist/lib/ui.js +11 -6
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# cairn-cli
|
|
2
2
|
|
|
3
|
-
A command-line client for **Compute Substrate / Cairn**
|
|
3
|
+
A command-line client for **Compute Substrate / Cairn** - browse the board, and **send CSD,
|
|
4
4
|
propose, attest, and place stones on the Wall** straight from your terminal.
|
|
5
5
|
|
|
6
6
|
For the people who'd rather not put a key in a browser extension: **cairn-cli never holds your
|
|
7
|
-
key.** Reads are plain HTTP. For writes it drives your **own installed `csd` wallet**
|
|
8
|
-
signs with your key (CSD_SIG_V1)
|
|
7
|
+
key.** Reads are plain HTTP. For writes it drives your **own installed `csd` wallet** - `csd`
|
|
8
|
+
signs with your key (CSD_SIG_V1) -- https://github.com/compute-substrate/compute-substrate
|
|
9
|
+
|
|
10
|
+
cairn-cli adds the Cairn layer on top: it computes the
|
|
9
11
|
canonical payload hash, fetches a spendable input from the Cairn proxy (so you don't need a
|
|
10
12
|
synced local node), registers your off-chain content, and gives you the board / wall / network
|
|
11
13
|
views the raw `csd` CLI doesn't have. Browsing needs no `csd` binary and no keys.
|
|
@@ -44,15 +46,16 @@ cairn watch # live auto-refreshing board
|
|
|
44
46
|
cairn recent # recent proposals and support
|
|
45
47
|
cairn show <id> # item detail and integrity check
|
|
46
48
|
cairn verify <id> # recompute the content hash and check it
|
|
47
|
-
cairn wall # the Wall
|
|
49
|
+
cairn wall # the Wall - top stones + the reigning King
|
|
48
50
|
cairn network # live network telemetry (alias: cairn stats)
|
|
49
51
|
cairn quests # open quests
|
|
50
52
|
cairn profile <addr> # identity + on-chain reputation
|
|
51
53
|
cairn leaderboard # top builders by reputation
|
|
54
|
+
cairn tokens [address] # CairnX token balances + .csd names (see below)
|
|
52
55
|
cairn ls --json # machine-readable output
|
|
53
56
|
```
|
|
54
57
|
|
|
55
|
-
## Wallet (transacting
|
|
58
|
+
## Wallet (transacting - uses your own `csd` wallet)
|
|
56
59
|
|
|
57
60
|
One-time: install Compute Substrate's `csd` CLI and create/import your key.
|
|
58
61
|
|
|
@@ -61,7 +64,7 @@ csd wallet new # or: csd wallet init --privkey <your ke
|
|
|
61
64
|
cairn setup # checks csd + wallet, shows your address + balance
|
|
62
65
|
```
|
|
63
66
|
|
|
64
|
-
Then transact
|
|
67
|
+
Then transact - cairn-cli builds the request, `csd` signs with your key, and the tx is submitted
|
|
65
68
|
through the Cairn proxy (no local node required):
|
|
66
69
|
|
|
67
70
|
```bash
|
|
@@ -75,11 +78,33 @@ cairn wall place "gm, Compute Substrate"
|
|
|
75
78
|
Fees and amounts are in **CSD** (e.g. `--amount 1.5`, `--fee 0.05`). Minimums: 0.25 CSD to propose,
|
|
76
79
|
0.05 CSD to attest. Support is a paid demand signal, not a payment to the author; fees go to miners.
|
|
77
80
|
|
|
81
|
+
## CairnX (tokens + .csd names)
|
|
82
|
+
|
|
83
|
+
CairnX is the token / DeFi layer that lives entirely in `cairnx:v1` records on-chain
|
|
84
|
+
(traded at [cairn-substrate.com/trade](https://cairn-substrate.com/trade)). Reads hit the
|
|
85
|
+
CairnX state API (`CAIRNX_API` → local service → public gateway); the one write —
|
|
86
|
+
`token-send` — anchors a canonical transfer record signed by your own `csd` wallet.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
cairn tokens [address] # token balances (locked shown) + owned .csd names
|
|
90
|
+
cairn token-info CAIRN # supply · minted · decimals · mint mode · top-10 holders
|
|
91
|
+
cairn token-send --ticker CAIRN --to 0x… --amount 1.5 # send tokens (--dry-run to preview, --yes to skip the prompt)
|
|
92
|
+
cairn names [address] # owned .csd names
|
|
93
|
+
cairn name inverse # one name: owner · lease · open offer
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`token-send` amounts are **human units converted exactly** (string math, never floats):
|
|
97
|
+
`--amount 1.5` on an 8-decimals token sends `150000000` base units, and `1.5` of a
|
|
98
|
+
0-decimals token is an **error**, never a truncation. The transfer itself is free at the
|
|
99
|
+
token layer; anchoring it on-chain costs the 0.25 CSD propose fee (printed before anything
|
|
100
|
+
signs, and `--dry-run` shows the exact canonical record + hash without signing).
|
|
101
|
+
|
|
78
102
|
## Configuration (environment variables)
|
|
79
103
|
|
|
80
104
|
| Variable | Default | Purpose |
|
|
81
105
|
|---|---|---|
|
|
82
106
|
| `CAIRN_API` | `https://cairn-substrate.com` | the board / proxy to talk to (use your own, e.g. `http://127.0.0.1:7777`) |
|
|
107
|
+
| `CAIRNX_API` | local service, then the public gateway | the CairnX (token/name) state API; set it to pin one base |
|
|
83
108
|
| `CAIRN_CSD` | `csd` | path to your installed `csd` binary (signs your transactions) |
|
|
84
109
|
| `CAIRN_ADDR` | – | your public addr20; skips deriving it from the csd wallet |
|
|
85
110
|
| `CAIRN_RPC` | – | optional csd node RPC; enables fully trustless `verify` (recompute the hash + confirm on-chain) |
|
|
@@ -91,13 +116,18 @@ Fees and amounts are in **CSD** (e.g. `--amount 1.5`, `--fee 0.05`). Minimums: 0
|
|
|
91
116
|
- `verify` fetches an item, recomputes `sha256(canonical content)` locally, and if `CAIRN_RPC` is set,
|
|
92
117
|
confirms that hash is the one committed on-chain. You trust the math, not the server.
|
|
93
118
|
- `send` / `propose` / `support` / `wall place`: cairn-cli fetches a spendable input from the Cairn
|
|
94
|
-
proxy, hands it to **your** `csd` (which signs with your wallet key
|
|
119
|
+
proxy, hands it to **your** `csd` (which signs with your wallet key - for these commands the key
|
|
95
120
|
stays inside `csd` and never enters the cairn-cli process), then submits the signed transaction
|
|
96
121
|
through the proxy and (for proposals) registers the off-chain content. Sealed claims and
|
|
97
122
|
Sign-in-with-CSD live in the Cairn Wallet.
|
|
98
|
-
- **
|
|
123
|
+
- **CairnX commands** (`tokens`, `token-info`, `token-send`, `names`, `name`) read the CairnX
|
|
124
|
+
state API. `token-send` builds the canonical transfer record locally (`sha256(uri)` is the
|
|
125
|
+
on-chain commitment, byte-exact-tested against the resolver's own builder), checks your
|
|
126
|
+
balance, prints the record + the 0.25 CSD anchor cost, then has `csd` sign the anchoring
|
|
127
|
+
Propose — the same no-key-in-process path as `propose`/`send`.
|
|
128
|
+
- **registry commands** (`gateway register`, `peer announce`, `identity claim`) are the one
|
|
99
129
|
exception: they sign a registry *binding* with `@inversealtruism/csd-registry`, so cairn-cli reads
|
|
100
|
-
your private key from `csd wallet config` and signs **in-process** (the key is never networked
|
|
130
|
+
your private key from `csd wallet config` and signs **in-process** (the key is never networked - only
|
|
101
131
|
the signed canonical content is published). Because these load key material into the Node process,
|
|
102
132
|
the `csd-registry` / `csd-codec` dependencies are **pinned to exact versions** (no caret ranges) to
|
|
103
133
|
shrink the supply-chain surface. If you only ever `send`/`propose`/`support`, your key never leaves `csd`.
|