Constructor
# new Client(config)
Create a RPC Client to connect to a Avian node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
|||
url |
string
|
Url endpoint to connect to node server |
|
username |
string
|
RPC username |
|
password |
string
|
RPC password |
|
httpOptions |
Objct
|
<optional> |
HTTP options object of values to add to request headers |
Example
import Client from '@aviannetwork/avian-rpc';
const client = new Client({
url: 'http://127.0.0.1:9050',
username: 'username',
password: 'password',
});
client.assets.listAssets().then(assets => {
console.log('assets', assets);
});
Members
Methods
# request(method, paramsopt) → {Promise}
Make a RPC request with a method command and payload
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
method |
string
|
Name of rpc command. |
|
params |
Object
|
Array
|
<optional> |
Data required by rpc command. Typically an object or an array. |
Promise