midnight-cast
v0.1.3
Published
Read-only developer CLI for Midnight: network health, indexer queries, error decoding
Downloads
678
Maintainers
Readme
midnight-cast (mn)
Read-only developer CLI for Midnight network health, indexer queries, error decoding. Think Foundry cast for Midnight, not a wallet or app scaffold.
npm i -g midnight-cast
mn ping preprod && mn tip preprod && mn versions preprodRequires Node.js 20+ (22+ recommended).
What it does
| Area | Commands |
|------|----------|
| Health | ping, tip, versions |
| Chain | block latest, rpc |
| Errors | decode (ledger, pallet, 1010, jsonrpc, --raw) |
| Indexer | tx, dust-event, dust-events |
| Config | config init, config show |
No wallet keys. No signing or proving.
Quick start
npm i -g midnight-cast # or: npx midnight-cast …
mn config init # ~/.config/midnight-cast/config.toml
mn ping preprod
mn tip preprod
mn decode 170Networks: preview, preprod, mainnet, local — use --network or MN_NETWORK.
Debug ladder
When something breaks, run in order:
mn ping— services up?mn tip— indexer synced?mn versions— stack matches support matrix?mn decode— what does the error mean?mn tx— what happened on chain?
Common one-liners
mn decode --raw "1010: Invalid Transaction: Custom error: 186"
mn decode 1010 # Substrate envelope → find inner N
mn tx <hash> --network preprod # tx status, fees, segments (+ decode hint on fail)
mn dust-events --from 565900 --limit 10 --network preprod
mn rpc chain_getHeader --json
mn versions preprod --fail-on-mismatch # CI; scans all @midnight-ntwrk/* in package.jsonCommunity & support
| Need | Where |
|------|--------|
| Midnight errors, network issues, dev questions | Midnight Discord |
| mn bug or something not working | GitHub Issues |
| New command or feature idea | GitHub Issues (feature request) |
mn decode --raw "…" auto-detects 1010 envelopes, Custom(N), ledger error names, pallet module errors, and JSON-RPC codes in one paste. Map is stamped with ledger version. For codes not in the map or protocol questions — Discord + Midnight docs are the right place.
Note: mn may clash with midnight-wallet-cli on some machines (both install a mn binary). Use npx midnight-cast or midnight-cast if needed.
Documentation
- Workflows — tx failed, Custom 170, DUST sync, version skew
- Command reference — every flag and exit code
- Docs index
Cast ↔ mn
cast block → mn block latest
cast rpc → mn rpc
cast logs → mn dust-events
cast 4byte → mn decode
cast send → wallet / Lace (not mn)Development
git clone https://github.com/Kanasjnr/midnight-cast.git
cd midnight-cast && npm install && npm run build
npm link # global mn
npm run mn -- decode 170 # without link
npm test
INTEGRATION=1 npm run test:integrationLicense
Apache-2.0
