Skip to content

fix(soroban): mock invokeContract returns real results; regression tests for #581/#582 - #622

Open
jajafwangshak86-ops wants to merge 1 commit into
Sorokit:mainfrom
jajafwangshak86-ops:fix/issues-573-581-582
Open

fix(soroban): mock invokeContract returns real results; regression tests for #581/#582#622
jajafwangshak86-ops wants to merge 1 commit into
Sorokit:mainfrom
jajafwangshak86-ops:fix/issues-573-581-582

Conversation

@jajafwangshak86-ops

@jajafwangshak86-ops jajafwangshak86-ops commented Aug 29, 2026

Copy link
Copy Markdown

Closes #573
Closes #581
Closes #582

What changed

#573invokeContract returns "Not implemented"
Root cause was the mock client: soroban.invokeContract always resolved with data: null, and the Soroban screen renders a null result as "Not implemented". No component rendering was at fault. Fixed at the source in src/lib/mock-client.ts — the mock now resolves with a deterministic, non-null result ({ success: true, result: {...}, txHash }), so the panel shows a real invocation result.

#581 — unsafe casts on submit buttons
Verified the offending code is already gone from main: both SorobanPanel.tsx and TransactionPanel.tsx open their forms natively via type="submit" buttons linked through the form attribute. This PR pins that behaviour with regression tests so it can't silently regress:

  • SorobanPanel.test.tsx — Invoke button is type="submit", points at the form id, and clicking it reaches the form's onSubmit and a real invocation.
  • TransactionPanel.test.tsx — Send Payment button is type="submit" tied to the form.

#582 — ContractEventFeed stale-closure polling
Verified the fix is already in main: load is memoized with useCallback([contractId, limit, filterTypes, client]) and the polling interval effect restarts when contractId changes. Added polling contractId switching (#582) regression tests that switch contractId mid-poll (with fake timers) and assert every poll after the switch hits the NEW contract id, plus a Live-toggle pause/resume test.

Test harness fix

SorobanPanel/TransactionPanel tests mocked useSorokit without a client, so invocations never reached the mocked API (the pre-existing suite failures). The mocks now expose the client the panels actually read, bringing the panels' success-state tests back to green.

Verification

  • npm run typecheck passes.
  • eslint on changed files passes.
  • Changed files: 117 passed / 6 failed (the 6 remaining are pre-existing, unrelated to this PR: ContractEventFeed JSON-export tests query /export json/i against an aria-label of "Export {n} events as JSON", and 3 TransactionPanel tests that override the context mock with balance arrays).

Commits: 1

…ith regression tests

- mock-client invokeContract now resolves with a deterministic result instead
  of null data, so the Soroban screen renders a real result (fixes the
  'Not implemented' symptom from Sorokit#573).
- add regression tests covering the Sorokit#581 native form submission (type=submit
  buttons linked to the parent form) and Sorokit#582 ContractEventFeed polling
  restart on contractId change.
- fix SorobanPanel/TransactionPanel test harness so the mocked context
  exposes the client the panels actually read.
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@jajafwangshak86-ops 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

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

Labels

None yet

Projects

None yet

1 participant