Skip to content

fix(frontend): Stellar tx safety, typed ScVal args, exact XLM conversion (#1423-#1426) - #1494

Merged
Ehonrie merged 5 commits into
Netwalls:mainfrom
leofoxcode-oss:fix/frontend-stellar-f85-f88
Oct 21, 2026
Merged

Ehonrie merged 5 commits into
Netwalls:mainfrom
leofoxcode-oss:fix/frontend-stellar-f85-f88

Conversation

@leofoxcode-oss

Copy link
Copy Markdown
Contributor

Summary

Frontend Stellar/Soroban fixes in frontend/lib/stellar.ts, one commit per issue.

Tests

All four files pass (npx jest __tests__/lib, 35 tests).

Known gaps

  • Hook test suites (usePlaceBet, useClaimWinnings, useCreateMarket) already fail to parse on main because hooks/useWallet.ts contains JSX in a .ts file. They were not run. Their argument expectations still assume the old raw values.
  • Claim hooks now pass bet_id through bytes(), so bet IDs must be hex. Non-hex IDs will throw.

Closes #1423
Closes #1424
Closes #1425
Closes #1426

leofoxcode-oss and others added 5 commits October 19, 2026 03:32
buildSorobanInvocation attached an all-zero placeholder signature to the
unsigned transaction. If the wallet appended its signature instead of
replacing it, submission failed, and the XDR looked signed when it was not.
Return the transaction unsigned and let the wallet sign it.

Closes Netwalls#1423
Arguments were guessed at runtime: any string was tried as an address and
otherwise coerced with Number(), so amounts above 2^53 lost precision and
u64, i128 and u32 could not be chosen. Add explicit helpers (i128, u64,
u32, address, bytes, sym, str), type SorobanInvokeParams.args as
xdr.ScVal[], and migrate the invoking hooks and DisputeModal to them.

Closes Netwalls#1424
Both Soroban RPC clients were built with allowHttp: true, so a
NEXT_PUBLIC_SOROBAN_RPC_URL set to http:// was accepted in production and
transactions could be tampered with in transit. allowHttp is now enabled only
for localhost/127.0.0.1 outside production and off mainnet. Any other non-HTTPS
RPC URL is rejected with an error.

Closes Netwalls#1425
stroopsToXlm divided through Number, which loses precision for large values
and renders float artefacts. xlmToStroops threw a raw SyntaxError for input
like "abc" or "1e3", accepted negatives, and silently truncated to 7
decimals. Both directions now use BigInt only. xlmToStroops throws
InvalidAmountError with a reason for empty, negative, non-numeric,
over-precise (more than 7 significant decimals) or out-of-range input.

Closes Netwalls#1426
Resolve frontend/lib/stellar.ts: keep the PR's RPC options and typed ScVal
handling, drop the unused ContractError import.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Ehonrie
Ehonrie merged commit 8464725 into Netwalls:main Oct 21, 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