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
Modifier and TypeFieldDescriptionstatic final long
Minimum base fee for transactions. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSignature
(DecoratedSignature signature) Adds a signature to the transaction's existing list of signatures.static AbstractTransaction
fromEnvelopeXdr
(String envelope, Network network) Creates aTransaction
instance from previously buildTransactionEnvelope
static AbstractTransaction
fromEnvelopeXdr
(TransactionEnvelope envelope, Network network) Creates aAbstractTransaction
instance from previously buildTransactionEnvelope
@NonNull Network
The 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.void
sign
(byte @NonNull [] preimage) Adds a new sha256Hash signature to this transaction by revealing preimage.void
Adds a new signature ed25519PublicKey to this transaction.abstract byte[]
Returns signature base.abstract TransactionEnvelope
Returns 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
-KeyPair
object 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 aAbstractTransaction
instance from previously buildTransactionEnvelope
- Parameters:
envelope
- the transaction envelopenetwork
- the network that the transaction is to be submitted to- Returns:
- the
Transaction
orFeeBumpTransaction
instance
-
fromEnvelopeXdr
Creates aTransaction
instance from previously buildTransactionEnvelope
- Parameters:
envelope
- Base-64 encodedTransactionEnvelope
- Returns:
- the
Transaction
orFeeBumpTransaction
instance - 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.
-