A Module written in javascript for managing various keyrings of BSCereum accounts, encrypting them, and using them. This repository contains BSCHdKeyring
class to create Binance smart chain wallet from Safle Vault.
npm install --save @getsafle/vault-bsc-controller
const { KeyringController, getBalance } = require('@getsafle/vault-bsc-controller');
const bscController = 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 bscController.createNewVaultAndKeychain(password);
const keyringState = await bscController.createNewVaultAndRestore(password, mnemonic);
const keyringState = await bscController.addNewAccount(keyringObject);
const privateKey = await bscController.exportAccount(address);
const signedTx = await bscController.signTransaction(bscTx, _fromAddress);
const signedMsg = await bscController.signMessage(msgParams);
const signedObj = await bscController.sign(msgParams, pvtKey, web3Obj);
const signedData = await bscController.signTypedMessage(msgParams);
const balance = await getBalance(address, web3);
const receipt = await bscController.sendTransaction(signedTx, web3);
const fees = await bscController.getFees(rawTx, web3);