Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@metamask/keyring-api

Package Overview
Dependencies
Maintainers
10
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/keyring-api - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

9

CHANGELOG.md

@@ -9,2 +9,8 @@ # Changelog

## [0.2.5]
### Changed
- Remove `buildHandlersChain` ([#114](https://github.com/MetaMask/keyring-api/pull/114))
- Update doc for `eth_signTransaction` ([#111](https://github.com/MetaMask/keyring-api/pull/111))
- Remove un-versioned `eth_signTypedData` method ([#113](https://github.com/MetaMask/keyring-api/pull/113))
## [0.2.4]

@@ -83,3 +89,4 @@ ### Changed

[Unreleased]: https://github.com/MetaMask/keyring-api/compare/v0.2.4...HEAD
[Unreleased]: https://github.com/MetaMask/keyring-api/compare/v0.2.5...HEAD
[0.2.5]: https://github.com/MetaMask/keyring-api/compare/v0.2.4...v0.2.5
[0.2.4]: https://github.com/MetaMask/keyring-api/compare/v0.2.3...v0.2.4

@@ -86,0 +93,0 @@ [0.2.3]: https://github.com/MetaMask/keyring-api/compare/v0.2.2...v0.2.3

6

dist/api.d.ts

@@ -10,3 +10,2 @@ import type { Json } from '@metamask/utils';

SignTransaction = "eth_signTransaction",
SignTypedData = "eth_signTypedData",
SignTypedDataV1 = "eth_signTypedData_v1",

@@ -28,3 +27,3 @@ SignTypedDataV3 = "eth_signTypedData_v3",

options: Record<string, Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}, {

@@ -46,7 +45,6 @@ /**

*/
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData: "eth_signTypedData";
eth_signTypedData_v1: "eth_signTypedData_v1";

@@ -53,0 +51,0 @@ eth_signTypedData_v3: "eth_signTypedData_v3";

@@ -16,3 +16,2 @@ "use strict";

EthMethod["SignTransaction"] = "eth_signTransaction";
EthMethod["SignTypedData"] = "eth_signTypedData";
EthMethod["SignTypedDataV1"] = "eth_signTypedData_v1";

@@ -50,3 +49,2 @@ EthMethod["SignTypedDataV3"] = "eth_signTypedData_v3";

`${EthMethod.SignTransaction}`,
`${EthMethod.SignTypedData}`,
`${EthMethod.SignTypedDataV1}`,

@@ -53,0 +51,0 @@ `${EthMethod.SignTypedDataV3}`,

@@ -17,3 +17,3 @@ import type { Infer } from 'superstruct';

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}[], import("superstruct").Struct<{

@@ -24,3 +24,3 @@ type: "eip155:eoa" | "eip155:eip4337";

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}, {

@@ -30,7 +30,6 @@ id: import("superstruct").Struct<string, null>;

options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData: "eth_signTypedData";
eth_signTypedData_v1: "eth_signTypedData_v1";

@@ -69,3 +68,3 @@ eth_signTypedData_v3: "eth_signTypedData_v3";

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}, {

@@ -75,7 +74,6 @@ id: import("superstruct").Struct<string, null>;

options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData: "eth_signTypedData";
eth_signTypedData_v1: "eth_signTypedData_v1";

@@ -114,3 +112,3 @@ eth_signTypedData_v3: "eth_signTypedData_v3";

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}, {

@@ -120,7 +118,6 @@ id: import("superstruct").Struct<string, null>;

options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData: "eth_signTypedData";
eth_signTypedData_v1: "eth_signTypedData_v1";

@@ -169,3 +166,3 @@ eth_signTypedData_v3: "eth_signTypedData_v3";

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
};

@@ -181,3 +178,3 @@ };

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
};

@@ -190,3 +187,3 @@ }, {

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}, {

@@ -196,7 +193,6 @@ id: import("superstruct").Struct<string, null>;

options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData: "eth_signTypedData";
eth_signTypedData_v1: "eth_signTypedData_v1";

@@ -203,0 +199,0 @@ eth_signTypedData_v3: "eth_signTypedData_v3";

@@ -9,3 +9,3 @@ export declare const AccountCreatedEventStruct: import("superstruct").Struct<{

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
};

@@ -21,3 +21,3 @@ };

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
};

@@ -33,3 +33,3 @@ }, {

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}, {

@@ -39,7 +39,6 @@ id: import("superstruct").Struct<string, null>;

options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData: "eth_signTypedData";
eth_signTypedData_v1: "eth_signTypedData_v1";

@@ -64,3 +63,3 @@ eth_signTypedData_v3: "eth_signTypedData_v3";

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
};

@@ -76,3 +75,3 @@ };

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
};

@@ -88,3 +87,3 @@ }, {

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}, {

@@ -94,7 +93,6 @@ id: import("superstruct").Struct<string, null>;

options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData: "eth_signTypedData";
eth_signTypedData_v1: "eth_signTypedData_v1";

@@ -101,0 +99,0 @@ eth_signTypedData_v3: "eth_signTypedData_v3";

@@ -7,3 +7,3 @@ import type { Infer } from 'superstruct';

options: Record<string, import("@metamask/utils").Json>;
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
metadata: {

@@ -54,7 +54,6 @@ name: string;

options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData: "eth_signTypedData";
eth_signTypedData_v1: "eth_signTypedData_v1";

@@ -61,0 +60,0 @@ eth_signTypedData_v3: "eth_signTypedData_v3";

@@ -1,2 +0,1 @@

import type { OnRpcRequestHandler } from '@metamask/snaps-utils';
import type { Json } from '@metamask/utils';

@@ -11,15 +10,2 @@ import type { Keyring } from './api';

}
/**
* Build a chain of handlers for a JSON-RPC request.
*
* If a handler throws a MethodNotSupportedError, the next handler in the chain
* is called. If all handlers throw a MethodNotSupportedError, the error is re-
* thrown.
*
* Any other error thrown by a handler is re-thrown.
*
* @param handlers - Handlers to chain.
* @returns A handler that chains the given handlers.
*/
export declare function buildHandlersChain(...handlers: OnRpcRequestHandler[]): OnRpcRequestHandler;
export declare enum KeyringRpcMethod {

@@ -47,1 +33,8 @@ ListAccounts = "keyring_listAccounts",

export declare function handleKeyringRequest(keyring: Keyring, request: JsonRpcRequest): Promise<Json | void>;
/**
* Check if a method is a keyring RPC method.
*
* @param method - Method to check.
* @returns Whether the method is a keyring RPC method.
*/
export declare function isKeyringRpcMethod(method: string): boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleKeyringRequest = exports.KeyringRpcMethod = exports.buildHandlersChain = exports.MethodNotSupportedError = void 0;
exports.isKeyringRpcMethod = exports.handleKeyringRequest = exports.KeyringRpcMethod = exports.MethodNotSupportedError = void 0;
const superstruct_1 = require("superstruct");

@@ -16,31 +16,2 @@ const api_1 = require("./internal/api");

exports.MethodNotSupportedError = MethodNotSupportedError;
/**
* Build a chain of handlers for a JSON-RPC request.
*
* If a handler throws a MethodNotSupportedError, the next handler in the chain
* is called. If all handlers throw a MethodNotSupportedError, the error is re-
* thrown.
*
* Any other error thrown by a handler is re-thrown.
*
* @param handlers - Handlers to chain.
* @returns A handler that chains the given handlers.
*/
function buildHandlersChain(...handlers) {
return async ({ origin, request }) => {
for (const handler of handlers) {
try {
return await handler({ origin, request });
}
catch (error) {
if (!(error instanceof MethodNotSupportedError)) {
throw error;
}
}
}
// All handlers failed to handle the request.
throw new MethodNotSupportedError(request.method);
};
}
exports.buildHandlersChain = buildHandlersChain;
var KeyringRpcMethod;

@@ -142,2 +113,12 @@ (function (KeyringRpcMethod) {

exports.handleKeyringRequest = handleKeyringRequest;
/**
* Check if a method is a keyring RPC method.
*
* @param method - Method to check.
* @returns Whether the method is a keyring RPC method.
*/
function isKeyringRpcMethod(method) {
return Object.values(KeyringRpcMethod).includes(method);
}
exports.isKeyringRpcMethod = isKeyringRpcMethod;
//# sourceMappingURL=rpc-handler.js.map
{
"name": "@metamask/keyring-api",
"version": "0.2.4",
"version": "0.2.5",
"description": "MetaMask Keyring API",

@@ -41,3 +41,3 @@ "keywords": [

"dependencies": {
"@metamask/providers": "^12.0.0",
"@metamask/providers": "^13.0.0",
"@metamask/rpc-methods": "^0.38.1-flask.1",

@@ -44,0 +44,0 @@ "@metamask/snaps-controllers": "^0.38.2-flask.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc