Files
api/docs/examples/01_simple_connect/index.js
T
Jaco Greeff 4854379424 Gitbook rendering updates (#159)
* Add .nodoc for in-flux packages

* Start with clean-slate for re-generation

* Update with working (although manual) config
2018-09-19 16:14:37 +02:00

17 lines
405 B
JavaScript
Executable File

const Api = require('@polkadot/api').default
const WsProvider = require('@polkadot/api-provider/ws').default
const provider = new WsProvider('ws://127.0.0.1:9944')
const api = new Api(provider)
async function getChain () {
return api.system.chain()
}
async function main () {
const chain = await getChain()
console.log('You are connected to chain:', chain)
}
main().finally(_ => process.exit())