A Module is written in javascript for managing various keyrings of Mantle accounts, encrypting them, and using them. This repository contains MANTLEHdKeyring
class to create Mantle wallet from Safle Vault.
npm install --save @getsafle/vault-mantle-controller
const { KeyringController, getBalance } = require('@getsafle/vault-mantle-controller');
const mantleController = 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 mantleController.createNewVaultAndKeychain(password);
const keyringState = await mantleController.createNewVaultAndRestore(password, mnemonic);
const keyringState = await mantleController.addNewAccount(keyringObject);
const privateKey = await mantleController.exportAccount(address);
const signedTx = await mantleController.signTransaction(mantleTx, _fromAddress);
const signedMsg = await mantleController.signMessage(msgParams);
const signedObj = await mantleController.sign(msgParams, pvtKey, web3Obj);
const balance = await getBalance(address, web3);