Improve @metamask/delegation-abis tree-shakability#131
Merged
jeffsmale90 merged 6 commits intomainfrom Jan 20, 2026
Merged
Conversation
0e3f7eb to
e64392b
Compare
930b7d3 to
98c41e4
Compare
4979884 to
9c336c9
Compare
…t_ update generated files - remove bytecodes from default export @metamask/delegation-abis - add new export @metamask/delegation-abis/bytecode - shuffle src files into src/abis, src/bytecode and src/artifacts - updates scripts/format-abis.js to ESM - disable bundling in tsup to avoid large chunks - adds plugin to rewrite relative import file extensions
…ly the abis to match new interface
9c336c9 to
eff4692
Compare
MoMannn
approved these changes
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
This PR improves the tree-shakability of @metamask/delegation-abis, so that bundled apps aren't bloated by unnecessary abi and bytecode data.
Note: this PR contains generated code - view by individual changes to see the file updates vs generated
🔄 What Changed?
Various changes to improve tree-shakability of @metamask/delegation-abis:
src/abis,src/bytecodeandsrc/artifactsscripts/format-abis.jsto ESMdeploySmartAccountsEnvironmentis still included as part of @metamask/smart-accounts-kit, which introduces all of the bytecodes. We may wish to decouple that in a separate PR.🚀 Why?
The @metamask/delegation-abi package includes all typescript ABI declarations for Delegation Framework. It also includes bytecode for each contract, to facilitate
deploySmartAccountsEnvironmentutility function. Dapp bundles depending on @metamask/smart-accounts-kit are unnecessarily bundling all ABI files, including bytecode. This change ensures that only the ABIs necessary for a bundled dapp are included.🧪 How to Test?
Describe how to test these changes:
I've validated that both abis and bytecode can be included both via cjs and esm.
No breaking changes
Breaking changes (describe below):
NarrowAbiToFunctionutility type is removed@metamask/delegation-abis previously exported an object
{ abi, bytecode }for each contract, and now exports the abi directly (no bytecode, no top-level object)📋 Checklist
Check off completed items:
🔗 Related Issues
Link to related issues:
Closes #
Related to #
📚 Additional Notes
Any additional information, concerns, or context:
Note
Makes
@metamask/delegation-abismore tree‑shakable by decoupling ABIs from bytecode and restructuring build outputs.src/abis/*and bytecode insrc/bytecode/*@metamask/delegation-abis/bytecodeand generatesdist/bytecode.*via updatedscripts/format-abis.js(now ESM) andscripts/generate.shsrc/index.ts(ABIs) andsrc/bytecode.ts(bytecodes) with sorted named exportsscripts/fixExtensionsPlugin.tsto rewrite relative imports for non-bundled tsup buildssrc/artifacts/and updates generation pipelineBreaking change: default exports now expose
abionly (previous{ abi, bytecode }removed).Written by Cursor Bugbot for commit eff4692. This will update automatically on new commits. Configure here.