Bump API requirement in examples (#704)

* Bump examples to latest APIs

* Transfer with hash

* Bump @babel/core
This commit is contained in:
Jaco Greeff
2019-02-16 09:11:48 +01:00
committed by GitHub
parent 09a31f2e30
commit eb5e2f700c
19 changed files with 25 additions and 30 deletions
@@ -22,14 +22,9 @@ async function main () {
const transfer = api.tx.balances.transfer(BOB_ADDR, 12345);
// Sign and send the transaction using our account
transfer.signAndSend(alice, ({ status, type }) => {
// retrieve the hash once we are finalised
if (type === 'Finalised') {
console.log(`Successful transfer of 12345 from Alice to Bob with hash ${status.asFinalised.toHex()}`);
} else {
console.log(`Transaction status: ${type}`);
}
});
const hash = await transfer.signAndSend(alice);
console.log('Transfer sent with hash', hash.toHex());
}
main().catch(console.error).finally(_ => process.exit());
main().catch(console.error).finally(() => process.exit());