Class AbstractTransaction<TxModel extends AbstractTransactionModel<?>>
java.lang.Object
com.kryptokrauts.aeternity.sdk.service.transaction.type.AbstractTransaction<TxModel>
- Type Parameters:
TxModel
- a TransactionModel class that extendsAbstractTransactionModel
- 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
-
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 BigIntegerprotected 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 modelprotected FeeCalculationModel
getFeeCalculationModel()
fee calculation model for this transaction type, one ofFeeCalculationModel
TxModel
getModel()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
model
-
-
Constructor Details
-
AbstractTransaction
public AbstractTransaction()
-
-
Method Details
-
getFeeCalculationModel
fee calculation model for this transaction type, one ofFeeCalculationModel
- 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
this method needs to be implemented for testing purposes (non native mode)- Type Parameters:
T
- type that extendsUnsignedTx
- 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 modeminimalGasPrice
- 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 ofRLPWriter
value
- the value to check forBigInteger.ZERO
-
getModel
-