Class AbstractTransaction

java.lang.Object
org.stellar.sdk.AbstractTransaction
Direct Known Subclasses:
FeeBumpTransaction, Transaction

public abstract class AbstractTransaction extends Object
Abstract class for transaction classes.
  • Field Details

    • MIN_BASE_FEE

      public static final long MIN_BASE_FEE
      Minimum 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

      public void sign(@NonNull @NonNull KeyPair signer)
      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

      public String 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

      public List<DecoratedSignature> getSignatures()
      Gets read only list(immutable) of the signatures on transaction.
      Returns:
      immutable list of signatures
    • addSignature

      public void addSignature(DecoratedSignature signature)
      Adds a signature to the transaction's existing list of signatures.
      Parameters:
      signature - the signature to add
    • toEnvelopeXdr

      public abstract TransactionEnvelope toEnvelopeXdr()
    • toEnvelopeXdrBase64

      public String toEnvelopeXdrBase64()
      Returns base64-encoded TransactionEnvelope XDR object. Transaction need to have at least one signature.
      Returns:
      the base64-encoded TransactionEnvelope XDR object.
    • fromEnvelopeXdr

      public static AbstractTransaction fromEnvelopeXdr(TransactionEnvelope envelope, Network network)
      Creates a AbstractTransaction instance from previously build TransactionEnvelope
      Parameters:
      envelope - the transaction envelope
      network - the network that the transaction is to be submitted to
      Returns:
      the Transaction or FeeBumpTransaction instance
    • fromEnvelopeXdr

      public static AbstractTransaction fromEnvelopeXdr(String envelope, Network network)
      Creates a Transaction instance from previously build TransactionEnvelope
      Parameters:
      envelope - Base-64 encoded TransactionEnvelope
      Returns:
      the Transaction or FeeBumpTransaction 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 signing
      network - the network that the transaction is to be submitted to
      Returns:
      the signature base of this transaction envelope
    • getNetwork

      @NonNull public @NonNull Network getNetwork()
      The network that the transaction is to be submitted to.