@metamask-previews/keyring-snap-client 8.2.1-d23a1b9 → 9.0.1-7275dbc
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 +26 -1
- package/LICENSE +21 -0
- package/dist/KeyringPublicClient.cjs.map +1 -1
- package/dist/KeyringPublicClient.d.cts.map +1 -1
- package/dist/KeyringPublicClient.d.mts.map +1 -1
- package/dist/KeyringPublicClient.mjs.map +1 -1
- package/dist/v2/KeyringClient.cjs +91 -0
- package/dist/v2/KeyringClient.cjs.map +1 -0
- package/dist/v2/KeyringClient.d.cts +29 -0
- package/dist/v2/KeyringClient.d.cts.map +1 -0
- package/dist/v2/KeyringClient.d.mts +29 -0
- package/dist/v2/KeyringClient.d.mts.map +1 -0
- package/dist/v2/KeyringClient.mjs +87 -0
- package/dist/v2/KeyringClient.mjs.map +1 -0
- package/dist/v2/index.cjs +18 -0
- package/dist/v2/index.cjs.map +1 -0
- package/dist/v2/index.d.cts +2 -0
- package/dist/v2/index.d.cts.map +1 -0
- package/dist/v2/index.d.mts +2 -0
- package/dist/v2/index.d.mts.map +1 -0
- package/dist/v2/index.mjs +2 -0
- package/dist/v2/index.mjs.map +1 -0
- package/package.json +43 -26
- package/v2.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [9.0.1]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Bump `@metamask/keyring-api` from `^23.0.0` to `^23.0.1` ([#518](https://github.com/MetaMask/accounts/pull/518))
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Workaround Browserify subpath export for `/v2` ([#516](https://github.com/MetaMask/accounts/pull/516))
|
|
19
|
+
|
|
20
|
+
## [9.0.0]
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Add `KeyringClientV2` class implementing the keyring v2 RPC client ([#408](https://github.com/MetaMask/accounts/pull/408))
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **BREAKING:** Move and rename `KeyringClientV2` to the new `./v2` subpath export ([#513](https://github.com/MetaMask/accounts/pull/513))
|
|
29
|
+
- `KeyringClientV2` is now `KeyringClient` from `@metamask/keyring-snap-client/v2`.
|
|
30
|
+
- Bump `@metamask/utils` from `^11.1.0` to `^11.11.0` ([#489](https://github.com/MetaMask/accounts/pull/489), [#483](https://github.com/MetaMask/accounts/pull/483))
|
|
31
|
+
- Bump `@metamask/keyring-api` from `^22.0.0` to `^23.0.0` ([#515](https://github.com/MetaMask/accounts/pull/515))
|
|
32
|
+
|
|
10
33
|
## [8.2.1]
|
|
11
34
|
|
|
12
35
|
### Changed
|
|
@@ -154,7 +177,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
154
177
|
- This new version fixes a bug with CJS re-exports.
|
|
155
178
|
- Initial release ([#24](https://github.com/MetaMask/accounts/pull/24))
|
|
156
179
|
|
|
157
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-snap-client@
|
|
180
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-snap-client@9.0.1...HEAD
|
|
181
|
+
[9.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-snap-client@9.0.0...@metamask/keyring-snap-client@9.0.1
|
|
182
|
+
[9.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-snap-client@8.2.1...@metamask/keyring-snap-client@9.0.0
|
|
158
183
|
[8.2.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-snap-client@8.2.0...@metamask/keyring-snap-client@8.2.1
|
|
159
184
|
[8.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-snap-client@8.1.1...@metamask/keyring-snap-client@8.2.0
|
|
160
185
|
[8.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-snap-client@8.1.0...@metamask/keyring-snap-client@8.1.1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MetaMask
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyringPublicClient.cjs","sourceRoot":"","sources":["../src/KeyringPublicClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,uDAAyD;AAIzD,uDAAgD;AAahD;;GAEG;AACU,QAAA,sBAAsB,GAAG;IACpC,8BAAgB,CAAC,aAAa;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AAC,YAAY;QAChB,OAAO,uBAAA,IAAI,mCAAQ,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,OAAO,uBAAA,IAAI,mCAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,OAAO,uBAAA,IAAI,mCAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,OAAO,uBAAA,IAAI,mCAAQ,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAuB;QACzC,OAAO,uBAAA,IAAI,mCAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,EAAU,EAAE,IAA2B;QAC1D,OAAO,uBAAA,IAAI,mCAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAC5B,OAAO,uBAAA,IAAI,mCAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,EAAU,EAAE,MAAgB;QACpD,OAAO,uBAAA,IAAI,mCAAQ,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAC5B,OAAO,uBAAA,IAAI,mCAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;CACF;AA1DD,kDA0DC","sourcesContent":["import type {\n KeyringAccount,\n KeyringAccountData,\n KeyringRequest,\n} from '@metamask/keyring-api';\nimport { KeyringRpcMethod } from '@metamask/keyring-api';\nimport type { Json } from '@metamask/utils';\n\nimport type { Sender } from './KeyringClient';\nimport { KeyringClient } from './KeyringClient';\n\n/**\n * Convert a tuple to a union.\n */\ntype TupleToUnion<Tuple extends readonly unknown[]> = Tuple[number];\n\n/**\n * Extract the method name from a RPC method name.\n */\ntype KeyringRpcMethodToMethodName<RpcMethod extends string> =\n RpcMethod extends `keyring_${infer Method}` ? Method : never;\n\n/**\n * Public methods list.\n */\nexport const KeyringPublicRpcMethod = [\n KeyringRpcMethod.CreateAccount,\n KeyringRpcMethod.GetAccount,\n KeyringRpcMethod.UpdateAccount,\n KeyringRpcMethod.DeleteAccount,\n KeyringRpcMethod.ExportAccount,\n KeyringRpcMethod.ListAccounts,\n KeyringRpcMethod.FilterAccountChains,\n KeyringRpcMethod.GetRequest,\n KeyringRpcMethod.ApproveRequest,\n KeyringRpcMethod.RejectRequest,\n KeyringRpcMethod.ListRequests,\n] as const;\n\n/**\n * Union of all public methods.\n */\ntype KeyringPublicMethod = KeyringRpcMethodToMethodName<\n TupleToUnion<typeof KeyringPublicRpcMethod>\n>;\n\n/**\n * A client that can be used by companion dapp. Only some keyring methods are\n * available with this client.\n */\nexport class KeyringPublicClient implements Pick<\n KeyringClient,\n KeyringPublicMethod\n> {\n readonly #client: KeyringClient;\n\n /**\n * Create a new instance of `KeyringPublicClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#client = new KeyringClient(sender);\n }\n\n async createAccount(options?: Record<string, Json>): Promise<KeyringAccount> {\n return this.#client.createAccount(options);\n }\n\n async deleteAccount(id: string): Promise<void> {\n return this.#client.deleteAccount(id);\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return this.#client.listAccounts();\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return this.#client.getAccount(id);\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return this.#client.getRequest(id);\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return this.#client.listRequests();\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n return this.#client.updateAccount(account);\n }\n\n async approveRequest(id: string, data?: Record<string, Json>): Promise<void> {\n return this.#client.approveRequest(id, data);\n }\n\n async rejectRequest(id: string): Promise<void> {\n return this.#client.rejectRequest(id);\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return this.#client.filterAccountChains(id, chains);\n }\n\n async exportAccount(id: string): Promise<KeyringAccountData> {\n return this.#client.exportAccount(id);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyringPublicClient.d.cts","sourceRoot":"","sources":["../src/KeyringPublicClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACf,8BAA8B;AAC/B,OAAO,EAAE,gBAAgB,EAAE,8BAA8B;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,4BAAwB;AAC9C,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD;;GAEG;AACH,KAAK,YAAY,CAAC,KAAK,SAAS,SAAS,OAAO,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAEpE;;GAEG;AACH,KAAK,4BAA4B,CAAC,SAAS,SAAS,MAAM,IACxD,SAAS,SAAS,WAAW,MAAM,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,sBAAsB,0WAYzB,CAAC;AAEX;;GAEG;AACH,KAAK,mBAAmB,GAAG,4BAA4B,CACrD,YAAY,CAAC,OAAO,sBAAsB,CAAC,CAC5C,CAAC;AAEF;;;GAGG;AACH,qBAAa,
|
|
1
|
+
{"version":3,"file":"KeyringPublicClient.d.cts","sourceRoot":"","sources":["../src/KeyringPublicClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACf,8BAA8B;AAC/B,OAAO,EAAE,gBAAgB,EAAE,8BAA8B;AACzD,OA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aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIpE,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAG7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyringPublicClient.d.mts","sourceRoot":"","sources":["../src/KeyringPublicClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACf,8BAA8B;AAC/B,OAAO,EAAE,gBAAgB,EAAE,8BAA8B;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,4BAAwB;AAC9C,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD;;GAEG;AACH,KAAK,YAAY,CAAC,KAAK,SAAS,SAAS,OAAO,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAEpE;;GAEG;AACH,KAAK,4BAA4B,CAAC,SAAS,SAAS,MAAM,IACxD,SAAS,SAAS,WAAW,MAAM,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,sBAAsB,0WAYzB,CAAC;AAEX;;GAEG;AACH,KAAK,mBAAmB,GAAG,4BAA4B,CACrD,YAAY,CAAC,OAAO,sBAAsB,CAAC,CAC5C,CAAC;AAEF;;;GAGG;AACH,qBAAa,
|
|
1
|
+
{"version":3,"file":"KeyringPublicClient.d.mts","sourceRoot":"","sources":["../src/KeyringPublicClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACf,8BAA8B;AAC/B,OAAO,EAAE,gBAAgB,EAAE,8BAA8B;AACzD,OAAO,KAAK,E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,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIpE,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAG7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyringPublicClient.mjs","sourceRoot":"","sources":["../src/KeyringPublicClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,OAAO,EAAE,gBAAgB,EAAE,8BAA8B;AAIzD,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAahD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,UAAU;IAC3B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,YAAY;IAC7B,gBAAgB,CAAC,mBAAmB;IACpC,gBAAgB,CAAC,UAAU;IAC3B,gBAAgB,CAAC,cAAc;IAC/B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,YAAY;CACrB,CAAC;AASX;;;GAGG;AACH,MAAM,OAAO,mBAAmB;
|
|
1
|
+
{"version":3,"file":"KeyringPublicClient.mjs","sourceRoot":"","sources":["../src/KeyringPublicClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,OAAO,EAAE,gBAAgB,EAAE,8BAA8B;AAIzD,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAahD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,UAAU;IAC3B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,aAAa;IAC9B,gBAAg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CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAC5B,OAAO,uBAAA,IAAI,mCAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,EAAU,EAAE,MAAgB;QACpD,OAAO,uBAAA,IAAI,mCAAQ,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAC5B,OAAO,uBAAA,IAAI,mCAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import type {\n KeyringAccount,\n KeyringAccountData,\n KeyringRequest,\n} from '@metamask/keyring-api';\nimport { KeyringRpcMethod } from '@metamask/keyring-api';\nimport type { Json } from '@metamask/utils';\n\nimport type { Sender } from './KeyringClient';\nimport { KeyringClient } from './KeyringClient';\n\n/**\n * Convert a tuple to a union.\n */\ntype TupleToUnion<Tuple extends readonly unknown[]> = Tuple[number];\n\n/**\n * Extract the method name from a RPC method name.\n */\ntype KeyringRpcMethodToMethodName<RpcMethod extends string> =\n RpcMethod extends `keyring_${infer Method}` ? Method : never;\n\n/**\n * Public methods list.\n */\nexport const KeyringPublicRpcMethod = [\n KeyringRpcMethod.CreateAccount,\n KeyringRpcMethod.GetAccount,\n KeyringRpcMethod.UpdateAccount,\n KeyringRpcMethod.DeleteAccount,\n KeyringRpcMethod.ExportAccount,\n KeyringRpcMethod.ListAccounts,\n KeyringRpcMethod.FilterAccountChains,\n KeyringRpcMethod.GetRequest,\n KeyringRpcMethod.ApproveRequest,\n KeyringRpcMethod.RejectRequest,\n KeyringRpcMethod.ListRequests,\n] as const;\n\n/**\n * Union of all public methods.\n */\ntype KeyringPublicMethod = KeyringRpcMethodToMethodName<\n TupleToUnion<typeof KeyringPublicRpcMethod>\n>;\n\n/**\n * A client that can be used by companion dapp. Only some keyring methods are\n * available with this client.\n */\nexport class KeyringPublicClient implements Pick<\n KeyringClient,\n KeyringPublicMethod\n> {\n readonly #client: KeyringClient;\n\n /**\n * Create a new instance of `KeyringPublicClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#client = new KeyringClient(sender);\n }\n\n async createAccount(options?: Record<string, Json>): Promise<KeyringAccount> {\n return this.#client.createAccount(options);\n }\n\n async deleteAccount(id: string): Promise<void> {\n return this.#client.deleteAccount(id);\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return this.#client.listAccounts();\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return this.#client.getAccount(id);\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return this.#client.getRequest(id);\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return this.#client.listRequests();\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n return this.#client.updateAccount(account);\n }\n\n async approveRequest(id: string, data?: Record<string, Json>): Promise<void> {\n return this.#client.approveRequest(id, data);\n }\n\n async rejectRequest(id: string): Promise<void> {\n return this.#client.rejectRequest(id);\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return this.#client.filterAccountChains(id, chains);\n }\n\n async exportAccount(id: string): Promise<KeyringAccountData> {\n return this.#client.exportAccount(id);\n }\n}\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _KeyringClient_sender;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.KeyringClient = void 0;
|
|
16
|
+
const v2_1 = require("@metamask/keyring-api/v2");
|
|
17
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
18
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
19
|
+
const uuid_1 = require("uuid");
|
|
20
|
+
class KeyringClient {
|
|
21
|
+
/**
|
|
22
|
+
* Create a new instance of `KeyringClient`.
|
|
23
|
+
*
|
|
24
|
+
* @param sender - The `Sender` instance to use to send requests to the snap.
|
|
25
|
+
*/
|
|
26
|
+
constructor(sender) {
|
|
27
|
+
_KeyringClient_sender.set(this, void 0);
|
|
28
|
+
__classPrivateFieldSet(this, _KeyringClient_sender, sender, "f");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Send a request to the Snap and return the response.
|
|
32
|
+
*
|
|
33
|
+
* @param request - A partial JSON-RPC request (method and params).
|
|
34
|
+
* @returns A promise that resolves to the response to the request.
|
|
35
|
+
*/
|
|
36
|
+
async send(request) {
|
|
37
|
+
return __classPrivateFieldGet(this, _KeyringClient_sender, "f").send({
|
|
38
|
+
...request,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async getAccounts() {
|
|
42
|
+
return (0, keyring_utils_1.strictMask)(await this.send({
|
|
43
|
+
jsonrpc: '2.0',
|
|
44
|
+
id: (0, uuid_1.v4)(),
|
|
45
|
+
method: v2_1.KeyringRpcMethod.GetAccounts,
|
|
46
|
+
}), v2_1.GetAccountsResponseStruct);
|
|
47
|
+
}
|
|
48
|
+
async getAccount(id) {
|
|
49
|
+
return (0, keyring_utils_1.strictMask)(await this.send({
|
|
50
|
+
jsonrpc: '2.0',
|
|
51
|
+
id: (0, uuid_1.v4)(),
|
|
52
|
+
method: v2_1.KeyringRpcMethod.GetAccount,
|
|
53
|
+
params: { id },
|
|
54
|
+
}), v2_1.GetAccountResponseStruct);
|
|
55
|
+
}
|
|
56
|
+
async createAccounts(params) {
|
|
57
|
+
return (0, keyring_utils_1.strictMask)(await this.send({
|
|
58
|
+
jsonrpc: '2.0',
|
|
59
|
+
id: (0, uuid_1.v4)(),
|
|
60
|
+
method: v2_1.KeyringRpcMethod.CreateAccounts,
|
|
61
|
+
params,
|
|
62
|
+
}), v2_1.CreateAccountsResponseStruct);
|
|
63
|
+
}
|
|
64
|
+
async exportAccount(id, options) {
|
|
65
|
+
return (0, keyring_utils_1.strictMask)(await this.send({
|
|
66
|
+
jsonrpc: '2.0',
|
|
67
|
+
id: (0, uuid_1.v4)(),
|
|
68
|
+
method: v2_1.KeyringRpcMethod.ExportAccount,
|
|
69
|
+
params: { id, ...(options && { options }) },
|
|
70
|
+
}), v2_1.ExportAccountResponseStruct);
|
|
71
|
+
}
|
|
72
|
+
async deleteAccount(id) {
|
|
73
|
+
(0, superstruct_1.assert)(await this.send({
|
|
74
|
+
jsonrpc: '2.0',
|
|
75
|
+
id: (0, uuid_1.v4)(),
|
|
76
|
+
method: v2_1.KeyringRpcMethod.DeleteAccount,
|
|
77
|
+
params: { id },
|
|
78
|
+
}), v2_1.DeleteAccountResponseStruct);
|
|
79
|
+
}
|
|
80
|
+
async submitRequest(request) {
|
|
81
|
+
return (0, keyring_utils_1.strictMask)(await this.send({
|
|
82
|
+
jsonrpc: '2.0',
|
|
83
|
+
id: (0, uuid_1.v4)(),
|
|
84
|
+
method: v2_1.KeyringRpcMethod.SubmitRequest,
|
|
85
|
+
params: request,
|
|
86
|
+
}), v2_1.SubmitRequestResponseStruct);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.KeyringClient = KeyringClient;
|
|
90
|
+
_KeyringClient_sender = new WeakMap();
|
|
91
|
+
//# sourceMappingURL=KeyringClient.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyringClient.cjs","sourceRoot":"","sources":["../../src/v2/KeyringClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iDAQkC;AASlC,2DAAqD;AACrD,uDAA+C;AAE/C,+BAAkC;AAIlC,MAAa,aAAa;IAGxB;;;;OAIG;IACH,YAAY,MAAc;QAPjB,wCAAgB;QAQvB,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,IAAI,CAClB,OAAyC;QAEzC,OAAO,uBAAA,IAAI,6BAAQ,CAAC,IAAI,CAAC;YACvB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,IAAA,0BAAU,EACf,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAA,SAAI,GAAE;YACV,MAAM,EAAE,qBAAgB,CAAC,WAAW;SACrC,CAAC,EACF,8BAAyB,CAC1B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,OAAO,IAAA,0BAAU,EACf,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAA,SAAI,GAAE;YACV,MAAM,EAAE,qBAAgB,CAAC,UAAU;YACnC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,6BAAwB,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,MAA4B;QAE5B,OAAO,IAAA,0BAAU,EACf,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAA,SAAI,GAAE;YACV,MAAM,EAAE,qBAAgB,CAAC,cAAc;YACvC,MAAM;SACP,CAAC,EACF,iCAA4B,CAC7B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,EAAa,EACb,OAA8B;QAE9B,OAAO,IAAA,0BAAU,EACf,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAA,SAAI,GAAE;YACV,MAAM,EAAE,qBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE;SAC5C,CAAC,EACF,gCAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAa;QAC/B,IAAA,oBAAM,EACJ,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAA,SAAI,GAAE;YACV,MAAM,EAAE,qBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,gCAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAuB;QACzC,OAAO,IAAA,0BAAU,EACf,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAA,SAAI,GAAE;YACV,MAAM,EAAE,qBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,OAAO;SAChB,CAAC,EACF,gCAA2B,CAC5B,CAAC;IACJ,CAAC;CACF;AArGD,sCAqGC","sourcesContent":["import type { KeyringAccount, KeyringRequest } from '@metamask/keyring-api';\nimport {\n CreateAccountsResponseStruct,\n DeleteAccountResponseStruct,\n GetAccountResponseStruct,\n GetAccountsResponseStruct,\n SubmitRequestResponseStruct,\n KeyringRpcMethod,\n ExportAccountResponseStruct,\n} from '@metamask/keyring-api/v2';\nimport type {\n CreateAccountOptions,\n ExportAccountOptions,\n ExportedAccount,\n KeyringRpc,\n KeyringRpcRequest,\n} from '@metamask/keyring-api/v2';\nimport type { AccountId } from '@metamask/keyring-utils';\nimport { strictMask } from '@metamask/keyring-utils';\nimport { assert } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type { Sender } from '../KeyringClient';\n\nexport class KeyringClient implements KeyringRpc {\n readonly #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the Snap and return the response.\n *\n * @param request - A partial JSON-RPC request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n protected async send<RequestMethod extends KeyringRpcMethod>(\n request: KeyringRpcRequest<RequestMethod>,\n ): Promise<Json> {\n return this.#sender.send({\n ...request,\n });\n }\n\n async getAccounts(): Promise<KeyringAccount[]> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.GetAccounts,\n }),\n GetAccountsResponseStruct,\n );\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.GetAccount,\n params: { id },\n }),\n GetAccountResponseStruct,\n );\n }\n\n async createAccounts(\n params: CreateAccountOptions,\n ): Promise<KeyringAccount[]> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.CreateAccounts,\n params,\n }),\n CreateAccountsResponseStruct,\n );\n }\n\n async exportAccount(\n id: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.ExportAccount,\n params: { id, ...(options && { options }) },\n }),\n ExportAccountResponseStruct,\n );\n }\n\n async deleteAccount(id: AccountId): Promise<void> {\n assert(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.DeleteAccount,\n params: { id },\n }),\n DeleteAccountResponseStruct,\n );\n }\n\n async submitRequest(request: KeyringRequest): Promise<Json> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.SubmitRequest,\n params: request,\n }),\n SubmitRequestResponseStruct,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { KeyringAccount, KeyringRequest } from "@metamask/keyring-api";
|
|
2
|
+
import { KeyringRpcMethod } from "@metamask/keyring-api/v2";
|
|
3
|
+
import type { CreateAccountOptions, ExportAccountOptions, ExportedAccount, KeyringRpc, KeyringRpcRequest } from "@metamask/keyring-api/v2";
|
|
4
|
+
import type { AccountId } from "@metamask/keyring-utils";
|
|
5
|
+
import type { Json } from "@metamask/utils";
|
|
6
|
+
import type { Sender } from "../KeyringClient.cjs";
|
|
7
|
+
export declare class KeyringClient implements KeyringRpc {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* Create a new instance of `KeyringClient`.
|
|
11
|
+
*
|
|
12
|
+
* @param sender - The `Sender` instance to use to send requests to the snap.
|
|
13
|
+
*/
|
|
14
|
+
constructor(sender: Sender);
|
|
15
|
+
/**
|
|
16
|
+
* Send a request to the Snap and return the response.
|
|
17
|
+
*
|
|
18
|
+
* @param request - A partial JSON-RPC request (method and params).
|
|
19
|
+
* @returns A promise that resolves to the response to the request.
|
|
20
|
+
*/
|
|
21
|
+
protected send<RequestMethod extends KeyringRpcMethod>(request: KeyringRpcRequest<RequestMethod>): Promise<Json>;
|
|
22
|
+
getAccounts(): Promise<KeyringAccount[]>;
|
|
23
|
+
getAccount(id: string): Promise<KeyringAccount>;
|
|
24
|
+
createAccounts(params: CreateAccountOptions): Promise<KeyringAccount[]>;
|
|
25
|
+
exportAccount(id: AccountId, options?: ExportAccountOptions): Promise<ExportedAccount>;
|
|
26
|
+
deleteAccount(id: AccountId): Promise<void>;
|
|
27
|
+
submitRequest(request: KeyringRequest): Promise<Json>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=KeyringClient.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyringClient.d.cts","sourceRoot":"","sources":["../../src/v2/KeyringClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,8BAA8B;AAC5E,OAAO,EAML,gBAAgB,EAEjB,iCAAiC;AAClC,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,iBAAiB,EAClB,iCAAiC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AAGzD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,KAAK,EAAE,MAAM,EAAE,6BAAyB;AAE/C,qBAAa,aAAc,YAAW,UAAU;;IAG9C;;;;OAIG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;OAKG;cACa,IAAI,CAAC,aAAa,SAAS,gBAAgB,EACzD,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC;IAMV,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAWxC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAY/C,cAAc,CAClB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,cAAc,EAAE,CAAC;IAYtB,aAAa,CACjB,EAAE,EAAE,SAAS,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC;IAYrB,aAAa,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAY3C,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAW5D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { KeyringAccount, KeyringRequest } from "@metamask/keyring-api";
|
|
2
|
+
import { KeyringRpcMethod } from "@metamask/keyring-api/v2";
|
|
3
|
+
import type { CreateAccountOptions, ExportAccountOptions, ExportedAccount, KeyringRpc, KeyringRpcRequest } from "@metamask/keyring-api/v2";
|
|
4
|
+
import type { AccountId } from "@metamask/keyring-utils";
|
|
5
|
+
import type { Json } from "@metamask/utils";
|
|
6
|
+
import type { Sender } from "../KeyringClient.mjs";
|
|
7
|
+
export declare class KeyringClient implements KeyringRpc {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* Create a new instance of `KeyringClient`.
|
|
11
|
+
*
|
|
12
|
+
* @param sender - The `Sender` instance to use to send requests to the snap.
|
|
13
|
+
*/
|
|
14
|
+
constructor(sender: Sender);
|
|
15
|
+
/**
|
|
16
|
+
* Send a request to the Snap and return the response.
|
|
17
|
+
*
|
|
18
|
+
* @param request - A partial JSON-RPC request (method and params).
|
|
19
|
+
* @returns A promise that resolves to the response to the request.
|
|
20
|
+
*/
|
|
21
|
+
protected send<RequestMethod extends KeyringRpcMethod>(request: KeyringRpcRequest<RequestMethod>): Promise<Json>;
|
|
22
|
+
getAccounts(): Promise<KeyringAccount[]>;
|
|
23
|
+
getAccount(id: string): Promise<KeyringAccount>;
|
|
24
|
+
createAccounts(params: CreateAccountOptions): Promise<KeyringAccount[]>;
|
|
25
|
+
exportAccount(id: AccountId, options?: ExportAccountOptions): Promise<ExportedAccount>;
|
|
26
|
+
deleteAccount(id: AccountId): Promise<void>;
|
|
27
|
+
submitRequest(request: KeyringRequest): Promise<Json>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=KeyringClient.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyringClient.d.mts","sourceRoot":"","sources":["../../src/v2/KeyringClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,8BAA8B;AAC5E,OAAO,EAML,gBAAgB,EAEjB,iCAAiC;AAClC,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,iBAAiB,EAClB,iCAAiC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AAGzD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,KAAK,EAAE,MAAM,EAAE,6BAAyB;AAE/C,qBAAa,aAAc,YAAW,UAAU;;IAG9C;;;;OAIG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;OAKG;cACa,IAAI,CAAC,aAAa,SAAS,gBAAgB,EACzD,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC;IAMV,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAWxC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAY/C,cAAc,CAClB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,cAAc,EAAE,CAAC;IAYtB,aAAa,CACjB,EAAE,EAAE,SAAS,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC;IAYrB,aAAa,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAY3C,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAW5D"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _KeyringClient_sender;
|
|
13
|
+
import { CreateAccountsResponseStruct, DeleteAccountResponseStruct, GetAccountResponseStruct, GetAccountsResponseStruct, SubmitRequestResponseStruct, KeyringRpcMethod, ExportAccountResponseStruct } from "@metamask/keyring-api/v2";
|
|
14
|
+
import { strictMask } from "@metamask/keyring-utils";
|
|
15
|
+
import { assert } from "@metamask/superstruct";
|
|
16
|
+
import { v4 as uuid } from "uuid";
|
|
17
|
+
export class KeyringClient {
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `KeyringClient`.
|
|
20
|
+
*
|
|
21
|
+
* @param sender - The `Sender` instance to use to send requests to the snap.
|
|
22
|
+
*/
|
|
23
|
+
constructor(sender) {
|
|
24
|
+
_KeyringClient_sender.set(this, void 0);
|
|
25
|
+
__classPrivateFieldSet(this, _KeyringClient_sender, sender, "f");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Send a request to the Snap and return the response.
|
|
29
|
+
*
|
|
30
|
+
* @param request - A partial JSON-RPC request (method and params).
|
|
31
|
+
* @returns A promise that resolves to the response to the request.
|
|
32
|
+
*/
|
|
33
|
+
async send(request) {
|
|
34
|
+
return __classPrivateFieldGet(this, _KeyringClient_sender, "f").send({
|
|
35
|
+
...request,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async getAccounts() {
|
|
39
|
+
return strictMask(await this.send({
|
|
40
|
+
jsonrpc: '2.0',
|
|
41
|
+
id: uuid(),
|
|
42
|
+
method: KeyringRpcMethod.GetAccounts,
|
|
43
|
+
}), GetAccountsResponseStruct);
|
|
44
|
+
}
|
|
45
|
+
async getAccount(id) {
|
|
46
|
+
return strictMask(await this.send({
|
|
47
|
+
jsonrpc: '2.0',
|
|
48
|
+
id: uuid(),
|
|
49
|
+
method: KeyringRpcMethod.GetAccount,
|
|
50
|
+
params: { id },
|
|
51
|
+
}), GetAccountResponseStruct);
|
|
52
|
+
}
|
|
53
|
+
async createAccounts(params) {
|
|
54
|
+
return strictMask(await this.send({
|
|
55
|
+
jsonrpc: '2.0',
|
|
56
|
+
id: uuid(),
|
|
57
|
+
method: KeyringRpcMethod.CreateAccounts,
|
|
58
|
+
params,
|
|
59
|
+
}), CreateAccountsResponseStruct);
|
|
60
|
+
}
|
|
61
|
+
async exportAccount(id, options) {
|
|
62
|
+
return strictMask(await this.send({
|
|
63
|
+
jsonrpc: '2.0',
|
|
64
|
+
id: uuid(),
|
|
65
|
+
method: KeyringRpcMethod.ExportAccount,
|
|
66
|
+
params: { id, ...(options && { options }) },
|
|
67
|
+
}), ExportAccountResponseStruct);
|
|
68
|
+
}
|
|
69
|
+
async deleteAccount(id) {
|
|
70
|
+
assert(await this.send({
|
|
71
|
+
jsonrpc: '2.0',
|
|
72
|
+
id: uuid(),
|
|
73
|
+
method: KeyringRpcMethod.DeleteAccount,
|
|
74
|
+
params: { id },
|
|
75
|
+
}), DeleteAccountResponseStruct);
|
|
76
|
+
}
|
|
77
|
+
async submitRequest(request) {
|
|
78
|
+
return strictMask(await this.send({
|
|
79
|
+
jsonrpc: '2.0',
|
|
80
|
+
id: uuid(),
|
|
81
|
+
method: KeyringRpcMethod.SubmitRequest,
|
|
82
|
+
params: request,
|
|
83
|
+
}), SubmitRequestResponseStruct);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_KeyringClient_sender = new WeakMap();
|
|
87
|
+
//# sourceMappingURL=KeyringClient.mjs.map
|
|
@@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EAAE,KAAK;YACd,EAAE,EAAE,IAAI,EAAE;YACV,MAAM,EAAE,gBAAgB,CAAC,cAAc;YACvC,MAAM;SACP,CAAC,EACF,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,EAAa,EACb,OAA8B;QAE9B,OAAO,UAAU,CACf,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAI,EAAE;YACV,MAAM,EAAE,gBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE;SAC5C,CAAC,EACF,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAa;QAC/B,MAAM,CACJ,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAI,EAAE;YACV,MAAM,EAAE,gBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAuB;QACzC,OAAO,UAAU,CACf,MAAM,IAAI,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAI,EAAE;YACV,MAAM,EAAE,gBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,OAAO;SAChB,CAAC,EACF,2BAA2B,CAC5B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { KeyringAccount, KeyringRequest } from '@metamask/keyring-api';\nimport {\n CreateAccountsResponseStruct,\n DeleteAccountResponseStruct,\n GetAccountResponseStruct,\n GetAccountsResponseStruct,\n SubmitRequestResponseStruct,\n KeyringRpcMethod,\n ExportAccountResponseStruct,\n} from '@metamask/keyring-api/v2';\nimport type {\n CreateAccountOptions,\n ExportAccountOptions,\n ExportedAccount,\n KeyringRpc,\n KeyringRpcRequest,\n} from '@metamask/keyring-api/v2';\nimport type { AccountId } from '@metamask/keyring-utils';\nimport { strictMask } from '@metamask/keyring-utils';\nimport { assert } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type { Sender } from '../KeyringClient';\n\nexport class KeyringClient implements KeyringRpc {\n readonly #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the Snap and return the response.\n *\n * @param request - A partial JSON-RPC request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n protected async send<RequestMethod extends KeyringRpcMethod>(\n request: KeyringRpcRequest<RequestMethod>,\n ): Promise<Json> {\n return this.#sender.send({\n ...request,\n });\n }\n\n async getAccounts(): Promise<KeyringAccount[]> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.GetAccounts,\n }),\n GetAccountsResponseStruct,\n );\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.GetAccount,\n params: { id },\n }),\n GetAccountResponseStruct,\n );\n }\n\n async createAccounts(\n params: CreateAccountOptions,\n ): Promise<KeyringAccount[]> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.CreateAccounts,\n params,\n }),\n CreateAccountsResponseStruct,\n );\n }\n\n async exportAccount(\n id: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.ExportAccount,\n params: { id, ...(options && { options }) },\n }),\n ExportAccountResponseStruct,\n );\n }\n\n async deleteAccount(id: AccountId): Promise<void> {\n assert(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.DeleteAccount,\n params: { id },\n }),\n DeleteAccountResponseStruct,\n );\n }\n\n async submitRequest(request: KeyringRequest): Promise<Json> {\n return strictMask(\n await this.send({\n jsonrpc: '2.0',\n id: uuid(),\n method: KeyringRpcMethod.SubmitRequest,\n params: request,\n }),\n SubmitRequestResponseStruct,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./KeyringClient.cjs"), exports);
|
|
18
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAgC","sourcesContent":["export * from './KeyringClient';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,oCAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,oCAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,oCAAgC","sourcesContent":["export * from './KeyringClient';\n"]}
|
package/package.json
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/keyring-snap-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1-7275dbc",
|
|
4
4
|
"description": "MetaMask Keyring Snap clients",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"keyring",
|
|
7
|
+
"metamask"
|
|
8
8
|
],
|
|
9
9
|
"homepage": "https://github.com/MetaMask/accounts/tree/main/packages/keyring-snap-client#readme",
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/MetaMask/accounts/issues"
|
|
12
12
|
},
|
|
13
|
+
"license": "MIT",
|
|
13
14
|
"repository": {
|
|
14
15
|
"type": "git",
|
|
15
16
|
"url": "https://github.com/MetaMask/accounts.git"
|
|
16
17
|
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/",
|
|
20
|
+
"v2.js"
|
|
21
|
+
],
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"main": "./dist/index.cjs",
|
|
24
|
+
"types": "./dist/index.d.cts",
|
|
17
25
|
"exports": {
|
|
18
26
|
".": {
|
|
19
27
|
"import": {
|
|
@@ -24,28 +32,41 @@
|
|
|
24
32
|
"types": "./dist/index.d.cts",
|
|
25
33
|
"default": "./dist/index.cjs"
|
|
26
34
|
}
|
|
27
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"./v2": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/v2/index.d.mts",
|
|
39
|
+
"default": "./dist/v2/index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/v2/index.d.cts",
|
|
43
|
+
"default": "./dist/v2/index.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public",
|
|
50
|
+
"registry": "https://registry.npmjs.org/"
|
|
28
51
|
},
|
|
29
|
-
"main": "./dist/index.cjs",
|
|
30
|
-
"types": "./dist/index.d.cts",
|
|
31
|
-
"files": [
|
|
32
|
-
"dist/"
|
|
33
|
-
],
|
|
34
52
|
"scripts": {
|
|
35
|
-
"build": "ts-bridge --project tsconfig.build.json --no-references",
|
|
53
|
+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
|
|
54
|
+
"build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
|
|
36
55
|
"build:clean": "yarn build --clean",
|
|
37
56
|
"build:docs": "typedoc",
|
|
38
57
|
"changelog:update": "../../scripts/update-changelog.sh @metamask/keyring-snap-client",
|
|
39
58
|
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/keyring-snap-client",
|
|
40
59
|
"publish:preview": "yarn npm publish --tag preview",
|
|
60
|
+
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
41
61
|
"test": "yarn test:source && yarn test:types",
|
|
42
|
-
"test:clean": "jest --clearCache",
|
|
43
|
-
"test:source": "jest
|
|
62
|
+
"test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
|
|
63
|
+
"test:source": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
|
|
44
64
|
"test:types": "../../scripts/tsd-test.sh ./src",
|
|
45
|
-
"test:
|
|
65
|
+
"test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
|
|
66
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
|
|
46
67
|
},
|
|
47
68
|
"dependencies": {
|
|
48
|
-
"@metamask/keyring-api": "
|
|
69
|
+
"@metamask/keyring-api": "23.0.1",
|
|
49
70
|
"@metamask/keyring-utils": "3.2.0",
|
|
50
71
|
"@metamask/superstruct": "^3.1.0",
|
|
51
72
|
"@types/uuid": "^9.0.8",
|
|
@@ -55,9 +76,9 @@
|
|
|
55
76
|
"devDependencies": {
|
|
56
77
|
"@lavamoat/allow-scripts": "^3.2.1",
|
|
57
78
|
"@lavamoat/preinstall-always-fail": "^2.1.0",
|
|
58
|
-
"@metamask/auto-changelog": "^
|
|
79
|
+
"@metamask/auto-changelog": "^6.1.0",
|
|
59
80
|
"@metamask/providers": "^19.0.0",
|
|
60
|
-
"@metamask/utils": "^11.
|
|
81
|
+
"@metamask/utils": "^11.11.0",
|
|
61
82
|
"@ts-bridge/cli": "^0.6.3",
|
|
62
83
|
"@types/jest": "^29.5.12",
|
|
63
84
|
"@types/node": "^20.12.12",
|
|
@@ -75,22 +96,18 @@
|
|
|
75
96
|
"peerDependencies": {
|
|
76
97
|
"@metamask/providers": "^19.0.0"
|
|
77
98
|
},
|
|
99
|
+
"tsd": {
|
|
100
|
+
"compilerOptions": {
|
|
101
|
+
"composite": "false"
|
|
102
|
+
},
|
|
103
|
+
"directory": "src"
|
|
104
|
+
},
|
|
78
105
|
"engines": {
|
|
79
106
|
"node": "^18.18 || >=20"
|
|
80
107
|
},
|
|
81
|
-
"publishConfig": {
|
|
82
|
-
"access": "public",
|
|
83
|
-
"registry": "https://registry.npmjs.org/"
|
|
84
|
-
},
|
|
85
108
|
"lavamoat": {
|
|
86
109
|
"allowScripts": {
|
|
87
110
|
"@lavamoat/preinstall-always-fail": false
|
|
88
111
|
}
|
|
89
|
-
},
|
|
90
|
-
"tsd": {
|
|
91
|
-
"directory": "src",
|
|
92
|
-
"compilerOptions": {
|
|
93
|
-
"composite": "false"
|
|
94
|
-
}
|
|
95
112
|
}
|
|
96
113
|
}
|
package/v2.js
ADDED