Skip to content

Transaction

The Transaction type provides access to data pertaining to a currently invoking transaction on a running smart contract.

To access the Transaction type you need a Context.

getContext()

Call getContext() from within a permitted specific annotated function.

From here, use the transaction() function to return the Transaction data.

var context = getContext();
var tx = context.transaction();

With the variable tx, you now have access to a number of transaction functions.

digest()

The digest() function returns the hash of the transaction in UInt256 form.

var context = getContext();
var tx = context.transaction();
var tx_digest = tx.digest();

from()

The from() function returns the Address of the transaction sender.

var context = getContext();
var tx = context.transaction();
var tx_sender = tx.from();

transfers()

transfers() returns an array of Transfer types.

var context = getContext();
var tx = context.transaction();
var tx_transfer = tx.transfers();

getTotalTransferAmount()

The getTotalTransferAmount() returns a value for the total transfer amount in UInt64.

var context = getContext();
var tx = context.transaction();
var tx_total_amount = tx.getTotalTransferAmount();

validFrom()

The validFrom() function returns the starting block index.

var context = getContext();
var tx = context.transaction();
var tx_valid_from = tx.validFrom();

validUntil()

The validUntil() function returns a future block index.

var context = getContext();
var tx = context.transaction();
var tx_valid_until = tx.validUntil();

chargeRate()

The chargeRate() function returns the charge rate in UInt64.

var context = getContext();
var tx = context.transaction();
var tx_charge_rate = tx.chargeRate();

chargeLimit()

The chargeLimit() function returns the limit to the transaction charge in UInt64.

var context = getContext();
var tx = context.transaction();
var tx_charge_limit = tx.chargeLimit();

contractDigest()

The contractDigest() function returns the hash of the contract string in UInt256 form.

var context = getContext();
var tx = context.transaction();
var tx_contract_digest = tx.contractDigest();

contractAddress()

The contractAddress() function returns the unique contract Address.

var context = getContext();
var tx = context.transaction();
var tx_contract_address = tx.contractAddress();

action()

The action() function returns the name of the currently invoking @action function.

var context = getContext();
var tx = context.transaction();
var tx_action = tx.action();

signatories()

The signatories() function returns an array of Address types.

var context = getContext();
var tx = context.transaction();
var tx_signatories = tx.signatories();

Example

Note

Coming soon.