UNPKG

bitcoincore-node

Version:

A comprehensive Node.js package for interacting with Bitcoin Core via RPC. Create, sign, and broadcast Bitcoin transactions, manage wallets, and access blockchain data through an easy-to-use API interface. Perfect for developers building cryptocurrency ap

102 lines (101 loc) 3.62 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.NetworkRPC = void 0; class NetworkRPC { constructor(bitcoinCore) { this.bitcoinCore = bitcoinCore; } // addnode addNode(node, command) { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('addnode', [node, command]); }); } // clearbanned clearBanned() { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('clearbanned'); }); } // disconnectnode disconnectNode(address, nodeId) { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('disconnectnode', [address, nodeId]); }); } // getaddednodeinfo getAddedNodeInfo(node) { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('getaddednodeinfo', [node]); }); } // getconnectioncount getConnectionCount() { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('getconnectioncount'); }); } // getnettotals getNetTotals() { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('getnettotals'); }); } // getnetworkinfo getNetworkInfo() { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('getnetworkinfo'); }); } // getnodeaddresses getNodeAddresses() { return __awaiter(this, arguments, void 0, function* (count = 1) { return this.bitcoinCore.callMethod('getnodeaddresses', [count]); }); } // getpeerinfo getPeerInfo() { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('getpeerinfo'); }); } // listbanned listBanned() { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('listbanned'); }); } // ping ping() { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('ping'); }); } // setban setBan(subnet_1, command_1) { return __awaiter(this, arguments, void 0, function* (subnet, command, bantime = 0, absolute = false) { return this.bitcoinCore.callMethod('setban', [ subnet, command, bantime, absolute, ]); }); } // setnetworkactive setNetworkActive(state) { return __awaiter(this, void 0, void 0, function* () { return this.bitcoinCore.callMethod('setnetworkactive', [state]); }); } } exports.NetworkRPC = NetworkRPC;