@ln-markets/bitcoind-rpc
@ln-markets/bitcoind-rpc is a simple and small connector to speak with your bitcoin daemon
⚠️ This module is written in native ECMAScript it will not work with Common JS
Install
You can install this package with npm, pnpm or yarn:
$> npm install @ln-markets/bitcoind-rpc
$> pnpm install @ln-markets/bitcoind-rpc
$> yarn add @ln-markets/bitcoind-rpc
Usage
import BitcoindRpcClient from '@ln-markets/bitcoind-rpc'
const bitcoind = new BitcoindRpcClient({
host: '127.0.0.1',
port: 18443,
user: 'lnmarkets',
password: 'lnmarkets',
})
Or you can can pass the configuration with env variable BITCOIND_HOST
BITCOIND_PORT
BITCOIND_USER
BITCOIND_PASSWORD
There is no method yet for each bitcoind rpc call.
You need to pass the method name as the first argument and the positional or named parameters as the second
// With positional parameter
const address1 = await bitcoind.request('getnewaddress', ['', 'legacy'])
// With named parameter
const address2 = await bitcoind.request('getnewaddress', {
label: ' ',
address_type: 'bech32',
})