Package Exports
- realis
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (realis) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
realis.js
Javascript API and Types
Installtion
yarn add @realis/api
How to instantiate a ReAlis API object and use it to connect to a node using ApiPromise.
Examples
const { ApiPromise, WsProvider } = require('@realis/api');
async function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('wss://realis.network');
// Create the API and wait until ready
const api = new ApiPromise({ provider });
await api.isReady;
// 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());