A full stack for bitcoin and blockchain-based applications
Crypto-RPC is a library that wraps other RPC libraries to create a normalized interface with RPCs.
import { CryptoRpc } from 'crypto-rpc';
const rpc = new CryptoRpc({
chain: 'BTC',
protocol: 'http',
host: 'localhost',
port: 8332,
user: 'my-user',
pass: 'my-password'
});
// Pass in the chain to the method to then call the chain's RPC instance
const tx = rpc.getTransaction({
chain: 'BTC',
txid: 'txid1'
});
OR
// Gets the chain's specific RPC instance
const btc = rpc.get('BTC');
// Call the method on the instance
const tx = btc.getTransaction('txid1');