# stdrpc

> ES6+ compatible, isomorphic JSON-RPC module for node and the browser.

Latest version **1.3.0** (published 2021-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install stdrpc
pnpm add stdrpc
yarn add stdrpc
bun add stdrpc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2021-04-15 |
| First published | 2017-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Monty Anderson |
| Maintainers | montyanderson |

## Links

- npm: https://www.npmjs.com/package/stdrpc
- Repository: https://github.com/montyanderson/stdrpc
- Homepage: https://github.com/montyanderson/stdrpc#readme
- Issues: https://github.com/montyanderson/stdrpc/issues
- npm.io page: https://npm.io/package/stdrpc

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [koa-basic-auth](https://npm.io/package/koa-basic-auth.md) ^4.0.0

## Recent versions

- 1.3.0 (latest) — 2021-04-15
- 1.1.0 — 2019-10-18
- 1.0.0 — 2018-06-03
- 0.0.3 — 2018-02-27
- 0.0.2 — 2018-02-25
- 0.0.1 — 2017-06-23

## 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()
```

---
_Source: https://npm.io/package/stdrpc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
