Global

Methods

add0x(data)

Adds 0x prefix to string
Parameters:
Name Type Description
data string string that should be prefixed by 0x
Source:
Returns:
String with 0x prefix

(async) allEvents(props)

Subscribes to all contract events
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
options object <optional>
Event options (@see subscribe)
callback function <optional>
Event callback (@see subscribe)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the event emitter (@see subsribe)

(async) allEvents(props)

Subscribes to all contract events
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
options object <optional>
Event options (@see subscribe)
callback function <optional>
Event callback (@see subscribe)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the event emitter (@see subsribe)

(async) balanceOf(props)

Gets balance of specific address
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
owner string Address to check balance
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the balance of owner address

(async) burn(props)

Burn tokens
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
privateKey string Private key (64 hex symbols, without '0x' prefix)
account string Address of account to burn tokens from
value BigNumber Transaction value
gasLimit BigNumber <optional>
Gas limit for the transaction
gasPrice BigNumber <optional>
Gas price for the transaction
nonce number <optional>
Nonce for the transaction
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the hash of created contract transaction

(async) BurnEvent(props)

Subscribes to BurnEvent event
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
options object <optional>
Event options (@see subscribe)
callback function <optional>
Event callback (@see subscribe)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the event emitter (@see subsribe)

(async) call()

Wrapper for callContractMethod function (@see callContractMethod)
Source:

(async) call()

Wrapper for callETHMethod function (@see callETHMethod)
Source:

(async) callContractMethod(payload)

Calls specific contract method with provided arguments
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
contractInstance object Contract instance
interfaceName string Interface name
method string Method name
args array Method arguments
Source:
Returns:
Promise that will be resolved with the result of contract method execution

(async) callETHMethod(payload)

Calls specific web3.eth method with provided arguments
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
method string Method name
args array Method arguments
Source:
Returns:
Promise that will be resolved with the result of web3.eth method execution

checkWeb3(payload) → {object}

Checks web3 connection status. Sets web3 globally if it does not exist
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
The same (as input) payload object
Type
object

(async) decimals(props)

Gets token decimals
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with token decimals

(async) estimateContractGas(payload)

Gets estimate gas for the contract transaction
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Description
method string Contract method name
args array Contract method arguments
privateKey string Private key (64 hex symbols, without '0x' prefix)
contractInstance object Contract instance
Source:
Returns:
Promise (@see getContractGasLimit)

(async) estimateETHGas(payload)

Gets estimate gas for the transaction
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object Method properties
Source:
Returns:
Promise that will be resolved with estimate gas value

(async) estimateGas(props)

Gets estimate gas for the contract transaction
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
privateKey string Private key (64 hex symbols, without '0x' prefix)
method string Method name
args array Method arguments
Source:
Returns:
Promise that will be resolved with estimate gas value

(async) estimateGas(props)

Gets estimate gas for the transaction
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
to string Address of the transaction receiver
value BigNumber Transaction value
data string <optional>
Transaction data
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with estimate gas value

(async) estimateGas()

Wrapper for estimateContractGas function (@see estimateContractGas)
Source:

(async) estimateGas()

Wrapper for estimateETHGas function (@see estimateETHGas)
Source:

filter(optionsopt) → {object}

Gets filter object, that can be used for getting of past logs or watching of new
Parameters:
Name Type Attributes Default Description
options object <optional>
{} Filter options
Properties
Name Type Attributes Description
fromBlock number | string <optional>
The number of the earliest block
toBlock number | string <optional>
The number of the latest block
address string | Array.<string> <optional>
An address(es) to get logs from
topics Array.<string> <optional>
Allows to manually set the topics for the event filter
Source:
Returns:
Type
object

filterETHLogs(payload) → {object}

Initializes filter object
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
options object <optional>
Filter options (@see filter)
Source:
Returns:
The event emitter (@see subscribe)
Type
object

(async) filterLogs()

Wrapper for filterETHLogs function (@see filterETHLogs)
Source:

getAddressFromPrivateKey(privateKey) → {string}

Gets account's address from its private key
Parameters:
Name Type Description
privateKey string Private key (64 hex symbols, without '0x' prefix)
Source:
Returns:
Account's address
Type
string

(async) getBalance(props)

Gets balance of the provided address
Parameters:
Name Type Default Description
props object {} API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
address string Address to check balance
defaultBlock number | string <optional>
Redefines of web3.eth.defaultBlock
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with balance of the provided address

(async) getBlock(props)

Returns block data
Parameters:
Name Type Default Description
props object {} API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
blockId string <optional>
block number or hash. Or the string "earliest"/"latest"/"pending"
returnTransactionObjects boolean <optional>
return all transactions as objects if true
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with block data

(async) getBlockNumber(props)

Gets current block number
Parameters:
Name Type Default Description
props object {} API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with current block number

(async) getContractGasLimit(method, args)

Gets gas limit for the contract transaction
Parameters:
Name Type Description
method function Contract method that used to send transaction
args array Contract method argumets
Source:
Returns:
Promise that will be resolved with estimate gas for sending of the contract transaction

getContractInstance(payload) → {object}

Gets contract instance
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Description
contractAddress string Contract address
interfaceName string Interface name
Source:
Returns:
Contract instance
Type
object

(async) getContractRawTx(payload)

Gets raw contract transaction data
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
contractAddress string Contract address
gasLimit BigNumber <optional>
Gas limit for the contract transaction
gasPrice BigNumber <optional>
Gas price for the transaction
nonce number <optional>
Nonce for the transaction
address string Address of the transaction sender
contractMethod function Contract method that used to send transaction
args array Contract method arguments
Source:
Returns:
Promise that will be resolved with raw contract transaction data

(async) getEvents(Event, optionsopt)

Gets past events
Parameters:
Name Type Attributes Default Description
Event function Function to get past events
options object <optional>
{} Event options
Properties
Name Type Attributes Description
filter object <optional>
Filter options by indexed event parameters
fromBlock number | string <optional>
The number of the earliest block
toBlock number | string <optional>
The number of the latest block
address string | Array.<string> <optional>
An address(es) to get logs from
topics Array.<string> <optional>
Allows to manually set the topics for the event filter
Source:
Returns:
Promise that will be resolved with past events

(async) getGasLimit(props)

Gets gas limit for the transaction
Parameters:
Name Type Description
props object Properties of the web3.eth.estimateGas function
Source:
Returns:
Promise that will be resolved with estimate gas for sending of the transaction

(async) getLogs(optionsopt)

Gets past logs
Parameters:
Name Type Attributes Default Description
options object <optional>
{} Filter options
Properties
Name Type Attributes Description
fromBlock number | string <optional>
The number of the earliest block
toBlock number | string <optional>
The number of the latest block
address string | Array.<string> <optional>
An address(es) to get logs from
topics Array.<string> <optional>
Allows to manually set the topics for the event filter
Source:
Returns:
Promise that will be resolved with past logs

(async) getLogsFilter(props)

Returns object for filtering of logs
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
options object <optional>
Filter options (@see filter)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the filter object (@see filter)

(async) getPastContractEvents(payload)

Gets past contract events
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
event string Event name
options object <optional>
Event options (@see getEvents)
contractInstance object Contract instance
Source:
Returns:
Promise that will be resolved with past events (@see getEvents)

(async) getPastETHLogs(payload)

Gets past ETH logs
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
options object <optional>
Event options (@see getLogs)
Source:
Returns:
Promise that will be resolved with past logs (@see getLogs)

(async) getPastEvents(props)

Gets past events
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
event string Event name (@see subscribe)
options object <optional>
Event options (@see subscribe)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the event logs (@see getPast)

(async) getPastEvents()

Wrapper for getPastContractEvents function (@see getPastContractEvents)
Source:

(async) getPastEvents(props)

Gets past events
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
event string Event name (@see subscribe)
options object <optional>
Event options (@see subscribe)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the event logs (@see getPast)

(async) getPastLogs()

Wrapper for getPastETHLogs function (@see getPastETHLogs)
Source:

(async) getPastLogs(props)

Gets past events
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
options object <optional>
Logs options (@see filter)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the event logs (@see getLogs)

(async) getRawTx(props)

Gets raw transaction data
Parameters:
Name Type Description
props object Properties
Properties
Name Type Attributes Description
address string Address of the transaction sender
to string Address of the transaction receiver
value BigNumber Transaction value
gasLimit BigNumber <optional>
Gas limit for the transaction
gasPrice BigNumber <optional>
Gas price for the transaction
nonce number <optional>
Nonce for the transaction
data string <optional>
Transaction data
Source:
Returns:
Promise that will be resolved with raw transaction data

(async) getTransaction(props)

Returns transaction data
Parameters:
Name Type Default Description
props object {} API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
transactionHash string Transaction hash
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with transaction data

(async) getTransactionReceipt(props)

Returns the receipt of a transaction
Parameters:
Name Type Default Description
props object {} API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
transactionHash string Transaction hash
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with transaction receipt

memoize(fn)

Caches result of some function
Parameters:
Name Type Description
fn function Function to memoize
Source:
Returns:
Result from cache (if exists) or result of the provided function excecution

(async) mint(props)

Mint tokens
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
privateKey string Private key (64 hex symbols, without '0x' prefix)
account string Address of account to mint tokens to
value BigNumber Transaction value
gasLimit BigNumber <optional>
Gas limit for the transaction
gasPrice BigNumber <optional>
Gas price for the transaction
nonce number <optional>
Nonce for the transaction
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the hash of created contract transaction

(async) MintEvent(props)

Subscribes to MintEvent event
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
options object <optional>
Event options (@see subscribe)
callback function <optional>
Event callback (@see subscribe)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the event emitter (@see subsribe)

(async) name(props)

Gets token name
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the token name

(async) sendContractTransaction(payload)

Sends contract transaction
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Description
privateKey string Private key (64 hex symbols, without '0x' prefix)
contractInstance object Contract instance
interfaceName string Interface name
method string Method name
args array Method arguments
Source:
Returns:
Promise that will be resolved with the hash of the contract transaction

(async) sendETHTransaction(payload)

Sends transaction
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object Method properties
Properties
Name Type Attributes Description
privateKey string Private key (64 hex symbols, without '0x' prefix)
to string Address of the transaction receiver
value BigNumber Transaction value
gasLimit BigNumber <optional>
Gas limit for the transaction
gasPrice BigNumber <optional>
Gas price for the transaction
nonce number <optional>
Nonce for the transaction
data string <optional>
Transaction data
Source:
Returns:
Promise that will be resolved with the hash of the transaction

(async) sendTransaction(props)

Sends transaction
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
privateKey string Private key (64 hex symbols, without '0x' prefix)
to string Address of the transaction receiver
value BigNumber Transaction value (in wei)
gasLimit BigNumber <optional>
Gas limit for the transaction
gasPrice BigNumber <optional>
Gas price for the transaction
nonce number <optional>
Nonce for the transaction
data string <optional>
Transaction data
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the hash of created transaction

(async) sendTransaction()

Wrapper for sendContractTransaction function (@see sendContractTransaction)
Source:

(async) sendTransaction()

Wrapper for sendETHTransaction function (@see sendETHTransaction)
Source:

signTx(rawTx, privateKey) → {string}

Signs raw transaction data with the specified private key
Parameters:
Name Type Description
rawTx object Transaction data
privateKey string Private key (64 hex symbols, without '0x' prefix)
Source:
Returns:
Serialized string of signed transaction
Type
string

subscribe(Event, optionsopt, callbackopt) → {object}

Subscribes to provided event
Parameters:
Name Type Attributes Default Description
Event function Function for event subscribing
options object <optional>
{} Event options
Properties
Name Type Attributes Description
filter object <optional>
Filter options by indexed event parameters
fromBlock number | string <optional>
The number of the earliest block
toBlock number | string <optional>
The number of the latest block
address string | Array.<string> <optional>
An address(es) to get logs from
topics Array.<string> <optional>
Allows to manually set the topics for the event filter
callback eventCallback <optional>
Callback which fired for each event or error
Source:
Returns:
The event emitter has the following events:
- data: Fires on each incoming event with the event object as argument
- error: Fires when an error in the subscription occours
Type
object

subscribeToContractEvent(payload) → {object}

Subscribes to specific contract event
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
options object <optional>
Event options (@see subscribe)
callback eventCallback <optional>
Event callback (@see subscribe)
contractInstance object Contract instance
method string Event name
Source:
Returns:
The event emitter (@see subscribe)
Type
object

(async) subscribeToEvent()

Wrapper for subscribeToContractEvent function (@see subscribeToContractEvent)
Source:

(async) symbol(props)

Gets token symbol
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the token symbol

(async) totalSupply(props)

Gets total supply of tokens
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the total supply of tokens

(async) transfer(props)

Transfers tokens
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
privateKey string Private key (64 hex symbols, without '0x' prefix)
to string Address of tokens receiver
value BigNumber Transaction value
gasLimit BigNumber <optional>
Gas limit for the transaction
gasPrice BigNumber <optional>
Gas price for the transaction
nonce number <optional>
Nonce for the transaction
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the hash of created contract transaction

(async) Transfer(props)

Subscribes to Transfer event
Parameters:
Name Type Description
props object API function properties
Properties
Name Type Attributes Description
rpcaddr string RPC address of Ethereum node to connect on
rpcport number RPC port of Ethereum node to connect on
contractAddress string Contract address
options object <optional>
Event options (@see subscribe)
callback function <optional>
Event callback (@see subscribe)
ssl boolean <optional>
Defines using of ssl for connection or not
Source:
Returns:
Promise that will be resolved with the event emitter (@see subsribe)

(async) validate(payload)

Validates input parameters by schema
Parameters:
Name Type Description
payload object Payload object
Properties
Name Type Description
props object API function properties
interfaceName string Interface name
method string API function name
args array API function arguments
Source:
Returns:
Promise that will be resolved with received payload comprising validated properties

Type Definitions

BigNumber

Type:
  • Object
Properties:
Name Type Attributes Description
isBigNumber boolean <optional>
type identifier, optional, because supported from v3.1.0
c Array.<number> coefficient
e number exponent
s number sign
Source:

eventCallback(error, event)

Parameters:
Name Type Description
error Object
event Object
Source:

Events

subscribeDataEvent

Data event
Type:
  • object
Source:

subscribeErrorEvent

Error event
Type:
  • object
Source: