Skip to content

Commit

Permalink
0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dkackman committed Sep 4, 2023
1 parent 73832d6 commit aba8016
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
42 changes: 41 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions packages/chia-daemon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,21 @@ if (connected) {
const state = await daemon.services.full_node.get_blockchain_state();
console.log(state);
}
```

Also supports `https` connections:

```javascript
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
Expand Down
9 changes: 7 additions & 2 deletions packages/chia-daemon/connection_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export const ServicePorts = {
data_layer: 8562,
};

export function createConnection(serviceName, host, chiaRoot, timeoutSeconds) {
export function createConnection(
serviceName,
host,
chiaRoot,
timeoutSeconds = 30
) {
if (chiaRoot === undefined) {
chiaRoot = getChiaRoot();
}
Expand All @@ -32,6 +37,6 @@ export function createConnection(serviceName, host, chiaRoot, timeoutSeconds) {
ServicePorts[serviceName],
`${chiaRoot}/config/ssl/${serviceName}/private_${serviceName}.key`,
`${chiaRoot}/config/ssl/${serviceName}/private_${serviceName}.crt`,
timeoutSeconds ?? 30
timeoutSeconds
);
}
2 changes: 1 addition & 1 deletion packages/chia-daemon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chia-daemon",
"version": "0.11.5",
"version": "0.12.0",
"description": "A JS daemon client for chia rpc with dynamically generated end points",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit aba8016

Please sign in to comment.