Skip to content

feat(app): /attester read-only payout-account checks - #50

Open
jdjioe5-cpu wants to merge 1 commit into
Kinlock-Org:mainfrom
jdjioe5-cpu:feat/attester-account-checks
Open

jdjioe5-cpu wants to merge 1 commit into
Kinlock-Org:mainfrom
jdjioe5-cpu:feat/attester-account-checks

Conversation

@jdjioe5-cpu

Copy link
Copy Markdown

What and why

Closes #42.
Replaces the /attester placeholder stub with a fully functioning, read-only payout-account verification page. Attesters can verify institutional payout accounts before onboarding or publishing registry records, strictly matching the verdicts of kinlock-registry/scripts/check-attester-readiness.ts without asking for secret keys, seed phrases, or transaction signatures.

Changes

  • lib/attester/strkey.ts (new): RFC 4648 Base32 + CRC-16 XModem validator for Stellar Ed25519 public keys (G-addresses). Pre-validates user inputs before any network calls, rejecting invalid prefixes, short inputs, and corrupted checksums.
  • lib/attester/readiness.ts (new): Core evaluation engine that categorizes Horizon accounts into three explicit verdicts:
    1. Account existence (account.exists);
    2. Native XLM float vs reserve requirement (>= 2 XLM);
    3. USDC trustline status: strictly distinguishes missing (absent) vs unapproved (unauthorised) vs full limit (no_room) vs authorised with room, showing the asset code and configured issuer.
  • app/attester/useAttesterChecker.ts & AttesterChecker.tsx (new): Client component and decoupled state hook with loading states, role="status", WCAG AA contrast, and zero inline strings.
  • app/attester/page.tsx: Replaced PageStub with AttesterChecker, configured with export const dynamic = "force-dynamic".
  • messages/en.json: Added all user-visible strings under pages.attester.*.
  • README.md & ROADMAP.md: Documented /attester in the routes table, advanced M3-12 to DONE, and added Changelog entry.

Hard rules / invariants touched

  • Hard Rule 3: Chain is truth. Reads live ledger state from Stellar Horizon.
  • Hard Rule 4: Non-custodial. Zero private keys, seed phrases, or transaction submission.
  • Hard Rule 5: No personal data logged or persisted.
  • Hard Rule 11: Country-agnostic core. Asset code and issuer are derived dynamically from config/registry; zero country or currency literals.

Tests

Added lib/attester/readiness.test.ts with 7 test cases covering all verdict branches against Horizon fixtures.
Ran all verification commands cleanly:

pnpm lint
> biome check .
Checked 88 files in 23ms. No fixes applied.

pnpm typecheck
> tsc --noEmit

pnpm test
✓ lib/i18n/inline-strings.test.ts (30 tests)
✓ lib/country-agnostic.test.ts (62 tests)
✓ lib/i18n/format.test.ts (11 tests)
✓ app/claim/[id]/claim-logic.test.ts (7 tests)
✓ lib/receipts/parse.test.ts (10 tests)
✓ app/payee/payee-logic.test.ts (8 tests)
✓ lib/security/csp.test.ts (5 tests)
✓ lib/i18n/messages.test.ts (3 tests)
✓ lib/attester/readiness.test.ts (7 tests)
✓ lib/locks/refund.test.ts (6 tests)
✓ lib/config.test.ts (4 tests)
✓ lib/indexer/index.test.ts (4 tests)
✓ lib/sdk.test.ts (3 tests)
✓ app/request/schedule.test.ts (4 tests)
✓ lib/claim-links/claim-links.test.ts (6 tests)
✓ app/send/send-logic.test.ts (8 tests)
Test Files  16 passed (16)
     Tests  178 passed (178)

pnpm build
▲ Next.js 16.3.8 (Turbopack)
✓ Compiled successfully in 447ms
✓ Generating static pages using 14 workers (5/5) in 423ms
Route (app)
├ ƒ /attester
...

Side-by-Side Parity Evidence against check-attester-readiness.ts

  1. Existing Funded Account (GCLMHF7LAR34TSELDNEREYPTNE4K7MMESPS62WXE7ZDLPWIJUF3MC5QM):
  • check-attester-readiness.ts:
    ✓ native XLM float: 9999.9647224 (need >= 2)
    ✓ USDC trustline authorized: true
    ✓ USDC trustline room: limit 9223372036854775807 > balance 80000000
    Account and trustline checks pass.
    
  • /attester Readiness Report:
    • Account: pass (exists on testnet)
    • Native XLM: pass (9999.9647224 XLM >= 2 XLM)
    • USDC trustline: pass (authorised with room)
    • Total problems: 0
  1. Unfunded / Missing Account (GCC7BYEDK2RJKHKRRY6QVEUYNRBAYRCTU76MQFPUGD7D3AO6G5XITMPJ):
  • check-attester-readiness.ts:
    ✗ account GCC7BYEDK2RJKHKRRY6QVEUYNRBAYRCTU76MQFPUGD7D3AO6G5XITMPJ does not exist on testnet
    ✗ no USDC trustline (USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5) on GCC7BYEDK2RJKHKRRY6QVEUYNRBAYRCTU76MQFPUGD7D3AO6G5XITMPJ
    2 problem(s) found.
    
  • /attester Readiness Report:
    • Account: fail (does not exist on testnet)
    • Native XLM: null
    • USDC trustline: fail (absent)
    • Total problems: 2

Docs / ADR

  • Updated README.md
  • Updated ROADMAP.md (M3-12 -> DONE)

Roadmap

  • Row M3-12 marked DONE
  • Changelog entry added: yes
  • Progress snapshot refreshed: yes

Assumptions and open questions

None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/attester: read-only payout-account checks (replace the stub)

2 participants