Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0db5207
chore: bump keyring API to v2 and update module resolution
hmalik88 Jul 22, 2026
eac224b
feat: migrate KeyringHandler to keyring API v2
hmalik88 Jul 22, 2026
af4d823
feat: add parseDerivationPath for bip44:derive-path handler
hmalik88 Jul 22, 2026
4255e88
fix: mark accounts as exportable in keyring account mapping
hmalik88 Jul 22, 2026
ab1e7fd
test: update KeyringHandler unit tests for keyring API v2
hmalik88 Jul 22, 2026
99e9dfe
test: update integration tests for keyring API v2
hmalik88 Jul 22, 2026
006fe70
chore: fix formatting
hmalik88 Jul 22, 2026
bab37ae
docs: update changelog for keyring API v2 migration
hmalik88 Jul 22, 2026
e5f223f
fix: upgrade sample-snap snaps dependencies to match bitcoin-wallet-s…
hmalik88 Jul 22, 2026
e3e8d20
chore: recalculate shasum
hmalik88 Jul 24, 2026
69b943d
fix: yarn dedupe
hmalik88 Jul 24, 2026
9c9e31e
fix: lint errors, formatting, dedupe, and shasum
hmalik88 Jul 24, 2026
c5280b2
docs: add PR links to changelog entries
hmalik88 Jul 24, 2026
25667fa
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 Jul 24, 2026
6278531
fix: use replaceAll to strip hardening apostrophes in parseDerivation…
hmalik88 Jul 24, 2026
1dcdc91
chore: recalculate shasum
hmalik88 Jul 24, 2026
4ede53f
chore: update keyring-api
hmalik88 Jul 24, 2026
6022074
refactor: move entropy assignment into try/catch
hmalik88 Jul 27, 2026
3bce0ba
chore: recalculate shasum
hmalik88 Jul 27, 2026
7ce1cc9
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 Jul 27, 2026
eac6f82
fix: update test
hmalik88 Jul 27, 2026
cbc9005
chore: add breaking entry in changelog
hmalik88 Jul 27, 2026
02c5739
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 Jul 27, 2026
43b4081
fix: merge conflicts
hmalik88 Jul 27, 2026
88e4710
feat: add defensive measure for account export
hmalik88 Jul 27, 2026
156ee6d
chore: recalculate shasum
hmalik88 Jul 27, 2026
aa59fae
chore: bump keyring-snap-sdk
hmalik88 Jul 27, 2026
452aaf4
refactor: use defaultAddressType
hmalik88 Jul 27, 2026
27e9e9b
chore: recalculate shasum
hmalik88 Jul 27, 2026
7ea0b51
fix: update logic
hmalik88 Jul 27, 2026
c679f16
chore: recalculate shasum
hmalik88 Jul 27, 2026
088d00a
refactor: apply code review
hmalik88 Jul 27, 2026
fa4e741
fix: lint fix
hmalik88 Jul 27, 2026
0a2a0f1
fix: lint fix
hmalik88 Jul 27, 2026
155217a
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 Jul 29, 2026
64fe7d3
fix: yarn.lock
hmalik88 Jul 29, 2026
31d9fde
fix: update deps and shasum
hmalik88 Jul 29, 2026
9579085
chore: update tron shasum
hmalik88 Jul 29, 2026
df46666
fix: shasum
hmalik88 Jul 29, 2026
288a959
chore: add tron changelog entries
hmalik88 Jul 29, 2026
a36f070
fix: lint fix
hmalik88 Jul 29, 2026
06663c3
fix: update entries
hmalik88 Jul 29, 2026
e96ca6d
fix: undo deletion after discovery
hmalik88 Jul 30, 2026
35db486
chore: update shasum
hmalik88 Jul 30, 2026
7cfade4
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 Jul 30, 2026
cfe2231
chore: recalculate shasum
hmalik88 Jul 30, 2026
777c1a4
fix: tron shasum
hmalik88 Jul 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/bitcoin-wallet-snap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add support for keyring API v2, including `bip44:derive-path`, `bip44:derive-index`, `bip44:derive-index-range`, and `bip44:discover` account creation types ([#43](https://github.com/MetaMask/internal-snaps/pull/43))
- Add `exportAccount` method supporting WIF (base58) private key export ([#43](https://github.com/MetaMask/internal-snaps/pull/43))
- Add `parseDerivationPath` to validate and parse BIP-44 derivation paths for native segwit (BIP-84) accounts ([#43](https://github.com/MetaMask/internal-snaps/pull/43))

### Changed

- **BREAKING** Remove v1 keyring API support (`createAccount`, v1 `Keyring` interface) in favour of v2 ([#43](https://github.com/MetaMask/internal-snaps/pull/43))
- Migrate `KeyringHandler` to implement `KeyringSnapRpc` from `@metamask/keyring-api/v2` ([#43](https://github.com/MetaMask/internal-snaps/pull/43))
- Update `snap.manifest.json` to declare `derivePath` capability in the `bip44` keyring block ([#43](https://github.com/MetaMask/internal-snaps/pull/43))
- Mark accounts as exportable in the keyring account mapping ([#43](https://github.com/MetaMask/internal-snaps/pull/43))

Comment thread
hmalik88 marked this conversation as resolved.
## [1.15.2]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ describe('OnClientRequestHandler', () => {

const response = await snap.onKeyringRequest({
origin: ORIGIN,
method: 'keyring_createAccount',
method: 'keyring_createAccounts',
params: {
options: {
scope: BtcScope.Regtest,
synchronize: false,
index: ACCOUNT_INDEX,
},
type: 'bip44:derive-path',
entropySource: 'm',
derivationPath: `m/84'/1'/${ACCOUNT_INDEX}'`,
},
});

if ('result' in response.response) {
account = response.response.result as KeyringAccount;
account = (
response.response.result as KeyringAccount[]
)[0] as KeyringAccount;
createdAccountId = account.id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,19 @@ describe('CronHandler', () => {
// create account without initial sync
const createResponse = await snap.onKeyringRequest({
origin: ORIGIN,
method: 'keyring_createAccount',
method: 'keyring_createAccounts',
params: {
options: {
scope: BtcScope.Regtest,
addressType: BtcAccountType.P2wpkh,
synchronize: false,
index: ACCOUNT_INDEX,
},
type: 'bip44:derive-path',
entropySource: 'm',
derivationPath: `m/84'/1'/${ACCOUNT_INDEX}'`,
},
});

expect(createResponse.response).toBeDefined();
expect('result' in createResponse.response).toBe(true);

const account = (createResponse.response as { result: KeyringAccount })
.result;
const account = (createResponse.response as { result: KeyringAccount[] })
.result[0] as KeyringAccount;

accountsToSync.push(account.id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ describe('KeyringRequestHandler', () => {

const response = await snap.onKeyringRequest({
origin: ORIGIN,
method: 'keyring_createAccount',
method: 'keyring_createAccounts',
params: {
options: {
scope: BtcScope.Regtest,
synchronize: false,
index: ACCOUNT_INDEX,
},
type: 'bip44:derive-path',
entropySource: 'm',
derivationPath: `m/84'/1'/${ACCOUNT_INDEX}'`,
},
});

if ('result' in response.response) {
account = response.response.result as KeyringAccount;
account = (
response.response.result as KeyringAccount[]
)[0] as KeyringAccount;
createdAccountId = account.id;
}

Expand All @@ -86,9 +86,9 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32000,
code: -32603,
message:
'Invalid format: At path: params.account -- Expected a value of type `UuidV4`, but received: `"notAUUID"`',
'At path: params.account -- Expected a value of type `UuidV4`, but received: `"notAUUID"`',
stack: expect.anything(),
});
});
Expand All @@ -109,14 +109,8 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32601,
data: {
account: account.id,
cause: null,
method: 'invalidMethod',
},
message:
'Method not implemented or not supported: Unrecognized Bitcoin account capability',
code: -32603,
message: 'Unrecognized Bitcoin account capability',
stack: expect.anything(),
});
});
Expand Down Expand Up @@ -381,12 +375,8 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32000,
message: 'Invalid format: Invalid PSBT',
data: {
cause: null,
transaction: 'notAPsbt',
},
code: -32603,
message: 'Invalid PSBT',

@hmalik88 hmalik88 Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because handleKeyringRequest either throws SnapError or Error , the middleware doesn't catch it as FormatError, hence the "Invalid format: " prefix gets stripped

stack: expect.anything(),
});
});
Expand Down Expand Up @@ -415,9 +405,9 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32000,
code: -32603,
message:
'Invalid format: At path: account -- Expected an object, but received: undefined',
'At path: account -- Expected an object, but received: undefined',
stack: expect.anything(),
});
});
Expand All @@ -442,9 +432,9 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32000,
code: -32603,
message:
'Invalid format: At path: options -- Expected an object, but received: undefined',
'At path: options -- Expected an object, but received: undefined',
stack: expect.anything(),
});
});
Expand Down Expand Up @@ -503,12 +493,8 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32000,
message: 'Invalid format: Invalid PSBT',
data: {
cause: null,
transaction: 'notAPsbt',
},
code: -32603,
message: 'Invalid PSBT',
stack: expect.anything(),
});
});
Expand Down Expand Up @@ -567,12 +553,8 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32000,
message: 'Invalid format: Invalid PSBT',
data: {
cause: null,
transaction: 'notAPsbt',
},
code: -32603,
message: 'Invalid PSBT',
stack: expect.anything(),
});
});
Expand Down Expand Up @@ -665,12 +647,8 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32000,
message: 'Invalid format: Invalid PSBT',
data: {
cause: null,
transaction: 'notAPsbt',
},
code: -32603,
message: 'Invalid PSBT',
stack: expect.anything(),
});
});
Expand Down Expand Up @@ -737,9 +715,8 @@ describe('KeyringRequestHandler', () => {
});

expect(response).toRespondWithError({
code: -32602,
data: { address: 'notAnAddress', amount: '1000', cause: null },
message: 'Validation failed: Invalid recipient',
code: -32603,
message: 'Invalid recipient',
stack: expect.anything(),
});
});
Expand Down
Loading
Loading