# Evernode JS Client Documentation ## Classes
BaseEvernodeClient

Creates an instance of BaseEvernodeClient.

FoundationClientBaseEvernodeClient

FoundationClient class to manage and interact with foundation operations. It extends the BaseEvernodeClient.

HeartbeatClientBaseEvernodeClient

HeartbeatClient is responsible for managing heartbeat operations in Evernode. It interacts with the XRP Ledger using the heartbeat address and listens for specific heartbeat events.

HookClientFactory

A factory class for creating different types of hook clients based on the provided hook type.

RegistryClientBaseEvernodeClient

RegistryClient is responsible for managing registry operations in Evernode. It interacts with the XRP Ledger using the registry address and listens for specific registry events.

HostClientBaseEvernodeClient

HostClient class to manage host operations. It extends the BaseEvernodeClient.

TenantClientBaseEvernodeClient

TenantClient class to manage tenant operations. It extends the BaseEvernodeClient.

Defaults

Defaults class is responsible for retrieving and overriding the default Evernode network configurations.

EncryptionHelper

EncryptionHelper class is responsible for encrypt and decrypt functions for messages.

EvernodeHelpers

Provides various utility functions for working with leases, tokens, and ledger entries within the Xahau ecosystem.

StateHelpers

Provides various utility functions for working with States.

TransactionHelper

Provides various utility functions for working with Xahau Transactions.

UtilHelpers

Provides utility helper functions for various operations.

XflHelpers

Helper class for handling XFL (Extended Floating-Point) float numbers.

XrplAccount

Represents an XRP Ledger account and provides methods for account management.

XrplApi

Class representing an XRPL API client.

## BaseEvernodeClient Creates an instance of BaseEvernodeClient. **Kind**: global class * [BaseEvernodeClient](#BaseEvernodeClient) * [new BaseEvernodeClient(xrpAddress, xrpSecret, watchEvents, [autoSubscribe], [options])](#new_BaseEvernodeClient_new) * [.on(event, handler)](#BaseEvernodeClient+on) * [.once(event, handler)](#BaseEvernodeClient+once) * [.off(event, handler)](#BaseEvernodeClient+off) * [.connect()](#BaseEvernodeClient+connect) ⇒ * [.disconnect()](#BaseEvernodeClient+disconnect) * [.subscribe()](#BaseEvernodeClient+subscribe) * [.unsubscribe()](#BaseEvernodeClient+unsubscribe) * [.getEVRBalance()](#BaseEvernodeClient+getEVRBalance) ⇒ * [.getHookStates()](#BaseEvernodeClient+getHookStates) ⇒ * [.getMoment(index)](#BaseEvernodeClient+getMoment) ⇒ * [.getMomentStartIndex(index)](#BaseEvernodeClient+getMomentStartIndex) ⇒ * [.refreshConfig()](#BaseEvernodeClient+refreshConfig) * [.extractEvernodeEvent(tx)](#BaseEvernodeClient+extractEvernodeEvent) ⇒ * [.getHostInfo(hostAddress)](#BaseEvernodeClient+getHostInfo) ⇒ * [.getAllHostsFromLedger()](#BaseEvernodeClient+getAllHostsFromLedger) ⇒ * [.getAllCandidatesFromLedger()](#BaseEvernodeClient+getAllCandidatesFromLedger) ⇒ * [.pruneDeadHost(hostAddress)](#BaseEvernodeClient+pruneDeadHost) * [.getCandidateByOwner(ownerAddress)](#BaseEvernodeClient+getCandidateByOwner) ⇒ * [.getDudHostCandidatesByOwner(ownerAddress)](#BaseEvernodeClient+getDudHostCandidatesByOwner) ⇒ * [.getCandidateById(candidateId)](#BaseEvernodeClient+getCandidateById) ⇒ * [.getDudHostVoteInfo(hostAddress)](#BaseEvernodeClient+getDudHostVoteInfo) ⇒ * [.getPilotedModeVoteInfo()](#BaseEvernodeClient+getPilotedModeVoteInfo) ⇒ * [.getReputationAddressByOrderedId(orderedId, moment)](#BaseEvernodeClient+getReputationAddressByOrderedId) ⇒ * [.getReputationOrderByAddress(hostAddress, moment)](#BaseEvernodeClient+getReputationOrderByAddress) ⇒ * [.getReputationContractInfoByAddress(hostsAddress, moment)](#BaseEvernodeClient+getReputationContractInfoByAddress) ⇒ * [.getReputationInfoByAddress(hostsAddress)](#BaseEvernodeClient+getReputationInfoByAddress) ⇒ ### new BaseEvernodeClient(xrpAddress, xrpSecret, watchEvents, [autoSubscribe], [options]) | Param | Type | Default | Description | | --------------------------- | --------------------------------- | ------------------ | -------------------------------------------------------------------------- | | xrpAddress | string | | The XRP address associated with the client. | | xrpSecret | string | | The XRP secret associated with the client. | | watchEvents | Array.<string> | | An array of event names to watch. | | [autoSubscribe] | boolean | false | Whether to automatically subscribe to events. | | [options] | Object | {} | Optional configuration options. | | [options.governorAddress] | string | | The governor address. Defaults to a predefined value if not provided. | | [options.xrplApi] | [XrplApi](#XrplApi) | | An instance of XrplApi. If not provided, a new instance will be created. | | [options.rippledServer] | string | | The URL of the rippled server to use if a new XrplApi instance is created. | | [options.config] | Object | | Optional configuration settings. | | [options.messagePrivateKey] | string | | The private key for message encryption, if required. | ### baseEvernodeClient.on(event, handler) Listens to the subscribed events. This will listen for the event without detaching the handler until it's 'off'. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) | Param | Type | Description | | ------- | --------------------- | ---------------------------------------------------------------------------------------------- | | event | string | The name of the event to listen for. | | handler | function | The callback function to handle the event. The function takes the event object as a parameter. | ### baseEvernodeClient.once(event, handler) Listens to the subscribed events. This will listen only once and detach the handler. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) | Param | Type | Description | | ------- | --------------------- | -------------------------------------- | | event | string | Event name. | | handler | function | Callback function to handle the event. | ### baseEvernodeClient.off(event, handler) Detach the listener event. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) | Param | Type | Default | Description | | ------- | --------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------- | | event | string | | Event name. | | handler | function | | (optional) Can be sent if a specific handler need to be detached. All the handlers will be detached if not specified. | ### baseEvernodeClient.connect() ⇒ Connects the client to xrpl server and do the config loading and subscriptions. 'subscribe' is called inside this. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: Boolean value `true` if the connection is successful. ### baseEvernodeClient.disconnect() Disconnects the client to xrpl server and do the un-subscriptions. 'unsubscribe' is called inside this. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) ### baseEvernodeClient.subscribe() Subscribes to the client events. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) ### baseEvernodeClient.unsubscribe() Unsubscribes from the client events. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) ### baseEvernodeClient.getEVRBalance() ⇒ Get the EVR balance in the account. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The available EVR amount as a string. ### baseEvernodeClient.getHookStates() ⇒ Get all XRPL hook states in the registry account. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The list of hook states, including Evernode configuration and hosts. ### baseEvernodeClient.getMoment(index) ⇒ Get the moment from the given index (timestamp). **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The moment of the given index (timestamp) as a number. Returns the current moment if the timestamp is not provided. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment value. | ### baseEvernodeClient.getMomentStartIndex(index) ⇒ Get start index (timestamp) of the moment. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The index (timestamp) of the moment as a 'number'. Returns the current moment's start index (timestamp) if ledger index parameter is not given. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment start index. | ### baseEvernodeClient.refreshConfig() Loads the configs from XRPL hook and updates the in-memory config. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) ### baseEvernodeClient.extractEvernodeEvent(tx) ⇒ Extracts the transaction info from a given transaction. Note: You need to deserialize HookParameters before passing the transaction to this function. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The event object in format `{name: string, data: Object}`. Returns `null` if the event is not handled. | Param | Type | Description | | ----- | ------------------- | -------------------------------------------------------- | | tx | object | The transaction object to be deserialized and extracted. | ### baseEvernodeClient.getHostInfo(hostAddress) ⇒ Get the registered host information. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The registered host information object. Returns null if not registered. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | [Optional] Address of the host. | ### baseEvernodeClient.getAllHostsFromLedger() ⇒ Get the hosts registered in Evernode. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The list of hosts. ### baseEvernodeClient.getAllCandidatesFromLedger() ⇒ Get the governor in Evernode. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The list of candidates. ### baseEvernodeClient.pruneDeadHost(hostAddress) Remove a host which is inactive for a long period. The inactivity is checked by Evernode it self and only pruned if inactive thresholds are met. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) | Param | Type | Description | | ----------- | ------------------- | -------------------------------------- | | hostAddress | string | XRPL address of the host to be pruned. | ### baseEvernodeClient.getCandidateByOwner(ownerAddress) ⇒ Get proposed new hook candidate info. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ------------ | ------------------- | -------------------------------- | | ownerAddress | string | [Optional] Address of the owner. | ### baseEvernodeClient.getDudHostCandidatesByOwner(ownerAddress) ⇒ Get proposed dud host candidates. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: An array of candidate information. Returns empty array if no candidates. | Param | Type | Description | | ------------ | ------------------- | ----------- | | ownerAddress | string | | Address of the owner | ### baseEvernodeClient.getCandidateById(candidateId) ⇒ Get candidate info. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | -------------------- | | candidateId | string | Id of the candidate. | ### baseEvernodeClient.getDudHostVoteInfo(hostAddress) ⇒ Get reported dud host info. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The dud host candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | ----------------------------------- | | hostAddress | string | [Optional] Address of the dud host. | ### baseEvernodeClient.getPilotedModeVoteInfo() ⇒ Get piloted mode vote info. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: The piloted mode candidate information. Returns null if no candidate. ### baseEvernodeClient.getReputationAddressByOrderedId(orderedId, moment) ⇒ Get reputation order info of given orderedId. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: Reputation address info object. | Param | Type | Default | Description | | --------- | ------------------- | ------------- | --------------------------------------------- | | orderedId | number | | Order id of the host. | | moment | number | | (optional) Moment to get reputation info for. | ### baseEvernodeClient.getReputationOrderByAddress(hostAddress, moment) ⇒ Get reputation order info of given host. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: Reputation order info object. | Param | Type | Default | Description | | ----------- | ------------------- | ------------- | --------------------------------------------- | | hostAddress | string | | (optional) Host address. | | moment | number | | (optional) Moment to get reputation info for. | ### baseEvernodeClient.getReputationContractInfoByAddress(hostsAddress, moment) ⇒ Get reputation contract info of given host. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: Reputation contract info object. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------------------------ | | hostsAddress | string | Host address. | | moment | number | (optional) Moment to get reputation contract info for. | ### baseEvernodeClient.getReputationInfoByAddress(hostsAddress) ⇒ Get reputation info of given host. **Kind**: instance method of [BaseEvernodeClient](#BaseEvernodeClient) **Returns**: Reputation info object. | Param | Type | Description | | ------------ | ------------------- | ------------- | | hostsAddress | string | Host address. | ## FoundationClient ⇐ [BaseEvernodeClient](#BaseEvernodeClient) FoundationClient class to manage and interact with foundation operations. It extends the BaseEvernodeClient. **Kind**: global class **Extends**: [BaseEvernodeClient](#BaseEvernodeClient) * [FoundationClient](#FoundationClient) ⇐ [BaseEvernodeClient](#BaseEvernodeClient) * [new FoundationClient(xrpAddress, xrpSecret, [options])](#new_FoundationClient_new) * [.propose(hashes, shortName, options)](#FoundationClient+propose) ⇒ * [.withdraw(candidateId, options)](#FoundationClient+withdraw) ⇒ * [.vote(candidateId, vote, options)](#FoundationClient+vote) ⇒ * [.reportDudHost(hostAddress, options)](#FoundationClient+reportDudHost) ⇒ * [.voteDudHost(hostAddress, vote, options)](#FoundationClient+voteDudHost) ⇒ * [.votePilotedMode(vote, options)](#FoundationClient+votePilotedMode) ⇒ * [.changeGovernanceMode(mode, options)](#FoundationClient+changeGovernanceMode) ⇒ * [.updateHostReputation(hostAddress, reputation, options)](#FoundationClient+updateHostReputation) ⇒ * [.on(event, handler)](#BaseEvernodeClient+on) * [.once(event, handler)](#BaseEvernodeClient+once) * [.off(event, handler)](#BaseEvernodeClient+off) * [.connect()](#BaseEvernodeClient+connect) ⇒ * [.disconnect()](#BaseEvernodeClient+disconnect) * [.subscribe()](#BaseEvernodeClient+subscribe) * [.unsubscribe()](#BaseEvernodeClient+unsubscribe) * [.getEVRBalance()](#BaseEvernodeClient+getEVRBalance) ⇒ * [.getHookStates()](#BaseEvernodeClient+getHookStates) ⇒ * [.getMoment(index)](#BaseEvernodeClient+getMoment) ⇒ * [.getMomentStartIndex(index)](#BaseEvernodeClient+getMomentStartIndex) ⇒ * [.refreshConfig()](#BaseEvernodeClient+refreshConfig) * [.extractEvernodeEvent(tx)](#BaseEvernodeClient+extractEvernodeEvent) ⇒ * [.getHostInfo(hostAddress)](#BaseEvernodeClient+getHostInfo) ⇒ * [.getAllHostsFromLedger()](#BaseEvernodeClient+getAllHostsFromLedger) ⇒ * [.getAllCandidatesFromLedger()](#BaseEvernodeClient+getAllCandidatesFromLedger) ⇒ * [.pruneDeadHost(hostAddress)](#BaseEvernodeClient+pruneDeadHost) * [.getCandidateByOwner(ownerAddress)](#BaseEvernodeClient+getCandidateByOwner) ⇒ * [.getDudHostCandidatesByOwner(ownerAddress)](#BaseEvernodeClient+getDudHostCandidatesByOwner) ⇒ * [.getCandidateById(candidateId)](#BaseEvernodeClient+getCandidateById) ⇒ * [.getDudHostVoteInfo(hostAddress)](#BaseEvernodeClient+getDudHostVoteInfo) ⇒ * [.getPilotedModeVoteInfo()](#BaseEvernodeClient+getPilotedModeVoteInfo) ⇒ * [.getReputationAddressByOrderedId(orderedId, moment)](#BaseEvernodeClient+getReputationAddressByOrderedId) ⇒ * [.getReputationOrderByAddress(hostAddress, moment)](#BaseEvernodeClient+getReputationOrderByAddress) ⇒ * [.getReputationContractInfoByAddress(hostsAddress, moment)](#BaseEvernodeClient+getReputationContractInfoByAddress) ⇒ * [.getReputationInfoByAddress(hostsAddress)](#BaseEvernodeClient+getReputationInfoByAddress) ⇒ ### new FoundationClient(xrpAddress, xrpSecret, [options]) Creates an instance of FoundationClient. | Param | Type | Default | Description | | ---------- | ------------------- | --------------- | ---------------------------------------------------------- | | xrpAddress | string | | The XRP address to associate with this client. | | xrpSecret | string | | The secret (private key) associated with the XRP address. | | [options] | Object | {} | Additional configuration options for the FoundationClient. | ### foundationClient.propose(hashes, shortName, options) ⇒ Propose a new hook candidate. **Kind**: instance method of [FoundationClient](#FoundationClient) **Returns**: Proposed candidate id. | Param | Type | Description | | --------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | hashes | string | Hook candidate hashes in hex format, . | | shortName | string | Short name for the proposal candidate. This can consist of 20 characters. In here you can include any reference to your code pull requests as well. | | options | \* | [Optional] transaction options. | ### foundationClient.withdraw(candidateId, options) ⇒ Withdraw a hook candidate. **Kind**: instance method of [FoundationClient](#FoundationClient) **Returns**: Transaction result. | Param | Type | Description | | ----------- | ------------------- | ---------------------------------- | | candidateId | string | Id of the candidate in hex format. | | options | \* | [Optional] transaction options. | ### foundationClient.vote(candidateId, vote, options) ⇒ Vote for a hook candidate. **Kind**: instance method of [FoundationClient](#FoundationClient) **Returns**: Transaction result. | Param | Type | Description | | ----------- | ------------------- | --------------------------------------------------- | | candidateId | string | Id of the candidate in hex format. | | vote | int | Vote value CandidateVote (0 - Reject, 1 - Support). | | options | \* | [Optional] transaction options. | ### foundationClient.reportDudHost(hostAddress, options) ⇒ Report dud host for removal. **Kind**: instance method of [FoundationClient](#FoundationClient) **Returns**: Transaction result. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | Address of the dud host. | | options | \* | [Optional] transaction options. | ### foundationClient.voteDudHost(hostAddress, vote, options) ⇒ Vote for a dud host. **Kind**: instance method of [FoundationClient](#FoundationClient) **Returns**: Transaction result. | Param | Type | Description | | ----------- | ------------------- | --------------------------------------------------- | | hostAddress | string | Address of the dud host. | | vote | int | Vote value CandidateVote (0 - Reject, 1 - Support). | | options | \* | [Optional] transaction options. | ### foundationClient.votePilotedMode(vote, options) ⇒ Vote for a piloted mode. **Kind**: instance method of [FoundationClient](#FoundationClient) **Returns**: Transaction result. | Param | Type | Description | | ------- | ---------------- | --------------------------------------------------- | | vote | int | Vote value CandidateVote (0 - Reject, 1 - Support). | | options | \* | [Optional] transaction options. | ### foundationClient.changeGovernanceMode(mode, options) ⇒ Change the governance mode. **Kind**: instance method of [FoundationClient](#FoundationClient) **Returns**: Transaction result. | Param | Type | Description | | ------- | ---------------- | ---------------------------------------------------- | | mode | int | Mode (1 - Piloted, 2 - CoPiloted, 3 - AutoPiloted). | | options | \* | [Optional] transaction options. | ### foundationClient.updateHostReputation(hostAddress, reputation, options) ⇒ Update the reputation of the host. **Kind**: instance method of [FoundationClient](#FoundationClient) **Returns**: Transaction result. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | Address of the dud host. | | reputation | number | Host reputation value. | | options | \* | [Optional] transaction options. | ### foundationClient.on(event, handler) Listens to the subscribed events. This will listen for the event without detaching the handler until it's 'off'. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [on](#BaseEvernodeClient+on) | Param | Type | Description | | ------- | --------------------- | ---------------------------------------------------------------------------------------------- | | event | string | The name of the event to listen for. | | handler | function | The callback function to handle the event. The function takes the event object as a parameter. | ### foundationClient.once(event, handler) Listens to the subscribed events. This will listen only once and detach the handler. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [once](#BaseEvernodeClient+once) | Param | Type | Description | | ------- | --------------------- | -------------------------------------- | | event | string | Event name. | | handler | function | Callback function to handle the event. | ### foundationClient.off(event, handler) Detach the listener event. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [off](#BaseEvernodeClient+off) | Param | Type | Default | Description | | ------- | --------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------- | | event | string | | Event name. | | handler | function | | (optional) Can be sent if a specific handler need to be detached. All the handlers will be detached if not specified. | ### foundationClient.connect() ⇒ Connects the client to xrpl server and do the config loading and subscriptions. 'subscribe' is called inside this. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [connect](#BaseEvernodeClient+connect) **Returns**: Boolean value `true` if the connection is successful. ### foundationClient.disconnect() Disconnects the client to xrpl server and do the un-subscriptions. 'unsubscribe' is called inside this. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [disconnect](#BaseEvernodeClient+disconnect) ### foundationClient.subscribe() Subscribes to the client events. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [subscribe](#BaseEvernodeClient+subscribe) ### foundationClient.unsubscribe() Unsubscribes from the client events. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [unsubscribe](#BaseEvernodeClient+unsubscribe) ### foundationClient.getEVRBalance() ⇒ Get the EVR balance in the account. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getEVRBalance](#BaseEvernodeClient+getEVRBalance) **Returns**: The available EVR amount as a string. ### foundationClient.getHookStates() ⇒ Get all XRPL hook states in the registry account. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getHookStates](#BaseEvernodeClient+getHookStates) **Returns**: The list of hook states, including Evernode configuration and hosts. ### foundationClient.getMoment(index) ⇒ Get the moment from the given index (timestamp). **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getMoment](#BaseEvernodeClient+getMoment) **Returns**: The moment of the given index (timestamp) as a number. Returns the current moment if the timestamp is not provided. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment value. | ### foundationClient.getMomentStartIndex(index) ⇒ Get start index (timestamp) of the moment. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getMomentStartIndex](#BaseEvernodeClient+getMomentStartIndex) **Returns**: The index (timestamp) of the moment as a 'number'. Returns the current moment's start index (timestamp) if ledger index parameter is not given. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment start index. | ### foundationClient.refreshConfig() Loads the configs from XRPL hook and updates the in-memory config. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [refreshConfig](#BaseEvernodeClient+refreshConfig) ### foundationClient.extractEvernodeEvent(tx) ⇒ Extracts the transaction info from a given transaction. Note: You need to deserialize HookParameters before passing the transaction to this function. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [extractEvernodeEvent](#BaseEvernodeClient+extractEvernodeEvent) **Returns**: The event object in format `{name: string, data: Object}`. Returns `null` if the event is not handled. | Param | Type | Description | | ----- | ------------------- | -------------------------------------------------------- | | tx | object | The transaction object to be deserialized and extracted. | ### foundationClient.getHostInfo(hostAddress) ⇒ Get the registered host information. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getHostInfo](#BaseEvernodeClient+getHostInfo) **Returns**: The registered host information object. Returns null if not registered. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | [Optional] Address of the host. | ### foundationClient.getAllHostsFromLedger() ⇒ Get the hosts registered in Evernode. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getAllHostsFromLedger](#BaseEvernodeClient+getAllHostsFromLedger) **Returns**: The list of hosts. ### foundationClient.getAllCandidatesFromLedger() ⇒ Get the governor in Evernode. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getAllCandidatesFromLedger](#BaseEvernodeClient+getAllCandidatesFromLedger) **Returns**: The list of candidates. ### foundationClient.pruneDeadHost(hostAddress) Remove a host which is inactive for a long period. The inactivity is checked by Evernode it self and only pruned if inactive thresholds are met. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [pruneDeadHost](#BaseEvernodeClient+pruneDeadHost) | Param | Type | Description | | ----------- | ------------------- | -------------------------------------- | | hostAddress | string | XRPL address of the host to be pruned. | ### foundationClient.getCandidateByOwner(ownerAddress) ⇒ Get proposed new hook candidate info. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getCandidateByOwner](#BaseEvernodeClient+getCandidateByOwner) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ------------ | ------------------- | -------------------------------- | | ownerAddress | string | [Optional] Address of the owner. | ### foundationClient.getDudHostCandidatesByOwner(ownerAddress) ⇒ Get proposed dud host candidates. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getDudHostCandidatesByOwner](#BaseEvernodeClient+getDudHostCandidatesByOwner) **Returns**: An array of candidate information. Returns empty array if no candidates. | Param | Type | Description | | ------------ | ------------------- | ----------- | | ownerAddress | string | | Address of the owner | ### foundationClient.getCandidateById(candidateId) ⇒ Get candidate info. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getCandidateById](#BaseEvernodeClient+getCandidateById) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | -------------------- | | candidateId | string | Id of the candidate. | ### foundationClient.getDudHostVoteInfo(hostAddress) ⇒ Get reported dud host info. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getDudHostVoteInfo](#BaseEvernodeClient+getDudHostVoteInfo) **Returns**: The dud host candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | ----------------------------------- | | hostAddress | string | [Optional] Address of the dud host. | ### foundationClient.getPilotedModeVoteInfo() ⇒ Get piloted mode vote info. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getPilotedModeVoteInfo](#BaseEvernodeClient+getPilotedModeVoteInfo) **Returns**: The piloted mode candidate information. Returns null if no candidate. ### foundationClient.getReputationAddressByOrderedId(orderedId, moment) ⇒ Get reputation order info of given orderedId. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getReputationAddressByOrderedId](#BaseEvernodeClient+getReputationAddressByOrderedId) **Returns**: Reputation address info object. | Param | Type | Default | Description | | --------- | ------------------- | ------------- | --------------------------------------------- | | orderedId | number | | Order id of the host. | | moment | number | | (optional) Moment to get reputation info for. | ### foundationClient.getReputationOrderByAddress(hostAddress, moment) ⇒ Get reputation order info of given host. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getReputationOrderByAddress](#BaseEvernodeClient+getReputationOrderByAddress) **Returns**: Reputation order info object. | Param | Type | Default | Description | | ----------- | ------------------- | ------------- | --------------------------------------------- | | hostAddress | string | | (optional) Host address. | | moment | number | | (optional) Moment to get reputation info for. | ### foundationClient.getReputationContractInfoByAddress(hostsAddress, moment) ⇒ Get reputation contract info of given host. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getReputationContractInfoByAddress](#BaseEvernodeClient+getReputationContractInfoByAddress) **Returns**: Reputation contract info object. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------------------------ | | hostsAddress | string | Host address. | | moment | number | (optional) Moment to get reputation contract info for. | ### foundationClient.getReputationInfoByAddress(hostsAddress) ⇒ Get reputation info of given host. **Kind**: instance method of [FoundationClient](#FoundationClient) **Overrides**: [getReputationInfoByAddress](#BaseEvernodeClient+getReputationInfoByAddress) **Returns**: Reputation info object. | Param | Type | Description | | ------------ | ------------------- | ------------- | | hostsAddress | string | Host address. | ## HeartbeatClient ⇐ [BaseEvernodeClient](#BaseEvernodeClient) HeartbeatClient is responsible for managing heartbeat operations in Evernode. It interacts with the XRP Ledger using the heartbeat address and listens for specific heartbeat events. **Kind**: global class **Extends**: [BaseEvernodeClient](#BaseEvernodeClient) * [HeartbeatClient](#HeartbeatClient) ⇐ [BaseEvernodeClient](#BaseEvernodeClient) * [.on(event, handler)](#BaseEvernodeClient+on) * [.once(event, handler)](#BaseEvernodeClient+once) * [.off(event, handler)](#BaseEvernodeClient+off) * [.connect()](#BaseEvernodeClient+connect) ⇒ * [.disconnect()](#BaseEvernodeClient+disconnect) * [.subscribe()](#BaseEvernodeClient+subscribe) * [.unsubscribe()](#BaseEvernodeClient+unsubscribe) * [.getEVRBalance()](#BaseEvernodeClient+getEVRBalance) ⇒ * [.getHookStates()](#BaseEvernodeClient+getHookStates) ⇒ * [.getMoment(index)](#BaseEvernodeClient+getMoment) ⇒ * [.getMomentStartIndex(index)](#BaseEvernodeClient+getMomentStartIndex) ⇒ * [.refreshConfig()](#BaseEvernodeClient+refreshConfig) * [.extractEvernodeEvent(tx)](#BaseEvernodeClient+extractEvernodeEvent) ⇒ * [.getHostInfo(hostAddress)](#BaseEvernodeClient+getHostInfo) ⇒ * [.getAllHostsFromLedger()](#BaseEvernodeClient+getAllHostsFromLedger) ⇒ * [.getAllCandidatesFromLedger()](#BaseEvernodeClient+getAllCandidatesFromLedger) ⇒ * [.pruneDeadHost(hostAddress)](#BaseEvernodeClient+pruneDeadHost) * [.getCandidateByOwner(ownerAddress)](#BaseEvernodeClient+getCandidateByOwner) ⇒ * [.getDudHostCandidatesByOwner(ownerAddress)](#BaseEvernodeClient+getDudHostCandidatesByOwner) ⇒ * [.getCandidateById(candidateId)](#BaseEvernodeClient+getCandidateById) ⇒ * [.getDudHostVoteInfo(hostAddress)](#BaseEvernodeClient+getDudHostVoteInfo) ⇒ * [.getPilotedModeVoteInfo()](#BaseEvernodeClient+getPilotedModeVoteInfo) ⇒ * [.getReputationAddressByOrderedId(orderedId, moment)](#BaseEvernodeClient+getReputationAddressByOrderedId) ⇒ * [.getReputationOrderByAddress(hostAddress, moment)](#BaseEvernodeClient+getReputationOrderByAddress) ⇒ * [.getReputationContractInfoByAddress(hostsAddress, moment)](#BaseEvernodeClient+getReputationContractInfoByAddress) ⇒ * [.getReputationInfoByAddress(hostsAddress)](#BaseEvernodeClient+getReputationInfoByAddress) ⇒ ### heartbeatClient.on(event, handler) Listens to the subscribed events. This will listen for the event without detaching the handler until it's 'off'. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [on](#BaseEvernodeClient+on) | Param | Type | Description | | ------- | --------------------- | ---------------------------------------------------------------------------------------------- | | event | string | The name of the event to listen for. | | handler | function | The callback function to handle the event. The function takes the event object as a parameter. | ### heartbeatClient.once(event, handler) Listens to the subscribed events. This will listen only once and detach the handler. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [once](#BaseEvernodeClient+once) | Param | Type | Description | | ------- | --------------------- | -------------------------------------- | | event | string | Event name. | | handler | function | Callback function to handle the event. | ### heartbeatClient.off(event, handler) Detach the listener event. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [off](#BaseEvernodeClient+off) | Param | Type | Default | Description | | ------- | --------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------- | | event | string | | Event name. | | handler | function | | (optional) Can be sent if a specific handler need to be detached. All the handlers will be detached if not specified. | ### heartbeatClient.connect() ⇒ Connects the client to xrpl server and do the config loading and subscriptions. 'subscribe' is called inside this. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [connect](#BaseEvernodeClient+connect) **Returns**: Boolean value `true` if the connection is successful. ### heartbeatClient.disconnect() Disconnects the client to xrpl server and do the un-subscriptions. 'unsubscribe' is called inside this. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [disconnect](#BaseEvernodeClient+disconnect) ### heartbeatClient.subscribe() Subscribes to the client events. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [subscribe](#BaseEvernodeClient+subscribe) ### heartbeatClient.unsubscribe() Unsubscribes from the client events. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [unsubscribe](#BaseEvernodeClient+unsubscribe) ### heartbeatClient.getEVRBalance() ⇒ Get the EVR balance in the account. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getEVRBalance](#BaseEvernodeClient+getEVRBalance) **Returns**: The available EVR amount as a string. ### heartbeatClient.getHookStates() ⇒ Get all XRPL hook states in the registry account. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getHookStates](#BaseEvernodeClient+getHookStates) **Returns**: The list of hook states, including Evernode configuration and hosts. ### heartbeatClient.getMoment(index) ⇒ Get the moment from the given index (timestamp). **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getMoment](#BaseEvernodeClient+getMoment) **Returns**: The moment of the given index (timestamp) as a number. Returns the current moment if the timestamp is not provided. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment value. | ### heartbeatClient.getMomentStartIndex(index) ⇒ Get start index (timestamp) of the moment. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getMomentStartIndex](#BaseEvernodeClient+getMomentStartIndex) **Returns**: The index (timestamp) of the moment as a 'number'. Returns the current moment's start index (timestamp) if ledger index parameter is not given. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment start index. | ### heartbeatClient.refreshConfig() Loads the configs from XRPL hook and updates the in-memory config. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [refreshConfig](#BaseEvernodeClient+refreshConfig) ### heartbeatClient.extractEvernodeEvent(tx) ⇒ Extracts the transaction info from a given transaction. Note: You need to deserialize HookParameters before passing the transaction to this function. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [extractEvernodeEvent](#BaseEvernodeClient+extractEvernodeEvent) **Returns**: The event object in format `{name: string, data: Object}`. Returns `null` if the event is not handled. | Param | Type | Description | | ----- | ------------------- | -------------------------------------------------------- | | tx | object | The transaction object to be deserialized and extracted. | ### heartbeatClient.getHostInfo(hostAddress) ⇒ Get the registered host information. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getHostInfo](#BaseEvernodeClient+getHostInfo) **Returns**: The registered host information object. Returns null if not registered. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | [Optional] Address of the host. | ### heartbeatClient.getAllHostsFromLedger() ⇒ Get the hosts registered in Evernode. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getAllHostsFromLedger](#BaseEvernodeClient+getAllHostsFromLedger) **Returns**: The list of hosts. ### heartbeatClient.getAllCandidatesFromLedger() ⇒ Get the governor in Evernode. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getAllCandidatesFromLedger](#BaseEvernodeClient+getAllCandidatesFromLedger) **Returns**: The list of candidates. ### heartbeatClient.pruneDeadHost(hostAddress) Remove a host which is inactive for a long period. The inactivity is checked by Evernode it self and only pruned if inactive thresholds are met. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [pruneDeadHost](#BaseEvernodeClient+pruneDeadHost) | Param | Type | Description | | ----------- | ------------------- | -------------------------------------- | | hostAddress | string | XRPL address of the host to be pruned. | ### heartbeatClient.getCandidateByOwner(ownerAddress) ⇒ Get proposed new hook candidate info. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getCandidateByOwner](#BaseEvernodeClient+getCandidateByOwner) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ------------ | ------------------- | -------------------------------- | | ownerAddress | string | [Optional] Address of the owner. | ### heartbeatClient.getDudHostCandidatesByOwner(ownerAddress) ⇒ Get proposed dud host candidates. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getDudHostCandidatesByOwner](#BaseEvernodeClient+getDudHostCandidatesByOwner) **Returns**: An array of candidate information. Returns empty array if no candidates. | Param | Type | Description | | ------------ | ------------------- | ----------- | | ownerAddress | string | | Address of the owner | ### heartbeatClient.getCandidateById(candidateId) ⇒ Get candidate info. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getCandidateById](#BaseEvernodeClient+getCandidateById) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | -------------------- | | candidateId | string | Id of the candidate. | ### heartbeatClient.getDudHostVoteInfo(hostAddress) ⇒ Get reported dud host info. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getDudHostVoteInfo](#BaseEvernodeClient+getDudHostVoteInfo) **Returns**: The dud host candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | ----------------------------------- | | hostAddress | string | [Optional] Address of the dud host. | ### heartbeatClient.getPilotedModeVoteInfo() ⇒ Get piloted mode vote info. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getPilotedModeVoteInfo](#BaseEvernodeClient+getPilotedModeVoteInfo) **Returns**: The piloted mode candidate information. Returns null if no candidate. ### heartbeatClient.getReputationAddressByOrderedId(orderedId, moment) ⇒ Get reputation order info of given orderedId. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getReputationAddressByOrderedId](#BaseEvernodeClient+getReputationAddressByOrderedId) **Returns**: Reputation address info object. | Param | Type | Default | Description | | --------- | ------------------- | ------------- | --------------------------------------------- | | orderedId | number | | Order id of the host. | | moment | number | | (optional) Moment to get reputation info for. | ### heartbeatClient.getReputationOrderByAddress(hostAddress, moment) ⇒ Get reputation order info of given host. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getReputationOrderByAddress](#BaseEvernodeClient+getReputationOrderByAddress) **Returns**: Reputation order info object. | Param | Type | Default | Description | | ----------- | ------------------- | ------------- | --------------------------------------------- | | hostAddress | string | | (optional) Host address. | | moment | number | | (optional) Moment to get reputation info for. | ### heartbeatClient.getReputationContractInfoByAddress(hostsAddress, moment) ⇒ Get reputation contract info of given host. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getReputationContractInfoByAddress](#BaseEvernodeClient+getReputationContractInfoByAddress) **Returns**: Reputation contract info object. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------------------------ | | hostsAddress | string | Host address. | | moment | number | (optional) Moment to get reputation contract info for. | ### heartbeatClient.getReputationInfoByAddress(hostsAddress) ⇒ Get reputation info of given host. **Kind**: instance method of [HeartbeatClient](#HeartbeatClient) **Overrides**: [getReputationInfoByAddress](#BaseEvernodeClient+getReputationInfoByAddress) **Returns**: Reputation info object. | Param | Type | Description | | ------------ | ------------------- | ------------- | | hostsAddress | string | Host address. | ## HookClientFactory A factory class for creating different types of hook clients based on the provided hook type. **Kind**: global class ### HookClientFactory.create(hookType, [options]) ⇒ Promise.<(Object\|null)> Creates a hook client from given type. **Kind**: static method of [HookClientFactory](#HookClientFactory) **Returns**: Promise.<(Object\|null)> - - Returns a promise that resolves to an instance of the requested HookClient type, or `null` if the type is unsupported. **Throws**: - Error Will throw an error if there is an issue connecting to the GovernorClient or obtaining the necessary configuration. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------------------------------------------------------------------------ | | hookType | string | | Type of the Required Hook. (Supported Hook types 'GOVERNOR', 'REGISTRY', 'HEARTBEAT' and 'REPUTATION') | | [options] | Object | {} | Optional configuration for the hook client. | ## RegistryClient ⇐ [BaseEvernodeClient](#BaseEvernodeClient) RegistryClient is responsible for managing registry operations in Evernode. It interacts with the XRP Ledger using the registry address and listens for specific registry events. **Kind**: global class **Extends**: [BaseEvernodeClient](#BaseEvernodeClient) * [RegistryClient](#RegistryClient) ⇐ [BaseEvernodeClient](#BaseEvernodeClient) * [.getActiveHostsFromLedger()](#RegistryClient+getActiveHostsFromLedger) ⇒ Promise.<Array> * [.on(event, handler)](#BaseEvernodeClient+on) * [.once(event, handler)](#BaseEvernodeClient+once) * [.off(event, handler)](#BaseEvernodeClient+off) * [.connect()](#BaseEvernodeClient+connect) ⇒ * [.disconnect()](#BaseEvernodeClient+disconnect) * [.subscribe()](#BaseEvernodeClient+subscribe) * [.unsubscribe()](#BaseEvernodeClient+unsubscribe) * [.getEVRBalance()](#BaseEvernodeClient+getEVRBalance) ⇒ * [.getHookStates()](#BaseEvernodeClient+getHookStates) ⇒ * [.getMoment(index)](#BaseEvernodeClient+getMoment) ⇒ * [.getMomentStartIndex(index)](#BaseEvernodeClient+getMomentStartIndex) ⇒ * [.refreshConfig()](#BaseEvernodeClient+refreshConfig) * [.extractEvernodeEvent(tx)](#BaseEvernodeClient+extractEvernodeEvent) ⇒ * [.getHostInfo(hostAddress)](#BaseEvernodeClient+getHostInfo) ⇒ * [.getAllHostsFromLedger()](#BaseEvernodeClient+getAllHostsFromLedger) ⇒ * [.getAllCandidatesFromLedger()](#BaseEvernodeClient+getAllCandidatesFromLedger) ⇒ * [.pruneDeadHost(hostAddress)](#BaseEvernodeClient+pruneDeadHost) * [.getCandidateByOwner(ownerAddress)](#BaseEvernodeClient+getCandidateByOwner) ⇒ * [.getDudHostCandidatesByOwner(ownerAddress)](#BaseEvernodeClient+getDudHostCandidatesByOwner) ⇒ * [.getCandidateById(candidateId)](#BaseEvernodeClient+getCandidateById) ⇒ * [.getDudHostVoteInfo(hostAddress)](#BaseEvernodeClient+getDudHostVoteInfo) ⇒ * [.getPilotedModeVoteInfo()](#BaseEvernodeClient+getPilotedModeVoteInfo) ⇒ * [.getReputationAddressByOrderedId(orderedId, moment)](#BaseEvernodeClient+getReputationAddressByOrderedId) ⇒ * [.getReputationOrderByAddress(hostAddress, moment)](#BaseEvernodeClient+getReputationOrderByAddress) ⇒ * [.getReputationContractInfoByAddress(hostsAddress, moment)](#BaseEvernodeClient+getReputationContractInfoByAddress) ⇒ * [.getReputationInfoByAddress(hostsAddress)](#BaseEvernodeClient+getReputationInfoByAddress) ⇒ ### registryClient.getActiveHostsFromLedger() ⇒ Promise.<Array> Retrieves all active hosts registered in the ledger. **Kind**: instance method of [RegistryClient](#RegistryClient) **Returns**: Promise.<Array> - - A promise that resolves to an array of active hosts. ### registryClient.on(event, handler) Listens to the subscribed events. This will listen for the event without detaching the handler until it's 'off'. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [on](#BaseEvernodeClient+on) | Param | Type | Description | | ------- | --------------------- | ---------------------------------------------------------------------------------------------- | | event | string | The name of the event to listen for. | | handler | function | The callback function to handle the event. The function takes the event object as a parameter. | ### registryClient.once(event, handler) Listens to the subscribed events. This will listen only once and detach the handler. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [once](#BaseEvernodeClient+once) | Param | Type | Description | | ------- | --------------------- | -------------------------------------- | | event | string | Event name. | | handler | function | Callback function to handle the event. | ### registryClient.off(event, handler) Detach the listener event. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [off](#BaseEvernodeClient+off) | Param | Type | Default | Description | | ------- | --------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------- | | event | string | | Event name. | | handler | function | | (optional) Can be sent if a specific handler need to be detached. All the handlers will be detached if not specified. | ### registryClient.connect() ⇒ Connects the client to xrpl server and do the config loading and subscriptions. 'subscribe' is called inside this. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [connect](#BaseEvernodeClient+connect) **Returns**: Boolean value `true` if the connection is successful. ### registryClient.disconnect() Disconnects the client to xrpl server and do the un-subscriptions. 'unsubscribe' is called inside this. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [disconnect](#BaseEvernodeClient+disconnect) ### registryClient.subscribe() Subscribes to the client events. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [subscribe](#BaseEvernodeClient+subscribe) ### registryClient.unsubscribe() Unsubscribes from the client events. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [unsubscribe](#BaseEvernodeClient+unsubscribe) ### registryClient.getEVRBalance() ⇒ Get the EVR balance in the account. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getEVRBalance](#BaseEvernodeClient+getEVRBalance) **Returns**: The available EVR amount as a string. ### registryClient.getHookStates() ⇒ Get all XRPL hook states in the registry account. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getHookStates](#BaseEvernodeClient+getHookStates) **Returns**: The list of hook states, including Evernode configuration and hosts. ### registryClient.getMoment(index) ⇒ Get the moment from the given index (timestamp). **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getMoment](#BaseEvernodeClient+getMoment) **Returns**: The moment of the given index (timestamp) as a number. Returns the current moment if the timestamp is not provided. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment value. | ### registryClient.getMomentStartIndex(index) ⇒ Get start index (timestamp) of the moment. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getMomentStartIndex](#BaseEvernodeClient+getMomentStartIndex) **Returns**: The index (timestamp) of the moment as a 'number'. Returns the current moment's start index (timestamp) if ledger index parameter is not given. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment start index. | ### registryClient.refreshConfig() Loads the configs from XRPL hook and updates the in-memory config. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [refreshConfig](#BaseEvernodeClient+refreshConfig) ### registryClient.extractEvernodeEvent(tx) ⇒ Extracts the transaction info from a given transaction. Note: You need to deserialize HookParameters before passing the transaction to this function. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [extractEvernodeEvent](#BaseEvernodeClient+extractEvernodeEvent) **Returns**: The event object in format `{name: string, data: Object}`. Returns `null` if the event is not handled. | Param | Type | Description | | ----- | ------------------- | -------------------------------------------------------- | | tx | object | The transaction object to be deserialized and extracted. | ### registryClient.getHostInfo(hostAddress) ⇒ Get the registered host information. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getHostInfo](#BaseEvernodeClient+getHostInfo) **Returns**: The registered host information object. Returns null if not registered. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | [Optional] Address of the host. | ### registryClient.getAllHostsFromLedger() ⇒ Get the hosts registered in Evernode. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getAllHostsFromLedger](#BaseEvernodeClient+getAllHostsFromLedger) **Returns**: The list of hosts. ### registryClient.getAllCandidatesFromLedger() ⇒ Get the governor in Evernode. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getAllCandidatesFromLedger](#BaseEvernodeClient+getAllCandidatesFromLedger) **Returns**: The list of candidates. ### registryClient.pruneDeadHost(hostAddress) Remove a host which is inactive for a long period. The inactivity is checked by Evernode it self and only pruned if inactive thresholds are met. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [pruneDeadHost](#BaseEvernodeClient+pruneDeadHost) | Param | Type | Description | | ----------- | ------------------- | -------------------------------------- | | hostAddress | string | XRPL address of the host to be pruned. | ### registryClient.getCandidateByOwner(ownerAddress) ⇒ Get proposed new hook candidate info. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getCandidateByOwner](#BaseEvernodeClient+getCandidateByOwner) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ------------ | ------------------- | -------------------------------- | | ownerAddress | string | [Optional] Address of the owner. | ### registryClient.getDudHostCandidatesByOwner(ownerAddress) ⇒ Get proposed dud host candidates. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getDudHostCandidatesByOwner](#BaseEvernodeClient+getDudHostCandidatesByOwner) **Returns**: An array of candidate information. Returns empty array if no candidates. | Param | Type | Description | | ------------ | ------------------- | ----------- | | ownerAddress | string | | Address of the owner | ### registryClient.getCandidateById(candidateId) ⇒ Get candidate info. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getCandidateById](#BaseEvernodeClient+getCandidateById) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | -------------------- | | candidateId | string | Id of the candidate. | ### registryClient.getDudHostVoteInfo(hostAddress) ⇒ Get reported dud host info. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getDudHostVoteInfo](#BaseEvernodeClient+getDudHostVoteInfo) **Returns**: The dud host candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | ----------------------------------- | | hostAddress | string | [Optional] Address of the dud host. | ### registryClient.getPilotedModeVoteInfo() ⇒ Get piloted mode vote info. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getPilotedModeVoteInfo](#BaseEvernodeClient+getPilotedModeVoteInfo) **Returns**: The piloted mode candidate information. Returns null if no candidate. ### registryClient.getReputationAddressByOrderedId(orderedId, moment) ⇒ Get reputation order info of given orderedId. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getReputationAddressByOrderedId](#BaseEvernodeClient+getReputationAddressByOrderedId) **Returns**: Reputation address info object. | Param | Type | Default | Description | | --------- | ------------------- | ------------- | --------------------------------------------- | | orderedId | number | | Order id of the host. | | moment | number | | (optional) Moment to get reputation info for. | ### registryClient.getReputationOrderByAddress(hostAddress, moment) ⇒ Get reputation order info of given host. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getReputationOrderByAddress](#BaseEvernodeClient+getReputationOrderByAddress) **Returns**: Reputation order info object. | Param | Type | Default | Description | | ----------- | ------------------- | ------------- | --------------------------------------------- | | hostAddress | string | | (optional) Host address. | | moment | number | | (optional) Moment to get reputation info for. | ### registryClient.getReputationContractInfoByAddress(hostsAddress, moment) ⇒ Get reputation contract info of given host. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getReputationContractInfoByAddress](#BaseEvernodeClient+getReputationContractInfoByAddress) **Returns**: Reputation contract info object. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------------------------ | | hostsAddress | string | Host address. | | moment | number | (optional) Moment to get reputation contract info for. | ### registryClient.getReputationInfoByAddress(hostsAddress) ⇒ Get reputation info of given host. **Kind**: instance method of [RegistryClient](#RegistryClient) **Overrides**: [getReputationInfoByAddress](#BaseEvernodeClient+getReputationInfoByAddress) **Returns**: Reputation info object. | Param | Type | Description | | ------------ | ------------------- | ------------- | | hostsAddress | string | Host address. | ## HostClient ⇐ [BaseEvernodeClient](#BaseEvernodeClient) HostClient class to manage host operations. It extends the BaseEvernodeClient. **Kind**: global class **Extends**: [BaseEvernodeClient](#BaseEvernodeClient) * [HostClient](#HostClient) ⇐ [BaseEvernodeClient](#BaseEvernodeClient) * [new HostClient(xrpAddress, xrpSecret, [options])](#new_HostClient_new) * [.getRegistrationUriToken()](#HostClient+getRegistrationUriToken) ⇒ * [.getRegistration()](#HostClient+getRegistration) ⇒ * [.getLeaseByIndex(index)](#HostClient+getLeaseByIndex) ⇒ * [.getLeases()](#HostClient+getLeases) ⇒ * [.getLeaseOffers()](#HostClient+getLeaseOffers) ⇒ * [.getUnofferedLeases()](#HostClient+getUnofferedLeases) ⇒ * [.isRegistered()](#HostClient+isRegistered) ⇒ * [.prepareAccount(domain)](#HostClient+prepareAccount) * [.prepareReputationAccount(reputationAddress, reputationSecret)](#HostClient+prepareReputationAccount) * [.setReputationContractInfo(peerPort, publicKey)](#HostClient+setReputationContractInfo) * [.getReputationInfo(moment)](#HostClient+getReputationInfo) ⇒ * [.prepareHostReputationScores(scoreVersion, clusterSize, collectedScores)](#HostClient+prepareHostReputationScores) ⇒ * [.sendReputations(bufferHex)](#HostClient+sendReputations) * [.offerLease(leaseIndex, leaseAmount, tosHash, outboundIPAddress)](#HostClient+offerLease) * [.mintLease(leaseIndex, leaseAmount, tosHash, outboundIPAddress)](#HostClient+mintLease) * [.offerMintedLease(uriTokenId, leaseAmount)](#HostClient+offerMintedLease) * [.expireLease(uriTokenId)](#HostClient+expireLease) * [.acceptRegToken(options)](#HostClient+acceptRegToken) ⇒ * [.register(countryCode, cpuMicroSec, ramMb, diskMb, totalInstanceCount, cpuModel, cpuCount, cpuSpeed, description, emailAddress, leaseAmount, options)](#HostClient+register) ⇒ * [.deregister(error, options)](#HostClient+deregister) ⇒ * [.updateRegInfo(activeInstanceCount, version, totalInstanceCount, tokenID, countryCode, cpuMicroSec, ramMb, diskMb, description, emailAddress, leaseAmount, options)](#HostClient+updateRegInfo) ⇒ * [.heartbeat(voteInfo, options)](#HostClient+heartbeat) ⇒ * [.acquireSuccess(txHash, tenantAddress, instanceInfo, options)](#HostClient+acquireSuccess) ⇒ * [.acquireError(txHash, tenantAddress, leaseAmount, reason, options)](#HostClient+acquireError) ⇒ * [.extendSuccess(txHash, tenantAddress, expiryMoment, options)](#HostClient+extendSuccess) ⇒ * [.extendError(txHash, tenantAddress, reason, refund, options)](#HostClient+extendError) ⇒ * [.refundTenant(txHash, tenantAddress, refundAmount, options)](#HostClient+refundTenant) ⇒ * [.requestRebate(options)](#HostClient+requestRebate) ⇒ * [.transfer(transfereeAddress, options)](#HostClient+transfer) * [.isTransferee()](#HostClient+isTransferee) ⇒ * [.propose(hashes, shortName, options)](#HostClient+propose) ⇒ * [.withdraw(candidateId, options)](#HostClient+withdraw) ⇒ * [.reportDudHost(hostAddress, options)](#HostClient+reportDudHost) ⇒ * [.on(event, handler)](#BaseEvernodeClient+on) * [.once(event, handler)](#BaseEvernodeClient+once) * [.off(event, handler)](#BaseEvernodeClient+off) * [.connect()](#BaseEvernodeClient+connect) ⇒ * [.disconnect()](#BaseEvernodeClient+disconnect) * [.subscribe()](#BaseEvernodeClient+subscribe) * [.unsubscribe()](#BaseEvernodeClient+unsubscribe) * [.getEVRBalance()](#BaseEvernodeClient+getEVRBalance) ⇒ * [.getHookStates()](#BaseEvernodeClient+getHookStates) ⇒ * [.getMoment(index)](#BaseEvernodeClient+getMoment) ⇒ * [.getMomentStartIndex(index)](#BaseEvernodeClient+getMomentStartIndex) ⇒ * [.refreshConfig()](#BaseEvernodeClient+refreshConfig) * [.extractEvernodeEvent(tx)](#BaseEvernodeClient+extractEvernodeEvent) ⇒ * [.getHostInfo(hostAddress)](#BaseEvernodeClient+getHostInfo) ⇒ * [.getAllHostsFromLedger()](#BaseEvernodeClient+getAllHostsFromLedger) ⇒ * [.getAllCandidatesFromLedger()](#BaseEvernodeClient+getAllCandidatesFromLedger) ⇒ * [.pruneDeadHost(hostAddress)](#BaseEvernodeClient+pruneDeadHost) * [.getCandidateByOwner(ownerAddress)](#BaseEvernodeClient+getCandidateByOwner) ⇒ * [.getDudHostCandidatesByOwner(ownerAddress)](#BaseEvernodeClient+getDudHostCandidatesByOwner) ⇒ * [.getCandidateById(candidateId)](#BaseEvernodeClient+getCandidateById) ⇒ * [.getDudHostVoteInfo(hostAddress)](#BaseEvernodeClient+getDudHostVoteInfo) ⇒ * [.getPilotedModeVoteInfo()](#BaseEvernodeClient+getPilotedModeVoteInfo) ⇒ * [.getReputationAddressByOrderedId(orderedId, moment)](#BaseEvernodeClient+getReputationAddressByOrderedId) ⇒ * [.getReputationOrderByAddress(hostAddress, moment)](#BaseEvernodeClient+getReputationOrderByAddress) ⇒ * [.getReputationContractInfoByAddress(hostsAddress, moment)](#BaseEvernodeClient+getReputationContractInfoByAddress) ⇒ * [.getReputationInfoByAddress(hostsAddress)](#BaseEvernodeClient+getReputationInfoByAddress) ⇒ ### new HostClient(xrpAddress, xrpSecret, [options]) Creates an instance of HostClient. | Param | Type | Default | Description | | ---------- | ------------------- | --------------- | --------------------------------------------------------- | | xrpAddress | string | | The XRP address to associate with this client. | | xrpSecret | string | | The secret (private key) associated with the XRP address. | | [options] | Object | {} | Additional configuration options for the HostClient. | ### hostClient.getRegistrationUriToken() ⇒ Get registration URI token info. **Kind**: instance method of [HostClient](#HostClient) **Returns**: The registration URI token object. ### hostClient.getRegistration() ⇒ Get host info if registered. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Host info object if registered, Otherwise null. ### hostClient.getLeaseByIndex(index) ⇒ Get lease token by index. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Lease token. | Param | Description | | ----- | ------------------- | | index | Index of the token. | ### hostClient.getLeases() ⇒ Get offered and unoffered leases created by the host. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Array of lease offer objects. ### hostClient.getLeaseOffers() ⇒ Get lease offers created by the host. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Array of lease offer objects. ### hostClient.getUnofferedLeases() ⇒ Get unoffered leases created by the host. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Array of lease objects. ### hostClient.isRegistered() ⇒ Check wether the host is registered. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Boolean if the host is registered or not. ### hostClient.prepareAccount(domain) Prepare the host account with account fields and trust lines. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Description | | ------ | ------------------- | ------------------------------------------- | | domain | string | Domain which the host machine is reachable. | ### hostClient.prepareReputationAccount(reputationAddress, reputationSecret) Prepare the reputation account with account fields and trust lines. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Description | | ----------------- | ------------------- | ---------------------------------- | | reputationAddress | string | Address of the reputation account. | | reputationSecret | string | Secret of the reputation account. | ### hostClient.setReputationContractInfo(peerPort, publicKey) Set the reputation contract info. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Description | | --------- | ------------------- | ----------------------------------------------- | | peerPort | number | Peer port of the reputation contract instance. | | publicKey | string | Public key of the reputation contract instance. | ### hostClient.getReputationInfo(moment) ⇒ Get reputation info of this host. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Reputation info object. | Param | Type | Default | Description | | ------ | ------------------- | ------------- | --------------------------------------------- | | moment | number | | (optional) Moment to get reputation info for. | ### hostClient.prepareHostReputationScores(scoreVersion, clusterSize, collectedScores) ⇒ Prepare host reputation score to a common format for submission. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Unified reputation score buffer. | Param | Type | Default | Description | | --------------- | ------------------- | ------------- | -------------------------------------------------- | | scoreVersion | number | | Version of the scores. | | clusterSize | number | | Size of the cluster. | | collectedScores | object | | [Optional] Score object in { host: score } format. | ### hostClient.sendReputations(bufferHex) Send reputation scores to the reputation hook. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Description | | --------- | ------------------- | ------------------------------------ | | bufferHex | string | Prepared score buffer as hex string. | ### hostClient.offerLease(leaseIndex, leaseAmount, tosHash, outboundIPAddress) Create a lease offer. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Default | Description | | ----------------- | ------------------- | ----------------- | -------------------------------------- | | leaseIndex | number | | Index number for the lease. | | leaseAmount | number | | Amount (EVRs) of the lease offer. | | tosHash | string | | Hex hash of the Terms Of Service text. | | outboundIPAddress | string | null | Assigned IP Address. | ### hostClient.mintLease(leaseIndex, leaseAmount, tosHash, outboundIPAddress) Mint a lease offer. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Default | Description | | ----------------- | ------------------- | ----------------- | -------------------------------------- | | leaseIndex | number | | Index number for the lease. | | leaseAmount | number | | Amount (EVRs) of the lease offer. | | tosHash | string | | Hex hash of the Terms Of Service text. | | outboundIPAddress | string | null | Assigned IP Address. | ### hostClient.offerMintedLease(uriTokenId, leaseAmount) Create a lease offer. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Description | | ----------- | ------------------- | --------------------------------- | | uriTokenId | number | Id of the token. | | leaseAmount | number | Amount (EVRs) of the lease offer. | ### hostClient.expireLease(uriTokenId) Expire the lease offer. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Description | | ---------- | ------------------- | ------------------------------ | | uriTokenId | string | Hex URI token id of the lease. | ### hostClient.acceptRegToken(options) ⇒ Accepts if there's an available reg token. **Kind**: instance method of [HostClient](#HostClient) **Returns**: True if there were reg token and it's accepted, Otherwise false. | Param | Type | Description | | ------- | --------------- | ------------------------------- | | options | \* | [Optional] transaction options. | ### hostClient.register(countryCode, cpuMicroSec, ramMb, diskMb, totalInstanceCount, cpuModel, cpuCount, cpuSpeed, description, emailAddress, leaseAmount, options) ⇒ Register the host in the Evernode network. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ------------------ | ------------------- | ------------------------------------------- | | countryCode | string | Upper case country code with two letters. | | cpuMicroSec | number | CPU cycle in micro seconds of the host. | | ramMb | number | Ram size in mega bytes. | | diskMb | number | Disk size in mega bytes. | | totalInstanceCount | number | Total number of instance slots in the host. | | cpuModel | string | Model of the host CPU. | | cpuCount | number | Number of CPUs in the host. | | cpuSpeed | number | CPU MHz. | | description | string | Description about the host. | | emailAddress | string | Email address of the host. | | leaseAmount | number | Lease fee of the host. | | options | \* | [Optional] transaction options. | ### hostClient.deregister(error, options) ⇒ Deregister a host from the Evernode network. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Boolean whether host is registered or not. | Param | Type | Default | Description | | ------- | ------------------- | ----------------- | ------------------------------- | | error | string | null | [Optional] Error. | | options | \* | | [Optional] transaction options. | ### hostClient.updateRegInfo(activeInstanceCount, version, totalInstanceCount, tokenID, countryCode, cpuMicroSec, ramMb, diskMb, description, emailAddress, leaseAmount, options) ⇒ Update the host registration in the Evernode network. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Default | Description | | ------------------- | ------------------- | ----------------- | -------------------------------------------- | | activeInstanceCount | number | | Currently active instance count in the host. | | version | string | null | Sashimono version installed on the host | | totalInstanceCount | number | | Total number of instance slots in the host. | | tokenID | string | null | Registration Token Id of the host. | | countryCode | string | null | Upper case country code with two letters. | | cpuMicroSec | number | | | | ramMb | number | | Ram size in mega bytes. | | diskMb | number | | Disk size in mega bytes. | | description | string | null | Description about the host. | | emailAddress | string | null | Email address of the host. | | leaseAmount | number | | Lease fee of the host. | | options | \* | | [Optional] transaction options. | ### hostClient.heartbeat(voteInfo, options) ⇒ Send a heartbeat from the host. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | -------- | --------------- | ------------------------------------------------------------------------ | | voteInfo | \* | [Optional] Candidate votes if there's any `{ '': '{number 0 | 1} vote', ... }` | | options | \* | [Optional] transaction options. | ### hostClient.acquireSuccess(txHash, tenantAddress, instanceInfo, options) ⇒ Send acquire success response to the tenant. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ------------- | ------------------- | -------------------------------------- | | txHash | string | Acquire lease transaction hash in hex. | | tenantAddress | string | XRPL address of the tenant. | | instanceInfo | string | Created instance info. | | options | \* | [Optional] transaction options. | ### hostClient.acquireError(txHash, tenantAddress, leaseAmount, reason, options) ⇒ Send acquire error response to the tenant. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ------------- | ------------------- | -------------------------------------- | | txHash | string | Acquire lease transaction hash in hex. | | tenantAddress | string | Xrpl address of the tenant. | | leaseAmount | number | Lease amount to be refunded. | | reason | string | Reason for the error. | | options | \* | [Optional] transaction options. | ### hostClient.extendSuccess(txHash, tenantAddress, expiryMoment, options) ⇒ Send extend success response to the tenant. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ------------- | ------------------- | -------------------------------------- | | txHash | string | Extend lease transaction hash in hex. | | tenantAddress | string | XRPL address of the tenant. | | expiryMoment | number | Moment which the instance will expire. | | options | \* | [Optional] transaction options. | ### hostClient.extendError(txHash, tenantAddress, reason, refund, options) ⇒ Send extend error response to the tenant. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ------------- | ------------------- | ------------------------------------- | | txHash | string | Extend lease transaction hash in hex. | | tenantAddress | string | Xrpl address of the tenant. | | reason | string | Reason for the error. | | refund | number | Amount to be refunded. | | options | \* | [Optional] transaction options. | ### hostClient.refundTenant(txHash, tenantAddress, refundAmount, options) ⇒ Send refunds to the tenant. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ------------- | ------------------- | -------------------------------- | | txHash | string | Request transaction hash in hex. | | tenantAddress | string | Xrpl address of the tenant. | | refundAmount | number | Amount to be refunded. | | options | \* | [Optional] transaction options. | ### hostClient.requestRebate(options) ⇒ Request registration rebates from the registry. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ------- | --------------- | ------------------------------- | | options | \* | [Optional] transaction options. | ### hostClient.transfer(transfereeAddress, options) Initiate a host transfer. **Kind**: instance method of [HostClient](#HostClient) | Param | Type | Description | | ----------------- | ------------------- | ----------------------------------------------------------------------- | | transfereeAddress | string | [Optional] Xrpl account address to host registration to be transferred. | | options | \* | [Optional] transaction options. | ### hostClient.isTransferee() ⇒ Check whether this host is a transferee. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Boolean wether the host is a transferee or not. ### hostClient.propose(hashes, shortName, options) ⇒ Propose a new hook candidate. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Proposed candidate id. | Param | Type | Description | | --------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | hashes | string | Hook candidate hashes in hex format, . | | shortName | string | Short name for the proposal candidate. This can consist of 20 characters. In here you can include any reference to your code pull requests as well. | | options | \* | [Optional] transaction options. | ### hostClient.withdraw(candidateId, options) ⇒ Withdraw a hook candidate. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ----------- | ------------------- | ---------------------------------- | | candidateId | string | Id of the candidate in hex format. | | options | \* | [Optional] transaction options. | ### hostClient.reportDudHost(hostAddress, options) ⇒ Report dud host for removal. **Kind**: instance method of [HostClient](#HostClient) **Returns**: Transaction result. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | Address of the dud host. | | options | \* | [Optional] transaction options. | ### hostClient.on(event, handler) Listens to the subscribed events. This will listen for the event without detaching the handler until it's 'off'. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [on](#BaseEvernodeClient+on) | Param | Type | Description | | ------- | --------------------- | ---------------------------------------------------------------------------------------------- | | event | string | The name of the event to listen for. | | handler | function | The callback function to handle the event. The function takes the event object as a parameter. | ### hostClient.once(event, handler) Listens to the subscribed events. This will listen only once and detach the handler. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [once](#BaseEvernodeClient+once) | Param | Type | Description | | ------- | --------------------- | -------------------------------------- | | event | string | Event name. | | handler | function | Callback function to handle the event. | ### hostClient.off(event, handler) Detach the listener event. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [off](#BaseEvernodeClient+off) | Param | Type | Default | Description | | ------- | --------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------- | | event | string | | Event name. | | handler | function | | (optional) Can be sent if a specific handler need to be detached. All the handlers will be detached if not specified. | ### hostClient.connect() ⇒ Connects the client to xrpl server and do the config loading and subscriptions. 'subscribe' is called inside this. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [connect](#BaseEvernodeClient+connect) **Returns**: Boolean value `true` if the connection is successful. ### hostClient.disconnect() Disconnects the client to xrpl server and do the un-subscriptions. 'unsubscribe' is called inside this. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [disconnect](#BaseEvernodeClient+disconnect) ### hostClient.subscribe() Subscribes to the client events. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [subscribe](#BaseEvernodeClient+subscribe) ### hostClient.unsubscribe() Unsubscribes from the client events. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [unsubscribe](#BaseEvernodeClient+unsubscribe) ### hostClient.getEVRBalance() ⇒ Get the EVR balance in the account. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getEVRBalance](#BaseEvernodeClient+getEVRBalance) **Returns**: The available EVR amount as a string. ### hostClient.getHookStates() ⇒ Get all XRPL hook states in the registry account. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getHookStates](#BaseEvernodeClient+getHookStates) **Returns**: The list of hook states, including Evernode configuration and hosts. ### hostClient.getMoment(index) ⇒ Get the moment from the given index (timestamp). **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getMoment](#BaseEvernodeClient+getMoment) **Returns**: The moment of the given index (timestamp) as a number. Returns the current moment if the timestamp is not provided. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment value. | ### hostClient.getMomentStartIndex(index) ⇒ Get start index (timestamp) of the moment. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getMomentStartIndex](#BaseEvernodeClient+getMomentStartIndex) **Returns**: The index (timestamp) of the moment as a 'number'. Returns the current moment's start index (timestamp) if ledger index parameter is not given. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment start index. | ### hostClient.refreshConfig() Loads the configs from XRPL hook and updates the in-memory config. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [refreshConfig](#BaseEvernodeClient+refreshConfig) ### hostClient.extractEvernodeEvent(tx) ⇒ Extracts the transaction info from a given transaction. Note: You need to deserialize HookParameters before passing the transaction to this function. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [extractEvernodeEvent](#BaseEvernodeClient+extractEvernodeEvent) **Returns**: The event object in format `{name: string, data: Object}`. Returns `null` if the event is not handled. | Param | Type | Description | | ----- | ------------------- | -------------------------------------------------------- | | tx | object | The transaction object to be deserialized and extracted. | ### hostClient.getHostInfo(hostAddress) ⇒ Get the registered host information. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getHostInfo](#BaseEvernodeClient+getHostInfo) **Returns**: The registered host information object. Returns null if not registered. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | [Optional] Address of the host. | ### hostClient.getAllHostsFromLedger() ⇒ Get the hosts registered in Evernode. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getAllHostsFromLedger](#BaseEvernodeClient+getAllHostsFromLedger) **Returns**: The list of hosts. ### hostClient.getAllCandidatesFromLedger() ⇒ Get the governor in Evernode. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getAllCandidatesFromLedger](#BaseEvernodeClient+getAllCandidatesFromLedger) **Returns**: The list of candidates. ### hostClient.pruneDeadHost(hostAddress) Remove a host which is inactive for a long period. The inactivity is checked by Evernode it self and only pruned if inactive thresholds are met. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [pruneDeadHost](#BaseEvernodeClient+pruneDeadHost) | Param | Type | Description | | ----------- | ------------------- | -------------------------------------- | | hostAddress | string | XRPL address of the host to be pruned. | ### hostClient.getCandidateByOwner(ownerAddress) ⇒ Get proposed new hook candidate info. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getCandidateByOwner](#BaseEvernodeClient+getCandidateByOwner) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ------------ | ------------------- | -------------------------------- | | ownerAddress | string | [Optional] Address of the owner. | ### hostClient.getDudHostCandidatesByOwner(ownerAddress) ⇒ Get proposed dud host candidates. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getDudHostCandidatesByOwner](#BaseEvernodeClient+getDudHostCandidatesByOwner) **Returns**: An array of candidate information. Returns empty array if no candidates. | Param | Type | Description | | ------------ | ------------------- | ----------- | | ownerAddress | string | | Address of the owner | ### hostClient.getCandidateById(candidateId) ⇒ Get candidate info. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getCandidateById](#BaseEvernodeClient+getCandidateById) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | -------------------- | | candidateId | string | Id of the candidate. | ### hostClient.getDudHostVoteInfo(hostAddress) ⇒ Get reported dud host info. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getDudHostVoteInfo](#BaseEvernodeClient+getDudHostVoteInfo) **Returns**: The dud host candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | ----------------------------------- | | hostAddress | string | [Optional] Address of the dud host. | ### hostClient.getPilotedModeVoteInfo() ⇒ Get piloted mode vote info. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getPilotedModeVoteInfo](#BaseEvernodeClient+getPilotedModeVoteInfo) **Returns**: The piloted mode candidate information. Returns null if no candidate. ### hostClient.getReputationAddressByOrderedId(orderedId, moment) ⇒ Get reputation order info of given orderedId. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getReputationAddressByOrderedId](#BaseEvernodeClient+getReputationAddressByOrderedId) **Returns**: Reputation address info object. | Param | Type | Default | Description | | --------- | ------------------- | ------------- | --------------------------------------------- | | orderedId | number | | Order id of the host. | | moment | number | | (optional) Moment to get reputation info for. | ### hostClient.getReputationOrderByAddress(hostAddress, moment) ⇒ Get reputation order info of given host. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getReputationOrderByAddress](#BaseEvernodeClient+getReputationOrderByAddress) **Returns**: Reputation order info object. | Param | Type | Default | Description | | ----------- | ------------------- | ------------- | --------------------------------------------- | | hostAddress | string | | (optional) Host address. | | moment | number | | (optional) Moment to get reputation info for. | ### hostClient.getReputationContractInfoByAddress(hostsAddress, moment) ⇒ Get reputation contract info of given host. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getReputationContractInfoByAddress](#BaseEvernodeClient+getReputationContractInfoByAddress) **Returns**: Reputation contract info object. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------------------------ | | hostsAddress | string | Host address. | | moment | number | (optional) Moment to get reputation contract info for. | ### hostClient.getReputationInfoByAddress(hostsAddress) ⇒ Get reputation info of given host. **Kind**: instance method of [HostClient](#HostClient) **Overrides**: [getReputationInfoByAddress](#BaseEvernodeClient+getReputationInfoByAddress) **Returns**: Reputation info object. | Param | Type | Description | | ------------ | ------------------- | ------------- | | hostsAddress | string | Host address. | ## TenantClient ⇐ [BaseEvernodeClient](#BaseEvernodeClient) TenantClient class to manage tenant operations. It extends the BaseEvernodeClient. **Kind**: global class **Extends**: [BaseEvernodeClient](#BaseEvernodeClient) * [TenantClient](#TenantClient) ⇐ [BaseEvernodeClient](#BaseEvernodeClient) * [new TenantClient(xrpAddress, xrpSecret, [options])](#new_TenantClient_new) * [.prepareAccount([options])](#TenantClient+prepareAccount) * [.getLeaseHost(hostAddress)](#TenantClient+getLeaseHost) ⇒ Promise.<Object> * [.acquireLeaseSubmit(hostAddress, requirement, options)](#TenantClient+acquireLeaseSubmit) ⇒ * [.prepareAcquireLeaseTransaction(hostAddress, requirement, options)](#TenantClient+prepareAcquireLeaseTransaction) ⇒ * [.watchAcquireResponse(tx, options)](#TenantClient+watchAcquireResponse) ⇒ * [.acquireLease(hostAddress, requirement, options)](#TenantClient+acquireLease) ⇒ * [.extendLeaseSubmit(hostAddress, amount, tokenID, options)](#TenantClient+extendLeaseSubmit) ⇒ * [.prepareExtendLeaseTransaction(hostAddress, amount, tokenID, options)](#TenantClient+prepareExtendLeaseTransaction) ⇒ * [.watchExtendResponse(tx, options)](#TenantClient+watchExtendResponse) ⇒ * [.extendLease(hostAddress, moments, instanceName, options)](#TenantClient+extendLease) ⇒ * [.terminateLease(uriTokenId)](#TenantClient+terminateLease) * [.on(event, handler)](#BaseEvernodeClient+on) * [.once(event, handler)](#BaseEvernodeClient+once) * [.off(event, handler)](#BaseEvernodeClient+off) * [.connect()](#BaseEvernodeClient+connect) ⇒ * [.disconnect()](#BaseEvernodeClient+disconnect) * [.subscribe()](#BaseEvernodeClient+subscribe) * [.unsubscribe()](#BaseEvernodeClient+unsubscribe) * [.getEVRBalance()](#BaseEvernodeClient+getEVRBalance) ⇒ * [.getHookStates()](#BaseEvernodeClient+getHookStates) ⇒ * [.getMoment(index)](#BaseEvernodeClient+getMoment) ⇒ * [.getMomentStartIndex(index)](#BaseEvernodeClient+getMomentStartIndex) ⇒ * [.refreshConfig()](#BaseEvernodeClient+refreshConfig) * [.extractEvernodeEvent(tx)](#BaseEvernodeClient+extractEvernodeEvent) ⇒ * [.getHostInfo(hostAddress)](#BaseEvernodeClient+getHostInfo) ⇒ * [.getAllHostsFromLedger()](#BaseEvernodeClient+getAllHostsFromLedger) ⇒ * [.getAllCandidatesFromLedger()](#BaseEvernodeClient+getAllCandidatesFromLedger) ⇒ * [.pruneDeadHost(hostAddress)](#BaseEvernodeClient+pruneDeadHost) * [.getCandidateByOwner(ownerAddress)](#BaseEvernodeClient+getCandidateByOwner) ⇒ * [.getDudHostCandidatesByOwner(ownerAddress)](#BaseEvernodeClient+getDudHostCandidatesByOwner) ⇒ * [.getCandidateById(candidateId)](#BaseEvernodeClient+getCandidateById) ⇒ * [.getDudHostVoteInfo(hostAddress)](#BaseEvernodeClient+getDudHostVoteInfo) ⇒ * [.getPilotedModeVoteInfo()](#BaseEvernodeClient+getPilotedModeVoteInfo) ⇒ * [.getReputationAddressByOrderedId(orderedId, moment)](#BaseEvernodeClient+getReputationAddressByOrderedId) ⇒ * [.getReputationOrderByAddress(hostAddress, moment)](#BaseEvernodeClient+getReputationOrderByAddress) ⇒ * [.getReputationContractInfoByAddress(hostsAddress, moment)](#BaseEvernodeClient+getReputationContractInfoByAddress) ⇒ * [.getReputationInfoByAddress(hostsAddress)](#BaseEvernodeClient+getReputationInfoByAddress) ⇒ ### new TenantClient(xrpAddress, xrpSecret, [options]) Creates an instance of TenantClient. | Param | Type | Default | Description | | ---------- | ------------------- | --------------- | --------------------------------------------------------- | | xrpAddress | string | | The XRP address to associate with this client. | | xrpSecret | string | | The secret (private key) associated with the XRP address. | | [options] | Object | {} | Additional configuration options for the TenantClient. | ### tenantClient.prepareAccount([options]) Prepare the tenant account with account fields and trust lines. **Kind**: instance method of [TenantClient](#TenantClient) | Param | Type | Default | Description | | --------- | ------------------- | --------------- | --------------------------------------------- | | [options] | Object | {} | Optional configuration for the account setup. | ### tenantClient.getLeaseHost(hostAddress) ⇒ Promise.<Object> Retrieves and validates a lease host based on the given host address. **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: Promise.<Object> - - Returns the host object if valid and active. **Throws**: - Will throw an error if the host is invalid, inactive, or not registered. | Param | Type | Description | | ----------- | ------------------- | ----------------------------------- | | hostAddress | string | The XRP Ledger address of the host. | ### tenantClient.acquireLeaseSubmit(hostAddress, requirement, options) ⇒ Prepare and submit acquire transaction.(Single signed scenario) **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: The transaction result. | Param | Type | Description | | ----------- | ------------------- | ---------------------------------------------- | | hostAddress | string | XRPL address of the host to acquire the lease. | | requirement | object | The instance requirements and configuration. | | options | object | [Optional] Options for the XRPL transaction. | ### tenantClient.prepareAcquireLeaseTransaction(hostAddress, requirement, options) ⇒ Prepare the Acquire transaction. **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: Prepared Acquire transaction. | Param | Type | Description | | ----------- | ------------------- | ---------------------------------------------- | | hostAddress | string | XRPL address of the host to acquire the lease. | | requirement | object | The instance requirements and configuration. | | options | object | [Optional] Options for the XRPL transaction. | ### tenantClient.watchAcquireResponse(tx, options) ⇒ Watch for the acquire-success response after the acquire request is made. **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: An object including transaction details,instance info, and acquireReference Id. | Param | Type | Description | | ------- | ------------------- | ------------------------------------------------------------ | | tx | object | The transaction returned by the acquireLeaseSubmit function. | | options | object | [Optional] Options for the XRPL transaction. | ### tenantClient.acquireLease(hostAddress, requirement, options) ⇒ Acquire an instance from a host **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: An object including transaction details,instance info, and acquireReference Id. | Param | Type | Description | | ----------- | ------------------- | ---------------------------------------------- | | hostAddress | string | XRPL address of the host to acquire the lease. | | requirement | object | The instance requirements and configuration. | | options | object | [Optional] Options for the XRPL transaction. | ### tenantClient.extendLeaseSubmit(hostAddress, amount, tokenID, options) ⇒ This function is called by a tenant client to submit the extend lease transaction in certain host. This function will be called inside extendLease function. This function can take four parameters as follows. **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: The transaction result. | Param | Type | Description | | ----------- | ------------------- | ------------------------------------------------------------------------------------- | | hostAddress | string | XRPL account address of the host. | | amount | number | Cost for the extended moments , in EVRs. | | tokenID | string | Tenant received instance name. this name can be retrieve by performing acquire Lease. | | options | object | This is an optional field and contains necessary details for the transactions. | ### tenantClient.prepareExtendLeaseTransaction(hostAddress, amount, tokenID, options) ⇒ This function is called to prepare an instance extension transaction for a particular host. **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: The prepared transaction. | Param | Type | Description | | ----------- | ------------------- | ------------------------------------------------------------------------------------- | | hostAddress | string | XRPL account address of the host. | | amount | number | Cost for the extended moments , in EVRs. | | tokenID | string | Tenant received instance name. this name can be retrieve by performing acquire Lease. | | options | object | This is an optional field and contains necessary details for the transactions. | ### tenantClient.watchExtendResponse(tx, options) ⇒ This function watches for an extendlease-success response(transaction) and returns the response or throws the error response on extendlease-error response from the host XRPL account. This function is called within the extendLease function. **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: An object including transaction details. | Param | Type | Description | | ------- | ------------------- | ------------------------------------------------------------------------------ | | tx | object | Response of extendLeaseSubmit. | | options | object | This is an optional field and contains necessary details for the transactions. | ### tenantClient.extendLease(hostAddress, moments, instanceName, options) ⇒ This function is called by a tenant client to extend an available instance in certain host. This function can take four parameters as follows. **Kind**: instance method of [TenantClient](#TenantClient) **Returns**: An object including transaction details. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------------------------------------------------------- | | hostAddress | string | XRPL account address of the host. | | moments | number | 1190 ledgers (est. 1 hour). | | instanceName | string | Tenant received instance name. this name can be retrieve by performing acquire Lease. | | options | object | This is an optional field and contains necessary details for the transactions. | ### tenantClient.terminateLease(uriTokenId) Terminate the lease instance. **Kind**: instance method of [TenantClient](#TenantClient) | Param | Type | Description | | ---------- | ------------------- | ------------------------------ | | uriTokenId | string | Hex URI token id of the lease. | ### tenantClient.on(event, handler) Listens to the subscribed events. This will listen for the event without detaching the handler until it's 'off'. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [on](#BaseEvernodeClient+on) | Param | Type | Description | | ------- | --------------------- | ---------------------------------------------------------------------------------------------- | | event | string | The name of the event to listen for. | | handler | function | The callback function to handle the event. The function takes the event object as a parameter. | ### tenantClient.once(event, handler) Listens to the subscribed events. This will listen only once and detach the handler. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [once](#BaseEvernodeClient+once) | Param | Type | Description | | ------- | --------------------- | -------------------------------------- | | event | string | Event name. | | handler | function | Callback function to handle the event. | ### tenantClient.off(event, handler) Detach the listener event. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [off](#BaseEvernodeClient+off) | Param | Type | Default | Description | | ------- | --------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------- | | event | string | | Event name. | | handler | function | | (optional) Can be sent if a specific handler need to be detached. All the handlers will be detached if not specified. | ### tenantClient.connect() ⇒ Connects the client to xrpl server and do the config loading and subscriptions. 'subscribe' is called inside this. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [connect](#BaseEvernodeClient+connect) **Returns**: Boolean value `true` if the connection is successful. ### tenantClient.disconnect() Disconnects the client to xrpl server and do the un-subscriptions. 'unsubscribe' is called inside this. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [disconnect](#BaseEvernodeClient+disconnect) ### tenantClient.subscribe() Subscribes to the client events. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [subscribe](#BaseEvernodeClient+subscribe) ### tenantClient.unsubscribe() Unsubscribes from the client events. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [unsubscribe](#BaseEvernodeClient+unsubscribe) ### tenantClient.getEVRBalance() ⇒ Get the EVR balance in the account. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getEVRBalance](#BaseEvernodeClient+getEVRBalance) **Returns**: The available EVR amount as a string. ### tenantClient.getHookStates() ⇒ Get all XRPL hook states in the registry account. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getHookStates](#BaseEvernodeClient+getHookStates) **Returns**: The list of hook states, including Evernode configuration and hosts. ### tenantClient.getMoment(index) ⇒ Get the moment from the given index (timestamp). **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getMoment](#BaseEvernodeClient+getMoment) **Returns**: The moment of the given index (timestamp) as a number. Returns the current moment if the timestamp is not provided. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment value. | ### tenantClient.getMomentStartIndex(index) ⇒ Get start index (timestamp) of the moment. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getMomentStartIndex](#BaseEvernodeClient+getMomentStartIndex) **Returns**: The index (timestamp) of the moment as a 'number'. Returns the current moment's start index (timestamp) if ledger index parameter is not given. | Param | Type | Default | Description | | ----- | ------------------- | ------------- | ----------------------------------------------------------- | | index | number | | [Optional] Index (timestamp) to get the moment start index. | ### tenantClient.refreshConfig() Loads the configs from XRPL hook and updates the in-memory config. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [refreshConfig](#BaseEvernodeClient+refreshConfig) ### tenantClient.extractEvernodeEvent(tx) ⇒ Extracts the transaction info from a given transaction. Note: You need to deserialize HookParameters before passing the transaction to this function. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [extractEvernodeEvent](#BaseEvernodeClient+extractEvernodeEvent) **Returns**: The event object in format `{name: string, data: Object}`. Returns `null` if the event is not handled. | Param | Type | Description | | ----- | ------------------- | -------------------------------------------------------- | | tx | object | The transaction object to be deserialized and extracted. | ### tenantClient.getHostInfo(hostAddress) ⇒ Get the registered host information. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getHostInfo](#BaseEvernodeClient+getHostInfo) **Returns**: The registered host information object. Returns null if not registered. | Param | Type | Description | | ----------- | ------------------- | ------------------------------- | | hostAddress | string | [Optional] Address of the host. | ### tenantClient.getAllHostsFromLedger() ⇒ Get the hosts registered in Evernode. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getAllHostsFromLedger](#BaseEvernodeClient+getAllHostsFromLedger) **Returns**: The list of hosts. ### tenantClient.getAllCandidatesFromLedger() ⇒ Get the governor in Evernode. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getAllCandidatesFromLedger](#BaseEvernodeClient+getAllCandidatesFromLedger) **Returns**: The list of candidates. ### tenantClient.pruneDeadHost(hostAddress) Remove a host which is inactive for a long period. The inactivity is checked by Evernode it self and only pruned if inactive thresholds are met. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [pruneDeadHost](#BaseEvernodeClient+pruneDeadHost) | Param | Type | Description | | ----------- | ------------------- | -------------------------------------- | | hostAddress | string | XRPL address of the host to be pruned. | ### tenantClient.getCandidateByOwner(ownerAddress) ⇒ Get proposed new hook candidate info. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getCandidateByOwner](#BaseEvernodeClient+getCandidateByOwner) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ------------ | ------------------- | -------------------------------- | | ownerAddress | string | [Optional] Address of the owner. | ### tenantClient.getDudHostCandidatesByOwner(ownerAddress) ⇒ Get proposed dud host candidates. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getDudHostCandidatesByOwner](#BaseEvernodeClient+getDudHostCandidatesByOwner) **Returns**: An array of candidate information. Returns empty array if no candidates. | Param | Type | Description | | ------------ | ------------------- | ----------- | | ownerAddress | string | | Address of the owner | ### tenantClient.getCandidateById(candidateId) ⇒ Get candidate info. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getCandidateById](#BaseEvernodeClient+getCandidateById) **Returns**: The candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | -------------------- | | candidateId | string | Id of the candidate. | ### tenantClient.getDudHostVoteInfo(hostAddress) ⇒ Get reported dud host info. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getDudHostVoteInfo](#BaseEvernodeClient+getDudHostVoteInfo) **Returns**: The dud host candidate information. Returns null if no candidate. | Param | Type | Description | | ----------- | ------------------- | ----------------------------------- | | hostAddress | string | [Optional] Address of the dud host. | ### tenantClient.getPilotedModeVoteInfo() ⇒ Get piloted mode vote info. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getPilotedModeVoteInfo](#BaseEvernodeClient+getPilotedModeVoteInfo) **Returns**: The piloted mode candidate information. Returns null if no candidate. ### tenantClient.getReputationAddressByOrderedId(orderedId, moment) ⇒ Get reputation order info of given orderedId. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getReputationAddressByOrderedId](#BaseEvernodeClient+getReputationAddressByOrderedId) **Returns**: Reputation address info object. | Param | Type | Default | Description | | --------- | ------------------- | ------------- | --------------------------------------------- | | orderedId | number | | Order id of the host. | | moment | number | | (optional) Moment to get reputation info for. | ### tenantClient.getReputationOrderByAddress(hostAddress, moment) ⇒ Get reputation order info of given host. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getReputationOrderByAddress](#BaseEvernodeClient+getReputationOrderByAddress) **Returns**: Reputation order info object. | Param | Type | Default | Description | | ----------- | ------------------- | ------------- | --------------------------------------------- | | hostAddress | string | | (optional) Host address. | | moment | number | | (optional) Moment to get reputation info for. | ### tenantClient.getReputationContractInfoByAddress(hostsAddress, moment) ⇒ Get reputation contract info of given host. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getReputationContractInfoByAddress](#BaseEvernodeClient+getReputationContractInfoByAddress) **Returns**: Reputation contract info object. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------------------------ | | hostsAddress | string | Host address. | | moment | number | (optional) Moment to get reputation contract info for. | ### tenantClient.getReputationInfoByAddress(hostsAddress) ⇒ Get reputation info of given host. **Kind**: instance method of [TenantClient](#TenantClient) **Overrides**: [getReputationInfoByAddress](#BaseEvernodeClient+getReputationInfoByAddress) **Returns**: Reputation info object. | Param | Type | Description | | ------------ | ------------------- | ------------- | | hostsAddress | string | Host address. | ## Defaults Defaults class is responsible for retrieving and overriding the default Evernode network configurations. **Kind**: global class * [Defaults](#Defaults) * [.values](#Defaults.values) ⇒ * [.useNetwork(network)](#Defaults.useNetwork) * [.set(newDefaults)](#Defaults.set) ### Defaults.values ⇒ Read Evernode default configs. **Kind**: static property of [Defaults](#Defaults) **Returns**: The Object of Evernode configs ### Defaults.useNetwork(network) Load defaults from the public definitions json. **Kind**: static method of [Defaults](#Defaults) | Param | Type | Description | | ------- | ------------------- | --------------------------- | | network | string | Network to choose the info. | ### Defaults.set(newDefaults) Override Evernode default configs. **Kind**: static method of [Defaults](#Defaults) | Param | Type | Description | | ----------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | newDefaults | object | Configurations to override `{ governorAddress: '{string} governor xrpl address', rippledServer: '{string} rippled server url', xrplApi: '{XrplApi} xrpl instance', stateIndexId: '{string} firestore index', networkID: '{number} rippled network id' }` | ## EncryptionHelper EncryptionHelper class is responsible for encrypt and decrypt functions for messages. **Kind**: global class * [EncryptionHelper](#EncryptionHelper) * [.encrypt(publicKey, message, [options])](#EncryptionHelper.encrypt) ⇒ Promise.<(string\|null)> * [.decrypt(privateKey, encrypted)](#EncryptionHelper.decrypt) ⇒ Promise.<(Object\|null)> ### EncryptionHelper.encrypt(publicKey, message, [options]) ⇒ Promise.<(string\|null)> Encrypts a message using the given public key. **Kind**: static method of [EncryptionHelper](#EncryptionHelper) **Returns**: Promise.<(string\|null)> - A promise that resolves to the encrypted message in base64 format, or null if encryption fails. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------- | | publicKey | string | | The public key to use for encryption. | | message | Object | | The message object to be encrypted. | | [options] | Object | {} | Optional encryption parameters. | ### EncryptionHelper.decrypt(privateKey, encrypted) ⇒ Promise.<(Object\|null)> Decrypts an encrypted message using the given private key. **Kind**: static method of [EncryptionHelper](#EncryptionHelper) **Returns**: Promise.<(Object\|null)> - A promise that resolves to the decrypted message as an object, or null if decryption fails. | Param | Type | Description | | ---------- | ------------------- | -------------------------------------- | | privateKey | string | The private key to use for decryption. | | encrypted | string | The encrypted message string. | ## EvernodeHelpers Provides various utility functions for working with leases, tokens, and ledger entries within the Xahau ecosystem. **Kind**: global class * [EvernodeHelpers](#EvernodeHelpers) * [.getLeases(xrplAcc)](#EvernodeHelpers.getLeases) ⇒ Promise.<Array.<Object>> * [.getLeaseByIndex(xrplApi, index)](#EvernodeHelpers.getLeaseByIndex) ⇒ Promise.<(Object\|null)> * [.getLeaseOffers(xrplAcc)](#EvernodeHelpers.getLeaseOffers) ⇒ Promise.<Array.<Object>> * [.getUnofferedLeases(xrplAcc)](#EvernodeHelpers.getUnofferedLeases) ⇒ Promise.<Array.<Object>> * [.getNFTPageAndLocation(nfTokenId, xrplAcc, xrplApi, [buffer])](#EvernodeHelpers.getNFTPageAndLocation) ⇒ Promise.<(Buffer\|Object)> * [.getEpochRewardQuota(epoch, firstEpochRewardQuota)](#EvernodeHelpers.getEpochRewardQuota) ⇒ number * [.isValidURI(uri, pattern, [tokenCategory])](#EvernodeHelpers.isValidURI) ⇒ boolean ### EvernodeHelpers.getLeases(xrplAcc) ⇒ Promise.<Array.<Object>> Retrieves URI tokens that are valid leases for the specified XRPL account. **Kind**: static method of [EvernodeHelpers](#EvernodeHelpers) **Returns**: Promise.<Array.<Object>> - A promise that resolves to an array of URI tokens that are valid leases. | Param | Type | Description | | ------- | ------------------- | ------------------------ | | xrplAcc | Object | The XRPL account object. | ### EvernodeHelpers.getLeaseByIndex(xrplApi, index) ⇒ Promise.<(Object\|null)> Retrieves a lease by its index from the XRPL ledger. **Kind**: static method of [EvernodeHelpers](#EvernodeHelpers) **Returns**: Promise.<(Object\|null)> - A promise that resolves to the lease entry or null if not found or invalid. | Param | Type | Description | | ------- | -------------------------------- | ----------------------- | | xrplApi | [XrplApi](#XrplApi) | The XRPL API object. | | index | string | The ledger entry index. | ### EvernodeHelpers.getLeaseOffers(xrplAcc) ⇒ Promise.<Array.<Object>> Retrieves all leases that have offers (i.e., an associated amount) for the specified XRPL account. **Kind**: static method of [EvernodeHelpers](#EvernodeHelpers) **Returns**: Promise.<Array.<Object>> - A promise that resolves to an array of URI tokens with offers. | Param | Type | Description | | ------- | ------------------- | ------------------------ | | xrplAcc | Object | The XRPL account object. | ### EvernodeHelpers.getUnofferedLeases(xrplAcc) ⇒ Promise.<Array.<Object>> Retrieves leases that do not have offers (i.e., no amount associated) for the specified XRPL account. **Kind**: static method of [EvernodeHelpers](#EvernodeHelpers) **Returns**: Promise.<Array.<Object>> - A promise that resolves to an array of unoffered URI tokens. | Param | Type | Description | | ------- | ------------------- | ------------------------ | | xrplAcc | Object | The XRPL account object. | ### EvernodeHelpers.getNFTPageAndLocation(nfTokenId, xrplAcc, xrplApi, [buffer]) ⇒ Promise.<(Buffer\|Object)> Finds the NFT page and location of a specific NFToken in the XRPL ledger. **Kind**: static method of [EvernodeHelpers](#EvernodeHelpers) **Returns**: Promise.<(Buffer\|Object)> - A promise that resolves to either a buffer with the NFT page and location or an object with page and location details. | Param | Type | Default | Description | | --------- | -------------------- | ----------------- | ----------------------------------------- | | nfTokenId | string | | The ID of the NFToken. | | xrplAcc | Object | | The XRPL account object. | | xrplApi | Object | | The XRPL API object. | | [buffer] | boolean | true | Whether to return the result as a buffer. | ### EvernodeHelpers.getEpochRewardQuota(epoch, firstEpochRewardQuota) ⇒ number Calculates the reward quota for a specific epoch. **Kind**: static method of [EvernodeHelpers](#EvernodeHelpers) **Returns**: number - The calculated reward quota for the specified epoch. | Param | Type | Description | | --------------------- | ------------------- | ------------------------------------- | | epoch | number | The epoch number. | | firstEpochRewardQuota | number | The reward quota for the first epoch. | ### EvernodeHelpers.isValidURI(uri, pattern, [tokenCategory]) ⇒ boolean Checks if a given URI is valid based on a pattern and token category. **Kind**: static method of [EvernodeHelpers](#EvernodeHelpers) **Returns**: boolean - Returns true if the URI is valid, false otherwise. | Param | Type | Default | Description | | --------------- | ------------------- | ------------------------------------------------------ | -------------------------------------------------- | | uri | string | | The URI to validate. | | pattern | string | | The pattern to match the URI against. | | [tokenCategory] | string | "URITokenTypes.LEASE_URI_TOKEN" | The token category (default is a lease URI token). | ## StateHelpers Provides various utility functions for working with States. **Kind**: global class * [StateHelpers](#StateHelpers) * [.getStateData(states, key)](#StateHelpers.getStateData) ⇒ Object \| null * [.decodeReputationHostAddressState(stateKeyBuf, stateDataBuf)](#StateHelpers.decodeReputationHostAddressState) ⇒ Object * [.decodeReputationHostOrderAddressState(stateKeyBuf, stateDataBuf)](#StateHelpers.decodeReputationHostOrderAddressState) ⇒ Object * [.decodeReputationHostOrderedIdState(stateKeyBuf, stateDataBuf)](#StateHelpers.decodeReputationHostOrderedIdState) ⇒ Object * [.decodeReputationHostCountState(stateKeyBuf, stateDataBuf)](#StateHelpers.decodeReputationHostCountState) ⇒ Object * [.decodeHostAddressState(stateKeyBuf, stateDataBuf)](#StateHelpers.decodeHostAddressState) ⇒ Object * [.decodeTokenIdState(stateDataBuf)](#StateHelpers.decodeTokenIdState) ⇒ Object * [.decodeTransfereeAddrState(stateKeyBuf, stateDataBuf)](#StateHelpers.decodeTransfereeAddrState) ⇒ Object * [.decodeCandidateOwnerState(stateKeyBuf, stateDataBuf)](#StateHelpers.decodeCandidateOwnerState) ⇒ Object * [.decodeCandidateIdState(stateDataBuf)](#StateHelpers.decodeCandidateIdState) ⇒ Object * [.decodeStateData(stateKey, stateData)](#StateHelpers.decodeStateData) ⇒ Object * [.decodeStateKey(stateKey)](#StateHelpers.decodeStateKey) ⇒ Object * [.generateTokenIdStateKey(uriToken)](#StateHelpers.generateTokenIdStateKey) ⇒ string * [.generateHostAddrStateKey(address)](#StateHelpers.generateHostAddrStateKey) ⇒ string * [.generateReputationHostAddrStateKey(address)](#StateHelpers.generateReputationHostAddrStateKey) ⇒ string * [.generateReputationHostOrderAddressStateKey(address, moment)](#StateHelpers.generateReputationHostOrderAddressStateKey) ⇒ string * [.generateReputationHostOrderedIdStateKey(orderedId, moment)](#StateHelpers.generateReputationHostOrderedIdStateKey) ⇒ string * [.generateReputationHostCountStateKey(moment)](#StateHelpers.generateReputationHostCountStateKey) ⇒ string * [.generateReputationContractInfoStateKey(address)](#StateHelpers.generateReputationContractInfoStateKey) ⇒ string * [.generateTransfereeAddrStateKey(address)](#StateHelpers.generateTransfereeAddrStateKey) ⇒ string * [.generateCandidateIdStateKey(uniqueId)](#StateHelpers.generateCandidateIdStateKey) ⇒ string * [.generateCandidateOwnerStateKey(owner)](#StateHelpers.generateCandidateOwnerStateKey) ⇒ string * [.getHookStateIndex(hookAccount, stateKey, [hookNamespace])](#StateHelpers.getHookStateIndex) ⇒ string * [.getNewHookCandidateId(hashesBuf)](#StateHelpers.getNewHookCandidateId) ⇒ string * [.getPilotedModeCandidateId()](#StateHelpers.getPilotedModeCandidateId) ⇒ string * [.getDudHostCandidateId(hostAddress)](#StateHelpers.getDudHostCandidateId) ⇒ string * [.getCandidateType(candidateId)](#StateHelpers.getCandidateType) ⇒ number ### StateHelpers.getStateData(states, key) ⇒ Object \| null Retrieves the state data for a specific key from an array of states. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object \| null - The state data or null if not found. | Param | Type | Description | | ------ | ------------------- | ----------------------- | | states | Array | Array of state objects. | | key | string | Key for the state data. | ### StateHelpers.decodeReputationHostAddressState(stateKeyBuf, stateDataBuf) ⇒ Object Decodes reputation host address state from buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - Decoded state data including host address and reputation metrics. | Param | Type | Description | | ------------ | ------------------- | --------------------------------- | | stateKeyBuf | Buffer | Buffer containing the state key. | | stateDataBuf | Buffer | Buffer containing the state data. | ### StateHelpers.decodeReputationHostOrderAddressState(stateKeyBuf, stateDataBuf) ⇒ Object Decodes reputation host order address state from buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - Decoded state data including moment and ordered ID. | Param | Type | Description | | ------------ | ------------------- | --------------------------------- | | stateKeyBuf | Buffer | Buffer containing the state key. | | stateDataBuf | Buffer | Buffer containing the state data. | ### StateHelpers.decodeReputationHostOrderedIdState(stateKeyBuf, stateDataBuf) ⇒ Object Decodes reputation host ordered ID state from buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - Decoded state data including moment and ordered ID. | Param | Type | Description | | ------------ | ------------------- | --------------------------------- | | stateKeyBuf | Buffer | Buffer containing the state key. | | stateDataBuf | Buffer | Buffer containing the state data. | ### StateHelpers.decodeReputationHostCountState(stateKeyBuf, stateDataBuf) ⇒ Object Decodes reputation host count state from buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - Decoded state data including moment and count. | Param | Type | Description | | ------------ | ------------------- | --------------------------------- | | stateKeyBuf | Buffer | Buffer containing the state key. | | stateDataBuf | Buffer | Buffer containing the state data. | ### StateHelpers.decodeHostAddressState(stateKeyBuf, stateDataBuf) ⇒ Object Decodes a host address state from buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - The decoded host address state. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------- | | stateKeyBuf | Buffer | The buffer containing the state key. | | stateDataBuf | Buffer | The buffer containing the state data. | ### StateHelpers.decodeTokenIdState(stateDataBuf) ⇒ Object Decodes a token ID state from a buffer. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - The decoded token ID state. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------- | | stateDataBuf | Buffer | The buffer containing the state data. | ### StateHelpers.decodeTransfereeAddrState(stateKeyBuf, stateDataBuf) ⇒ Object Decodes a transferee address state from buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - The decoded transferee address state. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------- | | stateKeyBuf | Buffer | The buffer containing the state key. | | stateDataBuf | Buffer | The buffer containing the state data. | ### StateHelpers.decodeCandidateOwnerState(stateKeyBuf, stateDataBuf) ⇒ Object Decodes a candidate owner state from buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - The decoded candidate owner state. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------- | | stateKeyBuf | Buffer | The buffer containing the state key. | | stateDataBuf | Buffer | The buffer containing the state data. | ### StateHelpers.decodeCandidateIdState(stateDataBuf) ⇒ Object Decodes a candidate ID state from a buffer. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - The decoded candidate ID state. | Param | Type | Description | | ------------ | ------------------- | ------------------------------------- | | stateDataBuf | Buffer | The buffer containing the state data. | ### StateHelpers.decodeStateData(stateKey, stateData) ⇒ Object Decodes state data based on the state key and state data buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - The decoded state data with type information. | Param | Type | Description | | --------- | ------------------- | ------------------------------------- | | stateKey | Buffer | The buffer containing the state key. | | stateData | Buffer | The buffer containing the state data. | ### StateHelpers.decodeStateKey(stateKey) ⇒ Object Decodes a state key into a type and key. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: Object - An object containing the key as a hexadecimal string and its type. **Throws**: - Object Throws a Validation Error if the state key is invalid. | Param | Type | Description | | -------- | ------------------- | ------------------------------------ | | stateKey | Buffer | The buffer containing the state key. | ### StateHelpers.generateTokenIdStateKey(uriToken) ⇒ string Generates a state key for a token ID. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | -------- | ------------------- | ------------------------------------ | | uriToken | string | The URI token in hexadecimal format. | ### StateHelpers.generateHostAddrStateKey(address) ⇒ string Generates a state key for a host address. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | ------- | ------------------- | ----------------- | | address | string | The host address. | ### StateHelpers.generateReputationHostAddrStateKey(address) ⇒ string Generates a state key for a reputation host address. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | ------- | ------------------- | ---------------------------- | | address | string | The reputation host address. | ### StateHelpers.generateReputationHostOrderAddressStateKey(address, moment) ⇒ string Generates a state key for a reputation host order address. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | ------- | ------------------- | ---------------------------- | | address | string | The reputation host address. | | moment | number | The moment timestamp. | ### StateHelpers.generateReputationHostOrderedIdStateKey(orderedId, moment) ⇒ string Generates a state key for a reputation host ordered ID. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | --------- | ------------------- | --------------------- | | orderedId | string | The ordered ID. | | moment | number | The moment timestamp. | ### StateHelpers.generateReputationHostCountStateKey(moment) ⇒ string Generates a state key for a reputation host count. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | ------ | ------------------- | --------------------- | | moment | number | The moment timestamp. | ### StateHelpers.generateReputationContractInfoStateKey(address) ⇒ string Generates a state key for reputation contract information. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | ------- | ------------------- | --------------------- | | address | string | The contract address. | ### StateHelpers.generateTransfereeAddrStateKey(address) ⇒ string Generates a state key for a transferee address. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | ------- | ------------------- | ----------------------- | | address | string | The transferee address. | ### StateHelpers.generateCandidateIdStateKey(uniqueId) ⇒ string Generates a state key for a candidate ID. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | -------- | ------------------- | ------------------------ | | uniqueId | string | The unique candidate ID. | ### StateHelpers.generateCandidateOwnerStateKey(owner) ⇒ string Generates a state key for a candidate owner. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated state key as a hexadecimal string. | Param | Type | Description | | ----- | ------------------- | ---------------------------- | | owner | string | The candidate owner address. | ### StateHelpers.getHookStateIndex(hookAccount, stateKey, [hookNamespace]) ⇒ string Gets the hook state index for a specific hook account and state key. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The hook state index as a hexadecimal string. | Param | Type | Default | Description | | --------------- | ------------------- | --------------------------------------------------------- | -------------------------------------- | | hookAccount | string | | The hook account address. | | stateKey | string | | The state key as a hexadecimal string. | | [hookNamespace] | string | "EvernodeConstants.HOOK_NAMESPACE" | The hook namespace. | ### StateHelpers.getNewHookCandidateId(hashesBuf) ⇒ string Generates a new hook candidate ID based on hash buffers. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated candidate ID as a hexadecimal string. | Param | Type | Description | | --------- | ------------------- | ------------------------------------ | | hashesBuf | Buffer | The buffer containing the hash data. | ### StateHelpers.getPilotedModeCandidateId() ⇒ string Generates a candidate ID for the piloted mode. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated candidate ID as a hexadecimal string. ### StateHelpers.getDudHostCandidateId(hostAddress) ⇒ string Generates a candidate ID for a dud host. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: string - The generated candidate ID as a hexadecimal string. | Param | Type | Description | | ----------- | ------------------- | ----------------- | | hostAddress | string | The host address. | ### StateHelpers.getCandidateType(candidateId) ⇒ number Retrieves the candidate type from a candidate ID. **Kind**: static method of [StateHelpers](#StateHelpers) **Returns**: number - The candidate type. | Param | Type | Description | | ----------- | ------------------- | ----------------------------------------- | | candidateId | string | The candidate ID as a hexadecimal string. | ## TransactionHelper Provides various utility functions for working with Xahau Transactions. **Kind**: global class * [TransactionHelper](#TransactionHelper) * [.formatMemos(memos)](#TransactionHelper.formatMemos) ⇒ Array.<Object> * [.deserializeMemos(memos)](#TransactionHelper.deserializeMemos) ⇒ Array.<Object> * [.formatHookParams(params)](#TransactionHelper.formatHookParams) ⇒ Array.<Object> * [.deserializeHookParams(params)](#TransactionHelper.deserializeHookParams) ⇒ Array.<Object> * [.hexToASCII(hex)](#TransactionHelper.hexToASCII) ⇒ string * [.asciiToHex(str)](#TransactionHelper.asciiToHex) ⇒ string ### TransactionHelper.formatMemos(memos) ⇒ Array.<Object> Converts an array of memos from the internal format to the XRPL library format. **Kind**: static method of [TransactionHelper](#TransactionHelper) **Returns**: Array.<Object> - An array of memo objects in the XRPL library format. | Param | Type | Description | | ----- | --------------------------------- | ------------------------------------------------ | | memos | Array.<Object> | An array of memo objects in the internal format. | ### TransactionHelper.deserializeMemos(memos) ⇒ Array.<Object> Converts an array of memos from the XRPL library format to the internal format. **Kind**: static method of [TransactionHelper](#TransactionHelper) **Returns**: Array.<Object> - An array of memo objects in the internal format. | Param | Type | Description | | ----- | --------------------------------- | ---------------------------------------------------- | | memos | Array.<Object> | An array of memo objects in the XRPL library format. | ### TransactionHelper.formatHookParams(params) ⇒ Array.<Object> Converts an array of hook parameters from the internal format to the XRPL library format. **Kind**: static method of [TransactionHelper](#TransactionHelper) **Returns**: Array.<Object> - An array of hook parameter objects in the XRPL library format. | Param | Type | Description | | ------ | --------------------------------- | ---------------------------------------------------------- | | params | Array.<Object> | An array of hook parameter objects in the internal format. | ### TransactionHelper.deserializeHookParams(params) ⇒ Array.<Object> Converts an array of hook parameters from the XRPL library format to the internal format. **Kind**: static method of [TransactionHelper](#TransactionHelper) **Returns**: Array.<Object> - An array of hook parameter objects in the internal format. | Param | Type | Description | | ------ | --------------------------------- | -------------------------------------------------------------- | | params | Array.<Object> | An array of hook parameter objects in the XRPL library format. | ### TransactionHelper.hexToASCII(hex) ⇒ string Converts a hexadecimal string to an ASCII string. **Kind**: static method of [TransactionHelper](#TransactionHelper) **Returns**: string - The resulting ASCII string. | Param | Type | Description | | ----- | ------------------- | --------------------------------------- | | hex | string | The hexadecimal string to be converted. | ### TransactionHelper.asciiToHex(str) ⇒ string Converts an ASCII string to a hexadecimal string. **Kind**: static method of [TransactionHelper](#TransactionHelper) **Returns**: string - The resulting hexadecimal string. | Param | Type | Description | | ----- | ------------------- | --------------------------------- | | str | string | The ASCII string to be converted. | ## UtilHelpers Provides utility helper functions for various operations. **Kind**: global class * [UtilHelpers](#UtilHelpers) * [.decodeLeaseTokenUri(hexUri)](#UtilHelpers.decodeLeaseTokenUri) ⇒ Object * [.getCurrentUnixTime([format])](#UtilHelpers.getCurrentUnixTime) ⇒ number * [.deriveKeypair(secret)](#UtilHelpers.deriveKeypair) ⇒ Object * [.deriveAddress(publicKey)](#UtilHelpers.deriveAddress) ⇒ string ### UtilHelpers.decodeLeaseTokenUri(hexUri) ⇒ Object Decodes a lease token URI into its integrant parts. **Kind**: static method of [UtilHelpers](#UtilHelpers) **Returns**: Object - An object containing the decoded lease token URI's version, leaseIndex, halfTos, leaseAmount, identifier, and outboundIP | Param | Type | Description | | ------ | ------------------- | ------------------------------------------ | | hexUri | string | The lease token URI in hexadecimal format. | ### UtilHelpers.getCurrentUnixTime([format]) ⇒ number Gets the current Unix time. **Kind**: static method of [UtilHelpers](#UtilHelpers) **Returns**: number - The current Unix time in the specified format. | Param | Type | Default | Description | | -------- | ------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------- | | [format] | string | "\"sec\"" | The format of the time. If "sec", returns the time in seconds; otherwise, returns the time in milliseconds. | ### UtilHelpers.deriveKeypair(secret) ⇒ Object Derives a keypair from a given secret. **Kind**: static method of [UtilHelpers](#UtilHelpers) **Returns**: Object - An object containing the derived keypair. | Param | Type | Description | | ------ | ------------------- | -------------------------------------- | | secret | string | The secret used to derive the keypair. | ### UtilHelpers.deriveAddress(publicKey) ⇒ string Derives an address from a given public key. **Kind**: static method of [UtilHelpers](#UtilHelpers) **Returns**: string - The derived address. | Param | Type | Description | | --------- | ------------------- | ------------------------------------------ | | publicKey | string | The public key used to derive the address. | ## XflHelpers Helper class for handling XFL (Extended Floating-Point) float numbers. **Kind**: global class * [XflHelpers](#XflHelpers) * [.getExponent(xfl)](#XflHelpers.getExponent) ⇒ bigint * [.getMantissa(xfl)](#XflHelpers.getMantissa) ⇒ bigint * [.isNegative(xfl)](#XflHelpers.isNegative) ⇒ boolean * [.toString(xfl)](#XflHelpers.toString) ⇒ string * [.getXfl(floatStr)](#XflHelpers.getXfl) ⇒ bigint ### XflHelpers.getExponent(xfl) ⇒ bigint Retrieves the exponent of the XFL float number. **Kind**: static method of [XflHelpers](#XflHelpers) **Returns**: bigint - The exponent of the XFL float number. **Throws**: - string Throws an error if the XFL float number is negative. | Param | Type | Description | | ----- | ------------------- | --------------------- | | xfl | bigint | The XFL float number. | ### XflHelpers.getMantissa(xfl) ⇒ bigint Retrieves the mantissa of the XFL float number. **Kind**: static method of [XflHelpers](#XflHelpers) **Returns**: bigint - The mantissa of the XFL float number. **Throws**: - string Throws an error if the XFL float number is negative. | Param | Type | Description | | ----- | ------------------- | --------------------- | | xfl | bigint | The XFL float number. | ### XflHelpers.isNegative(xfl) ⇒ boolean Checks if the XFL float number is negative. **Kind**: static method of [XflHelpers](#XflHelpers) **Returns**: boolean - `true` if the XFL float number is negative, otherwise `false`. **Throws**: - string Throws an error if the XFL float number is negative. | Param | Type | Description | | ----- | ------------------- | --------------------- | | xfl | bigint | The XFL float number. | ### XflHelpers.toString(xfl) ⇒ string Converts an XFL float number to its string representation. **Kind**: static method of [XflHelpers](#XflHelpers) **Returns**: string - The string representation of the XFL float number. **Throws**: - string Throws an error if the XFL float number is negative. | Param | Type | Description | | ----- | ------------------- | --------------------- | | xfl | bigint | The XFL float number. | ### XflHelpers.getXfl(floatStr) ⇒ bigint Converts a string representation of a float number to an XFL float number. **Kind**: static method of [XflHelpers](#XflHelpers) **Returns**: bigint - The XFL float number. | Param | Type | Description | | -------- | ------------------- | ---------------------------------------------- | | floatStr | string | The string representation of the float number. | ## XrplAccount Represents an XRP Ledger account and provides methods for account management. **Kind**: global class * [XrplAccount](#XrplAccount) * [new XrplAccount(address, secret, options)](#new_XrplAccount_new) * [.on(event, handler)](#XrplAccount+on) * [.once(event, handler)](#XrplAccount+once) * [.off(event, handler)](#XrplAccount+off) * [.deriveKeypair()](#XrplAccount+deriveKeypair) ⇒ Object * [.exists()](#XrplAccount+exists) ⇒ Promise.<boolean> * [.getInfo()](#XrplAccount+getInfo) ⇒ Promise.<Object> * [.getSequence()](#XrplAccount+getSequence) ⇒ Promise.<number> * [.getMintedNFTokens()](#XrplAccount+getMintedNFTokens) ⇒ Promise.<number> * [.getBurnedNFTokens()](#XrplAccount+getBurnedNFTokens) ⇒ number * [.getMessageKey()](#XrplAccount+getMessageKey) ⇒ Promise.<(string\|null)> * [.getWalletLocator()](#XrplAccount+getWalletLocator) ⇒ Promise.<(string\|null)> * [.getDomain()](#XrplAccount+getDomain) ⇒ Promise.<(string\|null)> * [.getTrustLines([currency], issuer)](#XrplAccount+getTrustLines) ⇒ Promise.<Array.<Object>> * [.getChecks(fromAccount)](#XrplAccount+getChecks) ⇒ Promise.<Array.<Object>> * [.getNfts()](#XrplAccount+getNfts) ⇒ Promise.<Array.<Object>> * [.getOffers()](#XrplAccount+getOffers) ⇒ Promise.<Array.<Object>> * [.getNftOffers()](#XrplAccount+getNftOffers) ⇒ Promise.<Array.<Object>> * [.getNftByUri(uri, [isHexUri])](#XrplAccount+getNftByUri) ⇒ Promise.<(Object\|null)> * [.getAccountObjects(options)](#XrplAccount+getAccountObjects) ⇒ Promise.<Array.<Object>> * [.getNamespaceEntries(namespaceId, [options])](#XrplAccount+getNamespaceEntries) ⇒ Promise.<Array.<Object>> * [.getFlags()](#XrplAccount+getFlags) ⇒ Promise.<Object> * [.getAccountTrx([minLedgerIndex], [maxLedgerIndex], [isForward])](#XrplAccount+getAccountTrx) ⇒ Promise.<Array> * [.hasValidKeyPair()](#XrplAccount+hasValidKeyPair) ⇒ Promise.<boolean> * [.setAccountFields(fields, options)](#XrplAccount+setAccountFields) ⇒ Promise.<Object> * [.prepareSetAccountFields(fields, [options])](#XrplAccount+prepareSetAccountFields) ⇒ Promise.<Object> * [.setSignerList(signerList, [options])](#XrplAccount+setSignerList) ⇒ Promise.<Object> * [.prepareSetSignerList(signerList, options)](#XrplAccount+prepareSetSignerList) ⇒ Promise.<Object> * [.invoke(toAddr, [blobObj], [options])](#XrplAccount+invoke) ⇒ Promise.<Object> * [.prepareInvoke(toAddr, [blobObj], [options])](#XrplAccount+prepareInvoke) ⇒ Promise.<Object> * [.makePayment(toAddr, amount, [currency], [issuer], [memos], [options])](#XrplAccount+makePayment) ⇒ Promise.<Object> * [.prepareMakePayment(toAddr, amount, [currency], [issuer], [memos], [options])](#XrplAccount+prepareMakePayment) ⇒ Promise.<Object> * [.setTrustLine(currency, issuer, limit, [allowRippling], [memos], [options])](#XrplAccount+setTrustLine) ⇒ Promise.<Object> * [.prepareSetTrustLine(currency, issuer, limit, [allowRippling], [memos], [options])](#XrplAccount+prepareSetTrustLine) ⇒ Promise.<Object> * [.setRegularKey(regularKey, [memos], [options])](#XrplAccount+setRegularKey) ⇒ Promise.<Object> * [.prepareSetRegularKey(regularKey, [memos], [options])](#XrplAccount+prepareSetRegularKey) ⇒ Promise.<Object> * [.prepareCashCheck(check, [options])](#XrplAccount+prepareCashCheck) ⇒ Promise.<Object> * [.offerSell(sellAmount, sellCurrency, sellIssuer, forAmount, forCurrency, [forIssuer], [expiration], [memos], [options])](#XrplAccount+offerSell) ⇒ Promise.<Object> * [.prepareOfferSell(sellAmount, sellCurrency, sellIssuer, forAmount, forCurrency, [forIssuer], [expiration], [memos], [options])](#XrplAccount+prepareOfferSell) ⇒ Promise.<Object> * [.offerBuy(buyAmount, buyCurrency, buyIssuer, forAmount, forCurrency, [forIssuer], [expiration], [memos], [options])](#XrplAccount+offerBuy) ⇒ Promise.<Object> * [.prepareOfferBuy(buyAmount, buyCurrency, buyIssuer, forAmount, forCurrency, [forIssuer], [expiration], [memos], [options])](#XrplAccount+prepareOfferBuy) ⇒ Promise.<Object> * [.cancelOffer(offerSequence, [memos], [options])](#XrplAccount+cancelOffer) ⇒ Promise.<Object> * [.prepareCancelOffer(offerSequence, [memos], [options])](#XrplAccount+prepareCancelOffer) ⇒ Promise.<Object> * [.subscribe()](#XrplAccount+subscribe) ⇒ Promise.<void> * [.unsubscribe()](#XrplAccount+unsubscribe) ⇒ Promise.<void> * [.submitTransactionBlob(txBlob)](#XrplAccount+submitTransactionBlob) ⇒ Promise.<Object> * [.sign(tx, [isMultiSign])](#XrplAccount+sign) ⇒ Object * [.mintURIToken(uri, [digest], [flags], [options])](#XrplAccount+mintURIToken) ⇒ Promise.<Object> * [.prepareMintURIToken(uri, [digest], [flags], [options])](#XrplAccount+prepareMintURIToken) ⇒ Promise.<Object> * [.burnURIToken(uriTokenID, [options])](#XrplAccount+burnURIToken) ⇒ Promise.<Object> * [.prepareBurnURIToken(uriTokenID, [options])](#XrplAccount+prepareBurnURIToken) ⇒ Promise.<Object> * [.sellURIToken(uriTokenID, amount, currency, [issuer], [toAddr], [memos], [options])](#XrplAccount+sellURIToken) ⇒ Promise.<Object> * [.prepareSellURIToken(uriTokenID, amount, currency, [issuer], [toAddr], [memos], [options])](#XrplAccount+prepareSellURIToken) ⇒ Promise.<Object> * [.buyURIToken(uriToken, [memos], [options])](#XrplAccount+buyURIToken) ⇒ Promise.<Object> * [.prepareBuyURIToken(uriToken, [memos], [options])](#XrplAccount+prepareBuyURIToken) ⇒ Promise.<Object> * [.clearURITokenOffer(uriTokenID, [options])](#XrplAccount+clearURITokenOffer) ⇒ Promise.<Object> * [.prepareClearURITokenOffer(uriTokenID, [options])](#XrplAccount+prepareClearURITokenOffer) ⇒ Promise.<Object> * [.getURITokens(options)](#XrplAccount+getURITokens) ⇒ Promise.<Array> * [.getURITokenByUri(uri, [isHexUri])](#XrplAccount+getURITokenByUri) ⇒ Promise.<Object> * [.generateIssuedURITokenId(uri, [isHexUri])](#XrplAccount+generateIssuedURITokenId) ⇒ string * [.signAndSubmit(preparedTransaction, submissionRef)](#XrplAccount+signAndSubmit) ⇒ Promise.<Object> * [.submitMultisigned(tx)](#XrplAccount+submitMultisigned) ⇒ Promise.<Object> ### new XrplAccount(address, secret, options) Constructs an XrplAccount instance. | Param | Type | Default | Description | | ------- | ---------------------------------------- | ----------------- | ------------------------------- | | address | string \| null | null | The account address (optional). | | secret | string \| null | null | The secret key (optional). | | options | Object | | Additional options (optional). | ### xrplAccount.on(event, handler) Adds an event listener for the specified event. **Kind**: instance method of [XrplAccount](#XrplAccount) | Param | Type | Description | | ------- | --------------------- | --------------------------- | | event | string | The name of the event. | | handler | function | The event handler function. | ### xrplAccount.once(event, handler) Adds a one-time event listener for the specified event. **Kind**: instance method of [XrplAccount](#XrplAccount) | Param | Type | Description | | ------- | --------------------- | --------------------------- | | event | string | The name of the event. | | handler | function | The event handler function. | ### xrplAccount.off(event, handler) Removes an event listener for the specified event. **Kind**: instance method of [XrplAccount](#XrplAccount) | Param | Type | Default | Description | | ------- | ------------------------------------------ | ------------- | -------------------------------------- | | event | string | | The name of the event. | | handler | function \| null | | The event handler function (optional). | ### xrplAccount.deriveKeypair() ⇒ Object Derives the keypair from the account secret. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Object - The derived keypair. **Throws**: - Will throw an error if the account secret is empty. ### xrplAccount.exists() ⇒ Promise.<boolean> Checks if the account exists. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<boolean> - True if the account exists, otherwise false. ### xrplAccount.getInfo() ⇒ Promise.<Object> Retrieves account information. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The account information. ### xrplAccount.getSequence() ⇒ Promise.<number> Gets the account's sequence number. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<number> - The account's sequence number. ### xrplAccount.getMintedNFTokens() ⇒ Promise.<number> Retrieves the number of NFTs minted by the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<number> - The number of minted NFTs. ### xrplAccount.getBurnedNFTokens() ⇒ number Retrieves the number of NFTs burned by the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: number - The number of burned NFTs. ### xrplAccount.getMessageKey() ⇒ Promise.<(string\|null)> Retrieves the account's message key. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<(string\|null)> - The message key or null if not set. ### xrplAccount.getWalletLocator() ⇒ Promise.<(string\|null)> Retrieves the wallet locator from the account info. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<(string\|null)> - The wallet locator or null if not found. ### xrplAccount.getDomain() ⇒ Promise.<(string\|null)> Retrieves the domain from the account info and converts it from hex to ASCII. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<(string\|null)> - The domain as ASCII or null if not found. ### xrplAccount.getTrustLines([currency], issuer) ⇒ Promise.<Array.<Object>> Retrieves the trust lines for the account, filtered by currency and issuer. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array.<Object>> - The list of trust lines, filtered if a currency is specified. | Param | Type | Description | | ---------- | ------------------- | ------------------------------ | | [currency] | string | The currency to filter by. | | issuer | string | The issuer of the trust lines. | ### xrplAccount.getChecks(fromAccount) ⇒ Promise.<Array.<Object>> Retrieves the checks for the specified account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array.<Object>> - The list of checks. | Param | Type | Description | | ----------- | ------------------- | ------------------------------------------ | | fromAccount | string | The account from which to retrieve checks. | ### xrplAccount.getNfts() ⇒ Promise.<Array.<Object>> Retrieves the NFTs for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array.<Object>> - The list of NFTs. ### xrplAccount.getOffers() ⇒ Promise.<Array.<Object>> Retrieves the offers for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array.<Object>> - The list of offers. ### xrplAccount.getNftOffers() ⇒ Promise.<Array.<Object>> Retrieves the NFT offers for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array.<Object>> - The list of NFT offers. ### xrplAccount.getNftByUri(uri, [isHexUri]) ⇒ Promise.<(Object\|null)> Retrieves a specific NFT by its URI. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<(Object\|null)> - The NFT object or null if not found. | Param | Type | Default | Description | | ---------- | -------------------- | ------------------ | ----------------------------------------- | | uri | string | | The URI of the NFT to retrieve. | | [isHexUri] | boolean | false | Whether the URI is in hexadecimal format. | ### xrplAccount.getAccountObjects(options) ⇒ Promise.<Array.<Object>> Retrieves account objects for the account with the specified options. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array.<Object>> - The list of account objects. | Param | Type | Description | | ------- | ------------------- | ------------------------------------------- | | options | Object | The options for retrieving account objects. | ### xrplAccount.getNamespaceEntries(namespaceId, [options]) ⇒ Promise.<Array.<Object>> Retrieves namespace entries for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array.<Object>> - The list of namespace entries. | Param | Type | Default | Description | | ----------- | ------------------- | --------------- | ------------------------------------------------ | | namespaceId | string | | The ID of the namespace to retrieve entries for. | | [options] | Object | {} | The options for retrieving namespace entries. | ### xrplAccount.getFlags() ⇒ Promise.<Object> Retrieves the flags set on the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The account flags. ### xrplAccount.getAccountTrx([minLedgerIndex], [maxLedgerIndex], [isForward]) ⇒ Promise.<Array> Retrieves account transactions within a specified ledger range. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array> - The list of transactions. | Param | Type | Default | Description | | ---------------- | -------------------- | ----------------- | ------------------------------------------------------- | | [minLedgerIndex] | number | -1 | The minimum ledger index to retrieve transactions from. | | [maxLedgerIndex] | number | -1 | The maximum ledger index to retrieve transactions from. | | [isForward] | boolean | true | Whether to retrieve transactions in forward order. | ### xrplAccount.hasValidKeyPair() ⇒ Promise.<boolean> Checks if the current wallet has a valid key pair for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<boolean> - True if the key pair is valid, otherwise false. ### xrplAccount.setAccountFields(fields, options) ⇒ Promise.<Object> Sets account fields. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The transaction result. | Param | Type | Description | | ------- | ------------------- | ------------------------------------------ | | fields | Object | The fields to set. | | options | Object | Additional transaction options (optional). | ### xrplAccount.prepareSetAccountFields(fields, [options]) ⇒ Promise.<Object> Prepares an AccountSet transaction with the specified fields and options. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared AccountSet transaction. **Throws**: - Will throw an error if no fields are provided and `allowEmptyAccountSet` is not true. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | fields | Object | | The fields to set for the account. Example: { Domain: "www.mydomain.com", Flags: { asfDefaultRipple: false, asfDisableMaster: true } } | | [options] | Object | {} | Additional options for the transaction. Can include hook parameters. | ### xrplAccount.setSignerList(signerList, [options]) ⇒ Promise.<Object> Sets the signer list for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | ---------- | ------------------- | --------------- | ----------------------------------------------- | | signerList | Array | | The list of signers to set for the account. | | [options] | Object | {} | Additional options for setting the signer list. | ### xrplAccount.prepareSetSignerList(signerList, options) ⇒ Promise.<Object> Set the signer list to the account. Setting signerQuorum = 0 in options, will remove the signerlist from the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - Prepared transaction. | Param | Type | Description | | ---------- | --------------- | ------------------------------------------------------------------------------------------------ | | signerList | \* | (optional) An array of signers. Ex: [ {account:"ras24cvffvfbvfbbt5or4332", weight: 1}, {}, ...] | | options | \* | Ex: {signerQuorum: 1, sequence: 6543233} | ### xrplAccount.invoke(toAddr, [blobObj], [options]) ⇒ Promise.<Object> Invokes a transaction to a specified address. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | --------- | ---------------------------------------- | --------------- | ---------------------------------------------- | | toAddr | string | | The destination address. | | [blobObj] | Object \| null | | Optional blob object with data and its format. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareInvoke(toAddr, [blobObj], [options]) ⇒ Promise.<Object> Prepares an invoke transaction. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared invoke transaction. | Param | Type | Default | Description | | --------- | ---------------------------------------- | --------------- | ---------------------------------------------------- | | toAddr | string | | The destination address. | | [blobObj] | Object \| null | | Blob object containing data and whether it's in hex. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.makePayment(toAddr, amount, [currency], [issuer], [memos], [options]) ⇒ Promise.<Object> Makes a payment to the specified address. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | ---------- | ------------------------------------------ | ----------------- | -------------------------------------------- | | toAddr | string | | The destination address. | | amount | number \| string | | The amount to send. | | [currency] | string \| null | null | Optional currency code. | | [issuer] | string \| null | null | Optional issuer for non-XRP currencies. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareMakePayment(toAddr, amount, [currency], [issuer], [memos], [options]) ⇒ Promise.<Object> Prepares a payment transaction. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared payment transaction. | Param | Type | Default | Description | | ---------- | ------------------------------------------ | ----------------- | -------------------------------------------- | | toAddr | string | | The destination address. | | amount | number \| string | | The amount to send. | | [currency] | string \| null | null | Optional currency code. | | [issuer] | string \| null | null | Optional issuer for non-XRP currencies. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.setTrustLine(currency, issuer, limit, [allowRippling], [memos], [options]) ⇒ Promise.<Object> Sets a trust line with the specified parameters. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | --------------- | --------------------------------------- | ------------------ | -------------------------------------------- | | currency | string | | The currency code for the trust line. | | issuer | string | | The issuer of the currency. | | limit | string | | The limit for the trust line. | | [allowRippling] | boolean | false | Whether to allow rippling. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareSetTrustLine(currency, issuer, limit, [allowRippling], [memos], [options]) ⇒ Promise.<Object> Prepares a trust line transaction. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared trust line transaction. | Param | Type | Default | Description | | --------------- | --------------------------------------- | ------------------ | -------------------------------------------- | | currency | string | | The currency code for the trust line. | | issuer | string | | The issuer of the currency. | | limit | string | | The limit for the trust line. | | [allowRippling] | boolean | false | Whether to allow rippling. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.setRegularKey(regularKey, [memos], [options]) ⇒ Promise.<Object> Sets the regular key for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | ---------- | --------------------------------------- | --------------- | -------------------------------------------- | | regularKey | string | | The regular key to set. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareSetRegularKey(regularKey, [memos], [options]) ⇒ Promise.<Object> Prepares a transaction to set the regular key for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared regular key transaction. | Param | Type | Default | Description | | ---------- | --------------------------------------- | --------------- | -------------------------------------------- | | regularKey | string | | The regular key to set. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareCashCheck(check, [options]) ⇒ Promise.<Object> Cashes a check for the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | --------------------------------------- | | check | Object | | The check object with details. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.offerSell(sellAmount, sellCurrency, sellIssuer, forAmount, forCurrency, [forIssuer], [expiration], [memos], [options]) ⇒ Promise.<Object> Creates an offer to sell assets. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | ------------ | ------------------------------------------ | ----------------------- | -------------------------------------------- | | sellAmount | number \| string | | The amount to sell. | | sellCurrency | string | | The currency code of the asset to sell. | | sellIssuer | string | | The issuer of the asset to sell. | | forAmount | number \| string | | The amount to receive. | | forCurrency | string | | The currency code of the asset to receive. | | [forIssuer] | string \| null | null | The issuer of the asset to receive. | | [expiration] | number | 4294967295 | The expiration time for the offer. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareOfferSell(sellAmount, sellCurrency, sellIssuer, forAmount, forCurrency, [forIssuer], [expiration], [memos], [options]) ⇒ Promise.<Object> Prepares a transaction to sell assets. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared offer sell transaction. | Param | Type | Default | Description | | ------------ | ------------------------------------------ | ----------------------- | -------------------------------------------- | | sellAmount | number \| string | | The amount to sell. | | sellCurrency | string | | The currency code of the asset to sell. | | sellIssuer | string | | The issuer of the asset to sell. | | forAmount | number \| string | | The amount to receive. | | forCurrency | string | | The currency code of the asset to receive. | | [forIssuer] | string \| null | null | The issuer of the asset to receive. | | [expiration] | number | 4294967295 | The expiration time for the offer. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.offerBuy(buyAmount, buyCurrency, buyIssuer, forAmount, forCurrency, [forIssuer], [expiration], [memos], [options]) ⇒ Promise.<Object> Creates an offer to buy assets. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | ------------ | ------------------------------------------ | ----------------------- | --------------------------------------------------- | | buyAmount | number \| string | | The amount to buy. | | buyCurrency | string | | The currency code of the asset to buy. | | buyIssuer | string | | The issuer of the asset to buy. | | forAmount | number \| string | | The amount to give in exchange. | | forCurrency | string | | The currency code of the asset to give in exchange. | | [forIssuer] | string \| null | null | The issuer of the asset to give in exchange. | | [expiration] | number | 4294967295 | The expiration time for the offer. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareOfferBuy(buyAmount, buyCurrency, buyIssuer, forAmount, forCurrency, [forIssuer], [expiration], [memos], [options]) ⇒ Promise.<Object> Prepares an offer to buy assets. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared offer buy transaction. | Param | Type | Default | Description | | ------------ | ------------------------------------------ | ----------------------- | --------------------------------------------------- | | buyAmount | number \| string | | The amount to buy. | | buyCurrency | string | | The currency code of the asset to buy. | | buyIssuer | string | | The issuer of the asset to buy. | | forAmount | number \| string | | The amount to give in exchange. | | forCurrency | string | | The currency code of the asset to give in exchange. | | [forIssuer] | string \| null | null | The issuer of the asset to give in exchange. | | [expiration] | number | 4294967295 | The expiration time for the offer. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.cancelOffer(offerSequence, [memos], [options]) ⇒ Promise.<Object> Cancels an existing offer. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The result of the sign and submit operation. | Param | Type | Default | Description | | ------------- | --------------------------------------- | --------------- | -------------------------------------------- | | offerSequence | number | | The sequence number of the offer to cancel. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareCancelOffer(offerSequence, [memos], [options]) ⇒ Promise.<Object> Prepares a transaction to cancel an offer. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared offer cancel transaction. | Param | Type | Default | Description | | ------------- | --------------------------------------- | --------------- | -------------------------------------------- | | offerSequence | number | | The sequence number of the offer to cancel. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.subscribe() ⇒ Promise.<void> Subscribes to the XRPL address stream for transaction updates. Ensures only one subscription is active at a time. **Kind**: instance method of [XrplAccount](#XrplAccount) ### xrplAccount.unsubscribe() ⇒ Promise.<void> Unsubscribes from the XRPL address stream. **Kind**: instance method of [XrplAccount](#XrplAccount) ### xrplAccount.submitTransactionBlob(txBlob) ⇒ Promise.<Object> Submits a signed raw transaction. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - Result of the transaction submission. | Param | Type | Description | | ------ | ------------------- | ----------------------------------------------- | | txBlob | string | Signed and encoded transaction as a hex string. | ### xrplAccount.sign(tx, [isMultiSign]) ⇒ Object Signs the given transaction and returns the signed blob and its hash. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Object - The signed transaction hash and blob. Format: {hash: string, tx_blob: string} | Param | Type | Default | Description | | ------------- | -------------------- | ------------------ | -------------------------------------------- | | tx | Object | | Transaction object. | | [isMultiSign] | boolean | false | Whether the transaction is for multisigning. | ### xrplAccount.mintURIToken(uri, [digest], [flags], [options]) ⇒ Promise.<Object> Mints a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - Result of the mint transaction. | Param | Type | Default | Description | | --------- | ---------------------------------------- | ----------------- | ----------------------------------------------------- | | uri | string | | The URI to mint as a token. | | [digest] | string \| null | null | The optional digest for the token. | | [flags] | Object | {} | Flags to control token properties (e.g., isBurnable). | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareMintURIToken(uri, [digest], [flags], [options]) ⇒ Promise.<Object> Prepares the minting of a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared mint transaction. | Param | Type | Default | Description | | --------- | ---------------------------------------- | ----------------- | --------------------------------------- | | uri | string | | The URI to mint as a token. | | [digest] | string \| null | null | The optional digest for the token. | | [flags] | Object | {} | Flags to control token properties. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.burnURIToken(uriTokenID, [options]) ⇒ Promise.<Object> Burns a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - Result of the burn transaction. | Param | Type | Default | Description | | ---------- | ------------------- | --------------- | --------------------------------------- | | uriTokenID | string | | The ID of the URI token to burn. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareBurnURIToken(uriTokenID, [options]) ⇒ Promise.<Object> Prepares the burning of a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared burn transaction. | Param | Type | Default | Description | | ---------- | ------------------- | --------------- | --------------------------------------- | | uriTokenID | string | | The ID of the URI token to burn. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.sellURIToken(uriTokenID, amount, currency, [issuer], [toAddr], [memos], [options]) ⇒ Promise.<Object> Creates a sell offer for a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - Result of the sell transaction. | Param | Type | Default | Description | | ---------- | ------------------------------------------ | ----------------- | -------------------------------------------- | | uriTokenID | string | | The ID of the URI token to sell. | | amount | string \| number | | The amount to sell the token for. | | currency | string | | The currency code for the sale. | | [issuer] | string \| null | null | The issuer of the currency. | | [toAddr] | string \| null | null | The address of the buyer. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareSellURIToken(uriTokenID, amount, currency, [issuer], [toAddr], [memos], [options]) ⇒ Promise.<Object> Prepares a sell offer for a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared sell offer transaction. | Param | Type | Default | Description | | ---------- | ------------------------------------------ | ----------------- | -------------------------------------------- | | uriTokenID | string | | The ID of the URI token to sell. | | amount | string \| number | | The amount to sell the token for. | | currency | string | | The currency code for the sale. | | [issuer] | string \| null | null | The issuer of the currency. | | [toAddr] | string \| null | null | The address of the buyer. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.buyURIToken(uriToken, [memos], [options]) ⇒ Promise.<Object> Buys a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - Result of the buy transaction. | Param | Type | Default | Description | | --------- | --------------------------------------- | --------------- | -------------------------------------------- | | uriToken | Object | | The URI token object to buy. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareBuyURIToken(uriToken, [memos], [options]) ⇒ Promise.<Object> Prepares a buy offer for a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared buy offer transaction. | Param | Type | Default | Description | | --------- | --------------------------------------- | --------------- | -------------------------------------------- | | uriToken | Object | | The URI token object to buy. | | [memos] | Array \| null | | Optional memos to attach to the transaction. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.clearURITokenOffer(uriTokenID, [options]) ⇒ Promise.<Object> Clears a sell offer for a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - Result of the clear offer transaction. | Param | Type | Default | Description | | ---------- | ------------------- | --------------- | --------------------------------------- | | uriTokenID | string | | The ID of the URI token offer to clear. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.prepareClearURITokenOffer(uriTokenID, [options]) ⇒ Promise.<Object> Prepares the clearing of a sell offer for a URI token. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The prepared clear offer transaction. | Param | Type | Default | Description | | ---------- | ------------------- | --------------- | --------------------------------------- | | uriTokenID | string | | The ID of the URI token offer to clear. | | [options] | Object | {} | Additional options for the transaction. | ### xrplAccount.getURITokens(options) ⇒ Promise.<Array> Retrieves all URI tokens associated with the account. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Array> - List of URI tokens. | Param | Type | Description | | ------- | ------------------- | ------------------------------------- | | options | Object | Additional options for the retrieval. | ### xrplAccount.getURITokenByUri(uri, [isHexUri]) ⇒ Promise.<Object> Retrieves a URI token by its URI. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - The URI token object. | Param | Type | Default | Description | | ---------- | -------------------- | ------------------ | --------------------------------- | | uri | string | | The URI of the token to retrieve. | | [isHexUri] | boolean | false | Whether the URI is in hex format. | ### xrplAccount.generateIssuedURITokenId(uri, [isHexUri]) ⇒ string Generates the issued URI token ID from a given URI. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: string - The generated URI token ID. | Param | Type | Default | Description | | ---------- | -------------------- | ------------------ | -------------------------------------- | | uri | string | | The URI to generate the token ID from. | | [isHexUri] | boolean | false | Whether the URI is in hex format. | ### xrplAccount.signAndSubmit(preparedTransaction, submissionRef) ⇒ Promise.<Object> Sign and submit prepared transaction. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - result of the submitted transaction. | Param | Type | Description | | ------------------- | ------------------- | ---------------------------------------------------------- | | preparedTransaction | object | Prepared transaction. | | submissionRef | object | [Optional] Reference object to take submission references. | ### xrplAccount.submitMultisigned(tx) ⇒ Promise.<Object> Submit a multi-singed transaction. **Kind**: instance method of [XrplAccount](#XrplAccount) **Returns**: Promise.<Object> - Result of the transaction. | Param | Type | Description | | ----- | ------------------- | ------------------- | | tx | object | Signed transaction. | ## XrplApi Class representing an XRPL API client. **Kind**: global class * [XrplApi](#XrplApi) * [new XrplApi(rippledServer, [options])](#new_XrplApi_new) * [.on(event, handler)](#XrplApi+on) * [.once(event, handler)](#XrplApi+once) * [.off(event, [handler])](#XrplApi+off) * [.connect()](#XrplApi+connect) ⇒ Promise.<void> * [.disconnect()](#XrplApi+disconnect) ⇒ Promise.<void> * [.isValidKeyForAddress(publicKey, address)](#XrplApi+isValidKeyForAddress) ⇒ Promise.<boolean> * [.isAccountExists(address)](#XrplApi+isAccountExists) ⇒ Promise.<boolean> * [.getServerState([ledgerIdx])](#XrplApi+getServerState) ⇒ Promise.<string> * [.getAccountInfo(address)](#XrplApi+getAccountInfo) ⇒ Promise.<Object> * [.getServerDefinition()](#XrplApi+getServerDefinition) ⇒ Promise.<Object> * [.getServerInfo()](#XrplApi+getServerInfo) ⇒ Promise.<Object> * [.getAccountObjects(address, [options])](#XrplApi+getAccountObjects) ⇒ Promise.<Array.<Object>> * [.getNamespaceEntries(address, namespaceId, [options])](#XrplApi+getNamespaceEntries) ⇒ Promise.<Array.<Object>> * [.getNftOffers(address, [options])](#XrplApi+getNftOffers) ⇒ Promise.<Array.<Object>> * [.getTrustlines(address, [options])](#XrplApi+getTrustlines) ⇒ Promise.<Array.<Object>> * [.getAccountTrx(address, [options])](#XrplApi+getAccountTrx) ⇒ Promise.<Array.<Object>> * [.getNfts(address, [options])](#XrplApi+getNfts) ⇒ Promise.<Array.<Object>> * [.getOffers(address, [options])](#XrplApi+getOffers) ⇒ Promise.<Array.<Object>> * [.getSellOffers(nfTokenId, [options])](#XrplApi+getSellOffers) ⇒ Promise.<Array.<Object>> * [.getBuyOffers(nfTokenId, [options])](#XrplApi+getBuyOffers) ⇒ Promise.<Array.<Object>> * [.getLedgerEntry(index, [options])](#XrplApi+getLedgerEntry) ⇒ Promise.<(Object\|null)> * [.getURITokenByIndex(index)](#XrplApi+getURITokenByIndex) ⇒ Promise.<(Object\|null)> * [.getTxnInfo(txnHash, options)](#XrplApi+getTxnInfo) ⇒ Promise.<Object> * [.subscribeToAddress(address, handler)](#XrplApi+subscribeToAddress) ⇒ Promise.<void> * [.unsubscribeFromAddress(address, handler)](#XrplApi+unsubscribeFromAddress) ⇒ Promise.<void> * [.getTransactionFee(txBlob)](#XrplApi+getTransactionFee) ⇒ Promise.<number> * [.getTransactionValidatedResults(txHash)](#XrplApi+getTransactionValidatedResults) ⇒ * [.submitMultisignedAndWait(tx, submissionRef)](#XrplApi+submitMultisignedAndWait) ⇒ * [.submitMultisigned(tx)](#XrplApi+submitMultisigned) ⇒ * [.submitAndWait(tx_blob, submissionRef)](#XrplApi+submitAndWait) ⇒ * [.submit(tx_blob)](#XrplApi+submit) ⇒ * [.multiSign(transactions)](#XrplApi+multiSign) ⇒ string ### new XrplApi(rippledServer, [options]) | Param | Type | Default | Description | | -------------------------------- | ---------------------------------------- | ----------------- | ---------------------------------------------------------- | | rippledServer | string \| null | null | The URL of the primary rippled server or null if not used. | | [options] | Object | {} | Optional configuration options. | | [options.fallbackRippledServers] | Array.<string> | [] | List of fallback server URLs. | | [options.xrplClientOptions] | Object | {} | Options for the xrpl client. | | [options.autoReconnect] | boolean | true | Whether to automatically reconnect. | ### xrplApi.on(event, handler) Adds an event listener for a specified event. **Kind**: instance method of [XrplApi](#XrplApi) | Param | Type | Description | | ------- | --------------------- | ------------------------------------------- | | event | string | The event to listen for. | | handler | function | The function to call when the event occurs. | ### xrplApi.once(event, handler) Adds a one-time event listener for a specified event. **Kind**: instance method of [XrplApi](#XrplApi) | Param | Type | Description | | ------- | --------------------- | ------------------------------------------- | | event | string | The event to listen for. | | handler | function | The function to call when the event occurs. | ### xrplApi.off(event, [handler]) Removes an event listener for a specified event. **Kind**: instance method of [XrplApi](#XrplApi) | Param | Type | Default | Description | | --------- | --------------------- | ------------- | ------------------------------------------------------ | | event | string | | The event to stop listening for. | | [handler] | function | | The function to remove or null to remove all handlers. | ### xrplApi.connect() ⇒ Promise.<void> Connects to the XRPL API. **Kind**: instance method of [XrplApi](#XrplApi) ### xrplApi.disconnect() ⇒ Promise.<void> Disconnects from the XRPL API. **Kind**: instance method of [XrplApi](#XrplApi) ### xrplApi.isValidKeyForAddress(publicKey, address) ⇒ Promise.<boolean> Checks if the given public key is valid for the specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<boolean> - Returns true if the public key is valid for the address. | Param | Type | Description | | --------- | ------------------- | ----------------------------- | | publicKey | string | The public key to check. | | address | string | The address to check against. | ### xrplApi.isAccountExists(address) ⇒ Promise.<boolean> Checks if an account exists at the specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<boolean> - Returns true if the account exists. | Param | Type | Description | | ------- | ------------------- | -------------------- | | address | string | The account address. | ### xrplApi.getServerState([ledgerIdx]) ⇒ Promise.<string> Gets the server state at the specified ledger index. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<string> - The server state. | Param | Type | Default | Description | | ----------- | ------------------- | ---------------------------------------------- | -------------------------------------- | | [ledgerIdx] | string | "\"current\"" | The ledger index to get the state for. | ### xrplApi.getAccountInfo(address) ⇒ Promise.<Object> Gets account information for a specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Object> - The account information. | Param | Type | Description | | ------- | ------------------- | -------------------- | | address | string | The account address. | ### xrplApi.getServerDefinition() ⇒ Promise.<Object> Gets the server definitions. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Object> - The server definitions. ### xrplApi.getServerInfo() ⇒ Promise.<Object> Gets information about the server. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Object> - The server information. ### xrplApi.getAccountObjects(address, [options]) ⇒ Promise.<Array.<Object>> Gets account objects for a specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The account objects. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | address | string | | The account address. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getNamespaceEntries(address, namespaceId, [options]) ⇒ Promise.<Array.<Object>> Gets namespace entries for a specified address and namespace ID. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The namespace entries. | Param | Type | Default | Description | | ----------- | ------------------- | --------------- | ------------------------------------ | | address | string | | The account address. | | namespaceId | string | | The namespace ID. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getNftOffers(address, [options]) ⇒ Promise.<Array.<Object>> Gets NFT offers for a specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The NFT offers. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | address | string | | The account address. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getTrustlines(address, [options]) ⇒ Promise.<Array.<Object>> Gets trustlines for a specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The trustlines. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | address | string | | The account address. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getAccountTrx(address, [options]) ⇒ Promise.<Array.<Object>> Gets account transactions for a specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The account transactions. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | address | string | | The account address. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getNfts(address, [options]) ⇒ Promise.<Array.<Object>> Gets NFTs for a specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The NFTs. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | address | string | | The account address. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getOffers(address, [options]) ⇒ Promise.<Array.<Object>> Gets offers for a specified address. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The offers. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | address | string | | The account address. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getSellOffers(nfTokenId, [options]) ⇒ Promise.<Array.<Object>> Gets sell offers for a specified NFT token ID. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The sell offers. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | nfTokenId | string | | The NFT token ID. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getBuyOffers(nfTokenId, [options]) ⇒ Promise.<Array.<Object>> Gets buy offers for a specified NFT token ID. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Array.<Object>> - The buy offers. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | nfTokenId | string | | The NFT token ID. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getLedgerEntry(index, [options]) ⇒ Promise.<(Object\|null)> Gets ledger entry by index. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<(Object\|null)> - The ledger entry or null if not found. | Param | Type | Default | Description | | --------- | ------------------- | --------------- | ------------------------------------ | | index | string | | The ledger index. | | [options] | Object | {} | Optional parameters for the request. | ### xrplApi.getURITokenByIndex(index) ⇒ Promise.<(Object\|null)> Gets the URI token by index. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<(Object\|null)> - The URI token entry or null if not found. | Param | Type | Description | | ----- | ------------------- | --------------------------- | | index | string | The index of the URI token. | ### xrplApi.getTxnInfo(txnHash, options) ⇒ Promise.<Object> Gets transaction information. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<Object> - The transaction information. | Param | Type | Description | | ------- | ------------------- | ------------------------------------ | | txnHash | string | The hash of the transaction. | | options | Object | Optional parameters for the request. | ### xrplApi.subscribeToAddress(address, handler) ⇒ Promise.<void> Subscribes to address updates. **Kind**: instance method of [XrplApi](#XrplApi) | Param | Type | Description | | ------- | --------------------- | ----------------------------------------- | | address | string | The address to subscribe to. | | handler | function | The handler function for address updates. | ### xrplApi.unsubscribeFromAddress(address, handler) ⇒ Promise.<void> Unsubscribes from address updates. **Kind**: instance method of [XrplApi](#XrplApi) | Param | Type | Description | | ------- | --------------------- | -------------------------------- | | address | string | The address to unsubscribe from. | | handler | function | The handler function to remove. | ### xrplApi.getTransactionFee(txBlob) ⇒ Promise.<number> Gets the transaction fee. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Promise.<number> - The transaction fee. | Param | Type | Description | | ------ | ------------------- | --------------------- | | txBlob | string | The transaction blob. | ### xrplApi.getTransactionValidatedResults(txHash) ⇒ Get the transaction results if validated. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: Validated results of the transaction. | Param | Type | Description | | ------ | ------------------- | --------------------------------- | | txHash | string | Hash of the transaction to check. | ### xrplApi.submitMultisignedAndWait(tx, submissionRef) ⇒ Submit a multi-signature transaction and wait for validation. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: response object of the validated transaction. | Param | Type | Description | | ------------- | ------------------- | ---------------------------------------------------------- | | tx | object | Multi-signed transaction object. | | submissionRef | object | [Optional] Reference object to take submission references. | ### xrplApi.submitMultisigned(tx) ⇒ Only submit a multi-signature transaction. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: response object of the submitted transaction. | Param | Type | Description | | ----- | ------------------- | -------------------------------- | | tx | object | Multi-signed transaction object. | ### xrplApi.submitAndWait(tx_blob, submissionRef) ⇒ Submit a single-signature transaction. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: response object of the validated transaction. | Param | Type | Description | | ------------- | ------------------- | ---------------------------------------------------------- | | tx_blob | string | Signed transaction object. | | submissionRef | object | [Optional] Reference object to take submission references. | ### xrplApi.submit(tx_blob) ⇒ Only submit a single-signature transaction. **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: response object of the submitted transaction. | Param | Type | Description | | ------- | ------------------- | -------------------------- | | tx_blob | string | Signed transaction object. | ### xrplApi.multiSign(transactions) ⇒ string Joins the given array of signed transactions into one multi-signed transaction. For more details: https://js.xrpl.org/functions/multisign.html **Kind**: instance method of [XrplApi](#XrplApi) **Returns**: string - A single multi-signed transaction in string format that contains all signers from the input transactions. **Throws**: - Error If the transactions array is empty. | Param | Type | Description | | ------------ | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | transactions | Array.<(string\|object)> | An array of signed transactions, either as serialized strings or transaction objects, to combine into a single multi-signed transaction. |