Description
A Stellar account can be prevented from transacting by an issuer revoking authorisation (freeze) or by being flagged AUTH_IMMUTABLE in a state that prevents future authorisation. Sending payments to or from such accounts results in submission failures that are difficult to distinguish from other errors. A detector should identify accounts in a frozen or effectively locked state before any payment operation is attempted.
Technical Context
Add src/accountStateDetector.ts. Reads TrustLineRecord.authorized and TrustLineRecord.authorized_to_maintain_liabilities from @stellar/stellar-sdk Server.loadAccount(). Inspects AccountRecord.flags.auth_revocable and auth_immutable. Integrates with src/preflightChecker.ts. Adds AccountLockState to src/types.ts. Throws AccountFrozenError or AccountLockedError from src/errors.ts as appropriate.
Acceptance Criteria
Description
A Stellar account can be prevented from transacting by an issuer revoking authorisation (freeze) or by being flagged
AUTH_IMMUTABLEin a state that prevents future authorisation. Sending payments to or from such accounts results in submission failures that are difficult to distinguish from other errors. A detector should identify accounts in a frozen or effectively locked state before any payment operation is attempted.Technical Context
Add
src/accountStateDetector.ts. ReadsTrustLineRecord.authorizedandTrustLineRecord.authorized_to_maintain_liabilitiesfrom@stellar/stellar-sdkServer.loadAccount(). InspectsAccountRecord.flags.auth_revocableandauth_immutable. Integrates withsrc/preflightChecker.ts. AddsAccountLockStatetosrc/types.ts. ThrowsAccountFrozenErrororAccountLockedErrorfromsrc/errors.tsas appropriate.Acceptance Criteria
detectLockState(accountId: string, asset: Asset): Promise<AccountLockState>returns{ isFrozen, isLocked, trustlineAuthorized, reason? }authorized: falseandauthorized_to_maintain_liabilities: falseon the matching trustlineAUTH_REVOCABLEflag that would allow future revocation and includes it in the report as{ revocableByIssuer: true }src/preflightChecker.tscallsdetectLockState()for each recipient and blocks payment if any account is frozen