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