Problem
src/components/TransactionPanel.tsx canSubmit guard (line 24) only checks that dest is a non-empty string and amount is a positive number:
const canSubmit = isConnected && dest.trim() && amount.trim() && parseFloat(amount) > 0;
There is no Stellar address format validation. A Stellar public key must start with G, be exactly 56 characters, and pass a base32 checksum. Users can currently enter abc, 0x1234, or an Ethereum address and the form will submit it to the network, wasting fees and confusing users with an opaque network error.
Two more related problems: (1) there is no balance check — entering an amount that exceeds the user's XLM balance submits to the network and fails there, rather than showing a clear inline error before submission; (2) the amount field uses type="number" but has no max attribute, so there is no browser-level upper bound either.
Solution
- Add a Stellar address validator. Use the regex
/^G[A-Z2-7]{55}$/ for a lightweight check, or import StrKey.isValidEd25519PublicKey from @stellar/stellar-sdk for full checksum validation.
- Show an inline error under the Destination Address
Input when format is invalid.
- Compare
parseFloat(amount) against the XLM balance from useSorokit() context and show an "Insufficient balance" error when exceeded.
- Keep
canSubmit false while either validation fails.
Acceptance Criteria
Note for Contributors: If you're assigned to this issue, write a clear and detailed description for your pull request. Explain what was changed, why it was needed, how it was implemented, and include any relevant testing or screenshots where applicable.
Problem
src/components/TransactionPanel.tsxcanSubmitguard (line 24) only checks thatdestis a non-empty string andamountis a positive number:There is no Stellar address format validation. A Stellar public key must start with
G, be exactly 56 characters, and pass a base32 checksum. Users can currently enterabc,0x1234, or an Ethereum address and the form will submit it to the network, wasting fees and confusing users with an opaque network error.Two more related problems: (1) there is no balance check — entering an amount that exceeds the user's XLM balance submits to the network and fails there, rather than showing a clear inline error before submission; (2) the
amountfield usestype="number"but has nomaxattribute, so there is no browser-level upper bound either.Solution
/^G[A-Z2-7]{55}$/for a lightweight check, or importStrKey.isValidEd25519PublicKeyfrom@stellar/stellar-sdkfor full checksum validation.Inputwhen format is invalid.parseFloat(amount)against the XLMbalancefromuseSorokit()context and show an "Insufficient balance" error when exceeded.canSubmitfalse while either validation fails.Acceptance Criteria