Rename st -> query (#269)
This commit is contained in:
committed by
Amaury Martiny
parent
b913ace9be
commit
fb528d051c
@@ -10,13 +10,13 @@ async function main () {
|
||||
|
||||
// Retrieve the initial balance. Since the call has no callback, it is simply a promise
|
||||
// the resolves to the current on-chain value
|
||||
let previous = await api.st.balances.freeBalance(Alice);
|
||||
let previous = await api.query.balances.freeBalance(Alice);
|
||||
|
||||
console.log(`${Alice} has an ${previous} balance`);
|
||||
console.log(`You may leave this example running and start example 06 or transfer any value to ${Alice}`);
|
||||
|
||||
// Here we subscribe to any balance changes and updates the on-screen value
|
||||
api.st.balances.freeBalance(Alice, (current) => {
|
||||
api.query.balances.freeBalance(Alice, (current) => {
|
||||
// Calculate the delta
|
||||
const change = current.sub(previous);
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ async function main () {
|
||||
|
||||
// Make our basic chain state/storage queries, all in one go
|
||||
const [accountNonce, blockPeriod, validators] = await Promise.all([
|
||||
api.st.system.accountNonce(Alice),
|
||||
api.st.timestamp.blockPeriod(),
|
||||
api.st.session.validators()
|
||||
api.query.system.accountNonce(Alice),
|
||||
api.query.timestamp.blockPeriod(),
|
||||
api.query.session.validators()
|
||||
]);
|
||||
|
||||
console.log(`accountNonce(${Alice}) ${accountNonce}`);
|
||||
@@ -21,7 +21,7 @@ async function main () {
|
||||
// get the balances for all validators
|
||||
const validatorBalances = await Promise.all(
|
||||
validators.map((authorityId) =>
|
||||
api.st.balances.freeBalance(authorityId)
|
||||
api.query.balances.freeBalance(authorityId)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ async function main () {
|
||||
const api = await ApiPromise.create();
|
||||
|
||||
// retrieve the nonce for Alice, used to sign the transaction
|
||||
const aliceNonce = await api.st.system.accountNonce(alice.address());
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user