Methods
buildCreateContractTransaction(String, Number, Number, Number, transactionopt)
- Source:
This is a helper function to build a create-contract transaction
the transaction object takes at least 5 fields, value(unit is 1e-8 ECO), confirmations, isStake, hash and pos
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bitcoinjs-lib.KeyPair |
keyPair | ||
String |
code The contract byte code | ||
Number |
gasLimit | ||
Number |
gasPrice(unit: 1e-8 ECO/gas) | ||
Number |
fee(unit: ECO) | ||
transaction |
<optional> |
utxoList |
Returns:
String the built tx
buildPubKeyHashTransaction(String, Number, Number, transactionopt)
- Source:
This is a helper function to build a pubkeyhash transaction
the transaction object takes at least 5 fields, value(unit is 1e-8 ECO), confirmations, isStake, hash and pos
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bitcoinjs-lib.KeyPair |
keyPair | ||
String |
to | ||
Number |
amount(unit: ECO) | ||
Number |
fee(unit: ECO) | ||
transaction |
<optional> |
utxoList |
Returns:
String the built tx
buildSendToContractTransaction(String, String, Number, Number, Number, transactionopt)
- Source:
This is a helper function to build a send-to-contract transaction
the transaction object takes at least 5 fields, value(unit is 1e-8 ECO), confirmations, isStake, hash and pos
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bitcoinjs-lib.KeyPair |
keyPair | ||
String |
contractAddress The contract address | ||
String |
encodedData The encoded abi data | ||
Number |
gasLimit | ||
Number |
gasPrice(unit: 1e-8 ECO/gas) | ||
Number |
fee(unit: ECO) | ||
transaction |
<optional> |
utxoList |
Returns:
String the built tx
fromUtf8(string, optional) → {String}
- Source:
Should be called to get hex representation (prefixed by 0x) of utf8 string
Parameters:
Name | Type | Description |
---|---|---|
string |
String | |
optional |
Number | padding |
Returns:
hex representation of input string
- Type
- String
hex2Buffer(hexString)
- Source:
function that converts a hex string to a buffer
Parameters:
Name | Type | Description |
---|---|---|
hexString |
Returns:
a buffer
isEcoAddress() → {Boolean}
- Source:
Returns true if given string is valid ecochain address
Parameters:
Type | Description |
---|---|
String |
Returns:
- Type
- Boolean
isJson() → {Boolean}
- Source:
Returns true if given string is valid json object
Parameters:
Type | Description |
---|---|
String |
Returns:
- Type
- Boolean
number2Buffer(number)
- Source:
function that converts a number to a buffer
Parameters:
Name | Type | Description |
---|---|---|
number |
Returns:
a buffer
selectTxs(transactionopt, Number, Number)
- Source:
This is a function for selecting ecochain utxos to build transactions
the transaction object takes at least 3 fields, value(unit is 1e-8 ECO) , confirmations and isStake
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
<optional> |
unspentTransactions | |
Number |
amount(unit: ECO) | ||
Number |
fee(unit: ECO) |
Returns:
[transaction]
toUtf8(string) → {String}
- Source:
Should be called to get utf8 from it's hex representation
Parameters:
Name | Type | Description |
---|---|---|
string |
String | in hex |
Returns:
ascii string representation of hex value
- Type
- String