* Lazily create registry types (also solves resolution order) * Typo in comment * Alphabetical definitions (ordering detected) * Make fallback & SessionKeys work as expected * Cleanup registration, user-types takes priority * typo * Api constructors only take options * Cleanup typos * Don't create classes while validating metadata * Adjust badges... well, waiting for CI, so... * typo
23 lines
746 B
JavaScript
Executable File
23 lines
746 B
JavaScript
Executable File
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
// Required imports
|
|
const { ApiPromise, WsProvider } = require('@polkadot/api');
|
|
|
|
async function main () {
|
|
// Initialise the provider to connect to the local node
|
|
const provider = new WsProvider('ws://127.0.0.1:9944');
|
|
|
|
// Create the API and wait until ready
|
|
const api = await ApiPromise.create({ provider });
|
|
|
|
// Retrieve the chain & node information information via rpc calls
|
|
const [chain, nodeName, nodeVersion] = await Promise.all([
|
|
api.rpc.system.chain(),
|
|
api.rpc.system.name(),
|
|
api.rpc.system.version()
|
|
]);
|
|
|
|
console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
|
|
}
|
|
|
|
main().catch(console.error).finally(() => process.exit());
|