@arcblock/node-ocap
v0.1.0 ocap blockchain arcblock sdk nodejs
@arcblock/node-ocap
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
npm i @arcblock/[email protected]
Metadata
- MIT
- >=10
- wangshijun
- released 8/15/2018