Update docs for system.account (#1944)

This commit is contained in:
Jaco Greeff
2020-02-25 17:01:41 +01:00
committed by GitHub
parent 67841a9212
commit c17f93a3ec
14 changed files with 24 additions and 24 deletions
@@ -25,12 +25,12 @@ async function main () {
if (balance[0] === 'first') {
// Now we know that if the previous value emitted as balance[0] is `first`,
// then balance[1] is the initial value of Alice account.
console.log(`Alice ${Alice} has a balance of ${balance[1][1].free}`);
console.log(`Alice ${Alice} has a balance of ${balance[1].data.free}`);
console.log('You may leave this example running and start the "Make a transfer" example or transfer any value to Alice address');
return;
}
const change = balance[1][1].free.sub(balance[0][1].free);
const change = balance[1].data.free.sub(balance[0].date.free);
// Only display value changes
if (!change.isZero()) {
+4 -4
View File
@@ -36,16 +36,16 @@ function main () {
})
)
// Then we're subscribing to the emitted results
.subscribe(([[accountNonce], blockPeriod, validators, validatorBalances]) => {
console.log(`accountNonce(${Alice}) ${accountNonce}`);
.subscribe(([{ nonce }, blockPeriod, validators, validatorBalances]) => {
console.log(`accountNonce(${Alice}) ${nonce}`);
console.log(`blockPeriod ${blockPeriod.toNumber()} seconds`);
if (validatorBalances) {
// And lastly we print out the authorityIds and balances of all validators
console.log('validators', validators.map((authorityId, index) => ({
address: authorityId.toString(),
balance: validatorBalances[index][1].free.toString(),
nonce: validatorBalances[index][0].toString()
balance: validatorBalances[index].data.free.toString(),
nonce: validatorBalances[index].data.toString()
})));
}
});