Transaction class¶
-
class
Transaction
()¶ An object of
Transaction()
class is created with factory static methodsNew()
.
Static methods¶
-
sNew
(networkType, transactionType, addressToHex, amount, fee, nonce, timestamp, dataHex, gas, gasPrice)¶ Arguments: - networkType (NetworkType) – A type of network.
- transactionType (TransactionType) – A type of transaction.
- addressToHex (string) – Semux-address in string hexadecimal form.
- amount (string) – Amount of payment (integer value in nanosem).
- fee (string) – Amount of fee (integer value in nanosem).
- nonce (string) – A Nonce (unique and sequential for the sender).
- timestamp (string) – A timestamp of the transaction (in milliseconds).
- dataHex (string) – Some arbitrary text data in string hexadecimal form.
- gas (string) – Amount of gas.
- gasPrice (string) – Gas price (integer value in nanosem).
Returns: object
ofTransaction()
class.Factory method for creating ofTransaction()
class object.Example:var d = new Date(); var network_type = Module.UnoSemuxNetworkType.TESTNET; var transaction_type = Module.UnoSemuxTransactionType.TRANSFER; var to = "0x82c38263217817de2ef28937c7747716eb1e7228"; var data = "0x756E6F2D6C616273206C696768742077616C6C65742064656D6F"; // uno-labs light wallet demo var value = "100000000"; // nanosem var fee = "5000000"; // nanosem var nonce = "533"; // Actually, you have to get it from Node API var gas = "0"; var gas_price = "0"; // nanosem var transaction_rs = new Module.UnoSemuxTransaction.sNew( network_type, transaction_type, String(to), String(value), String(fee), String(nonce), String(d.getTime()), String(data), String(gas), String(gas_price) ); if (typeof transaction_rs.error != "undefined") { console.log(transaction_rs.error); } else { var transaction = transaction_rs.res; }
Class methods¶
-
encode
()¶ Returns: An encoded string
ofTransaction()
object.Method to get an encoded representation of itself.