npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mina-sdk

v0.1.0

Published

TypeScript / JavaScript SDK for interacting with Mina Protocol nodes via GraphQL

Downloads

22

Readme

Mina JavaScript SDK

CI npm version License

TypeScript/JavaScript SDK for interacting with Mina Protocol nodes via GraphQL. Companion to mina-sdk-python, mina-sdk-go, and mina-sdk-rust.

Features

  • Daemon GraphQL client — query node status, accounts, blocks; send payments and delegations
  • Typed response objects with a Currency type backed by bigint
  • Automatic retry with configurable backoff
  • Public executeQuery() for custom GraphQL queries
  • Ships ESM + CJS; works on Node 18+

Installation

npm install mina-sdk

Quick Start

import { Currency, MinaClient } from 'mina-sdk';

const client = new MinaClient();

console.log(await client.getSyncStatus()); // "SYNCED"

const account = await client.getAccount('B62q...');
console.log(`Balance: ${account.balance.total} MINA`);

const result = await client.sendPayment({
  sender: 'B62qsender...',
  receiver: 'B62qreceiver...',
  amount: Currency.fromMina('1.5'),
  fee: Currency.fromMina('0.01'),
});
console.log(`Tx hash: ${result.hash}`);

Configuration

import { MinaClient } from 'mina-sdk';

const client = new MinaClient({
  graphqlUri: 'http://127.0.0.1:3085/graphql', // default
  retries: 3,                                   // must be >= 1
  retryDelayMs: 5000,                           // delay between retries
  timeoutMs: 30_000,                            // per-request HTTP timeout
});

Constructor options are validated eagerly — invalid values throw RangeError at construction time.

API Reference

Queries

| Method | Returns | Description | |--------|---------|-------------| | getSyncStatus() | string | Node sync status (SYNCED, BOOTSTRAP, etc.) | | getDaemonStatus() | DaemonStatus | Comprehensive daemon status | | getNetworkId() | string | Network identifier | | getAccount(publicKey, tokenId?) | AccountData | Account balance, nonce, delegate | | getBestChain(maxLength?) | BlockInfo[] | Recent blocks from the best chain | | getPeers() | PeerInfo[] | Connected peers | | getPooledUserCommands(publicKey?) | PooledUserCommand[] | Pending transactions | | executeQuery(query, variables, name) | T | Run a custom GraphQL query |

Mutations

| Method | Returns | Description | |--------|---------|-------------| | sendPayment(params) | SendPaymentResult | Send a payment | | sendDelegation(params) | SendDelegationResult | Delegate stake | | setSnarkWorker(publicKey?) | string \| null | Set/unset SNARK worker | | setSnarkWorkFee(fee) | string | Set SNARK work fee |

Currency

import { Currency } from 'mina-sdk';

const a = Currency.fromMina(10);           // 10 MINA
const b = Currency.fromMina('1.5');        // 1.5 MINA
const c = Currency.fromNanomina(1_000_000_000n); // 1 MINA

console.log(a.add(b).toString()); // "11.500000000"
console.log(a.nanomina);          // 10000000000n
console.log(a.greaterThan(b));    // true
console.log(b.mul(3).toString()); // "4.500000000"

Currency is immutable and stored as a bigint of nanomina, so all arithmetic is exact.

Errors

  • GraphQLError — daemon returned an errors array (not retried)
  • DaemonConnectionError — transport-level failure after retries attempts
  • AccountNotFoundErrorgetAccount returned a null account
  • CurrencyParseError — invalid input to a Currency.from* factory
  • CurrencyUnderflowErrorCurrency.sub would go negative

Custom Queries

const data = await client.executeQuery<{ bestChain: Array<{ stateHash: string }> }>(
  `query { bestChain(maxLength: 1) { stateHash } }`,
  {},
  'best_chain_head',
);
console.log(data.bestChain[0].stateHash);

License

Apache-2.0