Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/keyring-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- These have been moved to the new `@metamask/keyring-sdk` package.
- `@ethereumjs/tx`, `@metamask/eth-sig-util`, and `async-mutex` are no longer dependencies of this package.

### Fixed

- Change `KeyringCapabilitiesStruct` to use `optional` instead of `exactOptional` for nested fields ([#481](https://github.com/MetaMask/accounts/pull/481))
- No runtime behavior change for JSON-sourced data; `undefined` cannot appear in JSON.

## [21.6.0]

### Added
Expand Down
20 changes: 10 additions & 10 deletions packages/keyring-api/src/api/v2/keyring-capabilities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
array,
boolean,
exactOptional,
optional,
nonempty,
object,
partial,
Expand All @@ -25,39 +25,39 @@ export const KeyringCapabilitiesStruct = object({
/**
* BIP-44 capabilities supported by this keyring.
*/
bip44: exactOptional(
bip44: optional(
object({
/**
* Whether the keyring supports deriving accounts from a specific BIP-44 path.
*/
derivePath: exactOptional(boolean()),
derivePath: optional(boolean()),
/**
* Whether the keyring supports deriving accounts from a BIP-44 account index.
*/
deriveIndex: exactOptional(boolean()),
deriveIndex: optional(boolean()),
/**
* Whether the keyring supports deriving accounts from a range of BIP-44 account indices.
*/
deriveIndexRange: exactOptional(boolean()),
deriveIndexRange: optional(boolean()),
/**
* Whether the keyring supports BIP-44 account discovery.
*/
discover: exactOptional(boolean()),
discover: optional(boolean()),
}),
),
/**
* Private key capabilities supported by this keyring.
*/
privateKey: exactOptional(
privateKey: optional(
object({
/**
* List of supported formats for importing private keys.
*/
importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),
importFormats: optional(array(ImportPrivateKeyFormatStruct)),
/**
* List of supported formats for exporting private keys.
*/
exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),
exportFormats: optional(array(ExportPrivateKeyFormatStruct)),
}),
),
/**
Expand All @@ -67,7 +67,7 @@ export const KeyringCapabilitiesStruct = object({
* accepts custom options for that method, different from the standard API.
* This is a workaround for keyrings with very specific requirements.
*/
custom: exactOptional(
custom: optional(
partial(
object({
createAccounts: boolean(),
Expand Down
Loading