UNPKG

@vafanassieff/bitcoin-cli-ts

Version:

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

24 lines 704 B
const defaultConfig = { protocol: 'http', host: '127.0.0.1', username: 'rpcuser', password: '', timeout: 15000, port: 18443, walletName: '', }; export function authenticatedBitcoind(config) { const mergedConfig = { ...defaultConfig, ...config, }; const { protocol, host, port, walletName, username, password } = mergedConfig; const walletPath = walletName ? `/wallet/${walletName}` : '/'; const auth = Buffer.from(`${username}:${password}`).toString('base64'); return { ...mergedConfig, url: `${protocol}://${host}:${port}${walletPath}`, authHeader: `Basic ${auth}`, }; } //# sourceMappingURL=bitcoind.js.map