new Util(contractSettings)
- Source:
set of helper functions
Parameters:
Name | Type | Description |
---|---|---|
contractSettings |
Methods
formatEther(value) → {String}
- Source:
converts BigNumber to number (as a string)
Parameters:
Name | Type | Description |
---|---|---|
value |
BigNunber |
Returns:
- Type
- String
(async) getEventLogs(contractAddress, event, fromBlock) → {Promise.<*>}
- Source:
Returns event logs for a specific contract event and fetches block timestamp for each transaction
Parameters:
Name | Type | Description |
---|---|---|
contractAddress |
String | in format "0x1234567890abcdef" |
event |
Object.<ethers.Interface> | ethers.js event interface |
fromBlock |
Returns:
- Type
- Promise.<*>
(async) getGasAndSpeedInfo() → {Promise.<{gasFastGwei: number, gasAverageGwei: number, gasSlowGwei: number, timeFastMinutes: *, timeAverageMinutes: *, timeSlowMinutes: *}>}
- Source:
Returns the object with estimates for slow, average and fast gas prices and approximate waiting times
Returns:
- Type
- Promise.<{gasFastGwei: number, gasAverageGwei: number, gasSlowGwei: number, timeFastMinutes: *, timeAverageMinutes: *, timeSlowMinutes: *}>
(async) getGasEstimate(toAddress, ethValue, data) → {Promise.<String>}
- Source:
Estimates gas for a transaction
Parameters:
Name | Type | Description |
---|---|---|
toAddress |
where to send transaction | |
ethValue |
optional - if function requires ETH to be sent | |
data |
optional if function requires data to be sent example (new Interface(CONTRACT_ABIS.Depot).functions.exchangeEtherForSynths()).data example2 synthInterface.functions.approve(MAINNET_ADDRESSES.Depot, utils.parseEther("2")).data; |
Returns:
- Type
- Promise.<String>
parseEther(value) → {BigNumber}
- Source:
converts number (as a string) to a BigNumber
Parameters:
Name | Type | Description |
---|---|---|
value |
String |
Returns:
- Type
- BigNumber
(async) signAndSendTransaction(transaction, fromAddress) → {Promise.<void>}
- Source:
Manually sign any transaction with custom signer
Parameters:
Name | Type | Description |
---|---|---|
transaction |
||
fromAddress |
Returns:
- Type
- Promise.<void>
toUtf8Bytes(stringValue) → {Utf8Bytes}
- Source:
converts string to bytes
Parameters:
Name | Type | Description |
---|---|---|
stringValue |
Returns:
- Type
- Utf8Bytes
(async) waitForTransaction(transactionHash) → {Promise.<*>}
- Source:
Waits for ethereum transaction to succeed or fail. Checks the status every second.
Parameters:
Name | Type | Description |
---|---|---|
transactionHash |
Returns:
- Type
- Promise.<*>