Skip to content

Account Flags State Inspector #519

Description

@Kingsman-99

Description

Stellar accounts carry boolean flags (AUTH_REQUIRED, AUTH_REVOCABLE, AUTH_CLAWBACK_ENABLED, AUTH_IMMUTABLE) that significantly affect which operations can be performed against them. The SDK does not currently surface these flags in a typed, structured form, forcing callers to inspect raw Horizon AccountRecord.flags objects. A flags inspector should decode account flags and expose typed methods for checking each flag.

Technical Context

Add src/accountFlagsInspector.ts. Reads AccountRecord.flags from @stellar/stellar-sdk Horizon types. Extends src/flags.ts. Adds AccountFlagSet interface to src/types.ts. Integrates with src/preflightChecker.ts to warn or block operations that are incompatible with the recipient's flag state (e.g. sending to an AUTH_REQUIRED asset issuer without prior authorisation).

Acceptance Criteria

  • inspectFlags(accountId: string): Promise<AccountFlagSet> returns { authRequired, authRevocable, authImmutable, authClawbackEnabled } as typed booleans
  • AccountFlagSet.isCompatibleWith(operation: string): boolean returns false when a flag makes the operation impossible (e.g. authRequired blocks trustline creation without explicit authorisation)
  • src/preflightChecker.ts calls inspectFlags() for each recipient and attaches the result to the preflight report
  • Exposes hasAnyRestrictiveFlag(account): boolean as a convenience method for quick-fail checks
  • Unit tests mock AccountRecord.flags combinations and assert correct boolean decoding for all 16 possible flag combinations
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions