meterify.module.options
A module provides several options for configuring the transaction confirmation workflow or for defining default values. This document describes the available option properties on a module.
Example:
defaultBlock
The default block is used for all methods which have a block parameter. You can override it by passing the block parameter if a block is required.
The defaultBlock
property can return the following values:
Value
Type
Description
a number
Number
A block number
genesis
String
The genesis block
latest
String
The latest block (current head of the blockchain)
pending
String
The currently mined block (including pending transactions)
Default is latest
defaultAccount
This default address is used as the default "from"
property, if no "from"
property is specified.
Returns:
Type
Description
String
- 20 Bytes
Any Ethereum address. You need to have the private key for that address in your node or keystore. (Default is undefined
)
defaultGasPrice
The default gas price which will be used for a request.
Returns:
Type
Description
string
or number
The current value of the defaultGasPrice property.
defaultGas
The default gas which will be used for a request.
Returns:
Type
Description
string
or number
The current value of the defaultGas property.
transactionBlockTimeout
The transactionBlockTimeout
will be used over a socket-based connection. This option does define the amount of new blocks it should wait until the first confirmation happens. This means the PromiEvent rejects with a timeout error when the timeout got exceeded.
Returns:
Type
Description
number
The current value of transactionBlockTimeout
transactionConfirmationBlocks
This defines the number of blocks it requires until a transaction will be handled as confirmed.
Returns:
Type
Description
number
The current value of transactionConfirmationBlocks
transactionPollingTimeout
The transactionPollingTimeout
will be used over a HTTP connection. This option does define the amount of polls (each second) it should wait until the first confirmation happens.
Returns:
Type
Description
number
The current value of transactionPollingTimeout
transactionSigner
The TransactionSigner
property does provide us the possibility to customize the signing process of the Eth
module and the related sub-modules.
The interface of a TransactionSigner
:
Returns:
Type
Description
TransactionSigner
A JavaScript class of type TransactionSigner.
setProvider
Will change the provider for its module.
Example:
Note: When called on the umbrella package web3
it will also set the provider for all sub modules web3.eth
, web3.shh
, etc.
Parameters:
Type
Description
Object
or String
provider
: a valid provider
Net
net
: (optional) the node.js Net package. This is only required for the IPC provider.
Returns:
Boolean
providers
Example:
Contains the current available providers.
Object
with the following providers:
Property
Name
Description
Object
HttpProvider
The HTTP provider is deprecated, as it will not work for subscriptions.
Object
WebsocketProvider
The Websocket provider is the standard for usage in legacy browsers.
Object
IpcProvider
The IPC provider is used node dapps when running a local node. Gives the most secure connection.
givenProvider
Example:
When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise null
.
Returns:
Type
Description
Object
The given provider set or false
.
currentProvider
Will return the current provider.
Example:
Returns:
Type
Description
Object
The current provider set.
BatchRequest
Example:
Class to create and execute batch requests.
Parameters:
none
Returns:
Type
Description
Object
Contains the following methods:
Method
Description
add(request)
To add a request object to the batch call.
execute()
Will execute the batch request.
Last updated