I create my signer wallet as follows:
const seed = bip39.mnemonicToSeedSync(WALLET_MNEMONIC, WALLET_PASSWORD);
const privateKeyBuffer = bip32
.fromSeed(seed)
.derivePath(`m/44'/434'/0'/0/0`).privateKey;
const keyring = new Keyring({ss58Format: 2});
return keyring.addFromAddress('0x'+privateKeyBuffer.toString("hex"));
and I try to transfer KSM from that account into another one:
const unsub = await api.tx.balances
.transfer(recipientAddress, amount)
.signAndSend(signerWallet, (result) => {
console.log(`Current status is ${result.status}`);
if (result.status.isInBlock) {
console.log(`Transaction included at blockHash ${result.status.asInBlock}`);
} else if (result.status.isFinalized) {
console.log(`Transaction finalized at blockHash ${result.status.asFinalized}`);
unsub();
}
});
However I get that error:
Cannot sign with a locked key pair
What is the problem with my code?