API Reference
API reference for the Nimiq Web Client (@nimiq/core) — classes, interfaces, enumerations, and type aliases grouped by domain.
Full reference for the @nimiq/core package. The entries below are auto-generated from the TypeScript definitions.
Client and Configuration
The main entry points for connecting to the network and configuring the client.
| Class | Description |
|---|---|
| Client | Core class — connect to the network, query state, send transactions, subscribe to events. |
| ClientConfiguration | Builder for configuring network, sync mode, peers, and logging before creating a client. |
| Policy | Protocol constants — epoch length, batch size, staking parameters, supply calculations. |
Accounts and Addresses
Working with on-chain accounts and Nimiq addresses.
| Class / Type | Description |
|---|---|
| Address | Create, parse, format, and compare Nimiq addresses. |
| PlainBasicAccount | Shape of a basic account returned by getAccount(). |
| PlainStakingContract | Shape of the staking contract account. |
| PlainVestingContract | Shape of a vesting contract account. |
| PlainHtlcContract | Shape of an HTLC (hashed time-locked contract) account. |
| AccountType | Enum of account types: basic, vesting, HTLC, staking. |
| PlainAccount | Union type of all plain account shapes. |
Transactions
Building, signing, and inspecting transactions.
| Class / Type | Description |
|---|---|
| TransactionBuilder | Static methods for creating all transaction types — basic transfers, staking, vesting, HTLCs. |
| Transaction | Transaction object — sign, serialize, verify, and inspect. |
| PlainTransaction | Shape of a serialized transaction. |
| PlainTransactionDetails | Transaction with inclusion state, block hash, and confirmations. |
| PlainTransactionReceipt | Lightweight receipt (transaction hash + block height). |
| TransactionFlag | Transaction flags (contract creation, signaling). |
| TransactionFormat | Transaction format (basic, extended). |
| TransactionState | Transaction lifecycle states (pending, included, etc.). |
Transaction Data and Proofs
Typed data and proof structures attached to transactions.
| Type | Description |
|---|---|
| PlainRawData | Raw transaction data payload. |
| PlainAddStakeData | Data for add-stake transactions. |
| PlainCreateStakerData | Data for create-staker transactions. |
| PlainCreateValidatorData | Data for create-validator transactions. |
| PlainUpdateStakerData | Data for update-staker transactions. |
| PlainUpdateValidatorData | Data for update-validator transactions. |
| PlainRetireStakeData | Data for retire-stake transactions. |
| PlainSetActiveStakeData | Data for set-active-stake transactions. |
| PlainVestingData | Data for vesting contract creation. |
| PlainHtlcData | Data for HTLC creation. |
| PlainRawProof | Raw transaction proof. |
| PlainStandardProof | Standard signature proof. |
| PlainHtlcRegularTransferProof | HTLC regular transfer proof (with pre-image). |
| PlainHtlcEarlyResolveProof | HTLC early resolve proof. |
| PlainHtlcTimeoutResolveProof | HTLC timeout resolve proof. |
| PlainTransactionProof | Union type of all proof shapes. |
| PlainTransactionRecipientData | Union type of all recipient data shapes. |
| PlainTransactionSenderData | Union type of all sender data shapes. |
Blocks
Block structures returned by the client.
| Type | Description |
|---|---|
| PlainMicroBlock | Shape of a micro block (produced by validators each slot). |
| PlainMacroBlock | Shape of a macro block (election and checkpoint blocks). |
| PlainBlockCommonFields | Fields shared by both block types. |
| PlainBlock | Union type of micro and macro blocks. |
Keys and Cryptography
Key generation, signing, and cryptographic primitives.
| Class | Description |
|---|---|
| KeyPair | Generate, derive, sign, and serialize Ed25519 keypairs. |
| PrivateKey | Private key generation and serialization. |
| PublicKey | Public key derivation, verification, and serialization. |
| Signature | Ed25519 signature. |
| SignatureProof | Signature proof construction for transactions. |
| ES256PublicKey | ES256 (P-256) public key — used for WebAuthn integration. |
| ES256Signature | ES256 (P-256) signature. |
| BLSKeyPair | BLS keypair — used for validator voting keys. |
| BLSPublicKey | BLS public key. |
| BLSSecretKey | BLS secret key. |
| Hash | Hashing utilities (Blake2b, SHA-256). |
| CryptoUtils | Shared cryptographic helpers. |
| MerkleTree | Merkle tree construction and proof verification. |
| Commitment | Schnorr commitment for multi-signature schemes. |
| CommitmentPair | Commitment pair (secret + commitment). |
| PartialSignature | Partial signature for multi-signature aggregation. |
| RandomSecret | Random secret for commitment schemes. |
| Secret | Base class for cryptographic secrets. |
Wallets and HD Derivation
Mnemonic phrases, entropy, and hierarchical deterministic key derivation.
| Class | Description |
|---|---|
| MnemonicUtils | Generate mnemonics, convert to keys/seeds, detect mnemonic type (BIP39 vs legacy). |
| ExtendedPrivateKey | HD key derivation — master key generation, child derivation, path-based derivation. |
| Entropy | Entropy generation and conversion for mnemonic phrases. |
Staking
Validator and staker data structures.
| Type | Description |
|---|---|
| PlainValidator | Shape of a validator returned by getValidator(). |
| PlainValidatorData | Validator configuration fields. |
| PlainStaker | Shape of a staker returned by getStaker(). |
| StakingContract | Staking contract parsing utilities. |
Contracts
Vesting and HTLC contract helpers.
| Class | Description |
|---|---|
| VestingContract | Parse vesting contract data from transactions. |
| HashedTimeLockedContract | Parse HTLC data and proofs from transactions. |
Utilities
Serialization, formatting, and buffer helpers.
| Class | Description |
|---|---|
| SerialBuffer | Binary serialization buffer for reading and writing typed data. |
| BufferUtils | Convert between hex, base64, and byte arrays. |
| NumberUtils | Number formatting and parsing. |
| StringUtils | String utilities. |
| ArrayUtils | Array comparison and manipulation. |
Network and Peers
| Type | Description |
|---|---|
| PlainPeerInfo | Shape of peer information from peer-change events. |
| ConsensusState | Consensus state values (connecting, syncing, established). |
| PlainService | Network service flags. |
Initialization
| Type | Description |
|---|---|
| default | The init() function for web target — loads the WASM module. |
| initSync | Synchronous WASM initialization (when async is not available). |
| InitInput | Accepted input types for async init(). |
| SyncInitInput | Accepted input types for initSync(). |
| InitOutput | Output of WASM initialization. |
| PlainClientConfiguration | Shape of the built client configuration object. |