0.0.2 • Published 2 months ago

casper-multisignature-js-client v0.0.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 months ago

casper-multisignature-js-client

ci-multisignature

JS Client for Casper Multisignature

Installation

npm install casper-multisignature-js-client

Documentation

There are 2 options to make multi signature account.

1. Using wasm session code

Coming soon

You can find examples in client.test.ts.

2. Using stored session contract

Current smart contract is compatiable with MAKE's Associated Key Manager contract.

Deployed contracts on testnet and mainnet by MAKE.

NetworkContract Hash
Testnetd57f154b0f48964cb56d12ca825b084e54de6ebedb9dcdb3dea857176fef64b3
Mainnetb2ec4f982efa8643c979cb3ab42ad1a18851c2e6f91804cd3e65c079679bdc59
import {
  CasperMultiSignatureClient,
  type SetAssociatedKeysArgs,
} from "casper-multisignature-js-client";

const client = new CasperMultiSignatureClient(
  "http://<NODE-IP>:7777/rpc",
  "casper-test"
);

client.setContractHash(
  "d57f154b0f48964cb56d12ca825b084e54de6ebedb9dcdb3dea857176fef64b3"
);

// make sender's account as multi sig account having 3 associated keys
// to send deploy at least 2 associated keys should sign the deploy
// to make changes on keys, at least 3 associated keys should sign the deploy
const args: SetAssociatedKeysArgs = {
  deploymentThreshold: 2,
  keyManagementThreshold: 3,
  keys: [
    CLPublicKey.fromHex("<PUBLIC_KEY_1>"),
    CLPublicKey.fromHex("<PUBLIC_KEY_2>"),
    CLPublicKey.fromHex("<PUBLIC_KEY_3>"),
  ],
  weights: [1, 1, 1],
};

const deploy = client.setAssociatedKeys(
  args,
  10_000_000_000,
  CLPublicKey.fromHex("<SENDERS_PUBLIC_KEY>"),
  "casper-test", // optional
  [] // provide private key, if you want to sign deploy
);

const deployHash = await deploy.send("http://<NODE-IP>:7777/rpc");
0.0.2

2 months ago

0.0.1

3 months ago