API documentation (#253)
* Remove badges from READMEs (used inside docs) * Expand intro * Intro and examples for ApiRx * examples -> examples-rpc * Update intros with expanded example * Don't nest subscriptions
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
const Rpc = require('@polkadot/rpc-core').default;
|
||||
const WsProvider = require('@polkadot/rpc-provider/ws').default;
|
||||
const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = new Rpc(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());
|
||||
Reference in New Issue
Block a user