nxt.addons

## Class VoucherContext

- java.lang.Object
- - nxt.addons.AbstractContractContext
  - - nxt.addons.AbstractOperationContext
    - - nxt.addons.VoucherContext

-     public class VoucherContext
      extends AbstractOperationContext

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class nxt.addons.AbstractContractContext

      `AbstractContractContext.EventSource`

  - ### Field Summary

    - ### Fields inherited from class nxt.addons.AbstractOperationContext

      `blockId, chain, fullHash`

    - ### Fields inherited from class nxt.addons.AbstractContractContext

      `chainById, chainByName, config, contractName, FEE_CANNOT_CALCULATE, FEE_EXCEEDS_AMOUNT, INTERNAL_ERROR_CODE_THRESHOLD, MESSAGE_TO_ENCRYPT_WITHOUT_SECRET_PHRASE, source, VALIDATE_SAME_ACCOUNT_CODE, VALIDATE_SAME_CHAIN, VALIDATE_SAME_TRANSACTION_TYPE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VoucherContext(JO voucher, ContractRunnerConfig config, java.lang.String contractName)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected JO` | `addTriggerData(JO jo)`
    `BlockResponse` | `getBlock()` Returns the Json representation of the current block
    `protected java.lang.String` | `getReferencedTransaction()`
    `TransactionResponse` | `getTransaction()` Returns an object representing the trigger transaction data
    `protected JO` | `getTransactionJson()` Returns the Json representation of the trigger transaction data
    `JO` | `getVoucher()` Returns the transaction voucher which triggered this contract execution

    - ### Methods inherited from class nxt.addons.AbstractOperationContext

      `getAmountNQT, getChainOfTransaction, getPhasingAttachment, getRandomSeed, getRecipientId, getRuntimeParams, getSenderId, isSameChain, isSameRecipient, isSameSender, notPaymentTransaction, notSameChain, notSameRecipient, notSameSender, validateSameAccount`

    - ### Methods inherited from class nxt.addons.AbstractContractContext

      `createTransaction, createTransaction, fullHashToId, fullHashToId, generateErrorResponse, generateInfoResponse, generateInternalErrorResponse, generateResponse, getAccount, getAccountRs, getBlockchainConstants, getBlockchainHeight, getChain, getChain, getConfig, getContext, getContractName, getContractRunnerConfigParams, getContractSetupParameters, getHash, getHash, getParams, getParentChain, getPublicKey, getPublicKey, getPublicKeyHexString, getRandomnessSource, getResponse, getSource, initRandom, isPermissionGranted, loadContract, logErrorMessage, logInfoMessage, parseAccountId, parseHexString, publicKeyToAccountId, publicKeyToAccountId, rsAccount, setContractSetupParameters, sign, toHexString, verify`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VoucherContext

          public VoucherContext(JO voucher,
                                ContractRunnerConfig config,
                                java.lang.String contractName)

  - ### Method Detail

    - #### getTransactionJson

          protected JO getTransactionJson()

      Description copied from class: `AbstractOperationContext`
      Returns the Json representation of the trigger transaction data
      Specified by:
        `getTransactionJson` in class `AbstractOperationContext`
      Returns:
        the Json representation of the trigger transaction data

    - #### getTransaction

          public TransactionResponse getTransaction()

      Description copied from class: `AbstractOperationContext`
      Returns an object representing the trigger transaction data
      Specified by:
        `getTransaction` in class `AbstractOperationContext`
      Returns:
        an object representing the trigger transaction data

    - #### getBlock

          public BlockResponse getBlock()

      Description copied from class: `AbstractContractContext`
      Returns the Json representation of the current block
      Specified by:
        `getBlock` in class `AbstractContractContext`
      Returns:
        the current block represented as Json

    - #### addTriggerData

          protected JO addTriggerData(JO jo)

      Overrides:
        `addTriggerData` in class `AbstractContractContext`

    - #### getVoucher

          public JO getVoucher()

      Returns the transaction voucher which triggered this contract execution
      Returns:
        the transaction voucher json format

    - #### getReferencedTransaction

          protected java.lang.String getReferencedTransaction()

      Specified by:
        `getReferencedTransaction` in class `AbstractContractContext`