-
Notifications
You must be signed in to change notification settings - Fork 1
feat(bitcoin-snap): update to keyring v2 #43
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 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 eac224b
feat: migrate KeyringHandler to keyring API v2
hmalik88 af4d823
feat: add parseDerivationPath for bip44:derive-path handler
hmalik88 4255e88
fix: mark accounts as exportable in keyring account mapping
hmalik88 ab1e7fd
test: update KeyringHandler unit tests for keyring API v2
hmalik88 99e9dfe
test: update integration tests for keyring API v2
hmalik88 006fe70
chore: fix formatting
hmalik88 bab37ae
docs: update changelog for keyring API v2 migration
hmalik88 e5f223f
fix: upgrade sample-snap snaps dependencies to match bitcoin-wallet-s…
hmalik88 e3e8d20
chore: recalculate shasum
hmalik88 69b943d
fix: yarn dedupe
hmalik88 9c9e31e
fix: lint errors, formatting, dedupe, and shasum
hmalik88 c5280b2
docs: add PR links to changelog entries
hmalik88 25667fa
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 6278531
fix: use replaceAll to strip hardening apostrophes in parseDerivation…
hmalik88 1dcdc91
chore: recalculate shasum
hmalik88 4ede53f
chore: update keyring-api
hmalik88 6022074
refactor: move entropy assignment into try/catch
hmalik88 3bce0ba
chore: recalculate shasum
hmalik88 7ce1cc9
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 eac6f82
fix: update test
hmalik88 cbc9005
chore: add breaking entry in changelog
hmalik88 02c5739
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 43b4081
fix: merge conflicts
hmalik88 88e4710
feat: add defensive measure for account export
hmalik88 156ee6d
chore: recalculate shasum
hmalik88 aa59fae
chore: bump keyring-snap-sdk
hmalik88 452aaf4
refactor: use defaultAddressType
hmalik88 27e9e9b
chore: recalculate shasum
hmalik88 7ea0b51
fix: update logic
hmalik88 c679f16
chore: recalculate shasum
hmalik88 088d00a
refactor: apply code review
hmalik88 fa4e741
fix: lint fix
hmalik88 0a2a0f1
fix: lint fix
hmalik88 155217a
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 64fe7d3
fix: yarn.lock
hmalik88 31d9fde
fix: update deps and shasum
hmalik88 9579085
chore: update tron shasum
hmalik88 df46666
fix: shasum
hmalik88 288a959
chore: add tron changelog entries
hmalik88 a36f070
fix: lint fix
hmalik88 06663c3
fix: update entries
hmalik88 e96ca6d
fix: undo deletion after discovery
hmalik88 35db486
chore: update shasum
hmalik88 7cfade4
Merge remote-tracking branch 'origin/main' into hm/add-v2-methods
hmalik88 cfe2231
chore: recalculate shasum
hmalik88 777c1a4
fix: tron shasum
hmalik88 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 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 |
|---|---|---|
|
|
@@ -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; | ||
| } | ||
|
|
||
|
|
@@ -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(), | ||
| }); | ||
| }); | ||
|
|
@@ -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(), | ||
| }); | ||
| }); | ||
|
|
@@ -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', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because |
||
| stack: expect.anything(), | ||
| }); | ||
| }); | ||
|
|
@@ -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(), | ||
| }); | ||
| }); | ||
|
|
@@ -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(), | ||
| }); | ||
| }); | ||
|
|
@@ -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(), | ||
| }); | ||
| }); | ||
|
|
@@ -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(), | ||
| }); | ||
| }); | ||
|
|
@@ -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(), | ||
| }); | ||
| }); | ||
|
|
@@ -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(), | ||
| }); | ||
| }); | ||
|
|
||
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.