Package nxt.addons

Class AbstractOperationContext

java.lang.Object
nxt.addons.AbstractContractContext
nxt.addons.AbstractOperationContext
Direct Known Subclasses:
TransactionContext, VoucherContext

public abstract class AbstractOperationContext extends AbstractContractContext
  • Field Details

    • fullHash

      protected final byte[] fullHash
    • chain

      protected final int chain
    • blockId

      protected final long blockId
  • Constructor Details

    • AbstractOperationContext

      public AbstractOperationContext(byte[] fullHash, int chainId, long blockId, ContractRunnerConfig config, JO runtimeParams, String contractName, String seed)
  • Method Details

    • getTransactionJson

      protected abstract JO getTransactionJson()
      Returns the Json representation of the trigger transaction data
      Returns:
      the Json representation of the trigger transaction data
    • getTransaction

      public abstract TransactionResponse getTransaction()
      Returns an object representing the trigger transaction data
      Returns:
      an object representing the trigger transaction data
    • getRuntimeParams

      public JO getRuntimeParams()
      Returns the parameters passed to this contract invocation
      Overrides:
      getRuntimeParams in class AbstractContractContext
      Returns:
      the parameters passed to this contract invocation
    • getAmountNQT

      public long getAmountNQT()
      Returns the child chain amount of the trigger transaction
      Returns:
      the amount in NQT
    • getSenderId

      public long getSenderId()
      Returns the numeric id of the sender account
      Returns:
      the numeric id of the sender account
    • getRecipientId

      public long getRecipientId()
      Returns the numeric id of the recipient account
      Returns:
      the numeric id of the recipient account
    • getChainOfTransaction

      public ChainWrapper getChainOfTransaction()
      Returns the chain object of the trigger transaction
      Returns:
      the chain object
    • isSameRecipient

      @Deprecated public boolean isSameRecipient()
      Deprecated.
      Returns true if the trigger transaction recipient is the same account as the contract runner account in other words, returns true if the trigger transaction was sent to this contract runner
      Returns:
      true if the same recipient, false otherwise
    • notSameRecipient

      public boolean notSameRecipient()
      Returns true if the trigger transaction recipient is not the same account as the contract runner account in other words, returns true if the trigger transaction specified a different recipient than this contract runner account
      Returns:
      true if not the same recipient, false otherwise
    • isSameSender

      public boolean isSameSender()
      Returns true if the trigger transaction sender is the same account as the contract runner account in other words, returns true if the trigger transaction was sent by this contract runner
      Returns:
      true if the same sender, false otherwise
    • notSameSender

      public boolean notSameSender()
      Returns true if the trigger transaction sender is not the same account as the contract runner account in other words, returns true if the trigger transaction was submitted by a different sender than this contract runner account
      Returns:
      true if not the same sender, false otherwise
    • validateSameAccount

      public boolean validateSameAccount(String attribute)
      Returns true if the account id resolved from the attribute is the same account as the contract runner account
      Parameters:
      attribute - the key name whose value represents the account id
      Returns:
      true if the same account, false otherwise
    • notPaymentTransaction

      public boolean notPaymentTransaction()
      Returns true if the trigger transaction is not a send money transaction
      Returns:
      true if the trigger transaction is not a send money transaction, false otherwise
    • isSameChain

      public boolean isSameChain(int chainId)
      Returns true if the chain id is equal to the trigger transaction chain id
      Parameters:
      chainId - the chain id
      Returns:
      true if equal, false otherwise
    • notSameChain

      public boolean notSameChain(int chainId)
      Returns true if the chain id is not equal to the trigger transaction chain id
      Parameters:
      chainId - the chain id
      Returns:
      true if not equal, false otherwise
    • getRandomSeed

      public long getRandomSeed()
      Returns the random seed used by the contract to generate random numbers
      Returns:
      the random seed
    • getPhasingAttachment

      protected JO getPhasingAttachment()
      Overrides:
      getPhasingAttachment in class AbstractContractContext