Repository navigation
fix(frontend): Stellar tx safety, typed ScVal args, exact XLM conversion (#1423-#1426) - #1494
Merged
Ehonrie merged 5 commits intoOct 21, 2026
Merged
Conversation
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>
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.
Summary
Frontend Stellar/Soroban fixes in
frontend/lib/stellar.ts, one commit per issue.i128,u64,u32,address,bytes,sym,str).argsis nowxdr.ScVal[], and the invoking hooks andDisputeModaluse them. Amounts aboveNumber.MAX_SAFE_INTEGERstay exact.allowHttponly for localhost/127.0.0.1 outside production and off mainnet. Other non-HTTPS RPC URLs throw.stroopsToXlmandxlmToStroopsBigInt-exact.xlmToStroopsthrowsInvalidAmountErrorwith areasonfor bad input.Tests
frontend/__tests__/lib/stellar-invocation.test.ts(F-85: Remove the fake zero signature added before wallet signing #1423)frontend/__tests__/lib/stellar-scval.test.ts(F-86: Add typed ScVal argument helpers (stop coercing numeric strings and numbers) #1424), runs against the real SDKfrontend/__tests__/lib/stellar-rpc-url.test.ts(F-87: Only allow insecure RPC URLs in local development #1425)frontend/__tests__/lib/stellar-amounts.test.ts(F-88: Make stroops/XLM conversion exact and validate user input #1426)All four files pass (
npx jest __tests__/lib, 35 tests).Known gaps
usePlaceBet,useClaimWinnings,useCreateMarket) already fail to parse onmainbecausehooks/useWallet.tscontains JSX in a.tsfile. They were not run. Their argument expectations still assume the old raw values.bet_idthroughbytes(), so bet IDs must be hex. Non-hex IDs will throw.Closes #1423
Closes #1424
Closes #1425
Closes #1426