1.4.0 • Published 3 years ago

chaingreen-api v1.4.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
3 years ago

chaingreen-Api

Usage example

const { readFileSync } = require('fs');
const { Connection, constants, ApiClient } = require('chaingreen-api');

(async () => {
  const conn = new Connection('localhost:55400', {
    cert: readFileSync('private_daemon.crt'),
    key: readFileSync('private_daemon.key'),
  });
  conn.onMessage((message) => {
    console.log(message);
  });
  conn.addService(constants.SERVICE.walletUi);
  const fullNode = new ApiClient.FullNode({ connection: conn, origin: 'my-cool-service' });
  await fullNode.init();
  const blockchainState = await fullNode.getBlockchainState();
})();