AccountResponse
public class AccountResponse : Decodable, TransactionAccount, @unchecked Sendable
Represents a Stellar account with all its properties and balances.
Contains complete account information including balances, signers, thresholds, flags, sequence number, and sponsorship data. This is the main data structure returned when querying account details from Horizon.
Example usage:
let sdk = StellarSDK()
let response = await sdk.accounts.getAccountDetails(accountId: "GACCOUNT...")
switch response {
case .success(let account):
// Access account properties
print("Account ID: \(account.accountId)")
print("Sequence: \(account.sequenceNumber)")
// Check balances
for balance in account.balances {
if balance.assetType == AssetTypeAsString.NATIVE {
print("XLM Balance: \(balance.balance)")
} else {
print("\(balance.assetCode ?? ""): \(balance.balance)")
}
}
// Check signers
for signer in account.signers {
print("Signer: \(signer.key) weight: \(signer.weight)")
}
// Use for transaction building
let transaction = try Transaction(
sourceAccount: account,
operations: [/* ... */],
memo: Memo.none,
timeBounds: nil
)
case .failure(let error):
print("Error: \(error)")
}
See also:
- Stellar developer docs
- AccountService for querying accounts
-
Navigation links related to this account including transactions, operations, and payments.
Declaration
Swift
public let links: AccountLinksResponse -
The account ID (public key), always starts with ‘G’.
Declaration
Swift
public let accountId: String -
KeyPair instance for this account containing the public key.
Declaration
Swift
public let keyPair: KeyPair -
Current sequence number. Must be incremented for each transaction from this account.
Declaration
Swift
public var sequenceNumber: Int64 { get } -
Number of subentries (trustlines, offers, data entries, etc.) owned by this account. Affects the minimum balance requirement.
Declaration
Swift
public let subentryCount: UInt -
Paging token for cursor-based pagination.
Declaration
Swift
public let pagingToken: String -
Account designated to receive inflation (deprecated feature).
Declaration
Swift
public let inflationDestination: String? -
Home domain for this account. Used for federation and stellar.toml lookup.
Declaration
Swift
public let homeDomain: String? -
Signature thresholds for low, medium, and high security operations.
Declaration
Swift
public let thresholds: AccountThresholdsResponse -
Account flags (auth required, auth revocable, auth immutable, auth clawback enabled).
Declaration
Swift
public let flags: AccountFlagsResponse -
Array of all asset balances including native XLM and issued assets.
Declaration
Swift
public let balances: [AccountBalanceResponse] -
Array of account signers with their public keys and signing weights.
Declaration
Swift
public let signers: [AccountSignerResponse] -
Key-value data entries attached to this account. Values are base64 encoded.
Declaration
Swift
public let data: [String : String] -
Account ID of the sponsor for this account’s base reserve (if sponsored).
Declaration
Swift
public let sponsor: String? -
Number of reserves this account is currently sponsoring for other accounts.
Declaration
Swift
public let numSponsoring: Int -
Number of reserves being sponsored for this account by others.
Declaration
Swift
public let numSponsored: Int -
Ledger sequence number when the sequence number was last updated.
Declaration
Swift
public let sequenceLedger: Int? -
Timestamp when the sequence number was last updated (ISO 8601).
Declaration
Swift
public let sequenceTime: String? -
Ledger sequence number when this account was last modified.
Declaration
Swift
public let lastModifiedLedger: Int -
Timestamp when this account was last modified (ISO 8601).
Declaration
Swift
public let lastModifiedTime: String? -
Initializer - creates a new instance by decoding from the given decoder.
Declaration
Swift
public required init(from decoder: Decoder) throwsParameters
decoderThe decoder containing the data
-
Returns sequence number incremented by one, but does not increment internal counter.
Declaration
Swift
public func incrementedSequenceNumber() -> Int64 -
Increments sequence number in this object by one.
Declaration
Swift
public func incrementSequenceNumber() -
Declaration
Swift
public func decrementSequenceNumber()
View on GitHub
Install in Dash