Remove the nonce when using signAndSend (promise examples) (#648)

* Remove the nonce when using signAndSend

* Update descriptions
This commit is contained in:
Jaco Greeff
2019-01-29 19:47:25 +01:00
committed by GitHub
parent 273f1260e4
commit 4fa8ee085c
2 changed files with 4 additions and 11 deletions
@@ -16,16 +16,12 @@ async function main () {
// Instantiate the API
const api = await ApiPromise.create();
// Retrieve the nonce for Alice, to be used to sign the transaction
const aliceNonce = await api.query.system.accountNonce(alice.address());
// Create a extrinsic, transferring 12345 units to Bob. We can also create,
// sign and send in one operation (as per the samples in the Api documentation),
// here we split it out for the sake of readability
// Create a extrinsic, transferring 12345 units to Bob
const transfer = api.tx.balances.transfer(BOB_ADDR, 12345);
// Sign and send the transaction using our account. Send the transaction and retrieve the resulting Hash
// 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 {