Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bitcoin-cli-ts

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcoin-cli-ts

Auto-generated Bitcoin client library for bitcoind JSON-RPC API

  • 28.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5K
increased by148.98%
Maintainers
0
Weekly downloads
 
Created
Source

bitcoin-cli-ts

Auto-generated Bitcoin client library for Bitcoin Core JSON-RPC API

Installation

Install the package with:

npm i bitcoin-cli-ts
# or
yarn add bitcoin-cli-ts

Usage

Choose the version that corresponds to your Bitcoin Core version.

We use the major and minor versions from Bitcoin Core Releases and reserve the patch version for library fixes related to static code or dependencies.

Config

import { authenticatedBitcoind } from 'bitcoin-cli-ts'

const { host, username, password, port } = getBitcoinCoreRPCConfig()
const bitcoind = authenticatedBitcoind({
  protocol: 'http',
  host: host,
  username,
  password,
  timeout: 30000,
  port: parseInt(port, 10),
  walletName: wallet, // optional
})

Use rpc command

import { getBalance } from 'bitcoin-cli-ts'

const balance = await getBalance({ bitcoind })

Test

Test with Jest framework:

yarn test

Build

Build production (distribution) files in dist folder:

yarn build

It generates CommonJS (in dist/cjs folder), ES Modules (in dist/esm folder), as well as TypeScript declaration files (in dist/types folder).

Local development

Run:

yarn link
# or
npm link

and in your test project run:

yarn link bitcoin-cli-ts
# or
npm link bitcoin-cli-ts

If you want to remove the symlink, run:

# in your test project
yarn unlink bitcoin-cli-ts
# or
npm unlink bitcoin-cli-ts

# in bitcoin-cli-ts folder
yarn unlink
# or
npm unlink

Please check more details in npm link or yarn link

References

This library was developed based on:

Keywords

FAQs

Package last updated on 12 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc