0.12.3 • Published 2 years ago
chia-daemon v0.12.3
chia-daemon
A JS client for chia daemon and https services with dynamically generated end points
Getting Started
npm install
npm testDocumentation
https://dkackman.github.io/chia-daemon/
Basic Usage
Each service is a field on the services property of the ChiaDaemon.
- Since all service calls go through the daemon there is no need for other endpoint configuration
- All RPC calls are async
- Since all rpc call are dynamically invoked there is no need to update the library with new Chia releases.
(i.e. if you invoke
daemon.wallet.foo()it will call make an RPC to a function namedfooat that endpoint and error if it doesn't exist there)
import { ChiaDaemon, loadUIConfig } from 'chia-daemon';
const daemon = new ChiaDaemon(loadUIConfig(), 'my-chia-app');
const connected = await daemon.connect();
if (connected) {
const state = await daemon.services.full_node.get_blockchain_state();
console.log(state);
}Also supports https connections:
import { createHttpsService, createConnection } from "chia-daemon";
const connection = createConnection(
"wallet",
"localhost",
);
const wallet = createHttpsService(connection);
const response = await wallet.get_wallets({ include_data: true });
console.log(`You have ${response.wallets.length} wallets`);Payload Helpers
Includes helper functions to get request payloads right:
Get the OpenAPI responseBody Schema Descriptor
console.log(daemon.services.full_node.getPayloadDescriptor('open_connection'));
{
type: 'object',
required: [ 'ip', 'port' ],
properties: {
ip: { type: 'string', format: 'ipaddress' },
port: { type: 'integer' }
}
}Get a Payload Object Instance
const connection = daemon.services.full_node.makePayload('open_connection');
console.log(connection);
{ ip: '', port: 0 }
connection.ip = 'chia.net';
connection.port = 4444;
await daemon.services.full_node.open_connection(connection);0.12.0
2 years ago
0.12.1
2 years ago
0.11.2
2 years ago
0.12.2
2 years ago
0.11.3
2 years ago
0.12.3
2 years ago
0.11.5
2 years ago
0.11.1
2 years ago
0.11.0
3 years ago
0.10.2
3 years ago
0.10.1
3 years ago
0.10.0
3 years ago
0.8.0
3 years ago
0.7.0
3 years ago
0.6.0
3 years ago
0.3.0
3 years ago
0.2.1
3 years ago
0.2.0
3 years ago
0.3.6
3 years ago
0.3.5
3 years ago
0.5.0
3 years ago
0.4.1
3 years ago
0.3.2
3 years ago
0.2.3
3 years ago
0.4.0
3 years ago
0.3.1
3 years ago
0.2.2
3 years ago
0.3.4
3 years ago
0.2.5
3 years ago
0.3.3
3 years ago
0.2.4
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago