A module written in javascript for managing various keyrings of Arbitrum accounts, encrypting them, and using them.
npm install --save @getsafle/vault-arbitrum-controller
const { KeyringController, getBalance } = require('@getsafle/vault-arbitrum-controller');
const arbitrumController = 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 arbitrumController.createNewVaultAndKeychain(password);
const keyringState = await arbitrumController.createNewVaultAndRestore(password, mnemonic);
const keyringState = await arbitrumController.addNewAccount(keyringObject);
const privateKey = await arbitrumController.exportAccount(address);
const signedTx = await arbitrumController.signTransaction(arbitrumTx, _fromAddress);
const signedMsg = await arbitrumController.signMessage(msgParams);
const signedObj = await arbitrumController.sign(msgParams, pvtKey, web3Obj);
const signedData = await arbitrumController.signTypedMessage(msgParams);
const balance = await getBalance(address, web3);