Created
March 4, 2020 11:58
-
-
Save jimmychu0807/ae7ffd26489fb29d26e37201697b6de7 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
// 從 Alice 提交一個交易給另一用戶 | |
const unsub = await api.tx.balances | |
.transfer(recipient, 12345) | |
.signAndSend(alice, ({ eventRecords = [], status }) => { | |
console.log(`Current status is ${status.type}`); | |
if (status.isInBlock) { | |
console.log(`Transaction included at blockHash ${status.asInBlock}`); | |
} else if (status.isFinalized) { | |
console.log(`Transaction finalized at blockHash ${status.asFinalized}`); | |
unsub(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment