Commit 1f14fa8
authored
fix: Wait for unlock before handling
`getSnapKeyring` fails when the client is locked since we cannot access
the `KeyringController`. As with every other Snaps API, we want to wait
for the client to be unlocked before allowing use of functionality that
accesses the vault.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds `getUnlockPromise` to `manageAccounts` and awaits unlock before
routing requests to the snap keyring, with tests updated accordingly.
>
> - **RPC method `snap_manageAccounts`**:
> - Add `getUnlockPromise` to method hooks and await
`getUnlockPromise(true)` before calling `getSnapKeyring` and routing to
`handleKeyringSnapMessage` in `manageAccounts.ts`.
> - Update `specificationBuilder` and
`manageAccountsBuilder.methodHooks` to include `getUnlockPromise`.
> - **Tests**:
> - Update `manageAccounts.test.ts` to include `getUnlockPromise` in
hooks and mocks; maintain validation and routing assertions.
> - **Misc**:
> - Slightly adjust coverage threshold for lines in `jest.config.js`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ba55813. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->manageAccounts requests (#3686)1 parent ea29b05 commit 1f14fa8
File tree
3 files changed
+22
-1
lines changed- packages/snaps-rpc-methods
- src/restricted
3 files changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
| 112 | + | |
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
| 136 | + | |
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
| 144 | + | |
137 | 145 | | |
138 | 146 | | |
139 | 147 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
| |||
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
108 | 120 | | |
109 | 121 | | |
110 | 122 | | |
| |||
115 | 127 | | |
116 | 128 | | |
117 | 129 | | |
| 130 | + | |
118 | 131 | | |
119 | 132 | | |
0 commit comments