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

mns-zkapp

v0.3.7

Published

## How to build

Readme

Mina zkApp: Mns Zkapp

How to build

npm run build

How to run tests

npm run test
npm run testw # watch mode

RecordJSON DESC

export interface RecordJSON {
  /**
   * Record Key. All characters must be lowercase.
   *
   * @type {string}
   * @memberof RecordJSON
   */
  key: string;
  /**
   * Record Kind. Such as: address, profile
   *
   * @type {string}
   * @memberof RecordJSON
   */
  kind: string;
  /**
   * The record label field allows the user to freely input a string with a length of no more than 31 characters
   *
   * @type {string}
   * @memberof RecordJSON
   */
  label: string;
  /**
   * Time To Live. Default value: 300
   *
   * @type {number}
   * @memberof RecordJSON
   */
  ttl: number;
  /**
   * Record Value.
   *
   * @type {string}
   * @memberof RecordJSON
   */
  value: string;
}

The record kind field can take the following values:

export enum RecordKind {
  Address = 'address',
  Profile = 'profile',
  Custom = 'custom',
}

How to generate a key:

let qa = MnsFactory.getQAInstance(
    'https://proxy.berkeley.minaexplorer.com/graphql',
    zkappAddress,
    100_000_000
  );
qa.createAddressKey('mina'); // return a key: "address.mina"
qa.createProfileKey('twitter'); // return a key: "profile.twitter"
qa.createCustomKey('mykey'); // return a key: custom.mykey

At present, the agreed keys are:

address.mina, address.btc, address.eth profile.twitter, profile.facebook, profile.telegram, profile.discord

How to use

import { 
    MnsFactory,
    Account, 
    AccountJSON,
    stringToField,
    Permit, 
    PERMIT_UPDATE_REGISTER_FEE
} from 'mns-zkapp';
import {
    compactMerkleProofToJson,
    MemoryStore,
    SparseMerkleTree,
} from 'snarky-smt';
import {
    fetchAccount,
    Field,
    isReady,
    PrivateKey,
    shutdown,
    UInt64,
} from 'snarkyjs';

  await isReady;

  let zkappKey = PrivateKey.fromBase58(TEST_ZKAPP_KEY);
  let zkappAddress = zkappKey.toPublicKey();

  let qa = MnsFactory.getQAInstance(
    'https://proxy.berkeley.minaexplorer.com/graphql',
    zkappAddress,
    100_000_000
  );

  // to use this test, change this private key to an account which has enough MINA to pay fees
  let feePayerKey = PrivateKey.fromBase58(TEST_FEEPAYER_KEY);

  let feePayerPublicKey = feePayerKey.toPublicKey();
  let response = await fetchAccount(feePayerPublicKey);
  if (response.error) throw Error(response.error.statusText);
  let { nonce, balance } = response.account;
  console.log(
    `Using fee payer account with nonce ${nonce}, balance ${balance}`
  );

  // check if the zkapp is already deployed, based on whether the account exists and its first zkapp state is != 0
  let x = await qa.getMnsRegisterFee();
  let isDeployed = x?.equals(UInt64.fromNumber(0)).not().toBoolean() ?? false;

  // if the zkapp is not deployed yet, create a deploy transaction
  if (!isDeployed) {
    console.log(`Deploying zkapp for public key ${zkappAddress.toBase58()}.`);

    await qa.deploy(zkappKey, feePayerKey, feePayerPublicKey);
  }

  while (!isDeployed) {
    console.log('just wait 1 min...');
    await sleep(1 * 60 * 1000);
    let x = await qa.getMnsRegisterFee();
    isDeployed = x?.equals(UInt64.fromNumber(0)).not().toBoolean() ?? false;
  }

  // if the zkapp is not deployed yet, create an update transaction
  if (isDeployed) {
    let x = qa.getMnsZkapp().registerFee.get();
    console.log(`Found deployed zkapp, registerFee: ${x} .`);
    const newRegisterFee = 20_000_000;

    const callerNonce = await qa.getAccountNonce(feePayerKey.toPublicKey());
    const updateFeePermit = new Permit(PERMIT_UPDATE_REGISTER_FEE, callerNonce);
    const ownerSignature = qa.createMnsOwnerSignature(
      feePayerKey,
      updateFeePermit
    );
    await qa.updateRegisterFee(
      feePayerKey,
      newRegisterFee,
      updateFeePermit,
      ownerSignature
    );

    let tree = await SparseMerkleTree.buildNewTree<Field, Account>(
      new MemoryStore<Account>()
    );
    let cproof = await tree.proveCompact(stringToField('ok'));
    let proof = compactMerkleProofToJson(cproof);
    let account = AccountJSON.default('ok', feePayerPublicKey.toBase58());

    await qa.registerAccount(feePayerKey, feePayerKey, account, proof);
  }

License

Apache-2.0