Package nxt.addons
Class AbstractOperationContext
java.lang.Object
nxt.addons.AbstractContractContext
nxt.addons.AbstractOperationContext
- Direct Known Subclasses:
TransactionContext,VoucherContext
-
Nested Class Summary
Nested classes/interfaces inherited from class nxt.addons.AbstractContractContext
AbstractContractContext.EventSource -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final longprotected final intprotected final byte[]Fields inherited from class nxt.addons.AbstractContractContext
chainById, chainByName, config, contractName, contractSetupParameters, FEE_CANNOT_CALCULATE, FEE_EXCEEDS_AMOUNT, INTERNAL_ERROR_CODE_THRESHOLD, MANAGED_ACCOUNTS_INDEX_HINT_FIELD, MESSAGE_TO_ENCRYPT_WITHOUT_SECRET_PHRASE, response, source, VALIDATE_SAME_ACCOUNT_CODE, VALIDATE_SAME_CHAIN, VALIDATE_SAME_TRANSACTION_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionAbstractOperationContext(byte[] fullHash, int chainId, long blockId, ContractRunnerConfig config, JO runtimeParams, String contractName, String seed) -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the child chain amount of the trigger transactionReturns the chain object of the trigger transactionprotected JOlongReturns the random seed used by the contract to generate random numberslongReturns the numeric id of the recipient accountReturns the parameters passed to this contract invocationlongReturns the numeric id of the sender accountabstract TransactionResponseReturns an object representing the trigger transaction dataprotected abstract JOReturns the Json representation of the trigger transaction databooleanisSameChain(int chainId) Returns true if the chain id is equal to the trigger transaction chain idbooleanDeprecated.booleanReturns 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 runnerbooleanReturns true if the trigger transaction is not a send money transactionbooleannotSameChain(int chainId) Returns true if the chain id is not equal to the trigger transaction chain idbooleanReturns 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 accountbooleanReturns 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 accountbooleanvalidateSameAccount(String attribute) Returns true if the account id resolved from the attribute is the same account as the contract runner accountMethods inherited from class nxt.addons.AbstractContractContext
addTriggerData, canSetResponse, createTransaction, createTransaction, createTransaction, fullHashToId, fullHashToId, generateErrorResponse, generateInfoResponse, generateInternalErrorResponse, generateResponse, getAccount, getAccountRs, getBlock, getBlockchainConstants, getBlockchainHeight, getChain, getChain, getConfig, getContext, getContractName, getContractRunnerConfigParams, getContractSetupParameters, getHash, getHash, getNetworkType, getParams, getParentChain, getPublicKey, getPublicKey, getPublicKey, getPublicKeyHexString, getRandomnessSource, getResponse, getSource, initRandom, isPermissionGranted, loadContract, logErrorMessage, logInfoMessage, parseAccountId, parseHexString, publicKeyToAccountId, publicKeyToAccountId, rsAccount, setContractSetupParameters, setResponse, sign, toHexString, verify
-
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
Returns the Json representation of the trigger transaction data- Returns:
- the Json representation of the trigger transaction data
-
getTransaction
Returns an object representing the trigger transaction data- Returns:
- an object representing the trigger transaction data
-
getRuntimeParams
Returns the parameters passed to this contract invocation- Overrides:
getRuntimeParamsin classAbstractContractContext- 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
Returns the chain object of the trigger transaction- Returns:
- the chain object
-
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
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
- Overrides:
getPhasingAttachmentin classAbstractContractContext
-