0.1.0 • Published 7 years ago

parity-rpcs v0.1.0

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

Parity JSON RPCs

A machine-readable list of the Parity JSON RPCs.

npm version build status GPL-licensed chat on gitter

This module contains the definitions of most RPCs, in the most minimal required for making calls. I took them from the Parity source code. This module is intended to be used by libraries like parity-client. Things still missing:

  • some of the parity RPCs, all of personal and signer
  • an automated setup to generate this module, as having the definitions twice is dangerous

Installation

npm install --save parity-rpcs@derhuerst/parity-rpcs

Types

typeJavaScript values/example
'boolean'true/false
'number'0/-100.32
'string''foo bar baz'
'data'Buffer
['array', 'boolean'][true, false]
['object', {foo: 'boolean'}]{foo: true}
'address''0x5340e74cda65bc0de4d45908fc288cf99fdb2f9a'
'hash''0xc5f02e4fc4d9c5885cca4e652937ff4701b23fa10d25b42b327c111c0ef88e37'
'blockNr'123456/'latest'/'earliest'/'pending'
'work'todo
'syncing'todo
'accountsInfo'todo

Usage

const eth = require('parity-rpcs/eth')
// or
const {eth, personal} = require('parity-rpcs')

console.log(eth.getBlockByNumber)
{
	name: 'eth_getBlockByNumber',
	params: [
		{format: 'blockNr'},
		{format: 'boolean'}
	],
	returns: [
		'object',
		{
			number: 'number',
			hash: 'hash',
			parentHash: 'hash',
			nonce: 'data',
			sha3Uncles: 'data',
			logsBloom: 'data',
			transactionsRoot: 'data',
			stateRoot: 'data',
			receiptRoot: 'data',
			miner: 'address',
			difficulty: 'number',
			totalDifficulty: 'number',
			extraData: 'data',
			size: 'number',
			gasLimit: 'number',
			gasUsed: 'number',
			timestamp: 'number',
			transactions: ['array', 'data'],
			uncles: ['array', 'hash']
		}
	]
}

Contributing

If you have a question, found a bug or want to propose a feature, go to the issues page.