Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function transfer (keyRingFrom, addressTo, amount) {
const nextAccountIndex = await getAccountIndex(keyRingFrom.address());
// encode the call for signing
const encoded = encodeExtrinsic(
keyRingFrom,
nextAccountIndex,
extrinsics.staking.public.transfer,
[addressTo, amount]
);
await api.author.submitExtrinsic(encoded)
.catch(e => console.log);
}