1.0.14 • Published 7 years ago

cita-web3-plugin v1.0.14

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Build Status npm npm type definitions npm

CITA-Web3-Plugin

Promise based CITA RPC toolkit.

Features

  • Supports the Promise API

Installing

$ yarn add cita-web3-plugin

Example

import CitaWeb3Plugin from 'cita-web3-plugin'

const SERVER = 'localhost:1337'

const { CITA } = CitaWeb3Plugin({ server: SERVER })

/**
 * @function netPeerCount
 * @description request net peer count
 * @param null
 * @returns {string} peerCount
 */
CITA.netPeerCount().then(count => console.log(count))

/**
 * @function getBlockByNumber
 * @description request block by block number
 * @param {string} quantity - quantity is the current block height of CITA
 * @param {boolean} detialed - return transaction list if true, otherwise return hash of transaction
 * @returns {object} block
 */
CITA.getBlockByNumber({
  quantity: blockNumber
  detailed: true,
}).then(block => console.log(block))

/**
 * @function getBlockByHash
 * @description request block by block hash
 * @param {string} hash - block hash
 * @param {boolean} detailed - return transaction list if true, otherwise return hash of transaction
 * @returns {object} block
 */
CITA.getBlockByHash({
  hash: blockHash,
  detailed: true
}).then(block => console.log(block))
1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.0

7 years ago