@metamask-previews/eth-snap-keyring 22.1.0-de887b2 → 22.2.0-52bd218
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -18
- package/dist/v2/SnapKeyringV1Adapter.cjs +23 -0
- package/dist/v2/SnapKeyringV1Adapter.cjs.map +1 -0
- package/dist/v2/SnapKeyringV1Adapter.d.cts +14 -0
- package/dist/v2/SnapKeyringV1Adapter.d.cts.map +1 -0
- package/dist/v2/SnapKeyringV1Adapter.d.mts +14 -0
- package/dist/v2/SnapKeyringV1Adapter.d.mts.map +1 -0
- package/dist/v2/SnapKeyringV1Adapter.mjs +19 -0
- package/dist/v2/SnapKeyringV1Adapter.mjs.map +1 -0
- package/dist/v2/index.cjs +1 -0
- package/dist/v2/index.cjs.map +1 -1
- package/dist/v2/index.d.cts +1 -0
- package/dist/v2/index.d.cts.map +1 -1
- package/dist/v2/index.d.mts +1 -0
- package/dist/v2/index.d.mts.map +1 -1
- package/dist/v2/index.mjs +1 -0
- package/dist/v2/index.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [22.2.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `SnapKeyringV1Adapter` to adapt Snap v2 keyrings to legacy v1 keyring operations ([#557](https://github.com/MetaMask/accounts/pull/557))
|
|
15
|
+
- This adapter mostly exposes EVM signing operations through `EthKeyringV1Adapter`.
|
|
16
|
+
- This adapter also implements `removeAccount` the way it was implemented by the legacy Snap keyring (compatible with the `KeyringController` account removal flow).
|
|
17
|
+
|
|
10
18
|
### Changed
|
|
11
19
|
|
|
12
20
|
- Normalize `KeyringAccount`'s address with `:accountCreated` and `setAccounts` ([#556](https://github.com/MetaMask/accounts/pull/556))
|
|
21
|
+
- Bump `@metamask/keyring-sdk` from `^2.1.1` to `^2.2.0` ([#562](https://github.com/MetaMask/accounts/pull/562))
|
|
22
|
+
- Bump `@metamask/keyring-snap-sdk` from `^9.0.1` to `^9.0.2` ([#562](https://github.com/MetaMask/accounts/pull/562))
|
|
13
23
|
|
|
14
24
|
## [22.1.0]
|
|
15
25
|
|
|
@@ -69,7 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
69
79
|
- Support Stellar (`xlm:account`) accounts in account assertions and v1 migrations ([#483](https://github.com/MetaMask/accounts/pull/483))
|
|
70
80
|
- Add `SnapKeyringV1` class, a per-snap keyring wrapper that implements the old keyring interface and flows ([#507](https://github.com/MetaMask/accounts/pull/507))
|
|
71
81
|
- This will allow us to re-use the existing logic (that we still use today) as part of the new V2 implementation until we completely them.
|
|
72
|
-
- Add `SnapKeyringV2` class, a per-snap keyring wrapper that implements `KeyringV2` with `createAccount`, `createAccounts`, `deleteAccount`, `submitRequest`, `getAccount`, and `getAccounts` ([#501](https://github.com/MetaMask/accounts/pull/501)
|
|
82
|
+
- Add `SnapKeyringV2` class, a per-snap keyring wrapper that implements `KeyringV2` with `createAccount`, `createAccounts`, `deleteAccount`, `submitRequest`, `getAccount`, and `getAccounts` ([#501](https://github.com/MetaMask/accounts/pull/501), [#507](https://github.com/MetaMask/accounts/pull/507))
|
|
73
83
|
- `SnapKeyringV2` inherits from `SnapKeyringV1` so it can replace the current `SnapKeyring` class entirely, but for a single Snap.
|
|
74
84
|
- Add `@metamask/keyring-sdk` `^1.1.0` as a new dependency ([#501](https://github.com/MetaMask/accounts/pull/501))
|
|
75
85
|
- Add `./v2` subpath export for keyring v2 implementation ([#513](https://github.com/MetaMask/accounts/pull/513))
|
|
@@ -82,7 +92,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
82
92
|
- **BREAKING:** Bump `@metamask/keyring-api` from `^22.0.0` to `^23.0.0` ([#515](https://github.com/MetaMask/accounts/pull/515))
|
|
83
93
|
- Use `DeferredPromise` from `@metamask/utils` ([#508](https://github.com/MetaMask/accounts/pull/508))
|
|
84
94
|
- Refactor `SnapKeyring` to store accounts in per-snap `SnapKeyringV2` wrappers instead of a single flat map ([#501](https://github.com/MetaMask/accounts/pull/501))
|
|
85
|
-
- Bump `@metamask/messenger` from `^0.3.0` to `^1.1.1` ([#489](https://github.com/MetaMask/accounts/pull/489)
|
|
95
|
+
- Bump `@metamask/messenger` from `^0.3.0` to `^1.1.1` ([#489](https://github.com/MetaMask/accounts/pull/489), [#500](https://github.com/MetaMask/accounts/pull/500))
|
|
86
96
|
- Bump `@metamask/snaps-controllers` from `^19.0.0` to `^19.0.1` ([#500](https://github.com/MetaMask/accounts/pull/500))
|
|
87
97
|
- Bump `@metamask/snaps-utils` from `^12.1.2` to `^12.1.3` ([#500](https://github.com/MetaMask/accounts/pull/500))
|
|
88
98
|
- Bump `@metamask/utils` from `^11.10.0` to `^11.11.0` ([#483](https://github.com/MetaMask/accounts/pull/483))
|
|
@@ -117,9 +127,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
117
127
|
- **BREAKING:** Bump `@metamask/keyring-internal-api` from `^9.1.2` to `^10.0.0` ([#460](https://github.com/MetaMask/accounts/pull/460))
|
|
118
128
|
- **BREAKING:** Bump `@metamask/keyring-internal-snap-client` from `^8.0.2` to `^9.0.0` ([#460](https://github.com/MetaMask/accounts/pull/460))
|
|
119
129
|
- Bump `@metamask/keyring-api` from `^21.2.0` to `^21.4.0` ([#460](https://github.com/MetaMask/accounts/pull/460))
|
|
120
|
-
- Bump `@metamask/snaps-controllers` from `^14.0.1` to `^18.0.0` ([#422](https://github.com/MetaMask/accounts/pull/422)
|
|
121
|
-
- Bump `@metamask/snaps-sdk` from `^9.0.0` to `^10.4.0` ([#422](https://github.com/MetaMask/accounts/pull/422)
|
|
122
|
-
- Bump `@metamask/snaps-utils` from `^11.0.0` to `^12.1.0` ([#422](https://github.com/MetaMask/accounts/pull/422)
|
|
130
|
+
- Bump `@metamask/snaps-controllers` from `^14.0.1` to `^18.0.0` ([#422](https://github.com/MetaMask/accounts/pull/422), [#461](https://github.com/MetaMask/accounts/pull/461))
|
|
131
|
+
- Bump `@metamask/snaps-sdk` from `^9.0.0` to `^10.4.0` ([#422](https://github.com/MetaMask/accounts/pull/422), [#461](https://github.com/MetaMask/accounts/pull/461))
|
|
132
|
+
- Bump `@metamask/snaps-utils` from `^11.0.0` to `^12.1.0` ([#422](https://github.com/MetaMask/accounts/pull/422), [#424](https://github.com/MetaMask/accounts/pull/424), [#461](https://github.com/MetaMask/accounts/pull/461))
|
|
123
133
|
|
|
124
134
|
### Removed
|
|
125
135
|
|
|
@@ -156,7 +166,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
156
166
|
|
|
157
167
|
### Changed
|
|
158
168
|
|
|
159
|
-
- Add dependency to `@metamask/keyring-snap-sdk` version `^7.1.0` ([#387](https://github.com/MetaMask/accounts/pull/387)
|
|
169
|
+
- Add dependency to `@metamask/keyring-snap-sdk` version `^7.1.0` ([#387](https://github.com/MetaMask/accounts/pull/387), [#388](https://github.com/MetaMask/accounts/pull/388))
|
|
160
170
|
- Bump `@metamask/keyring-api` from `^21.0.0` to `^21.1.0` ([#388](https://github.com/MetaMask/accounts/pull/388))
|
|
161
171
|
|
|
162
172
|
## [17.2.0]
|
|
@@ -179,7 +189,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
179
189
|
|
|
180
190
|
### Changed
|
|
181
191
|
|
|
182
|
-
- **BREAKING:** Bump `@metamask/keyring-api` from `^20.0.0` to `^21.0.0` ([#355](https://github.com/MetaMask/accounts/pull/355)
|
|
192
|
+
- **BREAKING:** Bump `@metamask/keyring-api` from `^20.0.0` to `^21.0.0` ([#355](https://github.com/MetaMask/accounts/pull/355), [#356](https://github.com/MetaMask/accounts/pull/356))
|
|
183
193
|
|
|
184
194
|
## [16.1.0]
|
|
185
195
|
|
|
@@ -230,19 +240,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
230
240
|
|
|
231
241
|
### Changed
|
|
232
242
|
|
|
233
|
-
- Bump `@metamask/keyring-api` from `^17.4.0` to `^17.6.0` ([#277](https://github.com/MetaMask/accounts/pull/277)
|
|
243
|
+
- Bump `@metamask/keyring-api` from `^17.4.0` to `^17.6.0` ([#277](https://github.com/MetaMask/accounts/pull/277), [#288](https://github.com/MetaMask/accounts/pull/288))
|
|
234
244
|
|
|
235
245
|
## [12.1.1]
|
|
236
246
|
|
|
237
247
|
### Changed
|
|
238
248
|
|
|
239
|
-
- Bump `@metamask/keyring-api` from `^17.1.0` to `^17.4.0` ([#212](https://github.com/MetaMask/accounts/pull/212)
|
|
249
|
+
- Bump `@metamask/keyring-api` from `^17.1.0` to `^17.4.0` ([#212](https://github.com/MetaMask/accounts/pull/212), [#220](https://github.com/MetaMask/accounts/pull/220), [#263](https://github.com/MetaMask/accounts/pull/263), [#269](https://github.com/MetaMask/accounts/pull/269))
|
|
240
250
|
|
|
241
251
|
## [12.1.0]
|
|
242
252
|
|
|
243
253
|
### Added
|
|
244
254
|
|
|
245
|
-
- Add new concept of "internal options" and add a new `SnapKeyring.createAccount` method ([#252](https://github.com/MetaMask/accounts/pull/252)
|
|
255
|
+
- Add new concept of "internal options" and add a new `SnapKeyring.createAccount` method ([#252](https://github.com/MetaMask/accounts/pull/252), [#261](https://github.com/MetaMask/accounts/pull/261))
|
|
246
256
|
- Those internal options can be used by the caller of that method to customize the account creation flow.
|
|
247
257
|
- Add `setSelectedAccount` internal option ([#257](https://github.com/MetaMask/accounts/pull/257))
|
|
248
258
|
|
|
@@ -265,7 +275,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
265
275
|
|
|
266
276
|
### Changed
|
|
267
277
|
|
|
268
|
-
- **BREAKING:** Make account creation asynchronous ([#207](https://github.com/MetaMask/accounts/pull/207)
|
|
278
|
+
- **BREAKING:** Make account creation asynchronous ([#207](https://github.com/MetaMask/accounts/pull/207), [#211](https://github.com/MetaMask/accounts/pull/211))
|
|
269
279
|
- We no longer wait for `saveState` to finish before resuming the Snap account execution.
|
|
270
280
|
- Add `onceSaved` deferred promise to `addAccount` callback. This new promise is required so the callback can `await` the account creation.
|
|
271
281
|
- Use `ts-bridge/cli@0.6.3` ([#214](https://github.com/MetaMask/accounts/pull/214))
|
|
@@ -391,7 +401,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
391
401
|
|
|
392
402
|
### Changed
|
|
393
403
|
|
|
394
|
-
- Bump `@metamask/*` dependencies and add `@lavamoat/preinstall-always-fail` ([#65](https://github.com/MetaMask/accounts/pull/65)
|
|
404
|
+
- Bump `@metamask/*` dependencies and add `@lavamoat/preinstall-always-fail` ([#65](https://github.com/MetaMask/accounts/pull/65), [#59](https://github.com/MetaMask/accounts/pull/59), [#58](https://github.com/MetaMask/accounts/pull/58))
|
|
395
405
|
- Use TypeScript 5 ([#55](https://github.com/MetaMask/accounts/pull/55))
|
|
396
406
|
|
|
397
407
|
## [4.3.6]
|
|
@@ -420,10 +430,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
420
430
|
|
|
421
431
|
### Changed
|
|
422
432
|
|
|
423
|
-
- Bump `@metamask/snaps-controllers` from `^9.3.0` to `^9.6.0` ([#372](https://github.com/MetaMask/eth-snap-keyring/pull/372)
|
|
433
|
+
- Bump `@metamask/snaps-controllers` from `^9.3.0` to `^9.6.0` ([#372](https://github.com/MetaMask/eth-snap-keyring/pull/372), [#389](https://github.com/MetaMask/eth-snap-keyring/pull/389))
|
|
424
434
|
- Bump `@metamask/snaps-sdk` from `^6.1.0` to `^6.4.0` ([#389](https://github.com/MetaMask/eth-snap-keyring/pull/389))
|
|
425
435
|
- Bump `@metamask/utils` from `^9.1.0` to `^9.2.1` ([#385](https://github.com/MetaMask/eth-snap-keyring/pull/385))
|
|
426
|
-
- Bump `@metamask/keyring-api` from `^8.0.1` to `^8.1.0` ([#374](https://github.com/MetaMask/eth-snap-keyring/pull/374)
|
|
436
|
+
- Bump `@metamask/keyring-api` from `^8.0.1` to `^8.1.0` ([#374](https://github.com/MetaMask/eth-snap-keyring/pull/374), [#376](https://github.com/MetaMask/eth-snap-keyring/pull/376))
|
|
427
437
|
|
|
428
438
|
## [4.3.2]
|
|
429
439
|
|
|
@@ -431,9 +441,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
431
441
|
|
|
432
442
|
- Bump `@metamask/eth-sig-util` from `^7.0.1` to `^7.0.3` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311))
|
|
433
443
|
- Bump `@metamask/keyring-api` from `^8.0.0` to `^8.0.1` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311))
|
|
434
|
-
- Bump `@metamask/snaps-controllers` from `^8.1.1` to `^9.3.0` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311)
|
|
435
|
-
- Bump `@metamask/snaps-sdk` from `^4.2.0` to `^6.1.0` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311)
|
|
436
|
-
- Bump `@metamask/snaps-utils` from `^7.4.0` to `^7.8.0` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311)
|
|
444
|
+
- Bump `@metamask/snaps-controllers` from `^8.1.1` to `^9.3.0` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311), [#363](https://github.com/MetaMask/eth-snap-keyring/pull/363))
|
|
445
|
+
- Bump `@metamask/snaps-sdk` from `^4.2.0` to `^6.1.0` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311), [#363](https://github.com/MetaMask/eth-snap-keyring/pull/363))
|
|
446
|
+
- Bump `@metamask/snaps-utils` from `^7.4.0` to `^7.8.0` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311), [#363](https://github.com/MetaMask/eth-snap-keyring/pull/363))
|
|
437
447
|
- Bump `@metamask/utils` from `^8.4.0` to `^9.1.0` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311))
|
|
438
448
|
- Set tsconfig options `module`, `moduleResolution` to `Node16` ([#311](https://github.com/MetaMask/eth-snap-keyring/pull/311))
|
|
439
449
|
|
|
@@ -729,7 +739,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
729
739
|
|
|
730
740
|
- Initial release.
|
|
731
741
|
|
|
732
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@22.
|
|
742
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@22.2.0...HEAD
|
|
743
|
+
[22.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@22.1.0...@metamask/eth-snap-keyring@22.2.0
|
|
733
744
|
[22.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@22.0.1...@metamask/eth-snap-keyring@22.1.0
|
|
734
745
|
[22.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@22.0.0...@metamask/eth-snap-keyring@22.0.1
|
|
735
746
|
[22.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@21.0.1...@metamask/eth-snap-keyring@22.0.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SnapKeyringV1Adapter = void 0;
|
|
4
|
+
const v2_1 = require("@metamask/keyring-sdk/v2");
|
|
5
|
+
/**
|
|
6
|
+
* Adapts a v2 Snap keyring to the legacy v1 keyring API.
|
|
7
|
+
*/
|
|
8
|
+
class SnapKeyringV1Adapter extends v2_1.EthKeyringV1Adapter {
|
|
9
|
+
/**
|
|
10
|
+
* Remove an account matching the given address.
|
|
11
|
+
*
|
|
12
|
+
* @param address - Address of the account to remove.
|
|
13
|
+
*/
|
|
14
|
+
async removeAccount(address) {
|
|
15
|
+
const account = this.inner.lookupByAddress(address);
|
|
16
|
+
if (!account) {
|
|
17
|
+
throw new Error(`Account '${address}' not found`);
|
|
18
|
+
}
|
|
19
|
+
await this.inner.deleteAccount(account.id);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SnapKeyringV1Adapter = SnapKeyringV1Adapter;
|
|
23
|
+
//# sourceMappingURL=SnapKeyringV1Adapter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapKeyringV1Adapter.cjs","sourceRoot":"","sources":["../../src/v2/SnapKeyringV1Adapter.ts"],"names":[],"mappings":";;;AAAA,iDAA+D;AAI/D;;GAEG;AACH,MAAa,oBAAqB,SAAQ,wBAAgC;IACxE;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,OAAe;QACjC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAEpD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,aAAa,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF;AAfD,oDAeC","sourcesContent":["import { EthKeyringV1Adapter } from '@metamask/keyring-sdk/v2';\n\nimport type { SnapKeyring } from './SnapKeyring';\n\n/**\n * Adapts a v2 Snap keyring to the legacy v1 keyring API.\n */\nexport class SnapKeyringV1Adapter extends EthKeyringV1Adapter<SnapKeyring> {\n /**\n * Remove an account matching the given address.\n *\n * @param address - Address of the account to remove.\n */\n async removeAccount(address: string): Promise<void> {\n const account = this.inner.lookupByAddress(address);\n\n if (!account) {\n throw new Error(`Account '${address}' not found`);\n }\n\n await this.inner.deleteAccount(account.id);\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EthKeyringV1Adapter } from "@metamask/keyring-sdk/v2";
|
|
2
|
+
import type { SnapKeyring } from "./SnapKeyring.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Adapts a v2 Snap keyring to the legacy v1 keyring API.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SnapKeyringV1Adapter extends EthKeyringV1Adapter<SnapKeyring> {
|
|
7
|
+
/**
|
|
8
|
+
* Remove an account matching the given address.
|
|
9
|
+
*
|
|
10
|
+
* @param address - Address of the account to remove.
|
|
11
|
+
*/
|
|
12
|
+
removeAccount(address: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=SnapKeyringV1Adapter.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapKeyringV1Adapter.d.cts","sourceRoot":"","sources":["../../src/v2/SnapKeyringV1Adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iCAAiC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,0BAAsB;AAEjD;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,mBAAmB,CAAC,WAAW,CAAC;IACxE;;;;OAIG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CASpD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EthKeyringV1Adapter } from "@metamask/keyring-sdk/v2";
|
|
2
|
+
import type { SnapKeyring } from "./SnapKeyring.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Adapts a v2 Snap keyring to the legacy v1 keyring API.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SnapKeyringV1Adapter extends EthKeyringV1Adapter<SnapKeyring> {
|
|
7
|
+
/**
|
|
8
|
+
* Remove an account matching the given address.
|
|
9
|
+
*
|
|
10
|
+
* @param address - Address of the account to remove.
|
|
11
|
+
*/
|
|
12
|
+
removeAccount(address: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=SnapKeyringV1Adapter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapKeyringV1Adapter.d.mts","sourceRoot":"","sources":["../../src/v2/SnapKeyringV1Adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iCAAiC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,0BAAsB;AAEjD;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,mBAAmB,CAAC,WAAW,CAAC;IACxE;;;;OAIG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CASpD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EthKeyringV1Adapter } from "@metamask/keyring-sdk/v2";
|
|
2
|
+
/**
|
|
3
|
+
* Adapts a v2 Snap keyring to the legacy v1 keyring API.
|
|
4
|
+
*/
|
|
5
|
+
export class SnapKeyringV1Adapter extends EthKeyringV1Adapter {
|
|
6
|
+
/**
|
|
7
|
+
* Remove an account matching the given address.
|
|
8
|
+
*
|
|
9
|
+
* @param address - Address of the account to remove.
|
|
10
|
+
*/
|
|
11
|
+
async removeAccount(address) {
|
|
12
|
+
const account = this.inner.lookupByAddress(address);
|
|
13
|
+
if (!account) {
|
|
14
|
+
throw new Error(`Account '${address}' not found`);
|
|
15
|
+
}
|
|
16
|
+
await this.inner.deleteAccount(account.id);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=SnapKeyringV1Adapter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapKeyringV1Adapter.mjs","sourceRoot":"","sources":["../../src/v2/SnapKeyringV1Adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iCAAiC;AAI/D;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,mBAAgC;IACxE;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,OAAe;QACjC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAEpD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,aAAa,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import { EthKeyringV1Adapter } from '@metamask/keyring-sdk/v2';\n\nimport type { SnapKeyring } from './SnapKeyring';\n\n/**\n * Adapts a v2 Snap keyring to the legacy v1 keyring API.\n */\nexport class SnapKeyringV1Adapter extends EthKeyringV1Adapter<SnapKeyring> {\n /**\n * Remove an account matching the given address.\n *\n * @param address - Address of the account to remove.\n */\n async removeAccount(address: string): Promise<void> {\n const account = this.inner.lookupByAddress(address);\n\n if (!account) {\n throw new Error(`Account '${address}' not found`);\n }\n\n await this.inner.deleteAccount(account.id);\n }\n}\n"]}
|
package/dist/v2/index.cjs
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./SnapKeyring.cjs"), exports);
|
|
18
|
+
__exportStar(require("./SnapKeyringV1Adapter.cjs"), exports);
|
|
18
19
|
//# sourceMappingURL=index.cjs.map
|
package/dist/v2/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAA8B","sourcesContent":["export * from './SnapKeyring';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAA8B;AAC9B,6DAAuC","sourcesContent":["export * from './SnapKeyring';\nexport * from './SnapKeyringV1Adapter';\n"]}
|
package/dist/v2/index.d.cts
CHANGED
package/dist/v2/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,kCAA8B"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,2CAAuC"}
|
package/dist/v2/index.d.mts
CHANGED
package/dist/v2/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,kCAA8B"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,2CAAuC"}
|
package/dist/v2/index.mjs
CHANGED
package/dist/v2/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,kCAA8B","sourcesContent":["export * from './SnapKeyring';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,2CAAuC","sourcesContent":["export * from './SnapKeyring';\nexport * from './SnapKeyringV1Adapter';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/eth-snap-keyring",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.2.0-52bd218",
|
|
4
4
|
"description": "Snaps keyring bridge",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"keyring",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@ethereumjs/tx": "^5.4.0",
|
|
71
71
|
"@metamask/eth-sig-util": "^8.2.0",
|
|
72
|
-
"@metamask/keyring-api": "23.
|
|
72
|
+
"@metamask/keyring-api": "23.2.0",
|
|
73
73
|
"@metamask/keyring-internal-api": "11.0.1",
|
|
74
74
|
"@metamask/keyring-internal-snap-client": "10.0.3",
|
|
75
|
-
"@metamask/keyring-sdk": "2.
|
|
76
|
-
"@metamask/keyring-snap-sdk": "9.0.
|
|
75
|
+
"@metamask/keyring-sdk": "2.2.0",
|
|
76
|
+
"@metamask/keyring-snap-sdk": "9.0.2",
|
|
77
77
|
"@metamask/keyring-utils": "3.3.1",
|
|
78
78
|
"@metamask/messenger": "^1.1.1",
|
|
79
79
|
"@metamask/snaps-controllers": "^19.0.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"@lavamoat/allow-scripts": "^3.2.1",
|
|
90
90
|
"@lavamoat/preinstall-always-fail": "^2.1.0",
|
|
91
91
|
"@metamask/auto-changelog": "^6.1.0",
|
|
92
|
-
"@metamask/keyring-api": "23.
|
|
92
|
+
"@metamask/keyring-api": "23.2.0",
|
|
93
93
|
"@ts-bridge/cli": "^0.6.3",
|
|
94
94
|
"@types/jest": "^29.5.12",
|
|
95
95
|
"@types/node": "^20.12.12",
|