Snapshot from @midnight-ntwrk/wallet-sdk v3.0.0, taken 2026-03-28.
The authoritative source is the midnight-wallet repository.
- Design -- Three-wallet model, facade pattern, variant/runtime structure, services and capabilities
- Functional Programming -- Effect/Either patterns, immutability rules, typeclass patterns, canonical examples
- facade -- Unified API combining shielded, unshielded, and dust wallets
- shielded-wallet -- ZK private token operations
- unshielded-wallet -- Transparent token operations
- dust-wallet -- Fee management and dust generation
- hd -- BIP-32/BIP-44 hierarchical deterministic key derivation
- address-format -- Bech32m address encoding/decoding
- capabilities -- Transaction balancing, coin selection, imbalance tracking
- node-client -- Polkadot.js RPC client for the Midnight node
- prover-client -- ZK proof generation service client
- indexer-client -- GraphQL client for the Midnight indexer
Runnable snippets from the docs-snippets package:
- utils.ts -- Shared wallet initialization helper
- initialization.ts -- Full wallet init, sync, and state inspection
- hd.no-net.ts -- HD key derivation (no network required)
- addresses.no-net.ts -- Bech32m address encoding/decoding (no network required)
- shielded-transfer.ts -- Shielded token transfer
- unshielded-transfer.ts -- Unshielded (Night) token transfer
- combined-transfer.ts -- Combined shielded + unshielded transfer
- balancing.ts -- Transaction balancing with manual blueprint
- swap.ts -- Shielded token swap between two wallets
- designation.ts -- Register Night UTXOs for dust generation
- deregistration.ts -- Deregister Night UTXOs from dust generation
- redesignation.ts -- Designate dust to a different receiver
- dust-sponsorship.ts -- Third-party fee sponsorship flow
- wasm-prover.ts -- Initialization with WASM prover (no proof server)
- terms-and-conditions.ts -- Fetch and verify terms and conditions