# mock-chronik-client

> Testing utility to mock the Chronik indexer client and support unit tests that need to mock chronik related API calls.

Latest version **3.4.1** (published 2026-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install mock-chronik-client
pnpm add mock-chronik-client
yarn add mock-chronik-client
bun add mock-chronik-client
```

## Health

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

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 3.4.1 |
| Published | 2026-09-02 |
| First published | 2024-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 133.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1301 |
| Author | Bitcoin ABC |
| Maintainers | bytesofman |
| Keywords | chronik-client, chronik, mock |

## Links

- npm: https://www.npmjs.com/package/mock-chronik-client
- Repository: https://github.com/Bitcoin-ABC/bitcoin-abc
- Homepage: https://github.com/Bitcoin-ABC/bitcoin-abc#readme
- npm.io page: https://npm.io/package/mock-chronik-client

## Dependencies (3)

- [ws](https://npm.io/package/ws.md) ^8.21.0
- [ecashaddrjs](https://npm.io/package/ecashaddrjs.md) ^2.0.1
- [chronik-client](https://npm.io/package/chronik-client.md) ^4.3.1

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [@mikemajesty/zod-mock-schema](https://npm.io/package/@mikemajesty/zod-mock-schema.md) — 0 weekly downloads
- [vue-scroll-active-toc](https://npm.io/package/vue-scroll-active-toc.md) — 0 weekly downloads
- [@govuk-pay/run-amock](https://npm.io/package/@govuk-pay/run-amock.md) — 0 weekly downloads

## Recent versions

- 3.4.1 (latest) — 2026-09-02
- 2.1.3-rc (rc) — 2025-01-16
- 3.4.0 — 2026-05-19
- 3.3.0 — 2026-05-13
- 3.2.0 — 2026-05-05
- 3.1.1 — 2026-03-03
- 3.1.0 — 2025-06-18
- 3.0.0 — 2025-02-28
- 2.1.3 — 2025-01-16
- 2.1.2 — 2025-01-10
- 2.1.1 — 2024-12-20
- 2.1.0 — 2024-12-18
- 2.0.1 — 2024-12-12
- 2.0.0 — 2024-12-12
- 1.12.3 — 2024-12-03
- … 16 more at https://npm.io/package/mock-chronik-client/versions

## README

# mock-chronik-client

Testing utility to mock the Chronik indexer client and support unit tests that need to mock chronik related API calls.

## Usage

Mock chronik API calls including tx broadcasting and paginated tx history. Also includes an Agora mock. See unit tests for latest usage.

## Questions?

If you have any implementation questions regarding this mock tool please check the test suite in `/test/index.test.js` or feel free to reach out to the development team via the [eCash Development Telegram](https://t.me/eCashDevelopment).

### Change Log

1.1.0

- Add support to in-node subscribeToBlocks method and check flag, isSubscribedBlocks

    1.1.1

- Patch error tests

    1.2.0

- Add support to calls by `address(address)` returning same as `script(type, hash)`

    1.3.0

- Add support for `subscribeToAddress` and `unsubscribeFromAddress` websocket methods

    1.4.0

- Add support for `ws.unsubscribe` method and fix errors in `ws` tests

    1.4.1

- Patch repo path in package.json

    1.5.0

- Add support for ws subscribe methods and shape found in in-node chronik-client

    1.6.0

- Match shape of `subs` object in `ChronikClientNode` for `ChronikClientNode` ws methods and support unsubscribe from blocks

    1.7.0

- Allow getting and setting utxos() and history() by tokenId

    1.8.0

- Allow getting history without specifying pageNumber or pageSize

    1.9.0

- Support `blockTxs` endpoint
- Update websocket subs shape to match ChronikClientNode

    1.9.1

- Upgrading npm dependencies [D16380](https://reviews.bitcoinabc.org/D16380)

    1.10.0

- Allow getting and setting `history()` by `lokadId` [D16382](https://reviews.bitcoinabc.org/D16382)

    1.10.1

- Return missing `numTxs` key from `history()` calls [D16617](https://reviews.bitcoinabc.org/D16617)

    1.11.0

- Add support for `MockAgora`, a simple set-and-return mock for some `ecash-agora` class methods [D16737](https://reviews.bitcoinabc.org/D16737)

    1.12.0

- Extend `MockAgora` support to cover `offeredFungibleTokenIds()` and `activeOffersByTokenId()` methods [D16929](https://reviews.bitcoinabc.org/D16929)

    1.12.1

- Build published version with dependencies from `npm` [D17227](https://reviews.bitcoinabc.org/D17227)

    1.12.2

- Add `MockAgora` to stub ts declarations [D17274](https://reviews.bitcoinabc.org/D17274)

    1.12.3

- Add dummy `plugin` method to allow construction of `new Agora()` from `ecash-agora` with a `MockChronikClient` [D17279](https://reviews.bitcoinabc.org/D17279)

    2.0.0

[D17332](https://reviews.bitcoinabc.org/D17332)

- Full implementation of typescript
- Set history and utxos by script, address, or tokenId in one step (prev 2)
- Set history by lokadId in one step (prev 2)
- Better type checking
- Improved mock websocket (now it more closely follows the API of chronik-client)
- Add `broadcastTxs` method
- Add `chronikInfo` method

    2.0.1

- Build before deployment so it also works for non-ts users [D17338](https://reviews.bitcoinabc.org/D17338)

    2.1.0

- Support for Agora plugin websocket subscriptions [D17369](https://reviews.bitcoinabc.org/D17369)

    2.1.1

- Upgrade to dependency-free `ecashaddrjs` [D17269](https://reviews.bitcoinabc.org/D17269)

    2.1.2

- Update README [D17506](https://reviews.bitcoinabc.org/D17506)

    2.1.3

- Update `package.json` paths for correct typescript `dist` [D17542](https://reviews.bitcoinabc.org/D17542)

    3.0.0

- Update types to match latest breaking changes in `chronik-client` [D17727](https://reviews.bitcoinabc.org/D17727)

    3.1.0

- Support for txid websocket subscriptions [D18262](https://reviews.bitcoinabc.org/D18262)

- Match the correct type interfaces for the `broadcastTxs` method [D19627](https://reviews.bitcoinabc.org/D19627)

    3.2.0

- Support for the batchUtxos() function [D19943](https://reviews.bitcoinabc.org/D19943)

    3.3.0

- Support for the batchSummary() function [D19983](https://reviews.bitcoinabc.org/D19983)

    3.4.0

- Support for `broadcastAndFinalizeTx` and `broadcastAndFinalizeTxs` [D20014](https://reviews.bitcoinabc.org/D20014)

    3.4.1 [D20538](https://reviews.bitcoinabc.org/D20538)

- Patch bump to catch the latest `chronik-client`

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