Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/montyanderson/stdrpc
📡 ES6+ compatible, isomorphic JSON-RPC module for node and the browser.
https://github.com/montyanderson/stdrpc
bitcoin ethereum geth js json json-rpc node rpc
Last synced: about 2 months ago
JSON representation
📡 ES6+ compatible, isomorphic JSON-RPC module for node and the browser.
- Host: GitHub
- URL: https://github.com/montyanderson/stdrpc
- Owner: montyanderson
- License: mit
- Created: 2017-06-15T18:42:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-11-15T19:46:40.000Z (about 1 year ago)
- Last Synced: 2024-04-13T23:55:21.512Z (9 months ago)
- Topics: bitcoin, ethereum, geth, js, json, json-rpc, node, rpc
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/stdrpc
- Size: 166 KB
- Stars: 23
- Watchers: 3
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# stdrpc
ES6+ compatible, isomorphic JSON-RPC module for node and the browser.
[![Build Status](https://travis-ci.org/montyanderson/stdrpc.svg?branch=master)](https://travis-ci.org/montyanderson/stdrpc)
[![Coverage Status](https://coveralls.io/repos/github/montyanderson/stdrpc/badge.svg?branch=master)](https://coveralls.io/github/montyanderson/stdrpc?branch=master)* Compatible with [Bitcoin](https://bitcoin.org/), [Ethereum](https://www.ethereum.org/), [Zcash](https://z.cash/), and many more.
* Supports on-the-fly RPC methods using [Proxies](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy)
* Works in browser and in node
* Very small codebase
* Uses [axios](https://github.com/mzabriskie/axios) behind the scenes## Usage
``` javascript
const rpc = stdrpc({
url: "http://localhost:8332"
});rpc.getbalance().then(balance => {
// woo!
});
```## API
### stdrpc(options)
Returns a proxied object, returning a function for every method.
#### options
##### url
Type: `string`
Address of the RPC server
##### timeout
Type: `number`
Connection timeout. Default 0 (no timeout)
##### username
Type: `string`
Username for authentication
##### password
Type: `string`
Password authentication
##### methodTransform
Type: `function`
Transform function for method names
``` javascript
const rpc = stdrpc({
url: "http://localhost:8545",
methodTransform: require("decamelize")
});rpc.ethCoinbase() // becomes rpc.eth_coinbase()
```