Class: SurrogethClient

SurrogethClient()

Class representing a single surrogeth client. Maintains state about which relayers it's already tried to communicate with.

Constructor

new SurrogethClient()

Source:

Methods

(async) getRelayerFee(relayer) → {number|null}

Returns the fee for the specified relayer.
Parameters:
Name Type Description
relayer Object The relayer whose fee to return, as specified by a locator (i.e. IP address) and locatorType string (i.e. 'ip')
Source:
Returns:
The fee in Wei advertised by the specified relayer.
Type
number | null

(async) getRelayers(numRelayers, addressesToIgnore, allowedLocatorTypes) → {Array.<{locator: string, locatorType: string, burn: number, address: string}>}

Get the highest reputation relayers from the reputation contract.
Parameters:
Name Type Default Description
numRelayers number 1 The number of relayers to return.
addressesToIgnore Set.<string> Any relayer addresses to skip over.
allowedLocatorTypes Set.<string> The locator types to include.
Source:
Returns:
An array of information objects corresponding to relayers
Type
Array.<{locator: string, locatorType: string, burn: number, address: string}>

(async) submitTx(relayer, tx) → {string|null}

Submit the specified transaction to the specified relayer.
Parameters:
Name Type Description
relayer Object The relayer whose fee to return, as specified by a locator (i.e. IP address) and locatorType string (i.e. 'ip')
tx Object The transaction info to submit. 'to' is a hex string representing the address to send to and 'data' is a hex string or an empty string representing the data payload of the transaction
Source:
Returns:
The transaction hash of the submitted transaction
Type
string | null