casper-multisignature-js-client
v0.0.2
Published
Casper Multisignautre JavaScript Client
Downloads
6
Maintainers
Readme
casper-multisignature-js-client
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.
| Network | Contract Hash | | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Testnet | d57f154b0f48964cb56d12ca825b084e54de6ebedb9dcdb3dea857176fef64b3 | | Mainnet | b2ec4f982efa8643c979cb3ab42ad1a18851c2e6f91804cd3e65c079679bdc59 |
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");