Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 576243b

Browse files
committedOct 24, 2019
Refactoring with axios and async functions.
1 parent c34820f commit 576243b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+7296
-11873
lines changed
 

‎README.md

+57-11
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,74 @@
33
[![NPM](https://nodei.co/npm/@arqma/arqma-rpc.png)](https://nodei.co/npm/@arqma/arqma-rpc/)
44

55
Javascript library to interact with RPC Daemon and RPC Wallet.\
6-
All requests are queued and use promises.\
6+
All requests are queued. Most functions are async.
7+
8+
Since version 0.2.0 the RPCDaemon and RPCWallet objects are created using a factory function instead of declaring the object with "new".
9+
10+
There is no need to connect and disconnect the underlying socket anymore.
11+
712
The library supports HTTP, HTTPS and digest authentication.
813

9-
## RPCDaemon
10-
Please refer to the [documentation](https://arqma.github.io/arqma-rpc-js/RPCDaemon.html) and look at the unit tests.\
11-
Init without authentication:
14+
The library use an axios interceptor to implement digest authentication.
15+
16+
Digest authentication is activated as soon as a username and a password is supplied during object creation.
17+
18+
Once initialized simply use the query functions.
19+
20+
21+
## RPCDaemon without Digest Authentication
22+
Please refer to the [documentation](https://arqma.github.io/arqma-rpc-js/RPCDaemon.html) and look at the unit tests.
23+
```javascript
24+
const rpcDaemon = require('@arqma/arqma-rpc').RPCDaemon
25+
26+
const daemonClient = rpcDaemon.createDaemonClient({
27+
url: 'http://127.0.0.1:39994'
28+
})
29+
// When using a self signed certificate with HTTPS you need to set the function sslRejectUnauthorized to false.
30+
daemonClient.sslRejectUnauthorized(false)
1231
```
13-
let rpcDaemon = new RPCDaemon({
14-
url: 127.0.0.1:39994
32+
33+
34+
## RPCDaemon with Digest Authentication
35+
Please refer to the [documentation](https://arqma.github.io/arqma-rpc-js/RPCDaemon.html) and look at the unit tests.
36+
```javascript
37+
const rpcDaemon = require('@arqma/arqma-rpc').RPCDaemon
38+
39+
const daemonClient = rpcDaemon.createDaemonClient({
40+
url: 'http://127.0.0.1:39994',
41+
username: 'user',
42+
password: 'pass'
1543
})
44+
// When using a self signed certificate with HTTPS you need to set the function sslRejectUnauthorized to false.
45+
daemonClient.sslRejectUnauthorized(false)
1646
```
1747

18-
## RPCWallet
19-
Please refer to the [documentation](https://arqma.github.io/arqma-rpc-js/RPCWallet.html) and look at the unit tests.\
20-
Init with authentication:
48+
49+
## RPCWallet without Digest Authentication
50+
Please refer to the [documentation](https://arqma.github.io/arqma-rpc-js/RPCWallet.html) and look at the unit tests.
51+
```javascript
52+
const rpcWallet = require('@arqma/arqma-rpc').RPCWallet
53+
54+
const walletClient = rpcWallet.createWalletClient({
55+
url: 'http://127.0.0.1:20000'
56+
})
57+
// When using a self signed certificate with HTTPS you need to set the function sslRejectUnauthorized to false.
58+
walletClient.sslRejectUnauthorized(false)
2159
```
22-
let rpcWallet = new RPCWallet({
60+
61+
62+
## RPCWallet with Digest Authentication
63+
Please refer to the [documentation](https://arqma.github.io/arqma-rpc-js/RPCWallet.html) and look at the unit tests.
64+
```javascript
65+
const rpcWallet = require('@arqma/arqma-rpc').RPCWallet
66+
67+
const walletClient = rpcWallet.createWalletClient({
2368
url: 'http://127.0.0.1:20000',
2469
username: 'user',
2570
password: 'pass'
2671
})
27-
72+
// When using a self signed certificate with HTTPS you need to set the function sslRejectUnauthorized to false.
73+
walletClient.sslRejectUnauthorized(false)
2874
```
2975

3076
## Generate JSDoc documentation

‎docs/index.html

+45-13
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
This repository has been archived.