Skip to content

Conversation

@OGPoyraz
Copy link
Member

@OGPoyraz OGPoyraz commented Nov 20, 2025

Description

This PR adds zero balance check before onAmountInput RPC call to nonEVM send flow amount validations.

Open in GitHub Codespaces

Changelog

CHANGELOG entry:

Related issues

Fixes: MetaMask/metamask-mobile#22812

Manual testing steps

  1. Go to send flow
  2. Don't have any Tron / SOL / BTC
  3. Try sending it but see "insufficient balance" error

Screenshots/Recordings

Before

After

Screenshot 2025-11-20 at 14 14 31

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Adds an early zero-balance check for non-EVM send amount validation and covers it with a new test.

  • Validation (send):
    • Non-EVM: Add early zero-balance check in useAmountValidation (validateNonEvmAmount) returning insufficientFundsSend before snap RPC; include rawBalanceNumeric in hook deps.
  • Tests:
    • Add test ensuring non-EVM accounts with zero balance surface "Insufficient funds".

Written by Cursor Bugbot for commit cd0a0e6. This will update automatically on new commits. Configure here.

@OGPoyraz OGPoyraz requested a review from a team as a code owner November 20, 2025 13:14
@OGPoyraz OGPoyraz added team-confirmations Push issues to confirmations team no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels Nov 20, 2025
@OGPoyraz OGPoyraz changed the title fix: Implement client based nonEVM zero balance check to send flow fix: Implement nonEVM zero balance check to send flow before onAmountInput Nov 20, 2025
@metamaskbot
Copy link
Collaborator

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (2 files, +26 -1)
  • 📁 ui/
    • 📁 pages/
      • 📁 confirmations/
        • 📁 hooks/
          • 📁 send/
            • 📄 useAmountValidation.test.ts +21 -0
            • 📄 useAmountValidation.ts +5 -1

@metamaskbot
Copy link
Collaborator

Builds ready [cd0a0e6]
UI Startup Metrics (1246 ± 112 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12461060173311213241419
load1065901148210211421220
domContentLoaded1058898147710211341213
domInteractive241494182183
firstPaint591155123341910481185
backgroundConnect21219427212215233
firstReactRender28205183245
getState341783124158
initialActions106112
loadScripts85369312581019311001
setupStore1272241420
numNetworkReqs1257820573
BrowserifyPower User HomeuiStartup18921574252725020782406
load1010885191317410241491
domContentLoaded99487918881719981478
domInteractive36162063929151
firstPaint52810319104189291409
backgroundConnect22620126814233252
firstReactRender82481721787112
getState17412730144196268
initialActions103112
loadScripts78667616431687891265
setupStore201063112748
numNetworkReqs1017020232113183
WebpackStandard HomeuiStartup824737105972843988
load62455984365632789
domContentLoaded62055483565627782
domInteractive241492172170
firstPaint22384845144229596
backgroundConnect1263781430
firstReactRender28194253234
getState321392123950
initialActions102111
loadScripts61755282663625773
setupStore1252941420
numNetworkReqs1257720570
WebpackPower User HomeuiStartup15001251291125316761964
load70059816341506991050
domContentLoaded68859216181496801039
domInteractive40172654432163
firstPaint2811031629224287665
backgroundConnect1673472030
firstReactRender85531351192101
getState15812728027167218
initialActions104112
loadScripts68559016061476781028
setupStore23772143353
numNetworkReqs1536930556197276
FirefoxBrowserifyStandard HomeuiStartup12171032161911912661492
load102888412518110911188
domContentLoaded102888412518110911188
domInteractive56291753280116
firstPaint------
backgroundConnect3520105153969
firstReactRender21175462134
getState1067811930
initialActions102012
loadScripts100686912308010741149
setupStore11516317926
numNetworkReqs1257418767
BrowserifyPower User HomeuiStartup27331890376637729083600
load1192998167516312661526
domContentLoaded1192998167516312661526
domInteractive14634541118164461
firstPaint------
backgroundConnect251271077264336783
firstReactRender88381481695127
getState24486903242195866
initialActions3133335
loadScripts1149976163015312091493
setupStore1167821167116697
numNetworkReqs98592174191206
WebpackStandard HomeuiStartup14711302189311715231697
load1252108814609313051433
domContentLoaded1252108814609313051433
domInteractive69282114186138
firstPaint------
backgroundConnect4121119184489
firstReactRender292082113069
getState1158181019
initialActions103122
loadScripts1228107214138912841398
setupStore146152181245
numNetworkReqs1256517663
WebpackPower User HomeuiStartup29332194392238330853711
load14121064191719715591814
domContentLoaded14121064191719715591814
domInteractive14928811147148516
firstPaint------
backgroundConnect19831949230205763
firstReactRender87431421996127
getState30588936290322890
initialActions4154837
loadScripts13741049189918815171759
setupStore117677418192650
numNetworkReqs100682394394213
📊 Page Load Benchmark Results

Current Commit: cd0a0e6 | Date: 11/20/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±39ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 724ms (±36ms) 🟢 | historical mean value: 721ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±11ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 39ms 1.02s 1.32s 1.07s 1.32s
domContentLoaded 724ms 36ms 701ms 990ms 746ms 990ms
firstPaint 77ms 11ms 60ms 164ms 88ms 164ms
firstContentfulPaint 77ms 11ms 60ms 164ms 88ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 53 Bytes (0%)
  • ui: 432 Bytes (0.01%)
  • common: 44 Bytes (0%)

@OGPoyraz OGPoyraz added this pull request to the merge queue Nov 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 20, 2025
@OGPoyraz OGPoyraz added this pull request to the merge queue Nov 20, 2025
Merged via the queue into main with commit f871763 Nov 20, 2025
192 checks passed
@OGPoyraz OGPoyraz deleted the ogp/22812 branch November 20, 2025 16:19
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2025
@metamaskbot metamaskbot added the release-13.11.0 Issue or pull request that will be included in release 13.11.0 label Nov 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-13.11.0 Issue or pull request that will be included in release 13.11.0 size-S team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tron send flow can move from amount screen with no balance or setting the amount to 0

5 participants