Package org.stellar.sdk
Class AbstractTransaction
java.lang.Object
org.stellar.sdk.AbstractTransaction
- Direct Known Subclasses:
FeeBumpTransaction,Transaction
Abstract class for transaction classes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longMinimum base fee for transactions. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSignature(DecoratedSignature signature) Adds a signature to the transaction's existing list of signatures.static AbstractTransactionfromEnvelopeXdr(String envelope, Network network) Creates aTransactioninstance from previously buildTransactionEnvelopestatic AbstractTransactionfromEnvelopeXdr(TransactionEnvelope envelope, Network network) Creates aAbstractTransactioninstance from previously buildTransactionEnvelope@NonNull NetworkThe network that the transaction is to be submitted to.Gets read only list(immutable) of the signatures on transaction.static byte[]getTransactionSignatureBase(TransactionSignaturePayload.TransactionSignaturePayloadTaggedTransaction taggedTransaction, Network network) Get the signature base of this transaction envelope.byte[]hash()Returns transaction hash.hashHex()Returns transaction hash encoded as a hexadecimal string.voidsign(byte @NonNull [] preimage) Adds a new sha256Hash signature to this transaction by revealing preimage.voidAdds a new signature ed25519PublicKey to this transaction.abstract byte[]Returns signature base.abstract TransactionEnvelopeReturns base64-encoded TransactionEnvelope XDR object.
-
Field Details
-
MIN_BASE_FEE
public static final long MIN_BASE_FEEMinimum base fee for transactions. If this fee is below the network minimum, the transaction will fail. The more operations in the transaction, the greater the required fee.- See Also:
-
-
Method Details
-
sign
Adds a new signature ed25519PublicKey to this transaction.- Parameters:
signer-KeyPairobject representing a signer
-
sign
public void sign(byte @NonNull [] preimage) Adds a new sha256Hash signature to this transaction by revealing preimage.- Parameters:
preimage- the sha256 hash of preimage should be equal to signer hash
-
hash
public byte[] hash()Returns transaction hash.- Returns:
- the transaction hash
-
hashHex
Returns transaction hash encoded as a hexadecimal string.- Returns:
- the transaction hash as a hexadecimal string
-
signatureBase
public abstract byte[] signatureBase()Returns signature base.- Returns:
- the signature base
-
getSignatures
Gets read only list(immutable) of the signatures on transaction.- Returns:
- immutable list of signatures
-
addSignature
Adds a signature to the transaction's existing list of signatures.- Parameters:
signature- the signature to add
-
toEnvelopeXdr
-
toEnvelopeXdrBase64
Returns base64-encoded TransactionEnvelope XDR object. Transaction need to have at least one signature.- Returns:
- the base64-encoded TransactionEnvelope XDR object.
-
fromEnvelopeXdr
Creates aAbstractTransactioninstance from previously buildTransactionEnvelope- Parameters:
envelope- the transaction envelopenetwork- the network that the transaction is to be submitted to- Returns:
- the
TransactionorFeeBumpTransactioninstance
-
fromEnvelopeXdr
Creates aTransactioninstance from previously buildTransactionEnvelope- Parameters:
envelope- Base-64 encodedTransactionEnvelope- Returns:
- the
TransactionorFeeBumpTransactioninstance - Throws:
IllegalArgumentException- if the envelope is malformed
-
getTransactionSignatureBase
public static byte[] getTransactionSignatureBase(TransactionSignaturePayload.TransactionSignaturePayloadTaggedTransaction taggedTransaction, Network network) Get the signature base of this transaction envelope.- Parameters:
taggedTransaction- the tagged transaction for signingnetwork- the network that the transaction is to be submitted to- Returns:
- the signature base of this transaction envelope
-
getNetwork
The network that the transaction is to be submitted to.
-