Class PreconditionsV2

java.lang.Object
org.stellar.sdk.xdr.PreconditionsV2
All Implemented Interfaces:
XdrElement

public class PreconditionsV2 extends Object implements XdrElement
PreconditionsV2's original definition in the XDR file is:
 struct PreconditionsV2
 {
     TimeBounds* timeBounds;

     // Transaction only valid for ledger numbers n such that
     // minLedger <= n < maxLedger (if maxLedger == 0, then
     // only minLedger is checked)
     LedgerBounds* ledgerBounds;

     // If NULL, only valid when sourceAccount's sequence number
     // is seqNum - 1.  Otherwise, valid when sourceAccount's
     // sequence number n satisfies minSeqNum <= n < tx.seqNum.
     // Note that after execution the account's sequence number
     // is always raised to tx.seqNum, and a transaction is not
     // valid if tx.seqNum is too high to ensure replay protection.
     SequenceNumber* minSeqNum;

     // For the transaction to be valid, the current ledger time must
     // be at least minSeqAge greater than sourceAccount's seqTime.
     Duration minSeqAge;

     // For the transaction to be valid, the current ledger number
     // must be at least minSeqLedgerGap greater than sourceAccount's
     // seqLedger.
     uint32 minSeqLedgerGap;

     // For the transaction to be valid, there must be a signature
     // corresponding to every Signer in this array, even if the
     // signature is not otherwise required by the sourceAccount or
     // operations.
     SignerKey extraSigners<2>;
 };
 
  • Constructor Details

    • PreconditionsV2

      public PreconditionsV2()
    • PreconditionsV2

      public PreconditionsV2(TimeBounds timeBounds, LedgerBounds ledgerBounds, SequenceNumber minSeqNum, Duration minSeqAge, Uint32 minSeqLedgerGap, SignerKey[] extraSigners)
      Creates a new PreconditionsV2 instance.
      Parameters:
      timeBounds - the timeBounds field value
      ledgerBounds - the ledgerBounds field value
      minSeqNum - the minSeqNum field value
      minSeqAge - the minSeqAge field value
      minSeqLedgerGap - the minSeqLedgerGap field value
      extraSigners - the extraSigners field value
  • Method Details

    • encode

      public void encode(XdrDataOutputStream stream) throws IOException
      Description copied from interface: XdrElement
      Encodes this value to XDR and writes it to the provided stream.
      Specified by:
      encode in interface XdrElement
      Parameters:
      stream - the destination XDR output stream
      Throws:
      IOException - if an I/O error occurs while writing the value
    • decode

      public static PreconditionsV2 decode(XdrDataInputStream stream, int maxDepth) throws IOException
      Throws:
      IOException
    • decode

      public static PreconditionsV2 decode(XdrDataInputStream stream) throws IOException
      Throws:
      IOException
    • fromXdrBase64

      public static PreconditionsV2 fromXdrBase64(String xdr) throws IOException
      Throws:
      IOException
    • fromXdrByteArray

      public static PreconditionsV2 fromXdrByteArray(byte[] xdr) throws IOException
      Throws:
      IOException
    • toJson

      public String toJson()
      Description copied from interface: XdrElement
      Serializes this value to JSON.
      Specified by:
      toJson in interface XdrElement
      Returns:
      the JSON representation of this value
    • fromJson

      public static PreconditionsV2 fromJson(String json)
    • builder

      public static PreconditionsV2.PreconditionsV2Builder builder()
    • toBuilder

    • getTimeBounds

      public TimeBounds getTimeBounds()
      Value of the timeBounds field.
      Returns:
      the timeBounds field value
    • getLedgerBounds

      public LedgerBounds getLedgerBounds()
      Value of the ledgerBounds field.
      Returns:
      the ledgerBounds field value
    • getMinSeqNum

      public SequenceNumber getMinSeqNum()
      Value of the minSeqNum field.
      Returns:
      the minSeqNum field value
    • getMinSeqAge

      public Duration getMinSeqAge()
      Value of the minSeqAge field.
      Returns:
      the minSeqAge field value
    • getMinSeqLedgerGap

      public Uint32 getMinSeqLedgerGap()
      Value of the minSeqLedgerGap field.
      Returns:
      the minSeqLedgerGap field value
    • getExtraSigners

      public SignerKey[] getExtraSigners()
      Value of the extraSigners field.
      Returns:
      the extraSigners field value
    • setTimeBounds

      public void setTimeBounds(TimeBounds timeBounds)
      Value of the timeBounds field.
      Parameters:
      timeBounds - the timeBounds field value
    • setLedgerBounds

      public void setLedgerBounds(LedgerBounds ledgerBounds)
      Value of the ledgerBounds field.
      Parameters:
      ledgerBounds - the ledgerBounds field value
    • setMinSeqNum

      public void setMinSeqNum(SequenceNumber minSeqNum)
      Value of the minSeqNum field.
      Parameters:
      minSeqNum - the minSeqNum field value
    • setMinSeqAge

      public void setMinSeqAge(Duration minSeqAge)
      Value of the minSeqAge field.
      Parameters:
      minSeqAge - the minSeqAge field value
    • setMinSeqLedgerGap

      public void setMinSeqLedgerGap(Uint32 minSeqLedgerGap)
      Value of the minSeqLedgerGap field.
      Parameters:
      minSeqLedgerGap - the minSeqLedgerGap field value
    • setExtraSigners

      public void setExtraSigners(SignerKey[] extraSigners)
      Value of the extraSigners field.
      Parameters:
      extraSigners - the extraSigners field value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object