midnight-wallet-cli 0.5.6 → 0.5.8
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 +46 -5
- package/dist/mcp-server.js +405 -386
- package/dist/wallet.js +598 -526
- package/docs/SKILL-CORE.md +47 -0
- package/docs/SKILL.md +30 -8
- package/package.json +29 -26
package/README.md
CHANGED
|
@@ -80,6 +80,11 @@ midnight transfer mn_addr_undeployed1... 100
|
|
|
80
80
|
midnight wallet generate alice
|
|
81
81
|
midnight config set network preprod # or: preview
|
|
82
82
|
|
|
83
|
+
# Preprod only: its indexer and node are served by Blockfrost, which needs
|
|
84
|
+
# your own project id. Create a "Midnight Preprod" project at https://blockfrost.io
|
|
85
|
+
# and set its id once (it starts with nightpreprod):
|
|
86
|
+
midnight config set blockfrost-project-id <project id>
|
|
87
|
+
|
|
83
88
|
# 2. Get test tokens from the faucet
|
|
84
89
|
# preprod: https://faucet.preprod.midnight.network/
|
|
85
90
|
# preview: https://faucet.preview.midnight.network/
|
|
@@ -93,24 +98,60 @@ midnight balance
|
|
|
93
98
|
midnight transfer mn_addr_preprod1... 100
|
|
94
99
|
```
|
|
95
100
|
|
|
101
|
+
The first command that needs the wallet's Dust (`dust register`, a transfer, `midnight serve`, a contract deploy or call) reads the chain's Dust history first: about 5 minutes on preprod and 30 seconds on preview, once per wallet and network. After that it takes seconds. See [Native dust acceleration](#native-dust-acceleration).
|
|
102
|
+
|
|
96
103
|
## Supported Networks
|
|
97
104
|
|
|
98
105
|
| Network | Description |
|
|
99
106
|
|---------|-------------|
|
|
100
107
|
| `undeployed` | Local network via Docker (`midnight localnet up`) |
|
|
101
|
-
| `preprod` | Midnight pre-production testnet |
|
|
108
|
+
| `preprod` | Midnight pre-production testnet (indexer and node served by Blockfrost: needs a project id) |
|
|
102
109
|
| `preview` | Midnight preview testnet |
|
|
103
110
|
|
|
104
111
|
Wallets are network-agnostic — one seed derives addresses for all three networks. Use `--network <name>` on any command, or persist it with `midnight config set network preview`.
|
|
105
112
|
|
|
113
|
+
### Preprod and Blockfrost
|
|
114
|
+
|
|
115
|
+
Midnight shut its own preprod indexer down on 2026-10-09; [Blockfrost serves it now](https://docs.midnight.network/guides/networks-and-environments), along with the node RPC, and every request needs your own project id. Create a project for Midnight Preprod at [blockfrost.io](https://blockfrost.io) and give mn its id:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
midnight config set blockfrost-project-id <project id> # or: export BLOCKFROST_PROJECT_ID=<project id> (MN_BLOCKFROST_PROJECT_ID wins if both are set)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- Without one, a command that reaches preprod stops with `BLOCKFROST_PROJECT_ID_REQUIRED` and these instructions. A refused id is `BLOCKFROST_PROJECT_ID_REJECTED`. Requests count against your Blockfrost plan.
|
|
122
|
+
- The project id is a secret. mn keeps it in `~/.midnight/config.json` (mode 0600), shows it masked in `config get`, and hides it in everything it prints, errors and `--verbose` logs included.
|
|
123
|
+
- `mn serve` gives a connected dApp the wallet's indexer and node URLs (the DApp connector's `getConfiguration`), and on preprod those carry your project id: connect only dApps you trust with it.
|
|
124
|
+
- An old `indexer-ws` setting that points at `indexer.preprod.midnight.network` fails with `ENDPOINT_SHUT_DOWN`: remove it with `midnight config unset indexer-ws`.
|
|
125
|
+
- Preview and the local network need no project id.
|
|
126
|
+
|
|
106
127
|
## Native dust acceleration
|
|
107
128
|
|
|
108
|
-
|
|
129
|
+
A wallet's first Dust sync on a hosted network (`preprod`, `preview`) reads the chain's whole Dust event history, and that is the slow part of a first run. mn reads it with a native (Rust) program, the `dust-sync` sidecar, several times faster than the built-in WASM reader. Later runs resume from a cache and take seconds with either reader.
|
|
130
|
+
|
|
131
|
+
| Network | Dust events | First sync, native | First sync, WASM | Later runs |
|
|
132
|
+
|---------|-------------|--------------------|------------------|------------|
|
|
133
|
+
| `preprod` | 1.6M | about 5 min | about 27 min (estimated) | about 6 s |
|
|
134
|
+
| `preview` | 144k | about 30 s | about 2 min | about 10 s |
|
|
135
|
+
|
|
136
|
+
Measured on 2026-10-11 with 0.5.7 installed from npm on an Apple Silicon Mac (Linux arm64 gave the same preview time). The times grow with the chain. The preprod WASM figure is worked out from that reader's measured 1,000 events a second: Blockfrost closes the connection of a reader that slow about every 75 seconds, and mn resumes each time until the sync is done.
|
|
137
|
+
|
|
138
|
+
**It installs by itself.** npm adds one optional package for your platform, `@nel349/dust-sync-<os>-<arch>`: macOS (arm64, x64), Linux (x64, arm64; glibc) and Windows (x64). No configuration and no install scripts.
|
|
139
|
+
|
|
140
|
+
**When it can't be used, mn reads with the WASM reader**: everything works, more slowly. That is the case when:
|
|
141
|
+
|
|
142
|
+
- the package isn't there: npm ran with `--omit=optional` (or `--no-optional`), or there is no build for the platform;
|
|
143
|
+
- the binary can't start: Alpine and other musl-based Linux (the Linux builds need glibc);
|
|
144
|
+
- `MN_DISABLE_NATIVE_DUST=1` is set;
|
|
145
|
+
- a run of the sidecar fails (mn carries on in WASM from the last saved event).
|
|
146
|
+
|
|
147
|
+
On a long sync mn says so in one line on stderr, with the reason: `Native Dust reader not installed (@nel349/dust-sync-linux-x64): reading with the built-in one, several times slower on a long sync.` With `--verbose` every sync names its reader: `dust: native sidecar: <path>`, or `dust: native sidecar <reason>, using WASM`.
|
|
109
148
|
|
|
110
|
-
|
|
149
|
+
To get the native reader back, reinstall without leaving optional dependencies out (`npm install -g midnight-wallet-cli`); in a container, use a glibc image (for example `node:22-slim`, not `node:22-alpine`).
|
|
111
150
|
|
|
112
|
-
- `
|
|
113
|
-
- `
|
|
151
|
+
- `MN_DUST_SYNC_BIN=/path/to/dust-sync`: use your own build (`cargo build --release` in `sidecar/dust-sync`) in place of the installed one.
|
|
152
|
+
- `MN_DISABLE_NATIVE_DUST=1`: force the WASM reader (to compare, or if a binary misbehaves).
|
|
153
|
+
- The sidecar keeps its own checkpoint beside the wallet cache (`~/.midnight/cache/<network>/dust-native-*.json`), so an interrupted sync resumes; `midnight cache clear` removes it with the rest.
|
|
154
|
+
- On preprod the sidecar is started with the indexer URL, your Blockfrost project id included, as an argument: other processes of your own user can see it while the sync runs.
|
|
114
155
|
|
|
115
156
|
## DApp Connector
|
|
116
157
|
|