Skip to content

fix(frontend): wire dispute and claim flows to the contract, drop nonexistent endpoints (#1755, #1756) - #1836

Merged
hman38705 merged 1 commit into
solutions-plug:mainfrom
Phantomcall:fix/issues-1755-1756
Oct 20, 2026
Merged

hman38705 merged 1 commit into
solutions-plug:mainfrom
Phantomcall:fix/issues-1755-1756

Conversation

@Phantomcall

Copy link
Copy Markdown

Fixes two frontend flows that called HTTP endpoints which do not exist. Both
touch the same wallet/Soroban path, so they ship together.

#1755 — Dispute page used nonexistent endpoints and a stub sign

/api/v1/blockchain/markets/{id}/disputes is not served by
services/api/openapi.yaml, and useTransaction's sign just returned
{ marketId, reason } — no transaction was built, the reason was never a
contract argument, and write errors were described with the 'resolve'
context.

  • Dispute status is now read from api.getBlockchainMarket, the endpoint
    the backend actually serves; the disputed-outcome list is optional on that
    view and renders "no dispute filed yet" when absent.
  • Filing now builds and signs the contract's real file_dispute entry point
    and submits it to Soroban RPC.
  • Write errors are described with the new 'dispute' action context.

#1756 — Claim page used a nonexistent endpoint

/api/v1/blockchain/bets/{id} and /api/v1/blockchain/markets/{id}/claim are
not served either.

  • The bet is loaded from the typed client's getUserBets response for the
    connected wallet (the endpoint the backend does serve).
  • Claiming now invokes the contract's claim_winnings entry point via the
    wallet.
  • Write errors use the new 'claim' action context.

Shared: lib/wallet/soroban.ts

There is no Soroban client in the frontend, and no contract id / RPC env vars,
so this adds a small, tested client used by both pages: build → wallet-sign →
submit. It reads NEXT_PUBLIC_CONTRACT_ID / NEXT_PUBLIC_SOROBAN_RPC_URL /
NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE. When the contract id or RPC URL is
unset, the pages render a clear "not configured" message and disable the
submit button
instead of calling a nonexistent endpoint — so a deployment
that has not wired these yet degrades instead of breaking.

The existing lib/wallet/balance.ts already imported @stellar/stellar-sdk
without declaring it (it is absent from package.json and the lockfile), which
would fail a real next build. This PR declares the dependency
(^12.3.0) and adds it to package-lock.json, fixing that too.

Other changes

  • WriteAction gains 'dispute' and 'claim' with their 101 (NotAuthorized)
    messages.
  • Docs: docs/data-flow.md documents the client-side contract-write path;
    frontend/README.md and frontend/.env.example document the new env vars.
  • Tests: src/lib/wallet/__tests__/soroban.test.ts covers config resolution,
    argument encoding (verified against the real SDK), build/sign/submit wiring,
    the send/on-chain failure paths, and the unconfigured fast-path.

Verification

  • soroban.ts was exercised end-to-end against the real @stellar/stellar-sdk
    at both 12.3.0 and 17.0.1 (rpc namespace, valid 1-op transaction, hash
    returned, unconfigured path throws).
  • Changed files pass prettier --check with the repo's config.

Note on CI

npm ci fails on main today with a pre-existing peer-dependency conflict
(openapi-typescript@7 wants typescript@^5.x); this is unrelated to this PR
and reproduces on unmodified main. The lockfile/package.json pair added
here resolves correctly (npm ci --legacy-peer-deps --dry-run installs
@stellar/stellar-sdk@12.3.0).

Closes #1755
Closes #1756

@drips-wave

drips-wave Bot commented Oct 20, 2026

Copy link
Copy Markdown

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

@hman38705
hman38705 merged commit d09d671 into solutions-plug:main Oct 20, 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

2 participants