# adamant-api

> Modular TypeScript SDK for the ADAMANT blockchain and deterministic wallet helpers

Latest version **3.2.0** (published 2026-11-25) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install adamant-api
pnpm add adamant-api
yarn add adamant-api
bun add adamant-api
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2026-11-25 |
| First published | 2018-12-08 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.12.0 |
| Dependencies | 16 |
| Unpacked size | 322.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 487 |
| Author | ADAMANT community developers |
| Maintainers | adamant.im, martiliones, deidev |
| Keywords | adm, adamant, blockchain, messenger, messaging, chat, decentralized messenger, anonymous messenger, secure messenger, wallet, crypto wallet, private keys, communication, decentralized, decentralization, anonymous, anonymity, tor, privacy, security, secure, encrypted, encryption, crypto, cryptocurrency, dpos, api, sdk, typescript, nodejs, bitcoin, ethereum |

## Links

- npm: https://www.npmjs.com/package/adamant-api
- Repository: https://github.com/Adamant-im/adamant-api-jsclient
- Homepage: https://js.docs.adamant.im
- Issues: https://github.com/Adamant-im/adamant-api-jsclient/issues
- npm.io page: https://npm.io/package/adamant-api

## Dependencies (16)

- [axios](https://npm.io/package/axios.md) ^1.21.1
- [bip32](https://npm.io/package/bip32.md) ^5.0.1
- [bip39](https://npm.io/package/bip39.md) ^3.1.2
- [ecpair](https://npm.io/package/ecpair.md) ^3.0.2
- [pbkdf2](https://npm.io/package/pbkdf2.md) ^3.1.7
- [semver](https://npm.io/package/semver.md) ^7.8.6
- [coininfo](https://npm.io/package/coininfo.md) ^5.2.1
- [ed2curve](https://npm.io/package/ed2curve.md) ^0.3.0
- [tweetnacl](https://npm.io/package/tweetnacl.md) ^1.0.3
- [bytebuffer](https://npm.io/package/bytebuffer.md) ^5.0.1
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^11.1.5
- [bitcoinjs-lib](https://npm.io/package/bitcoinjs-lib.md) ^7.0.5
- [tiny-secp256k1](https://npm.io/package/tiny-secp256k1.md) ^2.2.5
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^4.8.4
- [ethereum-cryptography](https://npm.io/package/ethereum-cryptography.md) ^3.2.0
- [sodium-browserify-tweetnacl](https://npm.io/package/sodium-browserify-tweetnacl.md) ^0.2.6

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 3.2.0 (latest) — 2026-11-25
- 3.1.0 — 2026-07-17
- 3.0.0 — 2026-06-21
- 2.4.0 — 2024-06-06
- 2.3.1 — 2024-04-29
- 2.3.0 — 2024-01-26
- 2.2.0 — 2023-12-17
- 2.1.0 — 2023-11-19
- 2.0.0 — 2023-11-01
- 1.8.0 — 2023-01-13
- 1.7.0 — 2023-01-06
- 1.6.0 — 2022-11-16
- 1.5.0 — 2022-04-01
- 1.4.0 — 2022-02-12
- 1.3.0 — 2021-10-23
- … 36 more at https://npm.io/package/adamant-api/versions

## README

# ADAMANT JavaScript API

`adamant-api` is the TypeScript/Node.js SDK for the ADAMANT blockchain. It provides resilient ADM node access, account and transaction primitives, encrypted messaging, WebSocket subscriptions, and deterministic helpers for supported external wallets.

📚 **Documentation:** [js.docs.adamant.im](https://js.docs.adamant.im)

> Built and maintained by the ADAMANT developer community and **cryptofoundry**.
> Want custom crypto software, bots, payments or blockchain infrastructure built by engineers with production blockchain experience? [Tell us what to build](https://adamant.business#contact).
>

## Features

- Automatic ADM node health checks, retries, failover, and height-aware node selection
- Typed blockchain API requests and response DTOs
- ADM passphrase hashing, keypair and address derivation
- Message encryption and decryption
- Transaction construction, hashing, signing, and ID calculation
- WebSocket subscriptions for incoming transactions, new blocks, and account balance changes
- Optional BTC, ETH, DASH, and DOGE wallet derivation and address validation
- Pinned, reproducible OpenAPI schema types from [`Adamant-im/adamant`](https://github.com/Adamant-im/adamant/tree/dev/openapi)
- Pinned, reproducible coin metadata from [`adamant-wallets`](https://github.com/Adamant-im/adamant-wallets)

## Requirements

- Node.js 22 or newer
- npm, pnpm, or another package manager supported by your project

## Installation

```sh
npm install adamant-api
```

## ADM API usage

The package root and `adamant-api/adm` expose ADM functionality and shared metadata. Importing either entry point does not load coin-specific implementations.

```ts
import {AdamantApi} from 'adamant-api';

const api = new AdamantApi({
  nodes: [
    'http://localhost:36666',
    'https://endless.adamant.im',
    'https://clown.adamant.im',
    'https://lake.adamant.im',
  ],
  checkHealthAtStartup: true,
  minVersion: '0.8.0',
});

api.onReady(async () => {
  const response = await api.getBlocks();

  if (response.success) {
    console.log(response.blocks);
  } else {
    console.error(response.errorMessage);
  }
});
```

`minVersion` is inclusive. During health checks, nodes below this ADAMANT Node version are reported and excluded from API and WebSocket selection. `onReady` runs after that check selects a usable node. A node that is still loading or syncing is not usable, so the callback waits until one is available.

CommonJS remains supported:

```js
const {AdamantApi} = require('adamant-api');
```

Do not place a passphrase, private key, decrypted message, or sensitive token in logs.

## Modular imports

Use the narrowest entry point that fits the task:

| Entry point                | Purpose                                                 |
| -------------------------- | ------------------------------------------------------- |
| `adamant-api`              | ADM API and shared metadata                             |
| `adamant-api/adm`          | Explicit ADM-only SDK surface                           |
| `adamant-api/api`          | ADM HTTP client and generated API DTOs                  |
| `adamant-api/transactions` | ADM transaction construction, hashing, signing, and IDs |
| `adamant-api/metadata`     | Bundled ADM and coin metadata                           |
| `adamant-api/coins/btc`    | Bitcoin wallet helper                                   |
| `adamant-api/coins/eth`    | Ethereum wallet helper                                  |
| `adamant-api/coins/dash`   | Dash wallet helper                                      |
| `adamant-api/coins/doge`   | Dogecoin wallet helper                                  |

For example:

```ts
import {btc} from 'adamant-api/coins/btc';

const wallet = btc.keys('your twelve-word ADM passphrase');
const valid = btc.isValidAddress(wallet.address ?? '');
```

The external coin scope is intentionally limited to metadata, deterministic key/address derivation, and address validation. Balance lookup, history, fees, external-chain signing, and broadcasting are not part of this SDK surface.

## Wallet metadata

```ts
import {coinMetadata, walletMetadataSource} from 'adamant-api/metadata';

console.log(coinMetadata.ADM.decimals); // 8
console.log(walletMetadataSource.revision);
```

Metadata is generated from a pinned `adamant-wallets` revision so updates are deterministic and reviewable:

```sh
pnpm metadata:check
pnpm metadata:sync
```

Generated ADAMANT API DTOs follow the same pinned workflow from the ADAMANT Node OpenAPI specification (`Adamant-im/adamant/openapi`):

```sh
pnpm api-types:check
pnpm api-types:sync
```

## Reliability

`AdamantApi` checks configured nodes through the node status endpoint and selects a live node at an actual blockchain height. Safe GET failures (including HTTP `429 Too Many Requests` rate limits on ADAMANT Node v0.11.0+) fail over to another healthy node or wait a bounded `Retry-After` backoff when staying on the same node. POST requests are retried only when no HTTP response was received; an explicitly rejected POST is never replayed automatically, avoiding pointless retries for validation errors or duplicate transactions.

Applications should provide several independently operated HTTPS nodes and handle returned errors. Malformed responses, timeouts, and partial network outages must not be treated as successful requests.

Logging can be disabled only with `logLevel: 'none'`. Supported thresholds are
`error`, `warn`, `info`, `log`, and `debug`; unknown application-specific names
such as `trace` fall back to `log` instead of disabling SDK output.

## Error handling

Expected validation, node, and transport failures resolve to a single result
shape: `{success: false, errorMessage: string}`. Check `response.success`
before reading response data. Node-specific `error` and `message` fields are
normalized to `errorMessage`; application code does not need to check multiple
error fields. See the [error-handling guide](https://js.docs.adamant.im/guide/error-handling).

## Development

```sh
corepack enable
pnpm install
pnpm build
pnpm test
pnpm test:package
pnpm lint
```

`pnpm test:package` packs the current working tree and installs its tarball into a temporary consumer project. It verifies CommonJS and ESM imports, package subpaths, runtime helpers, and TypeScript declarations without using the published npm version. Edit [`scripts/package-test/consumer.ts`](./scripts/package-test/consumer.ts) to extend the consumer scenario.

Run the deterministic transaction ID example directly on Node.js 22 or newer:

```sh
pnpm build
node --experimental-strip-types examples/getId/index.mts
```

See [CONTRIBUTING.md](./CONTRIBUTING.md) for repository conventions, testing expectations, generated files, and pull request guidance.

## Links

- [ADAMANT website](https://adamant.im/)
- [ADAMANT documentation](https://docs.adamant.im/)
- [ADAMANT Improvement Proposals](https://aips.adamant.im/all)
- [ADAMANT Node](https://github.com/Adamant-im/adamant)
- [ADAMANT API schema](https://docs.adamant.im/schema/)
- [ADAMANT schema source](https://github.com/Adamant-im/adamant/tree/dev/openapi)
- [ADAMANT wallet metadata](https://github.com/Adamant-im/adamant-wallets)
- [ADAMANT blockchain explorer](https://explorer.adamant.im/)
- [Package documentation and examples](https://js.docs.adamant.im)
- [Changelog and releases](https://github.com/Adamant-im/adamant-api-jsclient/releases)
- [Issues and feature requests](https://github.com/Adamant-im/adamant-api-jsclient/issues)

## License

[GPL-3.0](./LICENSE)

---
_Source: https://npm.io/package/adamant-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
