Class AbstractTransaction<TxModel extends AbstractTransactionModel<?>>

java.lang.Object
com.kryptokrauts.aeternity.sdk.service.transaction.type.AbstractTransaction<TxModel>
Type Parameters:
TxModel - a TransactionModel class that extends AbstractTransactionModel
Direct Known Subclasses:
AbstractTransactionWithInnerTx, ChannelCloseMutualTransaction, ChannelCloseSoloTransaction, ChannelCreateTransaction, ChannelDepositTransaction, ChannelSettleTransaction, ChannelSlashTransaction, ChannelSnapshotSoloTransaction, ChannelWithdrawTransaction, ContractCallTransaction, ContractCreateTransaction, GeneralizedAccountsAttachTransaction, NameClaimTransaction, NamePreclaimTransaction, NameRevokeTransaction, NameTransferTransaction, NameUpdateTransaction, OracleExtendTransaction, OracleQueryTransaction, OracleRegisterTransaction, OracleRespondTransaction, PayingForTransaction, SpendTransaction

public abstract class AbstractTransaction<TxModel extends AbstractTransactionModel<?>>
extends java.lang.Object
this abstract class is the base of all transactions and wraps the calculation of transaction fees by using a default fee, generating the RLP and gaining the byte size of the transaction
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected TxModel model  
  • Constructor Summary

    Constructors
    Constructor Description
    AbstractTransaction()  
  • Method Summary

    Modifier and Type Method Description
    protected void checkZeroAndWriteValue​(org.apache.tuweni.rlp.RLPWriter rlpWriter, java.math.BigInteger value)
    check if value is 0
    if so, serialize as byte, otherwise serialize value as BigInteger
    protected abstract <T extends UnsignedTx>
    io.reactivex.Single<T>
    createInternal()
    this method needs to be implemented for testing purposes (non native mode)
    abstract org.apache.tuweni.bytes.Bytes createRLPEncodedList()
    generates a Bytes object from the attributes.
    io.reactivex.Single<UnsignedTx> createUnsignedTransaction​(boolean nativeMode, long minimalGasPrice)
    this method creates an unsigned transaction whether in native or debug mode if no fee is defined (null), the fee will be calculated based on the transactions byte size and maybe other transaction attributes using the fee calculation model
    protected FeeCalculationModel getFeeCalculationModel()
    fee calculation model for this transaction type, one of FeeCalculationModel
    TxModel getModel()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AbstractTransaction

      public AbstractTransaction()
  • Method Details

    • getFeeCalculationModel

      protected FeeCalculationModel getFeeCalculationModel()
      fee calculation model for this transaction type, one of FeeCalculationModel
      Returns:
      instance of the FeeCalculationModel to use for fee calculation
    • createRLPEncodedList

      public abstract org.apache.tuweni.bytes.Bytes createRLPEncodedList()
      generates a Bytes object from the attributes. this is necessary for calculating the fee based on RLP encoding
      Returns:
      Bytes
    • createInternal

      protected abstract <T extends UnsignedTx> io.reactivex.Single<T> createInternal()
      this method needs to be implemented for testing purposes (non native mode)
      Type Parameters:
      T - type that extends UnsignedTx
      Returns:
      a single-wrapped unsignedTx object
    • createUnsignedTransaction

      public io.reactivex.Single<UnsignedTx> createUnsignedTransaction​(boolean nativeMode, long minimalGasPrice)
      this method creates an unsigned transaction whether in native or debug mode if no fee is defined (null), the fee will be calculated based on the transactions byte size and maybe other transaction attributes using the fee calculation model
      Parameters:
      nativeMode - native or debug mode
      minimalGasPrice - the minimal gas price, which the fee is multiplied with
      Returns:
      a single-wrapped unsignedTx object
    • checkZeroAndWriteValue

      protected void checkZeroAndWriteValue​(org.apache.tuweni.rlp.RLPWriter rlpWriter, java.math.BigInteger value)
      check if value is 0
      if so, serialize as byte, otherwise serialize value as BigInteger
      Parameters:
      rlpWriter - instance of RLPWriter
      value - the value to check for BigInteger.ZERO
    • getModel

      public TxModel getModel()