@ellcrys/spell
Version:
The official JavaScript library for Ellcrys
58 lines (57 loc) • 1.24 kB
TypeScript
/**
* RPCClient connects to given host and port
* of an Ellcrys node.
*
* @export
* @class RPCClient
*/
export default class RPCClient {
/**
* client references the JSON-RPC 2.0 client
*
* @type {JSONRPCCaller}
* @memberof RPCClient
*/
client?: JSONRPCCaller;
/**
* clientOpts contains the options to pass
* to the client call request
*
* @public
* @type {*}
* @memberof RPCClient
*/
clientOpts: any;
/**
* The session token to access
* private endpoints
*
* @private
* @type {string}
* @memberof Spell
*/
private token;
/**
* Creates an instance of RPCClient.
*
* @param {*} client The underlying JSON-RPC 2.0 client
* @memberof RPCClient
*/
constructor(client?: JSONRPCCaller);
/**
* Call a RPC method
*
* @param {string} method The RPC method full name
* @param {*} params The method's parameters
* @returns {Promise}
* @memberof RPCClient
*/
call(method: string, params: any): Promise<any>;
/**
* Set the session token
*
* @param {string} token
* @memberof RPCClient
*/
setToken(token: string): void;
}