Created
March 4, 2020 11:58
-
-
Save jimmychu0807/4eb4f344e70970267ece72dd485bcce2 to your computer and use it in GitHub Desktop.
Markdium-用 Polkadot-JS API 輕鬆搭建 Substrate 前端
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 初始化 `api` 對象 | |
const api = ...; | |
// 取得鏈上的時間戳 | |
const now = await api.query.timestamp.now(); | |
// 一個模擬地址 | |
const ADDR = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE'; | |
// 取得用戶地址中的餘額 | |
const balance = await api.query.balances.freeBalance(ADDR); | |
const nonce = await api.query.system.accountNonce(ADDR); | |
console.log(`${now}: balance of ${balance} and a nonce of ${nonce}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment