Repository navigation
fix(frontend): wire dispute and claim flows to the contract, drop nonexistent endpoints (#1755, #1756) - #1836
Merged
Conversation
…existent endpoints Closes solutions-plug#1755 Closes solutions-plug#1756
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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}/disputesis not served byservices/api/openapi.yaml, anduseTransaction'ssignjust returned{ marketId, reason }— no transaction was built, thereasonwas never acontract argument, and write errors were described with the
'resolve'context.
api.getBlockchainMarket, the endpointthe backend actually serves; the disputed-outcome list is optional on that
view and renders "no dispute filed yet" when absent.
file_disputeentry pointand submits it to Soroban RPC.
'dispute'action context.#1756 — Claim page used a nonexistent endpoint
/api/v1/blockchain/bets/{id}and/api/v1/blockchain/markets/{id}/claimarenot served either.
getUserBetsresponse for theconnected wallet (the endpoint the backend does serve).
claim_winningsentry point via thewallet.
'claim'action context.Shared:
lib/wallet/soroban.tsThere 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 isunset, 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.tsalready imported@stellar/stellar-sdkwithout declaring it (it is absent from
package.jsonand the lockfile), whichwould fail a real
next build. This PR declares the dependency(
^12.3.0) and adds it topackage-lock.json, fixing that too.Other changes
WriteActiongains'dispute'and'claim'with their 101 (NotAuthorized)messages.
docs/data-flow.mddocuments the client-side contract-write path;frontend/README.mdandfrontend/.env.exampledocument the new env vars.src/lib/wallet/__tests__/soroban.test.tscovers 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.tswas exercised end-to-end against the real@stellar/stellar-sdkat both 12.3.0 and 17.0.1 (
rpcnamespace, valid 1-op transaction, hashreturned, unconfigured path throws).
prettier --checkwith the repo's config.Note on CI
npm cifails onmaintoday with a pre-existing peer-dependency conflict(
openapi-typescript@7wantstypescript@^5.x); this is unrelated to this PRand reproduces on unmodified
main. The lockfile/package.jsonpair addedhere resolves correctly (
npm ci --legacy-peer-deps --dry-runinstalls@stellar/stellar-sdk@12.3.0).Closes #1755
Closes #1756