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

1.0.3 • Public • Published

Mina Signer Wasm

Installation

with npm
npm i @chainsafe/mina-signer-wasm
with yarn
yarn add @chainsafe/mina-signer-wasm

Initialization

for NodeJs
import { Client } from "@chainsafe/mina-signer-wasm";

const client = new Client({ network: "testnet" });
for Web
import init, { Client } from "@chainsafe/mina-signer-wasm";

await init();
const client = new Client({ network: "testnet" });

Examples

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

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

// Sign and verify a payment
const 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");
}

Readme

Keywords

Package Sidebar

Install

npm i @chainsafe/mina-signer-wasm

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

897 kB

Total Files

25

Last publish

Collaborators

  • wemeetagain
  • mpetrunic