Everpocket JS Client Documentation
Classes
- ClusterContext
Manages the operations and states of the cluster.
- EvernodeContext
Handles operations related to node acquisition, host selection, transaction submission, and state management.
- HotPocketContext
The HotPocketContext class manages interactions with the HotPocket framework, including client connections, contract configurations, and peer management. It provides methods to connect to nodes, send messages, and update contract and peer data.
- NomadContext
The NomadContext class manages the lifecycle of nodes in a Nomad cluster.
- VoteContext
The VoteContext class handles voting operations and manages elections.
- XrplContext
Handles operations related to XRPL transactions.
- MultiSigner
Manages signing operations for Xahau transactions using a signer key.
- AllVoteElector
Evaluates votes in an election based on the desired vote count and timeout.
ClusterContext
Manages the operations and states of the cluster.
Kind: global class
new ClusterContext(evernodeContext, [options])
Creates an instance of ClusterContext
Param |
Type |
Default |
Description |
|---|---|---|---|
evernodeContext |
The context associated with Evernode for interacting with its environment. |
||
[options] |
|
|
Optional parameters for configuring the cluster thresholds. |
clusterContext.init()
Initiates the operations regarding the cluster.
Kind: instance method of ClusterContext
clusterContext.deinit()
Deinitiates the operations regarding the cluster.
Kind: instance method of ClusterContext
clusterContext.addNodeQueueCount() ⇒
Get the queued add node operations.
Kind: instance method of ClusterContext
Returns: Total number of cluster nodes.
clusterContext.getClusterUnlNodes() ⇒
Get all Unl nodes in the cluster.
Kind: instance method of ClusterContext
Returns: List of nodes in the cluster which are in Unl.
clusterContext.getClusterNodes() ⇒
Get all nodes in the cluster.
Kind: instance method of ClusterContext
Returns: List of nodes in the cluster.
clusterContext.getPendingNodes() ⇒
Get all pending nodes.
Kind: instance method of ClusterContext
Returns: List of pending nodes.
clusterContext.totalCount() ⇒
Get the pending + cluster node count in the cluster.
Kind: instance method of ClusterContext
Returns: Total number of cluster nodes.
clusterContext.feedUserMessage(user, msg) ⇒
Feed user message to the cluster context.
Kind: instance method of ClusterContext
Returns: Response for the cluster message with status.
Param |
Description |
|---|---|
user |
Contract client user. |
msg |
Message sent by the user. |
clusterContext.addNewClusterNode([maxLifeMoments], [lifeMoments], [options=])
Acquire and add new node to the cluster.
Kind: instance method of ClusterContext
Param |
Default |
Description |
|---|---|---|
[maxLifeMoments] |
|
Amount of maximum life moments for the instance. 0 means there’s no max life limit for the node. |
[lifeMoments] |
|
Amount of life moments for the instance. |
[options=] |
Acquire instance options. |
clusterContext.addToCluster(node)
Add a node to cluster and mark as UNL.
Kind: instance method of ClusterContext
Param |
Description |
|---|---|
node |
Cluster node to be added. |
clusterContext.addToUnl(pubkey)
Mark existing node as a UNL node.
Kind: instance method of ClusterContext
Param |
Description |
|---|---|
pubkey |
Public key of the node. |
clusterContext.extendNode(pubkey, lifeMoments)
Record a provided node for extend.
Kind: instance method of ClusterContext
Param |
Description |
|---|---|
pubkey |
Public key of the node to be extended. |
lifeMoments |
Number of moments to be extended. |
clusterContext.removeNode(pubkey, [force])
Removes a provided a node from the cluster.
Kind: instance method of ClusterContext
Param |
Default |
Description |
|---|---|---|
pubkey |
Public key of the node to be removed. |
|
[force] |
|
Force remove. (This might cause to fail some pending operations). |
EvernodeContext
Handles operations related to node acquisition, host selection, transaction submission, and state management.
Kind: global class
new EvernodeContext(xrplContext)
Creates an instance of EvernodeContext.
Param |
Type |
Description |
|---|---|---|
xrplContext |
The XRPL context object that handles communication with the XRPL network. |
evernodeContext.init()
Initialize the context.
Kind: instance method of EvernodeContext
evernodeContext.deinit()
Deinitialize the context.
Kind: instance method of EvernodeContext
evernodeContext.acquireNode(options) ⇒
Acquires a node based on the provided options.
Kind: instance method of EvernodeContext
Returns: Acquire data.
Param |
Description |
|---|---|
options |
Options related to a particular acquire operation. |
evernodeContext.getIfAcquired(acquireRefId) ⇒
Get the acquire info if acquired.
Kind: instance method of EvernodeContext
Returns: Acquired node.
Param |
Description |
|---|---|
acquireRefId |
Acquire reference. |
evernodeContext.getIfPending(acquireRefId) ⇒
Get the acquire info if pending.
Kind: instance method of EvernodeContext
Returns: Pending node.
Param |
Description |
|---|---|
acquireRefId |
Acquire reference. |
evernodeContext.decideLeaseOffer(hostAddress) ⇒
Decides a lease offer collectively.
Kind: instance method of EvernodeContext
Returns: URIToken related to the lease offer.
Param |
Description |
|---|---|
hostAddress |
Host that should be used to take lease offers. |
evernodeContext.decideHost([preferredHosts]) ⇒
Decides a host collectively.
Kind: instance method of EvernodeContext
Returns: Decided host address.
Param |
Default |
Description |
|---|---|---|
[preferredHosts] |
List of proffered host addresses. |
evernodeContext.decideMessageKey([options=]) ⇒
Decide a encryption key pair collectively
Kind: instance method of EvernodeContext
Returns: Public key of the decided key pair.
Param |
Description |
|---|---|
[options=] |
Vote options for message key decision. |
evernodeContext.getEvernodeConfig() ⇒
Get evernode configuration.
Kind: instance method of EvernodeContext
Returns: The evernode configuration.
evernodeContext.getCurMoment([options=]) ⇒
Get the current evernode moment.
Kind: instance method of EvernodeContext
Returns: The current moment value
Param |
Description |
|---|---|
[options=] |
Vote options to collect the current moment value. |
evernodeContext.acquireSubmit(hostAddress, leaseOffer, messageKey, options) ⇒
Submits the acquire transaction
Kind: instance method of EvernodeContext
Returns: Result of the submitted transaction.
Param |
Description |
|---|---|
hostAddress |
Relevant host address |
leaseOffer |
Relevant URIToken of the lease offer |
messageKey |
Encryption key of the tenant. |
options |
evernodeContext.extendSubmit(hostAddress, extension, tokenID, options) ⇒
This function is called by a tenant client to submit the extend lease transaction in certain host. This function will be called directly in test. This function can take four parameters as follows.
Kind: instance method of EvernodeContext
Returns: The transaction result.
Param |
Type |
Description |
|---|---|---|
hostAddress |
|
XRPL account address of the host. |
extension |
|
Moments to extend. |
tokenID |
|
Tenant received instance name. this name can be retrieve by performing acquire Lease. |
options |
|
This is an optional field and contains necessary details for the transactions. |
evernodeContext.getHosts() ⇒
Fetches registered hosts
Kind: instance method of EvernodeContext
Returns: An array of hosts that are having vacant leases.
evernodeContext.getAcquiredNodes() ⇒
Fetches details of successful acquires.
Kind: instance method of EvernodeContext
Returns: an array of instance acquisitions that are completed.
evernodeContext.getPendingAcquires() ⇒
Fetches details of pending acquires.
Kind: instance method of EvernodeContext
Returns: an array of instance acquisitions that are in progress.
evernodeContext.decodeLeaseTokenUri(uri) ⇒
Decode the URI of the lease URIToken
Kind: instance method of EvernodeContext
Returns: decoded content of the URI
Param |
Description |
|---|---|
uri |
URI of the URIToken |
HotPocketContext
The HotPocketContext class manages interactions with the HotPocket framework, including client connections, contract configurations, and peer management. It provides methods to connect to nodes, send messages, and update contract and peer data.
Kind: global class
new HotPocketContext(contractContext, [options])
Creates an instance of HotPocketContext.
Param |
Type |
Default |
Description |
|---|---|---|---|
contractContext |
|
The contract context containing the necessary contract and sequence details. |
|
[options] |
|
|
Optional configuration options. |
hotPocketContext.checkLiveness(node) ⇒
Checks the liveliness of a node.
Kind: instance method of HotPocketContext
Returns: the liveliness as a boolean figure.
Param |
Description |
|---|---|
node |
Node to check the connection. |
hotPocketContext.sendMessage(message, nodes) ⇒
Sends a message to a cluster node.
Kind: instance method of HotPocketContext
Returns: the state of the message sending as a boolean figure.
Param |
Description |
|---|---|
message |
Message to be sent. |
nodes |
Nodes to send the message. |
hotPocketContext.getContractConfig() ⇒
Get the contract config.
Kind: instance method of HotPocketContext
Returns: The contract config.
hotPocketContext.updateContractConfig() ⇒
Update the contract config.
Kind: instance method of HotPocketContext
Returns: The contract config.
hotPocketContext.getContractUnl() ⇒
Get the contract unl.
Kind: instance method of HotPocketContext
Returns: The contract unl.
hotPocketContext.updatePeers(toAdd, [toRemove])
Update the HotPocket peer list.
Kind: instance method of HotPocketContext
Param |
Default |
Description |
|---|---|---|
toAdd |
Peer list to add. |
|
[toRemove] |
|
Peer list to remove. |
NomadContext
The NomadContext class manages the lifecycle of nodes in a Nomad cluster.
Kind: global class
new NomadContext(clusterContext, contract)
Creates an instance of NomadContext.
Param |
Type |
Description |
|---|---|---|
clusterContext |
The cluster context for managing the cluster. |
|
contract |
|
Configuration options for the Nomad contract. |
nomadContext.init()
Initialize the nomad context.
Kind: instance method of NomadContext
nomadContext.deinit()
Deinitialize the nomad contract.
Kind: instance method of NomadContext
nomadContext.grow()
Grow the cluster upto target one by one.
Kind: instance method of NomadContext
nomadContext.extend()
Check for expiring nodes and send for extend.
Kind: instance method of NomadContext
nomadContext.prune()
Prune the nodes which fulfils the prune conditions.
Kind: instance method of NomadContext
VoteContext
The VoteContext class handles voting operations and manages elections.
Kind: global class
new VoteContext(contractContext, [options=])
Creates an instance of VoteContext.
Param |
Description |
|---|---|
contractContext |
The contract context to use. |
[options=] |
Options for vote context, including voteSerializer. |
voteContext.getUniqueNumber() ⇒
Gives an unique number every time this method is called.
Kind: instance method of VoteContext
Returns: An unique number.
voteContext.feedUnlMessage(sender, msg)
Deserialize UNL message and feed to the listeners.
Kind: instance method of VoteContext
Param |
Description |
|---|---|
sender |
UNLNode which has sent the message. |
msg |
Message received from UNL. |
voteContext.vote(electionName, votes, elector) ⇒
Send the votes to a election.
Kind: instance method of VoteContext
Returns: Evaluated votes as a promise.
Param |
Description |
|---|---|
electionName |
Election identifier to vote for. |
votes |
Votes for the election. |
elector |
Elector which evaluates the votes. |
voteContext.subscribe(electionName, votes, elector) ⇒
Send the votes to a election.
Kind: instance method of VoteContext
Returns: Evaluated votes as a promise.
Param |
Description |
|---|---|
electionName |
Election identifier to vote for. |
votes |
Votes for the election. |
elector |
Elector which evaluates the votes. |
voteContext.resolveVotes(electionName) ⇒
Resolve all the collected votes.
Kind: instance method of VoteContext
Returns: The vote collection.
Param |
Description |
|---|---|
electionName |
Name of the election to resolve. |
XrplContext
Handles operations related to XRPL transactions.
Kind: global class
new XrplContext(hpContext, address, [secret], [options])
Creates an instance of XrplContext.
Param |
Type |
Default |
Description |
|---|---|---|---|
hpContext |
The HotPocket context to use. |
||
address |
|
The XRPL account address. |
|
[secret] |
|
|
The XRPL account secret. |
[options] |
|
|
Options for XRPL context. |
xrplContext.init()
Initialize the xrpl context.
Kind: instance method of XrplContext
xrplContext.deinit()
Deinitialize the xrpl context.
Kind: instance method of XrplContext
xrplContext.getPendingTransactions() ⇒
Fetches details of submitted non validated transactions.
Kind: instance method of XrplContext
Returns: an array of transactions that are not validated.
xrplContext.getValidatedTransactions() ⇒
Fetches details of submitted validated transactions.
Kind: instance method of XrplContext
Returns: an array of transactions that are validated.
xrplContext.getValidatedTransaction(hash) ⇒
Get the transaction of the hash if validated.
Kind: instance method of XrplContext
Returns: The transaction if validated.
Param |
Description |
|---|---|
hash |
Transaction hash. |
xrplContext.loadSignerList()
Load signer list of the account
Kind: instance method of XrplContext
xrplContext.getSequence() ⇒
Get current sequence value of the master account.
Kind: instance method of XrplContext
Returns: Current sequence number.
xrplContext.getTransactions(ledgerIndex) ⇒
Get transaction list of the master account starting from a ledger.
Kind: instance method of XrplContext
Returns: LIst of transactions
Param |
Description |
|---|---|
ledgerIndex |
Starting ledger index. |
xrplContext.getMaxLedgerSequence() ⇒
Get a maximum ledger number to validate a transaction.
Kind: instance method of XrplContext
Returns: The maximum ledger number.
xrplContext.getTransactionSubmissionInfo([options=], [decisionOptions]) ⇒
Decide a transaction submission info for a transaction.
Kind: instance method of XrplContext
Returns: Transaction submission info.
Param |
Default |
Description |
|---|---|---|
[options=] |
Vote options to decide the transaction submission info. |
|
[decisionOptions] |
Any other options that needed to be decided. |
xrplContext.submitMultisignedTx(tx) ⇒
Submit a multisigned transaction.
Kind: instance method of XrplContext
Returns: The transaction response.
Param |
Description |
|---|---|
tx |
Multi-signed transaction |
xrplContext.multiSignAndSubmitTransaction(transaction, [options=])
Multi sign and submit a given transaction.
Kind: instance method of XrplContext
Param |
Description |
|---|---|
transaction |
Transaction to submit. |
[options=] |
Multisigner options. |
xrplContext.generateNewSignerList([options=]) ⇒
Generate new signer list.
Kind: instance method of XrplContext
Returns: The new signer list.
Param |
Description |
|---|---|
[options=] |
Multisigner options. |
xrplContext.setSignerList(signerListInfo, [options=])
Set a provided signer list to the master account.
Kind: instance method of XrplContext
Param |
Description |
|---|---|
signerListInfo |
Signer list info. |
[options=] |
Multisigner options to set. |
xrplContext.renewSignerList([options=])
Renew the current signer list.
Kind: instance method of XrplContext
Param |
Description |
|---|---|
[options=] |
Multisigner options to override. |
xrplContext.addXrplSigner(pubkey, weight, [options=]) ⇒
Add new signer node to the signer list.
Kind: instance method of XrplContext
Returns: New signer address.
Param |
Description |
|---|---|
pubkey |
Public key of the node to add. |
weight |
Signer weight for the new signer. |
[options=] |
Multisigner options to override. |
xrplContext.removeXrplSigner(pubkey, [options=])
Remove a signer node from the signer list.
Kind: instance method of XrplContext
Param |
Description |
|---|---|
pubkey |
Public key of the signer node to remove. |
[options=] |
Multisigner options to override. |
xrplContext.replaceSignerList(oldSignerAddress, newSignerAddress, [options=]) ⇒
Replaces a signer node from a new node.
Kind: instance method of XrplContext
Returns: New signer address.
Param |
Description |
|---|---|
oldSignerAddress |
Signer address of old node. |
newSignerAddress |
New address to add as signer. |
[options=] |
Multisigner options to override. |
xrplContext.getSignerList() ⇒ Object | null
Returns the signer list of the account
Kind: instance method of XrplContext
Returns: Object | null - An object in the form of {signerQuorum: <1> , signerList: [{account: “rawweeeere3e3”, weight: 1}, {}, …]} || null
xrplContext.isSigner() ⇒
Check wether this node is a signer.
Kind: instance method of XrplContext
Returns: true or false if signer or not.
MultiSigner
Manages signing operations for Xahau transactions using a signer key.
Kind: global class
new MultiSigner(masterAcc)
Creates an instance of MultiSigner.
Param |
Type |
Description |
|---|---|---|
masterAcc |
|
The master account containing XRPL API and address information. |
multiSigner.getSigner() ⇒
Get the signer.
Kind: instance method of MultiSigner
Returns: Signer info.
multiSigner.setSigner(signer)
Set the signer.
Kind: instance method of MultiSigner
Param |
Description |
|---|---|
signer |
Signer to set. |
multiSigner.removeSigner()
Remove the signer.
Kind: instance method of MultiSigner
multiSigner.generateSigner() ⇒
Generate a key for the node and save the node key in a file named by (../<master address>.key).
Kind: instance method of MultiSigner
Returns: Generated signer info.
multiSigner.sign(tx) ⇒
Kind: instance method of MultiSigner
Returns: The signed transaction blob.
Param |
Description |
|---|---|
tx |
Transaction in json. |
multiSigner.isSignerNode() ⇒
Check wether this is a signer.
Kind: instance method of MultiSigner
Returns: true or false based on signer or not.
AllVoteElector
Evaluates votes in an election based on the desired vote count and timeout.
Kind: global class
new AllVoteElector(desiredVoteCount, timeout)
Creates an instance of AllVoteElector.
Param |
Type |
Description |
|---|---|---|
desiredVoteCount |
|
The number of votes needed to complete the election. |
timeout |
|
The timeout period in milliseconds for the election. |
allVoteElector.election(electionName, voteEmitter, context) ⇒
Evaluate the election.
Kind: instance method of AllVoteElector
Returns: Evaluated votes as a promise.
Param |
Description |
|---|---|
electionName |
Election identifier. |
voteEmitter |
Event emitter which the votes are fed into, |
context |
Vote context for the election. |