Socket
Socket
Sign inDemoInstall

@metamask/keyring-api

Package Overview
Dependencies
Maintainers
11
Versions
36
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 6.4.0 to 7.0.0

29

CHANGELOG.md

@@ -10,2 +10,21 @@ # Changelog

## [7.0.0]
### Added
- Add `getAccountBalances` to `KeyringClient` ([#340](https://github.com/MetaMask/keyring-api/pull/340)).
- Allow multiple address per account ([#315](https://github.com/MetaMask/keyring-api/pull/315)).
### Changed
- **BREAKING:** Keep all ETH methods in the same `enum` ([#313](https://github.com/MetaMask/keyring-api/pull/313)).
- Bump @metamask/snaps-sdk from 4.4.1 to 4.4.2 ([#339](https://github.com/MetaMask/keyring-api/pull/339)).
- Bump @metamask/rpc-errors from 6.2.1 to 6.3.0 ([#337](https://github.com/MetaMask/keyring-api/pull/337)).
- Bump @metamask/json-rpc-middleware-stream from 7.0.1 to 7.0.2 ([#333](https://github.com/MetaMask/keyring-api/pull/333)).
- Bump @metamask/snaps-sdk from 4.4.0 to 4.4.1 ([#334](https://github.com/MetaMask/keyring-api/pull/334)).
### Fixed
- Allow stale action to be run manually and fix permissions ([#336](https://github.com/MetaMask/keyring-api/pull/336)).
## [6.4.0]

@@ -15,2 +34,3 @@

- **BREAKING:** Keep all ETH methods in the same `enum` ([#313](https://github.com/MetaMask/keyring-api/pull/313)).
- Add support for `@metamask/providers` v17 ([#329](https://github.com/MetaMask/keyring-api/pull/329)).

@@ -20,2 +40,6 @@

### Changed
- **BREAKING:** Keep all ETH methods in the same `enum` ([#313](https://github.com/MetaMask/keyring-api/pull/313)).
### Fixed

@@ -34,2 +58,3 @@

- **BREAKING:** Keep all ETH methods in the same `enum` ([#313](https://github.com/MetaMask/keyring-api/pull/313)).
- Bump @metamask/snaps-sdk from 4.2.0 to 4.3.0 ([#323](https://github.com/MetaMask/keyring-api/pull/323)).

@@ -43,3 +68,2 @@ - Split `api.ts` into different files ([#319](https://github.com/MetaMask/keyring-api/pull/319)).

- Don't use internal types in the public API ([#312](https://github.com/MetaMask/keyring-api/pull/312)).
- Keep all ETH methods in the same `enum` ([#313](https://github.com/MetaMask/keyring-api/pull/313)).

@@ -339,3 +363,4 @@ ## [6.2.1]

[Unreleased]: https://github.com/MetaMask/keyring-api/compare/v6.4.0...HEAD
[Unreleased]: https://github.com/MetaMask/keyring-api/compare/v7.0.0...HEAD
[7.0.0]: https://github.com/MetaMask/keyring-api/compare/v6.4.0...v7.0.0
[6.4.0]: https://github.com/MetaMask/keyring-api/compare/v6.3.1...v6.4.0

@@ -342,0 +367,0 @@ [6.3.1]: https://github.com/MetaMask/keyring-api/compare/v6.3.0...v6.3.1

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

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -47,5 +47,31 @@ methods: string[];

/**
* Account main address.
* Account addresses. It can be a single address or a map of addresses per
* chain.
*
* If the address is a string, it's assumed to be under the 'eip155'
* namespace. Otherwise, it must be a map of addresses per chain, where the
* key is the chain ID (CAIP-2) and the value is an array of addresses.
*
* @example
* ```ts
* address: {
* // Different addresses per chain.
* 'eip155:1': ['0x1234...'],
* 'eip155:137': ['0x5678...'],
* }
* ```
* @example
* ```ts
* address: {
* // The address is the same across all 'eip155' chains.
* 'eip155': ['0x1234...'],
* }
* ```
* @example
* ```ts
* // Assumed to be under the 'eip155' namespace.
* address: '0x1234...',
* ```
*/
address: import("superstruct").Struct<string, null>;
address: import("superstruct").Struct<string | Record<string, string[]>, null>;
/**

@@ -52,0 +78,0 @@ * Account options.

@@ -44,5 +44,31 @@ "use strict";

/**
* Account main address.
* Account addresses. It can be a single address or a map of addresses per
* chain.
*
* If the address is a string, it's assumed to be under the 'eip155'
* namespace. Otherwise, it must be a map of addresses per chain, where the
* key is the chain ID (CAIP-2) and the value is an array of addresses.
*
* @example
* ```ts
* address: {
* // Different addresses per chain.
* 'eip155:1': ['0x1234...'],
* 'eip155:137': ['0x5678...'],
* }
* ```
* @example
* ```ts
* address: {
* // The address is the same across all 'eip155' chains.
* 'eip155': ['0x1234...'],
* }
* ```
* @example
* ```ts
* // Assumed to be under the 'eip155' namespace.
* address: '0x1234...',
* ```
*/
address: (0, superstruct_1.string)(),
address: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.array)((0, superstruct_1.string)()))]),
/**

@@ -49,0 +75,0 @@ * Account options.

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

*
* See {@link KeyringAccount}.
*
* @deprecated Use the keys of the `address` map of the account object to
* indicate the supported chains. This method will be removed in a future
* version of the Keyring API.
* @param id - ID of the account to be checked.

@@ -81,3 +86,3 @@ * @param chains - List of chains (CAIP-2) to be checked.

*/
filterAccountChains(id: string, chains: string[]): Promise<string[]>;
filterAccountChains?(id: string, chains: string[]): Promise<string[]>;
/**

@@ -84,0 +89,0 @@ * Update an account.

22

dist/internal/api.d.ts

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

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -22,3 +22,3 @@ methods: string[];

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -33,3 +33,3 @@ methods: string[];

}>;
address: import("superstruct").Struct<string, null>;
address: import("superstruct").Struct<string | Record<string, string[]>, null>;
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;

@@ -60,3 +60,3 @@ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -71,3 +71,3 @@ methods: string[];

}>;
address: import("superstruct").Struct<string, null>;
address: import("superstruct").Struct<string | Record<string, string[]>, null>;
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;

@@ -98,3 +98,3 @@ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -109,3 +109,3 @@ methods: string[];

}>;
address: import("superstruct").Struct<string, null>;
address: import("superstruct").Struct<string | Record<string, string[]>, null>;
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;

@@ -172,3 +172,3 @@ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -184,3 +184,3 @@ methods: string[];

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -193,3 +193,3 @@ methods: string[];

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -204,3 +204,3 @@ methods: string[];

}>;
address: import("superstruct").Struct<string, null>;
address: import("superstruct").Struct<string | Record<string, string[]>, null>;
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;

@@ -207,0 +207,0 @@ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;

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

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -21,3 +21,3 @@ methods: string[];

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -35,3 +35,3 @@ methods: string[];

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -46,3 +46,3 @@ methods: string[];

}>;
address: import("superstruct").Struct<string, null>;
address: import("superstruct").Struct<string | Record<string, string[]>, null>;
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;

@@ -72,3 +72,3 @@ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -84,3 +84,3 @@ methods: string[];

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -96,3 +96,3 @@ methods: string[];

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -107,3 +107,3 @@ methods: string[];

}>;
address: import("superstruct").Struct<string, null>;
address: import("superstruct").Struct<string | Record<string, string[]>, null>;
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;

@@ -110,0 +110,0 @@ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;

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

id: string;
address: string;
address: string | Record<string, string[]>;
options: Record<string, import("@metamask/utils").Json>;

@@ -306,3 +306,3 @@ methods: string[];

}>;
address: Struct<string, null>;
address: Struct<string | Record<string, string[]>, null>;
options: Struct<Record<string, import("@metamask/utils").Json>, null>;

@@ -309,0 +309,0 @@ methods: Struct<string[], Struct<string, null>>;

import type { Json } from '@metamask/utils';
import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse } from './api';
import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, CaipAssetType, Balance } from './api';
import type { JsonRpcRequest } from './JsonRpcRequest';

@@ -17,2 +17,3 @@ export declare type Sender = {

getAccount(id: string): Promise<KeyringAccount>;
getAccountBalances(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;

@@ -19,0 +20,0 @@ filterAccountChains(id: string, chains: string[]): Promise<string[]>;

@@ -43,2 +43,8 @@ "use strict";

}
async getAccountBalances(id, assets) {
return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
method: rpc_1.KeyringRpcMethod.GetAccountBalances,
params: { id, assets },
}), api_1.GetAccountBalancesResponseStruct);
}
async createAccount(options = {}) {

@@ -45,0 +51,0 @@ return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {

@@ -50,2 +50,5 @@ "use strict";

case rpc_1.KeyringRpcMethod.FilterAccountChains: {
if (keyring.filterAccountChains === undefined) {
throw new MethodNotSupportedError(request.method);
}
(0, superstruct_1.assert)(request, api_1.FilterAccountChainsStruct);

@@ -52,0 +55,0 @@ return keyring.filterAccountChains(request.params.id, request.params.chains);

{
"name": "@metamask/keyring-api",
"version": "6.4.0",
"version": "7.0.0",
"description": "MetaMask Keyring API",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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