TransactionBuilderAccount
in
Interface for accounts used in transaction building.
Provides the contract for accessing account information needed to build and submit transactions. Implementations must provide account identification, sequence number management, and support for muxed accounts.
The sequence number is critical for transaction ordering and replay prevention. Each transaction must use a sequence number greater than the account's current sequence number on the ledger.
Tags
Table of Contents
Methods
- getAccountId() : string
- Gets the account ID (public key) as a string.
- getIncrementedSequenceNumber() : BigInteger
- Gets the sequence number incremented by one.
- getMuxedAccount() : MuxedAccount
- Gets the muxed account representation.
- getSequenceNumber() : BigInteger
- Gets the current sequence number for the account.
- incrementSequenceNumber() : void
- Increments the account's sequence number by one.
Methods
getAccountId()
Gets the account ID (public key) as a string.
public
getAccountId() : string
Returns the account's public key in StrKey format (G... address). This is used as the source account for transactions.
Return values
string —The account's public key in StrKey format
getIncrementedSequenceNumber()
Gets the sequence number incremented by one.
public
getIncrementedSequenceNumber() : BigInteger
Returns the next sequence number that should be used for a transaction without modifying the account's internal state. This is useful for previewing the next sequence number before building a transaction.
Return values
BigInteger —The sequence number plus one
getMuxedAccount()
Gets the muxed account representation.
public
getMuxedAccount() : MuxedAccount
Returns a MuxedAccount object that wraps the account ID. Muxed accounts allow multiple virtual accounts to share the same underlying account ID, useful for payment routing and account management.
Return values
MuxedAccount —The muxed account object
getSequenceNumber()
Gets the current sequence number for the account.
public
getSequenceNumber() : BigInteger
Returns the account's current sequence number, which represents the number of transactions this account has submitted. The next transaction from this account must use sequence number + 1.
Return values
BigInteger —The account's current sequence number
incrementSequenceNumber()
Increments the account's sequence number by one.
public
incrementSequenceNumber() : void
Modifies the account's internal sequence number, typically called after a transaction is successfully built. This ensures subsequent transactions use the correct sequence number.
Note: This only updates the local state. The on-ledger sequence number is only updated when the transaction is successfully submitted and included.