feat(bitcoin-wallet-snap)!: remove assets handlers - #260
Conversation
bd45f3d to
97c3041
Compare
0e4146b to
af44f36
Compare
Remove the onAssetsLookup, onAssetsConversion, onAssetHistoricalPrice, and onAssetsMarketData entry points, along with the now-unused AssetsHandler, AssetsUseCases, InMemoryCache, ICache, and the endowment:assets permission. Closes WPN-2012
af44f36 to
e432d5a
Compare
|
assets handlers
There was a problem hiding this comment.
🟡 Changes recommended
Cleanup is incomplete because an unused dependency and obsolete lint suppression remain, and the changelog marker violates repository convention.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Removes the Bitcoin Wallet Snap’s asset API entry points and associated implementation.
Changes:
- Removes four asset handlers and the
endowment:assetspermission. - Deletes related use cases, caching, metadata, and historical pricing code.
- Updates coverage thresholds and the changelog.
File summaries
| File | Description |
|---|---|
src/use-cases/index.ts |
Removes asset use-case export. |
src/use-cases/AssetsUseCases.ts |
Deletes asset pricing use cases. |
src/use-cases/AssetsUseCases.test.ts |
Deletes related tests. |
src/store/InMemoryCache.ts |
Deletes the unused cache. |
src/store/InMemoryCache.test.ts |
Deletes cache tests. |
src/store/ICache.ts |
Deletes cache interfaces. |
src/infra/PriceApiClientAdapter.ts |
Removes historical pricing support. |
src/index.ts |
Removes asset handler initialization and exports. |
src/handlers/mappings.ts |
Removes an unused account mapping. |
src/handlers/index.ts |
Removes the asset handler export. |
src/handlers/icons.ts |
Deletes asset metadata icons. |
src/handlers/AssetsHandler.ts |
Deletes asset entry-point handling. |
src/handlers/AssetsHandler.test.ts |
Deletes handler tests. |
src/entities/rates.ts |
Removes historical pricing types. |
src/entities/config.ts |
Removes conversion-expiration configuration. |
src/entities/account.ts |
Removes an unused reverse mapping. |
src/config.ts |
Removes the conversion-expiration value. |
snap.manifest.json |
Removes the assets permission and updates the hash. |
jest.config.mjs |
Updates coverage thresholds. |
CHANGELOG.md |
Documents the breaking removal. |
Review details
Suppressed comments (2)
packages/bitcoin-wallet-snap/src/use-cases/AssetsUseCases.ts:1
- Removing this file eliminates the only source import of
@metamask/slip44, but the package still declares it inpackages/bitcoin-wallet-snap/package.json:56(and its workspace lock entry remains). Remove the dependency with the workspace Yarn command so the package metadata and lockfile are updated together.
packages/bitcoin-wallet-snap/src/store/InMemoryCache.test.ts:1 - Deleting this test leaves its
@typescript-eslint/no-explicit-anysuppression behind ineslint-suppressions.json:118-122. Remove that obsolete entry so the suppression inventory no longer references a nonexistent file.
- Files reviewed: 20/20 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| ### Removed | ||
|
|
||
| - **BREAKING** Remove the `onAssetsLookup`, `onAssetsConversion`, `onAssetHistoricalPrice`, and `onAssetsMarketData` asset handler entry points, along with the now-unused `AssetsHandler`, `AssetsUseCases`, `InMemoryCache`, `ICache`, and the `endowment:assets` permission ([#260](https://github.com/MetaMask/internal-snaps/pull/260)) |
There was a problem hiding this comment.
What a catch. Well there are some inconsistencies where sometimes there is the colon and sometimes not but yes the convention prefers to have the colon.
There was a problem hiding this comment.
100%! I will fix it at release time
|
I have updated the description with the WHY part, feel to edit it if not coherent. |



Closes WPN-2012
Why
These
onAssetsLookup/onAssetsConversion/onAssetHistoricalPrice/onAssetsMarketDataentry points exist so a snap can serve asset metadata and price/conversion data to the client. For Bitcoin that responsibility already lives in the client:MultichainAssetsControllerandMultichainAssetsRatesControllersource bip122 assets and fiat rates directly, so nothing calls the snap's asset handlers. They are dead code that still costs us anendowment:assetspermission, a cache layer (InMemoryCache), and a price-API code path to maintain. Removing them reduces the snap's permission surface and bundle size with no change in behaviour.Summary
onAssetsLookup,onAssetsConversion,onAssetHistoricalPrice, andonAssetsMarketDataentry points frombitcoin-wallet-snapAssetsHandler,AssetsUseCases,InMemoryCache,ICache, and theconversionsExpirationIntervalconfigendowment:assetspermission from the manifestBreaking change
The asset handler entry points are no longer exported by the snap.