npm install --save @getsafle/vault-sol-controller
const { KeyringController, getBalance } = require('@getsafle/vault-sol-controller');
const solController = new KeyringController({
// 12 words mnemonic to create wallet
mnemonic: string,
// network - type of network [TESTNET|MAINNET]
// default is MAINNET even if no network is passed
network: string (TESTNET | MAINNET)
});
const keyringState = await solController.addAccount();
const privateKey = await solController.exportPrivateKey(address);
const privateKey = await solController.getAccounts();
const signedTx = await solController.signTransaction(solTx);
STX transfer transaction:
solTx: {from, to, amount, txnType}
Token transfer transaction:
solTx: {from, to, amount, txnType, token}
transactionType = 'NATIVE_TRANSFER' || 'TOKEN_TRANSFER'
const signedMsg = await solController.signMessage(msgString, address);
const fees = await solController.getFees(rawTransaction);
const balance = await getBalance(address, network); // if network !== TESTNET then it will fetch mainnet balance