Skip to content

Add makeMaxSpend to ethereum and ton engines - #1061

Open
j0ntz wants to merge 1 commit into
masterfrom
jon/make-max-spend
Open

Add makeMaxSpend to ethereum and ton engines#1061
j0ntz wants to merge 1 commit into
masterfrom
jon/make-max-spend

Conversation

@j0ntz

@j0ntz j0ntz commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

Pairs with the new EdgeCurrencyEngine.makeMaxSpend engine method in edge-core-js (EdgeApp/edge-core-js#727). The engine method is optional, so this PR is independent: the core only calls it once that change ships; until then the core fallback shim handles max spends.

Description

Implement the makeMaxSpend engine method on EthereumEngine and TonEngine. It computes the maximum spendable amount and builds the transaction back-to-back inside the engine, so network state and fee pricing stay consistent between the two steps. This avoids the race that affects separate getMaxSpendable and makeSpend calls (for Ethereum it also reuses the L1 fee pricing getMaxSpendable caches for makeSpend).

Asana: https://app.asana.com/0/1215088146871429/1207967192999590

Testing

  • npm run types (tsc): the change introduces no new type errors (verified by comparing error counts on the base branch vs this branch — both 15, all pre-existing and unrelated, from the locally-installed older edge-core-js and react-native-monero not being present; CI installs fresh dependencies).
  • The max-spend flow was exercised end to end in the running app via the core makeMaxSpend wallet API (see Add makeMaxSpend wallet API with core fallback shim edge-core-js#727); the engine method here mirrors that already-tested getMaxSpendable + makeSpend logic.

Note

Medium Risk
Touches core send paths for native max spends on Ethereum (fees, rollups, caching) and TON; behavior should match the prior two-step flow but any mismatch would affect full-balance sends.

Overview
Adds optional makeMaxSpend on EthereumEngine and TonEngine, pairing with edge-core-js’s wallet API so max-send is one engine call instead of separate getMaxSpendable + makeSpend.

Each implementation calls getMaxSpendable, sets the first spend target’s nativeAmount to that value, then makeSpend immediately. On Ethereum the comment notes this keeps L1 fee pricing aligned via lastMaxSpendable caching between the two steps; on TON it avoids balance/fee drift between queries.

CHANGELOG Unreleased documents the addition for ethereum and ton.

Reviewed by Cursor Bugbot for commit 47e400d. Bugbot is set up for automated code reviews on this repo. Configure here.

Implement the makeMaxSpend engine method on EthereumEngine and TonEngine.
It computes the maximum spendable amount and builds the transaction
back-to-back inside the engine so network state and fee pricing stay
consistent between the two steps, avoiding the race that affects separate
getMaxSpendable and makeSpend calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant