Built an ERC-20 allowance audit/revoke plugin on the Agent Wallet plugin beta, feedback + lessons

Hi all,

I’ve been building on the mm plugins beta for the last couple of days and wanted to share what came out of it, plus some feedback for the team.

The problem. An agent that swaps and trades accumulates ERC-20 approvals, often unlimited ones, and nothing in the current CLI lets you see or clean them up. Humans use revoke.cash for this. Agents had nothing.

What I built. mm-plugin-allowances, two commands:

  • mm allowances audit scans Approval events for the active wallet, lists what’s still live, flags unlimited allowances, and labels well-known spenders (Uniswap, Aave, 1inch, Permit2…). Multi-chain.
  • mm allowances revoke sends approve(spender, 0) through the wallet’s normal pipeline, so Guard Mode policy, simulation, Blockaid and 2FA all apply. Explicit gas flags for chains where the estimator runs low.

Everything uses named flags and structured JSON output so an agent can drive it safely. MIT, verified end to end on Sepolia.

Repo: GitHub - akugone/mm-plugin-allowances: MetaMask Agent Wallet (mm) plugin: audit and revoke ERC-20 token allowances, through MetaMask's policy and 2FA pipeline. · GitHub

Try it. It’s not on npm yet, so for now it installs from the GitHub checkout. That needs the unverified-installs opt-in the docs describe for development:

git clone https://github.com/akugone/mm-plugin-allowances && cd mm-plugin-allowances
npm install && npm run build
mm config set experimentalAllowUnverifiedInstalls true
mm plugins install "file:$PWD" --accept-permissions
mm allowances audit

Requires mm ≥ 6.2.0. npm publish will follow once I’ve had some feedback.

What worked well on the plugin API. The oclif-based structure made it quick to get going, the consent screen that lists commands and requested capabilities is exactly what you want for agent-facing tooling, and routing writes through the wallet’s own pipeline meant I didn’t have to reinvent any safety.

Two things I hit along the way.

  1. With the “Build a plugin” flow, mm plugins install file:$PWD symlinks the folder, so Node loads the plugin’s own devDependency copy of @metamask/agent-wallet instead of the host’s, and the consent hook rejects the command with a confusing window.addEventListener is not a function. Symlinking the host install into the plugin’s node_modules fixes it. Happy to file an issue with a repro if useful.
  2. On Sepolia the server wallet’s fee estimate sometimes lands under what the RPC accepts and the revoke fails with rpc_fee_too_low. I added --max-fee-gwei / --priority-fee-gwei flags as a workaround, but a --gas-speed style option on send-transaction itself would save every plugin author from doing the same.

Happy to answer questions, and very open to feedback from the team on whether this is the right shape for a plugin.

Martin

1 Like