Skip to content

feat: Add wallet library#8417

Draft
FrederikBolding wants to merge 24 commits intomainfrom
feat/wallet-library
Draft

feat: Add wallet library#8417
FrederikBolding wants to merge 24 commits intomainfrom
feat/wallet-library

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented Apr 9, 2026

Explanation

Feature branch. WIP.

Know limitations:

  • Does not run on Node 18. Currently skipped in CI. Would need polyfill to fix but we should probably deprecate Node 18 instead.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 14, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

FrederikBolding and others added 14 commits April 16, 2026 14:01
Builds and tests pass. All lint issues are fixed except a handful that
are deferred pending future changes.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Moderate risk due to new controller dependencies and changes to
initialization wiring/typing that could affect runtime messaging and
controller lifecycle. Test behavior now depends on external
`INFURA_PROJECT_KEY` and mocked timers, which may introduce
CI/environment sensitivity.
> 
> **Overview**
> **Stabilizes wallet builds/tests by wiring in missing controllers and
config.** The wallet package now depends on additional controllers
(accounts/approval/connectivity/network/remote feature
flags/transaction) and updates TS project references accordingly.
> 
> **Improves runtime/test ergonomics.** Jest loads a local `.env` (with
`.env.example` added and `.env` gitignored), `Wallet` exposes stronger
typed `messenger`/`state` and adds `destroy()` to clean up controller
instances; tests are updated to require `INFURA_PROJECT_KEY`, use fake
timers, and properly teardown the wallet.
> 
> **Tightens initialization typing and controller wiring.** Adds
`initialization/defaults.ts` for inferred
`DefaultInstances`/`DefaultActions`/`DefaultEvents`, introduces
`bindMessengerAction` to preserve action typings, and updates controller
initializers (notably `TransactionController` and
`RemoteFeatureFlagController`) to pass required options and bind
messenger actions safely.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a652933. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Anvil provides a local chain for the transaction test, and the remaining
tests don't make real RPC calls (nock blocks outgoing network), so a
real Infura key is no longer needed to run the test suite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a test for `createSecretRecoveryPhrase` to cover the untested
utility. Marks the defensive `return undefined` branch in `destroy()`
as ignored (all real controllers have a destroy method). Lowers coverage
thresholds from 100% to reflect code that is not yet reachable from the
public API in this prototype stage (e.g. isOffline callback, encryptor
factory bodies, ConnectivityController.init).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rekmarks rekmarks force-pushed the feat/wallet-library branch from ad559d1 to 623f9af Compare April 16, 2026 21:02
@rekmarks rekmarks force-pushed the feat/wallet-library branch from 623f9af to 3fb60ee Compare April 16, 2026 21:13
rekmarks and others added 4 commits April 16, 2026 14:30
Previously a pretest lifecycle hook, which is not guaranteed to run
depending on how CI invokes tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rekmarks and others added 5 commits April 16, 2026 15:28
Silences foundryup output on success (prints on failure), extracts
the install step into a named test:prepare script for discoverability,
and adds a yarn.config.cjs exception since the wallet test script
differs from the monorepo standard. Also updates the stale error
message in anvil.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Yarn's built-in shell doesn't support the shell syntax needed to
suppress foundryup output on success and print it on failure. Moving
to a real bash script avoids Yarn shell quirks that may explain why
the anvil binary download isn't running reliably in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mm-foundryup installs anvil to <cwd>/node_modules/.bin/anvil. If cwd
isn't what we expect when the script runs (which may be why CI fails),
anvil ends up somewhere neither getAnvilBinaryPath candidate matches.

Explicitly cd to the package root and verify the expected file exists
after install, with diagnostic output on failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Node 18 does not expose globalThis.crypto by default, which causes
the wallet package's tests to fail inside browser-passworder's
generateSalt.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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