Skip to content

Latest commit

 

History

History
883 lines (575 loc) · 43.4 KB

File metadata and controls

883 lines (575 loc) · 43.4 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Added

  • Add support for base32 private key encoding in exportAccount (#589)

Changed

  • Use sensitive struct for privateKey in PrivateKeyExportedAccountStruct (#577)
    • This make sure the private key value is always redacted in case of validation errors.
  • Bump @metamask/superstruct from ^3.3.0 to ^3.4.0 (#577)

Added

  • Add resolveAccountAddress to KeyringSnapRpc (v2) (#585)
    • Add snap.resolveAccountAddress boolean flag to KeyringCapabilities to declare support for this method.

Changed

  • Bump @metamask/superstruct from ^3.1.0 to ^3.3.0 (#580)

Added

  • Add KeyringRpc and KeyringSnapRpc RPC interfaces to v1 (#582)
    • KeyringRpc covers the standard account-management and request-handling methods.
    • KeyringSnapRpc extends KeyringRpc with optional snap-specific methods: listAccountAssets, listAccountTransactions, getAccountBalances, and setSelectedAccounts.
  • Add KeyringSnapRpc, KeyringSnapRpcMethod, isKeyringSnapRpcMethod, and related request/response structs to keyring v2 (./v2) (#582)
    • KeyringSnapRpc extends KeyringRpc (v2) with four optional snap-specific methods: setSelectedAccounts, getAccountTransactions, getAccountAssets, and getAccountBalances.
    • KeyringSnapRpcMethod spreads all base KeyringRpcMethod values and adds the four snap-specific method names.
  • Add optional snap capability field to KeyringCapabilities (v2) (#582)
    • Flags: snap.assets.metadata (keyring_getAccountAssets), snap.assets.balances (keyring_getAccountBalances), snap.transactions (keyring_getAccountTransactions), snap.selectedAccounts (keyring_setSelectedAccounts).

Added

  • Add TransactionType.TokenDisapprove for token disapproval transactions (#568)
  • Add optional TransactionDetails.typeLabel (#568)
    • This can be used to display a custom label regarding the transaction type.

Added

  • Add Stellar method signAuthEntry to XlmMethod (#548)
  • Add EthBytesStrictStruct (#555)

Changed

  • Bump @metamask/keyring-utils from ^3.2.0 to ^3.3.1 (#544, #546)

Added

  • Add TransactionType.TokenApprove for token approval transactions (#537)

Fixed

  • Workaround Browserify subpath export for /v2 (#516)

Added

  • Add Stellar (XLM) support (#483)
    • Add XlmScope, XlmAccountType and XlmAccount.
  • Add keyring v2 RPC types and structs (KeyringRpcV2, KeyringRpcV2Method, isKeyringRpcV2Method, and request/response structs) (#408)
  • Add ./v2 subpath export for all keyring v2 types and structs (#513)

Changed

  • BREAKING: Move and rename all keyring v2 types and structs to the new ./v2 subpath export (#513)
    • KeyringV2 is now Keyring from @metamask/keyring-api/v2.
    • KeyringRpcV2, KeyringRpcV2Method, and isKeyringRpcV2Method are now KeyringRpc, KeyringRpcMethod, and isKeyringRpcMethod from @metamask/keyring-api/v2.
    • KeyringCapabilities, KeyringType, account creation options (except CreateAccountOptions), and account export options are now exclusively available from @metamask/keyring-api/v2.
    • CreateAccountOptions and its subtypes (Bip44CreateAccountOptions, PrivateKeyCreateAccountOptions, CustomCreateAccountOptions) remain available from both @metamask/keyring-api and @metamask/keyring-api/v2.
  • Improve return type of isKeyringRpcMethod to use type predicate method is KeyringRpcMethod (#408)
  • Bump @metamask/utils from ^11.1.0 to ^11.11.0 (#489, #483)

Removed

  • BREAKING: Remove EthKeyringWrapper, EthKeyringMethod, KeyringWrapper, and KeyringAccountRegistry exports (#478)
    • 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.

Added

  • Add KeyringType.Money variant (#472)
  • Add optional details field to Transaction type (#445)
    • Add SecurityAlertResponse enum with values: benign, warning, malicious
    • Add optional origin field (string) to track transaction request source
    • Add optional securityAlertResponse field for Security Alert API responses

Added

  • Add EthAddressStrictStruct struct and EthAddressStrict types (#465)
    • This is a stricter variant of EthAddressStruct which uses Hex instead of string for its inferred type.
  • Add assertCreateAccountOptionIsSupported helper (#464)
    • This helper can be used to implement createAccounts and narrow down the options to the supported types (based on the keyring capabilities).

Changed

  • Re-use string for ERC4337 address-like fields (#465)
    • This change reverts that and keeps using string for all address-like types.
    • Changes in #405 updated the associated type for EthAddressStruct from string to Hex, this was actually a small breaking change that went unnoticed and that would require some effort to adapt in upstream clients/controllers, for this reason, we are undoing this change for now.
    • Version 21.4.0 is marked as DEPRECATED, consumers are expected to use version 21.5.0 instead, that reverts this breaking change.

21.4.0 - 2026-02-09 [DEPRECATED]

Added

  • Add Keyring.createAccounts optional method (#448)
    • This method is part of the keyring v2 specification and set as optional for backwards compatibility.
    • This method can be used to create one or more accounts using the new keyring v2 account creation typed options.
    • Add RPC support for this method through KeyringRpcMethod.CreateAccounts.
  • Add support for account derivations using range of indices in KeyringV2 (#451)
    • Add bip44:derive-index-range capability to KeyringCapabilities.
    • Add AccountCreationType.Bip44DeriveIndexRange and CreateAccountBip44DeriveIndexRangeOptions.
  • Add support for custom capabilities and entropy types in KeyringV2 (#415)
    • Add custom capability to KeyringCapabilities for keyrings with non-standard createAccounts method.
    • Add KeyringAccountEntropyTypeOption.Custom for custom/opaque entropy sources.
    • Add AccountCreationType.Custom and CreateAccountCustomOptions for custom account creation flows.
  • Add EthKeyringWrapper abstract class for Ethereum-based KeyringV2 implementations (#404)
    • Provides common Ethereum signing method routing (submitRequest) for all Ethereum-based keyrings.
  • Add KeyringWrapper base class to adapt legacy keyrings to KeyringV2 (#398, #402, #409, #410)

Changed

  • Make BIP-44 capabilities optional in KeyringCapabilities (#453)
    • The derivePath, deriveIndex, deriveIndexRange, and discover capabilities are now optional.
    • A capability set to true indicates support, while false or undefined indicates no support.
    • Keyrings no longer need to explicitly set unsupported capabilities to false.
  • Change KeyringWrapper.capabilities from a readonly property to a getter (#447)
    • Allows subclasses to override and return capabilities dynamically based on runtime state.
  • Refine EthAddressStruct in order to make it compatible with the Hex type from @metamask/utils (#405)

Added

  • Add initial KeyringV2 interface (#397)
    • This is an on-going work and should not be used for now.
  • Add new Tron methods signMessage and signTransaction (#401)

Changed

  • Deprecate Tron methods signMessageV2 and verifyMessageV2 (#401)

Added

  • Add stake:{deposit,withdraw} transaction types (#394)

Added

  • Add new optional Keyring.setSelectedAccounts method (#387)
    • This method can be invoked by the MetaMask client to inform which accounts are now selected for this Snap.

Added

  • BREAKING: Add new bitcoin methods to BtcMethod enum (#355, #356)
    • This change was not properly reported as breaking on the 20.1.1.

Removed

  • BREAKING: Remove BtcMethod.SendBitcoin method (#355)
    • This change was not properly reported as breaking on the 20.1.1.

Added

  • Add new bitcoin methods to BtcMethod enum (#354)

Added

  • Add Tron support (#349)

Changed

  • BREAKING: Add generic account type (#323)
    • This change was not properly reported as breaking on the 19.1.0.
    • The KeyringAccountType union now has a new member type any:account.

Added

  • Add generic account type (#318)
    • This account type can be used during the integration of new chains.
    • It's allowed only in Flask builds of MetaMask clients.

Changed

  • BREAKING: Add typed KeyringAccount.options (#316)
    • We still support the old Record<string, Json> type for options, however we now constrain 2 fields (entropy and exportable) and type their shapes to meet new requirements.

Changed

  • BREAKING: Add KeyringRequest.origin (#273)
    • This requires a platformVersion version 7.0.0 or newer.
    • This field will allow Snap to display the real origin of the caller (e.g dapp) when processing/confirming a keyring request (submitRequest).

Added

  • Add support for Bitcoin account type: p2pkh, p2sh, p2tr (#284)

Added

  • Add bridge:{send,receive} transaction type (#251)
  • Add unknown transaction type (#251)
    • This type can be used when a transaction type cannot be identified.

Added

  • Add discoverAccounts keyring method (#266)
  • Add KeyringEventPayload utility type to extract payload KeyringEvent enum (#203)
  • Add event payload types (#203)

Added

  • Add new MetaMaskOptions in createAccount (#252)
    • This options object might contain a new correlationId that MUST BE forwarded during the notify:accountCreated event.

Changed

  • Add missing Transaction.status for 'swap' (#229)

Added

  • Add swap transaction type (#218)

Changed

  • Use ts-bridge/cli@0.6.3 (#214)
    • This new version fixes a bug regarding some missing exports.

Added

  • Add new SolMethod.Sign{AndSendTransaction,Transaction,Message,In} methods (#191)

Changed

  • Deprecates SolMethod.SendAndConfirmTransaction method (#191)

Added

  • Re-export CaipAccountId type and struct (#186)

Changed

  • BREAKING: Use CaipAccountId for ResolvedAccountAddress.address (#186)
    • This was missing from SIP-26, but we expect this address to be CAIP-10 compliant.

Added

  • Re-export Caip* types and structs (#174)

Added

  • Add resolveAccountAddress keyring method (#157)

Changed

  • BREAKING: Remove CAIP redefinitions (#167)
    • We now rely on CAIP definitions coming @metamask/utils.
  • BREAKING: Enforce that scopes contains CAIP-2 chain IDs (#165)
    • Initially scopes accepted CAIP-2 namespaces as well to address the EVM EOA accounts that supports all EVM chains. This has been dropped in favor of eip155:0 scope.
  • BREAKING: Rename *Scopes enums to *Scope (#165)
  • Bump @metamask/utils from ^11.0.1 to ^11.1.0 (#167)

Added

  • Add account{AssetList,Balances,Transactions}UpdatedEventStruct keyring events (#154)

Changed

  • BREAKING: Make specific *AccountStruct.scopes more strict (#159)

Added

  • Add listAccountAssets keyring method (#148)

Changed

  • BREAKING: Make CaipAssetType type more restritive (#150)
    • It used to be a string but it has been restricted with a template literal type that matches CAIP-19 asset type.

Added

  • New scope constant values added for Ethereum, Bitcoin, and Solana (#101)

Changed

  • BREAKING: Add scopes field to KeyringAccount (#101)

Changed

  • Use ts-bridge/cli@0.6.1 (#118)
    • This new version fixes a bug with CJS re-exports.
  • BREAKING: Split into several smaller packages (#24)
    • This should improve dependencies management.
    • Internal related types (internal to both clients) have been moved to keyring-internal-* packages.
    • Keyring API clients (mainly used by dapps) have been moved to keyring-snap-client package.
    • Common utils have been moevd to keyring-utils package.

Added

  • Add listAccountTransactions keyring method (#41)

Added

  • BREAKING: Add ESM build (#40)
    • It's no longer possible to import files from ./dist directly.

Added

  • Add solana:data-account account support (#93)

Changed

  • Add proprietary license (#83)
  • BREAKING: Bump peer dependency @metamask/providers from ^17.2.0 to ^18.1.0 (#76)

Changed

  • BREAKING: Rename btc_sendmany method to sendBitcoin (#73)

Changed

  • Bump sinon and @types/sinon to latest versions (#51)
  • Add syncpack and sync dependencies (#53)

Changed

  • Bump @metamask/* and @lavamoat/* dependencies (#46)
  • Move deepmerge to devDependencies (#44)

Changed

  • Convert to monorepo
    • Package name does not change (@metamask/keyring-api) and sources have been moved to: packages/keyring-api.
    • You can find all the changes here.

Added

  • Add optional nameLastUpdatedAt metadata field (#366)

Changed

  • Bump @metamask/snaps-sdk from 6.1.0 to 6.2.0 (#367)
  • Bump @metamask/providers from 17.1.1 to 17.1.2 (#362)

Changed

  • Bump @metamask/snaps-sdk from ^6.0.0 to ^6.1.0 (#358)

Changed

  • Migrate to @metamask/superstruct and update required dependencies (#355).
  • Bump @metamask/providers from 17.1.0 to 17.1.1 (#354).
  • Bump @metamask/key-tree from 9.1.1 to 9.1.2 (#351).
  • Bump @metamask/rpc-errors from 6.3.0 to 6.3.1 (#350).
  • Bump @metamask/providers from 17.0.0 to 17.1.0 (#348).
  • Bump @metamask/snaps-sdk from 4.4.2 to 6.0.0 (#347).
  • Bump braces from 3.0.2 to 3.0.3 (#345).

Changed

  • BREAKING: Revert allow multiple address per account (#342).

Added

  • Add getAccountBalances to KeyringClient (#340).
  • BREAKING: Allow multiple address per account (#315).

Changed

  • BREAKING: Keep all ETH methods in the same enum (#313).
  • Bump @metamask/snaps-sdk from 4.4.1 to 4.4.2 (#339).
  • Bump @metamask/rpc-errors from 6.2.1 to 6.3.0 (#337).
  • Bump @metamask/json-rpc-middleware-stream from 7.0.1 to 7.0.2 (#333).
  • Bump @metamask/snaps-sdk from 4.4.0 to 4.4.1 (#334).

Fixed

  • Allow stale action to be run manually and fix permissions (#336).

Changed

  • BREAKING: Keep all ETH methods in the same enum (#313).
  • Add support for @metamask/providers v17 (#329).

Changed

  • BREAKING: Keep all ETH methods in the same enum (#313).

Fixed

  • Export Caip* types used in the API (#325).

Added

  • Add getAccountBalances method to Keyring interface (#320).
  • Add CAIP-19 types to utils (#321).

Changed

  • BREAKING: Keep all ETH methods in the same enum (#313).
  • Bump @metamask/snaps-sdk from 4.2.0 to 4.3.0 (#323).
  • Split api.ts into different files (#319).
  • Make the KeyringAccount type less rigid (#311).

Fixed

  • Ensure that errors are JSON-serializable (#162).
  • Don't use internal types in the public API (#312).

Changed

  • Bump @metamask/key-tree from 9.1.0 to 9.1.1 (#310).

Fixed

  • Use internal object function instead of the upstream one (#316).

Added

  • Add accountNameSuggestion field to the AccountCreatedEvent (#291)
  • Add displayConfirmation field to the AccountCreatedEvent (#307)

Changed

  • Fix isEvmAccountType accountType type to string or InternalAccountType (#304)
  • Bump @metamask/snaps-sdk from ^4.0.0 to ^4.2.0 (#305)

Added

  • Add isEvmAccountType helper (#297)
  • Add bip121:p2wpkh account support (#294)

Changed

  • Remove incorrect SignTransaction from EthErc4337Account (#300)
  • Bump @metamask/providers from 16.0.0 to 16.1.0 (#298)
  • Bump @metamask/snaps-sdk from 4.0.0 to 4.0.1 (#292)
  • Split account types (EOA + Erc4337) (#293)

Changed

  • BREAKING: Add importTime property to InternalAccount metadata (#289)
  • Bump tar from 6.1.15 to 6.2.1 (#286)
  • Bump @metamask/snaps-sdk from 3.2.0 to 4.0.0 (#287)
  • Add documentation for eth_decodeUserOperationCallData (#254)
  • Bump @metamask/snaps-sdk from 3.1.1 to 3.2.0 (#284)

Changed

  • Use @metamask/providers as a peer dependency (#282)
  • Bump @metamask/utils from 8.3.0 to 8.4.0 (#280)
  • Add stale CI workflow to close issues and PRs (#279)

Changed

  • BREAKING: Add new KeyringExecutionContext to user operation methods (#275)
  • Fix bundler type (defined as string now) (#277)
  • Bump @metamask/providers from 15.0.0 to 16.0.0 (#276)
  • Bump @metamask/safe-event-emitter from 3.1.0 to 3.1.1 (#274)

Changed

  • Bump @metamask/snaps-sdk to ^3.1.1 (#271)
  • Bump @metamask/safe-event-emitter from 3.0.0 to 3.1.0 (#270)
  • Fix bundler URL validation (#262)

Changed

  • Bump @metamask/providers to 15.0.0, @metamask/snaps-sdk to ^3.1.0 and @@metamask/utils to ^8.3.0(#266)
  • Bump @metamask/json-rpc-engine from 7.3.2 to 7.3.3 (#264)
  • Bump @metamask/snaps-sdk from 3.0.0 to 3.0.1 (#261)
  • Bump @metamask/snaps-sdk from 1.4.0 to 3.0.0 (#259)
  • Bump @metamask/rpc-errors from 6.1.0 to 6.2.1 (#258)

Changed

  • BREAKING Update node min version to 18.x (#247)
  • Update eth_patchUserOperation to return optional gas limit values (#250)
  • Bump ip from 2.0.0 to 2.0.1 (#253)
  • Bump @metamask/json-rpc-engine from 7.3.1 to 7.3.2 (#246)
  • Bump @metamask/snaps-sdk from 1.3.2 to 1.4.0 (#243)

Changed

  • Bump @metamask/utils from 8.2.1 to 8.3.0 (#238)
  • Bump Snap dependencies (#236)
    • Bump @metamask/snaps-controllers to ^4.0.0
    • Bump @metamask/snaps-sdk to ^1.3.2
    • Bump @metamask/snaps-utils to ^5.1.2
  • Bump @metamask/approval-controller from 5.0.0 to 5.1.1 (#225)
  • Bump @metamask/base-controller from 4.0.0 to 4.0.1 (#226)
  • Bump @metamask/json-rpc-engine from 7.3.0 to 7.3.1 (#227)
  • Bump @metamask/auto-changelog from 3.4.3 to 3.4.4 (#223)
  • Bump @metamask/snaps-sdk from 1.3.0 to 1.3.1 (#222)

Removed

  • BREAKING: remove KeyringSnapControllerClient class to fix dependency problems (#241)

Added

  • BREAKING: Add support for ERC-4337 transactions (#213)
    • Enum EthMethods has been extended with eth_prepareUserOperation, eth_patchUserOperation, eth_signUserOperation
    • Enum EthAccountType has been extended with eip155:erc4337

Changed

  • BREAKING: Update @metamask/providers from ^13.0.0 to ^14.0.1 (#209)
    • Consolidation on readable-stream@^3.6.2. Users should upgrade to extension-port-stream@^3.0.0 and json-rpc-middleware-stream@^5.0.0.
  • Replace deprecated @metamask/snaps-ui with @metamask/snaps-sdk (#204)
    • Replace @metamask/snaps-rpc-methods with @metamask/snaps-sdk
    • Update @metamask/snaps-controllers and @metamask/snaps-utils to versions that don't rely on @metamask/snaps-ui
  • Documentation updates (#185) (#201)

Removed

  • BREAKING EthAccountType.Eip4337 has been removed. eip155:eip4337 should be replaced with erc:4337

Fixed

  • Exclude *.test-d.ts files from builds (#184)
  • Remove @metamask/snaps-ui from dependency tree (#204)

Changed

  • UuidStruct is now a named type (#159)
  • Migrate from @metamask/rpc-methods to @metamask/snaps-rpc-methods (#175)

Fixed

  • Allow the request ID to be a string, number or null (#156)
  • Documentation fixes (#160) (#174) (#173) (#172)
  • Use UuidStruct for IDs in the internal API (#158)
  • Bump @metamask/json-rpc-engine from ^7.1.1 to ^7.2.0 (#164)

Added

  • Add migration steps to 1.0.0 (#149).
  • Add Account Snaps security guidelines (#143).

Changed

  • Bump @metamask/rpc-errors from 6.0.0 to 6.1.0 (#151).
  • Bump postcss from 8.4.24 to 8.4.31 (#150).

Added

  • Document how to migrate from API 0.1.x to 0.2.x (#124).

Changed

  • BREAKING: Use the onKeyringRequest snap export (#145).
  • BREAKING: Change the events' prefix to notify: (#139).

Added

  • Export events types (#125)

Changed

  • Remove unused lavamoat allowed scripts (#122).
  • Update events in sequence diagram (#121).
  • Update Snap and ESLint dependencies (#117).
  • Bump @metamask/rpc-methods from 0.38.1-flask.1 to 2.0.0 (#120).

Changed

  • Remove buildHandlersChain (#114).
  • Update doc for eth_signTransaction (#111).
  • Remove un-versioned eth_signTypedData method (#113).

Changed

  • Fix linting and compatibility with older tsc (#108).

Added

  • Add redirection message to snap async response (#102).

Changed

  • Use Omit instead of OmitUnion (#106).
  • Update KeyringResponse comment (#103).
  • Use KeyringRpcMethod enum instead of string (#105).
  • Refactor tests to match superstruct examples (#104).
  • Add exactOptional() superstruct type (#100).
  • Bump @metamask/providers from 11.1.2 to 12.0.0 (#99).
  • Bump @metamask/providers from 11.1.1 to 11.1.2 (#98).

Added

  • Add architecture and EVM methods docs (#86).
  • Add lastSelected and lastActive to metadata (#92).

Changed

  • Make request params optional (#96).
  • Remove lastActive field from internal account model (#95).
  • Move request ID to outer request (#94).

Changed

  • Set snap object keys to be mandatory and move name to metadata (#87).

Added

  • Add InternalAccount type and create submodule internal (#65).
  • Add keyring events and helper functions (#74).
  • Add a redirect field to asynchronous request responses (#75).
  • Add exportAccount method (#60).
  • Add getController to client (#43).

Changed

  • Rename erc4337 -> eip4337 (#42).
  • Make options a mandatory field of KeyringAccount (#30).
  • Make approveRequest and rejectRequest optional (#63).
  • Make exportAccount, listRequests and getRequest optional (#73).
  • Export enums with account methods and types (#66).
  • Make approveRequest accept a result argument (#59).
  • Remove account name from KeyringAccount type (#55).
  • Remove eth_sendTransaction method (#50).
  • Rename supportedMethods to methods (#35).

Changed

  • Downgrade snaps dependencies to 0.35.2-flask.1 (#25).

Changed

  • Update snaps dependencies (#21).

Added

  • Validate snap responses for type correctness (#15).

Changed

  • Rename RPC handling functions (#16).

0.1.0 - 2023-06-20

Added

  • Usage examples to README.md.
  • Keyring API definition.
  • JSON-RPC snap keyring client. It is intended to be used by a snap's companion dapp to send requests to the snap.
  • SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
  • Helper functions to create keyring handler in the snap.