Skip to content

Add transaction result decoder, predicate builder, rate cache, and account flags inspector - #576

Merged
Kingsman-99 merged 4 commits into
Stellar-split:mainfrom
whisper011:feature/issues-516-519
Jul 30, 2026
Merged

Add transaction result decoder, predicate builder, rate cache, and account flags inspector#576
Kingsman-99 merged 4 commits into
Stellar-split:mainfrom
whisper011:feature/issues-516-519

Conversation

@whisper011

Copy link
Copy Markdown
Contributor

Summary

Adds four small, independent SDK features requested in issues #516#519:

  • Transaction result XDR decoder (src/txResultDecoder.ts) — parses the base64-encoded TransactionResult XDR returned by Horizon into a typed DecodedTransactionResult, including per-operation results and fee-bump inner/outer results. Wired into src/receipt.ts as PaymentReceipt.decodedResult.
  • Claimable balance predicate builder (src/predicateBuilder.ts) — fluent PredicateBuilder for composing unconditional, absolute-window, relative-window, and AND/OR claim predicates without touching the raw Claimant/xdr.ClaimPredicate API. Wired into src/claimableBalanceFallback.ts.
  • Exchange rate cache with TTL eviction (src/rateCache.ts) — RateCache serves rates from memory until TTL expiry, with a background refresh at 80% of TTL to avoid cold-fetch latency, plus invalidate/invalidateAll. Wired into src/currencyConverter.ts.
  • Account flags state inspector (src/accountFlagsInspector.ts) — inspectFlags() decodes a Stellar account's AUTH_* flags into a typed AccountFlagSet with an isCompatibleWith(operation) check and a hasAnyRestrictiveFlag() convenience helper. Wired into src/preflightChecker.ts as checkRecipientFlags() so callers can preflight-check a recipient's flags before sending a payment or opening a trustline.

Each feature is scoped to its own commit.

Closes

Closes #516
Closes #517
Closes #518
Closes #519

Test plan

  • npm run build
  • npm test
  • ESLint / TypeScript checks
  • Manual sanity check: decode a known success and failure TransactionResult XDR fixture
  • Manual sanity check: build an absolute-window and AND/OR predicate and pass to createClaimableBalance
  • Manual sanity check: RateCache serves cached rate within TTL and refetches after expiry
  • Manual sanity check: inspectFlags() against an AUTH_REQUIRED issuer account returns isCompatibleWith("payment") === false

Note: this repo currently has pre-existing TypeScript/build errors unrelated to this change (e.g. in client.ts, preflightChecker.ts's existing sponsor-reserve check, several __tests__ files) — these were present before this branch and are out of scope here.

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@whisper011 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Kingsman-99
Kingsman-99 merged commit f918e8e into Stellar-split:main Jul 30, 2026
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.

Account Flags State Inspector Exchange Rate Cache with TTL Eviction Claimable Balance Predicate Builder Transaction Result XDR Decoder

2 participants