Move the calldata decoder to src/shared/calldataDecoder.js #765

Merged
clawbot merged 1 commits from issue-759-calldata-decoder-module into next 2026-11-10 22:33:26 +01:00
Collaborator

Closes #759.

  • decodeCalldata() and tokenAmountText() move from src/popup/views/approval.js to the new src/shared/calldataDecoder.js. The function bodies do not change. TxApproval keeps its import of tokenAmountText() for the permit lines.
  • tokenSourcesByChainId() moves from src/popup/views/helpers.js to src/shared/state.js, beside currentNetwork(). The decoder needs it, and it reads only state and the network table. helpers.js, approval.js and send.js import it from state.js.
  • TransactionDetail and six test files change only their import path. tests/approvalDisplayFloor.test.js and src/shared/amountDisplay.js also had a comment naming the old file.
  • README.md: the shared module list gains calldataDecoder.js, and Transaction decoding names it.

What the diff does not show:

  • The decoder never called approvalAddressHtml(). That function was already in the view and stays there, so no address rendering moved.
  • The new module requires src/shared/state.js, so it is popup only, like ens.js. The build already fails if a background bundle reaches state.js.

Judgement call: tokenSourcesByChainId() went into state.js rather than a module of its own. Moving it again later changes the same four imports.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/AutistMask/issues/759. - `decodeCalldata()` and `tokenAmountText()` move from `src/popup/views/approval.js` to the new `src/shared/calldataDecoder.js`. The function bodies do not change. TxApproval keeps its import of `tokenAmountText()` for the permit lines. - `tokenSourcesByChainId()` moves from `src/popup/views/helpers.js` to `src/shared/state.js`, beside `currentNetwork()`. The decoder needs it, and it reads only `state` and the network table. `helpers.js`, `approval.js` and `send.js` import it from `state.js`. - TransactionDetail and six test files change only their import path. `tests/approvalDisplayFloor.test.js` and `src/shared/amountDisplay.js` also had a comment naming the old file. - `README.md`: the shared module list gains `calldataDecoder.js`, and Transaction decoding names it. What the diff does not show: - The decoder never called `approvalAddressHtml()`. That function was already in the view and stays there, so no address rendering moved. - The new module requires `src/shared/state.js`, so it is popup only, like `ens.js`. The build already fails if a background bundle reaches `state.js`. Judgement call: `tokenSourcesByChainId()` went into `state.js` rather than a module of its own. Moving it again later changes the same four imports. Model: opus-5-5
clawbot added the needs-review label 2026-11-10 21:15:55 +01:00
clawbot self-assigned this 2026-11-10 21:15:55 +01:00
clawbot added 1 commit 2026-11-10 21:15:55 +01:00
refactor: move the calldata decoder to src/shared/calldataDecoder.js (closes #759)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
7c7d44509c
decodeCalldata() and tokenAmountText() move out of the TxApproval view into
src/shared/calldataDecoder.js. TxApproval, TransactionDetail and the decoder
tests import them from there.

tokenSourcesByChainId() moves from the popup view helpers to
src/shared/state.js, beside currentNetwork(), so the decoder requires nothing
under src/popup/. It reads only the state singleton and the network table.

Model: opus-5-5
Author
Collaborator

PASS: the decoder now lives in src/shared/calldataDecoder.js, nothing under src/shared/ requires a file under src/popup/, and the definition of done in #759 is met.

Model: opus-5-5

PASS: the decoder now lives in `src/shared/calldataDecoder.js`, nothing under `src/shared/` requires a file under `src/popup/`, and the definition of done in https://git.eeqj.de/sneak/AutistMask/issues/759 is met. Model: opus-5-5
clawbot merged commit 6d158bf1b1 into next 2026-11-10 22:33:26 +01:00
clawbot deleted branch issue-759-calldata-decoder-module 2026-11-10 22:33:26 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#765