-
-
Notifications
You must be signed in to change notification settings - Fork 279
feat(wallet): Add split persistence backed by better-sqlite3 #8480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8c1e9e5
feat(wallet): Add split persistence backed by better-sqlite3
rekmarks 0b122f7
fix(wallet): Restore @ts-expect-error for protected destroy access
rekmarks 331ef42
chore: Bump better-sqlite3
rekmarks 283acca
chore: lint
rekmarks 18b57d1
docs: Fix better-sqlite3 rebuild instructions
rekmarks b6b0596
refactor: Tweak sqlite imports
rekmarks 428d427
refactor: Tweak types, simplify tests
rekmarks c7ca356
fix: Harden persistence layer error handling and lifecycle management
rekmarks c6a88f5
tests: Cover persistence error paths and lifecycle edge cases
rekmarks 62ff2e3
chore: oxfmt & eslint
rekmarks 6df4a99
refactor: Make change and persist sets readonly
rekmarks cfad387
refactor: Unsubscribe in try block
rekmarks b36d336
refactor: Decouple persistence from Wallet constructor
rekmarks 366b265
chore: Re-export persistence-facing types from wallet entry
rekmarks f4e8dfa
fix: Prevent synchronous errors from interrupting destroy procedure
rekmarks 86a69b0
test: Add tests for destruction robustuness
rekmarks ce80922
fix: Rebuild better-sqlite3 if bindings are missing at test time
rekmarks bd9c504
fix: Only rebuild better-sqlite3 addon when missing
rekmarks 4c16ea9
refactor: Exclude instances without metadata from metadata getter
rekmarks 58ab0c5
refactor: Remove extraneous registerInitialEventPayload
rekmarks 772c1e6
refactor: Address review
rekmarks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e | ||
| set -o pipefail | ||
|
|
||
| # Pin cwd to the package root so all paths are predictable regardless of how | ||
| # this script is invoked. Also derive the monorepo root (two levels up). | ||
| PACKAGE_ROOT="$(cd "$(dirname "$0")/.." && pwd)" | ||
| MONOREPO_ROOT="$(cd "${PACKAGE_ROOT}/../.." && pwd)" | ||
| cd "${PACKAGE_ROOT}" | ||
|
|
||
| # Run foundryup's TypeScript entry point directly via tsx. This avoids having | ||
| # to build @metamask/foundryup first, which matters in CI where workspace deps | ||
| # aren't built before tests run. | ||
| if ! output=$(yarn tsx ../foundryup/src/cli.ts --binaries anvil 2>&1); then | ||
| echo "$output" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Install the better-sqlite3 native addon if missing. Yarn has | ||
| # `enableScripts: false` globally, so install scripts never run during | ||
| # `yarn install` and the addon may be absent from the filesystem. Invoke the | ||
| # prebuild-install binary directly to fetch a matching prebuild for the active | ||
| # Node version and platform. | ||
| BETTER_SQLITE3_DIR="${MONOREPO_ROOT}/node_modules/better-sqlite3" | ||
| if [ ! -f "${BETTER_SQLITE3_DIR}/build/Release/better_sqlite3.node" ]; then | ||
| ( | ||
| cd "${BETTER_SQLITE3_DIR}" | ||
| "${MONOREPO_ROOT}/node_modules/.bin/prebuild-install" | ||
| ) | ||
| fi |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,8 @@ | ||
| export { Wallet } from './Wallet'; | ||
| export type { WalletOptions } from './types'; | ||
| export type { | ||
| DefaultActions, | ||
| DefaultEvents, | ||
| RootMessenger, | ||
| WalletDestroyedEvent, | ||
| } from './initialization'; |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.