Non-Polynomial Mantissa

    @arcblock/grpc-client

    1.7.1 • Public • Published

    grpc-client

    styled with prettier docs Gitter

    gRpc Client library to connect your app with forge powered blockchain node, all requests are sent over tcp, can be used in only Node.js environment.

    A GRpcClient instance mainly supports 3 groups of methods that saves you time when read/write data from/to blockchain.

    • rpcs: read/write block/transaction/account/asset/chain/node data form/to the blockchain
    • senders: shortcut methods that takes a wallet and a tx object, then do the signing, and sending
    • encoders: shortcut methods that takes a wallet and a tx object, encode the transaction for later signing, used internally by senders

    Table of Contents

    Install

    npm i @arcblock/grpc-client
    // or
    yarn add @arcblock/grpc-client

    Usage

    const GRpcClient = require('@arcblock/grpc-client');
    
    const client = new GRpcClient('tcp://127.0.0.1:28210');
    console.log({
      rpcs: client.getRpcMethods(),
      senders: client.getTxSendMethods(),
      encoders: client.getTxEncodeMethods(),
    });
    
    (async () => {
      // fetch forge change info
      const { info } = await client.getChainInfo();
      console.log('chainInfo', info);
    
      // get block info
      const stream = client.getBlock({ height: 11 });
      stream
        .on('data', function({ block }) {
          console.log('blockInfo:', block);
        })
        .on('error', err => {
          console.error('error', err);
        });
    })();

    Examples

    Debugging

    • If you are in Node.js: DEBUG=@arcblock/grpc-client node script.js

    Documentation

    • Complete method list can be found here: README.md
    • Rpc arguments and response structure can be found here: API.md

    Install

    npm i @arcblock/grpc-client

    DownloadsWeekly Downloads

    41

    Version

    1.7.1

    License

    Apache-2.0

    Unpacked Size

    208 kB

    Total Files

    8

    Last publish

    Collaborators

    • wangshijun
    • polunzh
    • mave99a
    • gxw