@pokt-network/pocket-js
Version:
Pocket-js core package with the main functionalities to interact with the Pocket Network.
70 lines (69 loc) • 1.97 kB
TypeScript
import { Node } from "../node";
import { SessionHeader } from "../input/session-header";
/**
*
*
* @class Session
*/
export declare class Session {
/**
*
* Creates a Session object using a JSON string
* @param {String} json - JSON string.
* @returns {Session} - Session object.
* @memberof Session
*/
static fromJSON(json: string): Session;
readonly sessionHeader: SessionHeader;
readonly sessionKey: string;
readonly sessionNodes: Node[];
relayCount: number;
/**
* Request for Session.
* @constructor
* @param {SessionHeader} sessionHeader - Session Header object.
* @param {string} sessionKey - Session Key.
* @param {SessionNode[]} sessionNodes - Nodes for the session.
*/
constructor(sessionHeader: SessionHeader, sessionKey: string, sessionNodes: Node[]);
relayPlus(v: number): void;
/**
* Returns whether or not a node is part of this session
* @param {Node} node - Node object to verify if exists in the current session.
* @returns {boolean} whether or not the node is part of this session
* @memberof Session
*/
isNodeInSession(node: Node): boolean;
/**
* Returns a random session node that haven't been part of the current consensus
* @memberof Session
*/
getUniqueSessionNode(): Node | Error;
/**
* Returns a random session node
* @memberof Session
*/
getSessionNode(): Node | Error;
/**
*
* Creates a JSON object with the Session properties
* @returns {JSON} - JSON Object.
* @memberof Session
*/
toJSON(): {
header: {
app_public_key: string;
chain: string;
session_height: number;
};
key: string;
nodes: any;
};
/**
*
* Check if the Session object is valid
* @returns {boolean} - True or false.
* @memberof Session
*/
isValid(): boolean;
}