A Module written in javascript for managing various keyrings of rootstock accounts, encrypting them, and using them. This repository contains rootstockHdKeyring
class to create rootstock wallet from Safle Vault.
npm install --save @getsafle/vault-rootstock-controller
const { KeyringController, getBalance } = require('@getsafle/vault-rootstock-controller');
const rootstockController = new KeyringController({
encryptor: {
// An optional object for defining encryption schemes:
// Defaults to Browser-native SubtleCrypto.
encrypt(password, object) {
return new Promise('encrypted!');
},
decrypt(password, encryptedString) {
return new Promise({ foo: 'bar' });
},
},
});
const keyringState = await rootstockController.createNewVaultAndKeychain(password);
const keyringState = await rootstockController.createNewVaultAndRestore(password, mnemonic);
const keyringState = await rootstockController.addNewAccount(keyringObject);
const privateKey = await rootstockController.exportAccount(address);
const signedTx = await rootstockController.signTransaction(rootstockTx, _fromAddress);
const signedMsg = await rootstockController.signMessage(msgParams);
const signedObj = await rootstockController.sign(msgParams, pvtKey, web3Obj);
const signedData = await rootstockController.signTypedMessage(msgParams);
const balance = await rootstockController.getBalance(address, web3);
const receipt = await rootstockController.sendTransaction(signedTx, web3);
const fees = await rootstockController.getFees(rawTx, web3);