@chainsafe/mina-signer
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Mina Signer

This is a NodeJS SDK that allows you to sign strings, payments, and delegations using Mina's key pairs for various specified networks.

Install

yarn add mina-signer
# or with npm:
npm install --save mina-signer

Usage

import Client from "mina-signer";
const client = new Client({ network: "mainnet" });

// Generate keys
let keypair = client.genKeys();

// Sign and verify message
let signed = client.signMessage("hello", keypair);
if (client.verifyMessage(signed)) {
  console.log("Message was verified successfully");
}

// Sign and verify a payment
let signedPayment = client.signPayment(
  {
    to: keypair.publicKey,
    from: keypair.publicKey,
    amount: 1,
    fee: 1,
    nonce: 0,
  },
  keypair.privateKey
);
if (client.verifyPayment(signedPayment)) {
  console.log("Payment was verified successfully");
}

// Sign and verify a stake delegation
const signedDelegation = client.signStakeDelegation(
  {
    to: keypair.publicKey,
    from: keypair.publicKey,
    fee: "1",
    nonce: "0",
  },
  keypair.privateKey
);
if (client.verifyStakeDelegation(signedDelegation)) {
  console.log("Delegation was verified successfully");
}

Package Sidebar

Install

npm i @chainsafe/mina-signer

Weekly Downloads

1

Version

1.2.0

License

Apache-2.0

Unpacked Size

40.4 MB

Total Files

12

Last publish

Collaborators

  • wemeetagain
  • mpetrunic