Skip to content

fix(backend): use SDK discriminated unions for simulate responses in … - #799

Merged
aji70 merged 1 commit into
MyFanss:mainfrom
Mimah97:feat/fix-simulation-typing
Apr 23, 2026
Merged

fix(backend): use SDK discriminated unions for simulate responses in …#799
aji70 merged 1 commit into
MyFanss:mainfrom
Mimah97:feat/fix-simulation-typing

Conversation

@Mimah97

@Mimah97 Mimah97 commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

…chain reader

  • Extract retval via isSimulationError / isSimulationSuccess / isSimulationRestore instead of accessing sim.result?.retval directly on the union type
  • Add extractRetval() helper that narrows all three branches and returns a typed { retval } | { error } result — no more unsafe property access
  • Handle SimulateTransactionRestoreResponse (archived ledger entry) as a transient error with a clear message so callers can retry after restoration
  • Apply withRetry to readPlan and readPlanCount (previously missing, inconsistent)
  • Deduplicate server/tx construction into makeServer() and buildTx() helpers
  • Tests: subscription-chain-reader.service.spec.ts — 14 cases covering success, error, restore, missing retval, and network rejection for all four read methods
    closes Fix subscription-chain-reader simulation typing #580

…chain reader

- Extract retval via isSimulationError / isSimulationSuccess / isSimulationRestore
  instead of accessing sim.result?.retval directly on the union type
- Add extractRetval() helper that narrows all three branches and returns a
  typed { retval } | { error } result — no more unsafe property access
- Handle SimulateTransactionRestoreResponse (archived ledger entry) as a
  transient error with a clear message so callers can retry after restoration
- Apply withRetry to readPlan and readPlanCount (previously missing, inconsistent)
- Deduplicate server/tx construction into makeServer() and buildTx() helpers
- Tests: subscription-chain-reader.service.spec.ts — 14 cases covering
  success, error, restore, missing retval, and network rejection for all
  four read methods
@drips-wave

drips-wave Bot commented Apr 23, 2026

Copy link
Copy Markdown

@Mimah97 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

@aji70
aji70 merged commit d42306c into MyFanss:main Apr 23, 2026
2 of 9 checks passed
aji70 added a commit that referenced this pull request Apr 30, 2026
fix(backend): use SDK discriminated unions for simulate responses in …
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.

Fix subscription-chain-reader simulation typing

2 participants