Skip to content

Latest commit

 

History

History

README.md

Evo SDK

NPM Version Build Status Release Date standard-readme compliant

TypeScript SDK for building applications on Dash Platform

Evo SDK provides a high-level, strongly-typed interface for interacting with Dash Platform on supported networks. It wraps the WebAssembly-based @dashevo/wasm-sdk in ergonomic facades covering identities, documents, data contracts, tokens, DPNS, and more. The SDK works in both Node.js and modern browsers.

Table of Contents

Install

npm install @dashevo/evo-sdk

The package is ESM-only ("type": "module"). In CommonJS projects, use dynamic import(). Requires Node.js >= 18.18.

Usage

Trusted mode is required for all queries. It pre-fetches quorum public keys so the SDK can verify Platform proofs.

import { EvoSDK } from '@dashevo/evo-sdk';

const sdk = EvoSDK.testnetTrusted(); // or mainnetTrusted()
await sdk.connect();

const epoch = await sdk.epoch.current();
console.log('Current epoch:', epoch.index);

Configuration

EvoSDK accepts the following options:

Option Type Default Notes
network 'testnet' | 'mainnet' | 'local' | 'devnet' 'testnet' Target network.
trusted boolean false When true, pre-fetches quorum keys for proof verification. Required for default query methods.
addresses string[] Seed masternode addresses. Required for non-trusted devnet; optional for other networks (replaces built-in defaults).
devnetName string Short name of the devnet (e.g. 'paloma'). Required when network: 'devnet' and trusted: true (used to derive the quorum URL); ignored otherwise — only valid when network === 'devnet'.
quorumUrl string Override the trusted-context quorum base URL. Only meaningful when trusted: true. Useful for staging endpoints or devnets where the public DNS isn't deployed yet.
proofs boolean true Setting to false disables proof requests where supported, but unproved mode is limited — several query paths (e.g. document fetches) force proofs regardless, and some query builders reject the unproved path. Mainly intended for mock/offline replay.
version number latest Platform protocol version.
logs string Tracing/log filter for the underlying Wasm SDK. Accepts simple levels ('info', 'debug', …) or a full EnvFilter string.
settings { connectTimeoutMs?, timeoutMs?, retries?, banFailedAddress? } DAPI client transport settings.

Preset factories are available as convenience: EvoSDK.testnet(), EvoSDK.mainnet(), EvoSDK.testnetTrusted(), EvoSDK.mainnetTrusted(), EvoSDK.local(), EvoSDK.localTrusted() (the last two target a dashmate local node), and the devnet factories EvoSDK.devnet(name, options) / EvoSDK.devnetTrusted(name, options).

// Trusted devnet — quorum URL auto-derived from the devnet name.
const sdk = EvoSDK.devnetTrusted('paloma');
await sdk.connect();

// Non-trusted devnet — explicit addresses required (no quorum context).
const local = EvoSDK.devnet('paloma', {
  addresses: ['https://10.0.0.5:1443'],
});
await local.connect();

Two static helpers are also exported:

  • await EvoSDK.setLogLevel(filter) — configure the underlying Wasm SDK's tracing globally.
  • await EvoSDK.getLatestVersionNumber() — return the latest Platform protocol version supported by the bundled Wasm SDK.

Facades

The SDK organises its API into domain-specific facades, each accessible as a property on the EvoSDK instance:

Facade Description
sdk.addresses Query balances, transfer credits, withdraw to L1
sdk.identities Fetch, create, update, and top up identities
sdk.documents Query, create, replace, delete, and transfer documents; aggregate count / sum / average over indexed fields
sdk.contracts Fetch, publish, and update data contracts
sdk.tokens Mint, burn, transfer, freeze tokens and query balances
sdk.dpns Register and resolve Dash Platform names
sdk.epoch Query epoch information and evonode proposed blocks
sdk.protocol Protocol version upgrade state and voting
sdk.stateTransitions Broadcast and wait for state transitions
sdk.system System status, quorum info, and total credits
sdk.group Group membership, actions, and contested resources
sdk.voting Contested resource vote states and polls
sdk.shielded Query shielded pool state, encrypted notes, anchors, and nullifier status

A wallet namespace is also exported with utilities for BIP39 mnemonic generation and validation, BIP44/DIP9/DIP13 key derivation (path helpers included), extended-key conversion (xprvToXpub, deriveChildPublicKey), key-pair generation and import (generateKeyPair, keyPairFromWif, keyPairFromHex), public-key-to-address conversion, address validation, message signing, and Dashpay contact-key derivation. See src/wallet/functions.ts for the full list.

Contributing

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Dash Core Group, Inc.