|
3 | 3 | [](https://nodei.co/npm/@arqma/arqma-rpc/)
|
4 | 4 |
|
5 | 5 | 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 | + |
7 | 12 | The library supports HTTP, HTTPS and digest authentication.
|
8 | 13 |
|
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) |
12 | 31 | ```
|
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' |
15 | 43 | })
|
| 44 | +// When using a self signed certificate with HTTPS you need to set the function sslRejectUnauthorized to false. |
| 45 | +daemonClient.sslRejectUnauthorized(false) |
16 | 46 | ```
|
17 | 47 |
|
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) |
21 | 59 | ```
|
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({ |
23 | 68 | url: 'http://127.0.0.1:20000',
|
24 | 69 | username: 'user',
|
25 | 70 | password: 'pass'
|
26 | 71 | })
|
27 |
| -
|
| 72 | +// When using a self signed certificate with HTTPS you need to set the function sslRejectUnauthorized to false. |
| 73 | +walletClient.sslRejectUnauthorized(false) |
28 | 74 | ```
|
29 | 75 |
|
30 | 76 | ## Generate JSDoc documentation
|
|
0 commit comments