new Workers(workerAddress, chainId)
Workers contract interact class constructor
Parameters:
Name | Type | Description |
---|---|---|
workerAddress |
string | address of worker (external address) |
chainId |
number | chain id |
Methods
-
_validateRemoveParams(senderAddress, gasPrice)
-
Validate Remove (selfdestruct) params
Parameters:
Name Type Description senderAddress
string address of sender gasPrice
BigNumber gas price Returns:
- Type
- result
-
_validateRemoveWorkerParams(senderAddress, workerAddress, gasPrice)
-
Validate remove worker params
Parameters:
Name Type Description senderAddress
string address of sender workerAddress
string worker address gasPrice
BigNumber gas price Returns:
- Type
- result
-
getTxReceipt(transactionHash)
-
Get transaction receipt from transaction hash
Parameters:
Name Type Description transactionHash
string transaction hash TODO - this can be moved to a util class Returns:
- Type
- promise.<result>
-
isWorker(workerAddress)
-
Check if the given worker address is valid or not
Parameters:
Name Type Description workerAddress
string worker address Returns:
- Type
- Promise
-
remove(senderAddr, senderPassphrase, gasPrice, object)
-
Remove (selfdestruct)
Parameters:
Name Type Description senderAddr
string address of sender senderPassphrase
string passphrase of sender gasPrice
BigNumber gas price object
options for params like returnType, tag. Returns:
- Type
- Promise
-
removeWorker(senderAddress, senderPassphrase, workerAddress, gasPrice, options)
-
Remove worker
Parameters:
Name Type Description senderAddress
string address of sender senderPassphrase
string passphrase of sender workerAddress
string worker address gasPrice
BigNumber gas price options
object for params like returnType, tag. Returns:
- Type
- promise.<result>
-
setWorker(senderAddress, senderPassphrase, workerAddress, deactivationHeight, gasPrice, options)
-
Set or update the worker
Parameters:
Name Type Description senderAddress
string address of sender senderPassphrase
string passphrase of sender workerAddress
string worker address deactivationHeight
number block number till which the worker is valid gasPrice
BigNumber gas price options
object for params like returnType, tag. Returns:
- Type
- promise.<result>