feat: arc network send max feature#43486
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (1 files, +24 -20)
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 825ea8a. Configure here.
| // selectable or auto-selected default pay token. | ||
| if ( | ||
| token.chainId === CHAIN_IDS.ARC && | ||
| token.address?.toLowerCase() === ARC_USDC_TOKEN_ADDRESS |
There was a problem hiding this comment.
But can you still select native Arc as a payment token? If they are the same, what's wrong with that? You can still select other native tokens for other chains.
|
|
||
| const arcSuggestedMaxFeePerGas = | ||
| isArcNativeMirror && chainId | ||
| ? await fetchSuggestedMaxFeePerGas(chainId) |
There was a problem hiding this comment.
Why wouldn't the gas fee controller automatically poll this to gas fee estimates as with any other chain?
| // transfer. Because the gas is held upfront (gasLimit * maxFeePerGas) from the | ||
| // same balance the transfer draws from, a conservative ERC20 transfer gas | ||
| // limit is reserved so the transfer never exceeds the balance. | ||
| const ARC_USDC_TRANSFER_GAS_LIMIT = 100000; |
There was a problem hiding this comment.
Why have we refactored this file to such a degree if the only difference seems to be this alternate gas limit given the nature of the native / USDC token on Arc?
Could we instead just update getEstimatedTotalGas to accept an asset argument and conditionally use this gas limit instead?
Builds ready [ffca2fe]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [9ec22f9]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
928d8db to
8368bb0
Compare

Description
this ranch is chained to this one #43455 in order to make reviews small and easy
Changelog
CHANGELOG entry: arc send max feeature
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Refactor-only change with equivalent branching and dependencies; limited to send max amount calculation in the confirmations flow.
Overview
Send max on Arc still reserves gas using layer-1 fees and a direct gas-API suggested fee when Redux gas estimates are missing; this change only how those values are loaded.
useMaxAmountmerges two separateuseAsyncResultcalls (layer-1 gas + ArcfetchSuggestedMaxFeePerGas) into one async effect that returns{ layer1GasFees, arcSuggestedMaxFeePerGas }, so the hook triggers a single state update per resolution instead of two.Reviewed by Cursor Bugbot for commit e13e193. Bugbot is set up for automated code reviews on this repo. Configure here.