@azpool/chia-client
Version:
TypeScript client for Chia node peer RPC interface
41 lines • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SharedCalls = void 0;
const RpcClient_1 = require("./RpcClient");
const defaultProtocol = "https";
const defaultHostname = process.env.CHIA__HOSTNAME || "0.0.0.0";
const defaultPort = parseInt(process.env.CHIA__FULLNODE__PORT || '8555') || 8555;
const defaultCaCertPath = process.env.CHIA__CA_CERT_PATH || false;
const defaultCertPath = process.env.CHIA__FULLNODE__CERT_PATH || '';
const defaultKeyPath = process.env.CHIA__FULLNODE__KEY_PATH || '';
class SharedCalls extends RpcClient_1.RpcClient {
constructor(options) {
super({
protocol: (options === null || options === void 0 ? void 0 : options.protocol) || defaultProtocol,
hostname: (options === null || options === void 0 ? void 0 : options.hostname) || defaultHostname,
port: (options === null || options === void 0 ? void 0 : options.port) || defaultPort,
caCertPath: (options === null || options === void 0 ? void 0 : options.caCertPath) || defaultCaCertPath,
certPath: (options === null || options === void 0 ? void 0 : options.certPath) || defaultCertPath,
keyPath: (options === null || options === void 0 ? void 0 : options.keyPath) || defaultKeyPath,
});
}
async getConnections() {
return this.request("get_connections", {});
}
async openConnection(host, port) {
return this.request("open_connection", {
host: host,
port: port
});
}
async closeConnection(nodeId) {
return this.request("close_connection", {
node_id: nodeId,
});
}
async stopNode() {
return this.request("stop_node", {});
}
}
exports.SharedCalls = SharedCalls;
//# sourceMappingURL=SharedCalls.js.map