This package has been deprecated

Author message:

no longer maintained

@arcblock/ocap-node

0.2.7 • Public • Published

@arcblock/node-ocap

build status code coverage code style styled with prettier made with lass license

Node.js SDK for OCAP Service by ArcBlock

Table of Contents

Install

npm install @arcblock/node-ocap
// or
yarn add @arcblock/node-ocap

Usage

const OcapSDK = require('@arcblock/node-ocap');

// init client
const client = new OcapSDK({
  httpBaseUrl: 'https://ocap.arcblock.io/api', // we may have multiple hosts in future
  socketBaseUrl: ds => `wss://ocap.arcblock.io/api/${ds}/socket`,
  dataSource: 'eth', // btc, eth
});

// list api
const queries = client.getQueries();
const subscriptions = client.getSubscriptions();
const mutations = client.getMutations();

// query
const account = await client.accountByAddress({
  address: '0xe65d3128feafd14d472442608daf94bceb91e333',
});

// subscription
const subscription = await client.newBlockMined();
subscription.on('data', data => console.log(data));

See docs/example.btc.js for Bitcoin examples. See docs/example.eth.js for Ethereum examples. See docs/spec.md for full api support.

Documentation

Contributors

Name Website
wangshijun https://ocap.arcblock.io
  • wangshijun

License

MIT © wangshijun

Package Sidebar

Install

npm i @arcblock/ocap-node

Weekly Downloads

1

Version

0.2.7

License

MIT

Unpacked Size

13.8 kB

Total Files

6

Last publish

Collaborators

  • gxw
  • mave99a
  • polunzh
  • wangshijun