Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abrkn/bitcoin-json-rpc
Bitcoin JSON RPC for TypeScript with Response Type Enforcement
https://github.com/abrkn/bitcoin-json-rpc
bitcoin jsonrpc typescript zcash
Last synced: about 1 month ago
JSON representation
Bitcoin JSON RPC for TypeScript with Response Type Enforcement
- Host: GitHub
- URL: https://github.com/abrkn/bitcoin-json-rpc
- Owner: abrkn
- License: mit
- Created: 2020-04-17T07:16:55.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-02T02:28:17.000Z (7 months ago)
- Last Synced: 2024-11-08T12:06:27.261Z (about 2 months ago)
- Topics: bitcoin, jsonrpc, typescript, zcash
- Language: TypeScript
- Size: 490 KB
- Stars: 14
- Watchers: 6
- Forks: 9
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bitcoin-json-rpc
Bitcoin JSON RPC for TypeScript with Response Type Enforcement
## Installing
`npm install bitcoin-json-rpc`
## Example usage
```typescript
import BitcoinJsonRpc from 'bitcoin-json-rpc';const rpc = new BitcoinJsonRpc('http://localhost:8332');
const balance = await rpc.getBalance();
console.log(balance);
```## Non-standard methods
Methods not exposed by Bitcoin Core, such as `omni_getwalletaddressbalances`
or Liquid's `getbalance` are prefixed i.e. `getLiquidBalanceForAsset`.## Motivation
There are plenty of Bitcoin forks, including Omni, Zcash, and Blockstream Liquid.
These forks often introduce breaking changes to the JSON RPC responses that
are not reflected in their documentation.This library provides TypeScript types for RPC commands and validates the responses
using `io-ts`. If the response does not match the schema, an error is thrown.## Author
Andreas Brekken
## License
MIT