Skip to content

fix(wallet): Improve default messenger, state and instance types#8436

Merged
rekmarks merged 5 commits intorekm/wallet-library-tweaksfrom
fb/improve-wallet-lib-default-types
Apr 13, 2026
Merged

fix(wallet): Improve default messenger, state and instance types#8436
rekmarks merged 5 commits intorekm/wallet-library-tweaksfrom
fb/improve-wallet-lib-default-types

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented Apr 13, 2026

Explanation

Infer messenger, instance and state types from defaultConfigurations. Which lets us remove casting due to previous lack of messenger types.


Note

Medium Risk
Mostly TypeScript typing refactors, but it also downgrades @metamask/utils, which could introduce subtle compatibility or build/runtime differences across the wallet package.

Overview
Improves type-safety for the wallet initialization flow by deriving RootMessenger, default action/event types, instance types, and Wallet.state shape directly from defaultConfigurations (new initialization/defaults.ts) and re-exporting them via initialization/index.ts.

Updates Wallet and initialize to use these inferred types (including stricter messenger typing and typed DefaultState/DefaultInstances), removes the old RootMessenger type from types.ts, and adds a couple of targeted @ts-expect-error annotations for calling optional destroy().

Also adjusts sendTransaction to rely on the typed return value from messenger.call (removing an explicit cast) and downgrades @metamask/utils from ^11.11.0 to ^11.9.0 (with lockfile update).

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

@FrederikBolding FrederikBolding marked this pull request as ready for review April 13, 2026 11:11
@rekmarks rekmarks merged commit a652933 into rekm/wallet-library-tweaks Apr 13, 2026
318 of 347 checks passed
@rekmarks rekmarks deleted the fb/improve-wallet-lib-default-types branch April 13, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants