Skip to content

53.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 26 May 17:23
· 1360 commits to main since this release
a99db4d

@metamask/address-book-controller

Changed

  • BREAKING:: Bump to Node 16 (#1262)
  • BREAKING: The addressBook state property is now keyed by Hex chain ID rather than string, and the chainId property of each address book entry is also Hex rather than string.
    • This requires a state migration (#1367)
  • BREAKING: The methods delete and set now except the chain ID as Hex rather than as a decimal string (#1367)
  • Add @metamask/utils dependency (#1367)

@metamask/announcement-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)

@metamask/approval-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • Replace @metamask/controller-utils dependency with @metamask/utils (#1370)

@metamask/assets-controllers

Added

  • Support NFT detection on Ethereum Mainnet custom RPC endpoints (#1360)
  • Enable token detection for the Aurora network (#1327)

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: Change format of chain ID in state to 0x-prefixed hex string (#1367)
    • The functions isTokenDetectionSupportedForNetwork and formatIconUrlWithProxy now expect a chain ID as type Hex rather than as a decimal string
    • The assets contract controller now expects the chainId configuration entry and constructor parameter as type Hex rather than decimal string
    • The NFT controller now expects the chainId configuration entry and constructor parameter as type Hex rather than decimal string
    • The NFT controller methods addNft, checkAndUpdateSingleNftOwnershipStatus, findNftByAddressAndTokenId, updateNft, and resetNftTransactionStatusByTransactionId now expect the chain ID to be type Hex rather than a decimal string
    • The NFT controller state properties allNftContracts and allNfts are now keyed by address and Hex chain ID, rather than by address and decimal string chain ID
      • This requires a state migration
    • The NFT detection controller now expects the chainId configuration entry and constructor parameter as type Hex rather than decimal string
    • The token detection controller now expects the chainId configuration entry as type Hex rather than decimal string
    • The token list controller now expects the chainId constructor parameter as type Hex rather than decimal string
    • The token list controller state property tokensChainsCache is now keyed by Hex chain ID rather than by decimal string chain ID.
      • This requires a state migration
    • The token rates controller now expects the chainId configuration entry and constructor parameter as type Hex rather than decimal string
    • The token rates controller chainId setter now expects the chain ID as Hex rather than as a decimal string
    • The tokens controller now expects the chainId configuration entry and constructor parameter as type Hex rather than decimal string
    • The tokens controller addDetectedTokens method now accepts the chainId property of the detectionDetails parameter to be of type Hex rather than decimal string.
    • The tokens controller state properties allTokens, allIgnoredTokens, and allDetectedTokens are now keyed by chain ID in Hex format rather than decimal string.
      • This requires a state migration
  • BREAKING: Use approval controller for suggested assets (#1261, #1268)
    • The actions ApprovalController:acceptRequest and ApprovalController:rejectRequest are no longer required by the token controller messenger.
    • The suggestedAssets state has been removed, which means that suggested assets are no longer persisted in state
    • The return type for watchAsset has changed. It now returns a Promise that settles after the request has been confirmed or rejected.
  • BREAKING: Initialize controllers with the current network (#1361)
    • The following controllers now have a new chainId required constructor parameter:
      • AssetsContractController
      • NftController
      • NftDetectionController
      • TokenRatesController
      • TokensController
  • BREAKING: The token list controller messenger requires the NetworkController:stateChange event instead of the NetworkController:providerConfigChange event (#1329)
  • BREAKING: The token list controller onNetworkStateChange option now has a more restrictive type (#1329)
    • The event handler parameter type has been changed from NetworkState | ProviderConfig to NetworkState
  • BREAKING: Update the account tracker controller provider type (#1266)
    • The provider setter and the provider config entry now use our Provider type from eth-query rather than any
  • BREAKING: Update@metamask/preferences-controller dependency and add it as a peer dependency (#1393)
  • BREAKING: Update @metamask/approval-controller and @metamask/network-controller dependencies and peer dependencies
  • Bump @metamask/abi-utils from 1.1.0 to 1.2.0 (#1287)
  • Bump @metamask/utils from 5.0.1 to 5.0.2 (#1271)

Removed

  • BREAKING: Remove the networkType configuration option from the NFT detection controller, NFT controller, and tokens controller (#1360, #1359)
  • BREAKING: Remove the SuggestedAssetMeta and SuggestedAssetMetaBase types from the token controller (#1268)
  • BREAKING: Remove the acceptWatchAsset and rejectWatchAsset methods from the token controller (#1268)
    • Suggested assets can be accepted or rejected using the approval controller instead

@metamask/base-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • Replace @metamask/controller-utils dependency with @metamask/utils (#1370)

@metamask/composable-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)

@metamask/controller-utils

Added

  • Add constants BuiltInNetwork and ChainId (#1354)
  • Add Aurora network to the ChainId constant (#1327)
  • Add InfuraNetworkType enum (#1264)

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: The isSafeChainId chain ID parameter is now type Hex rather than number (#1367)
  • BREAKING: The ChainId enum and the GANACHE_CHAIN_ID constant are now formatted as 0x-prefixed hex strings rather than as decimal strings. (#1367)
  • The query function has improved type checks for the ethQuery argument (#1266)
    • This type change could be breaking, but only if you were passing in an invalid ethQuery parameter. In that circumstance this would have thrown an error at runtime anyway. Effectively this should be non-breaking for any usage that isn't already broken.
  • Bump @metamask/utils from 5.0.1 to 5.0.2 (#1271)

Removed

  • BREAKING: Remove Json type (#1370)
  • BREAKING: Remove NetworksChainId constant (#1354)
    • Use the new ChainId constant or the pre-existing NetworkId constant instead
  • BREAKING: Remove localhost network (#1313)
    • Remove the entry for localhost from BUILT_IN_NETWORKS, NetworkType, ChainId, and NetworksTicker
  • BREAKING: Remove hasProperty function (#1275)
    • Use the hasProperty function from @metamask/utils instead
  • BREAKING: Remove constants MAINNET and TESTNET_TICKER_SYMBOLS (#1132)
    • These were actually removed in v3.1.0, but are listed here again because that release (and the minor releases following it) have been deprecated due to the breaking change
    • We didn't discover this until many releases later, which is why this happened in a minor release

@metamask/ens-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: Add @metamask/network-controller as a dependency and peer dependency (#1367, #1362)
  • BREAKING: The ensEntries state property is now keyed by Hex chain ID rather than string, and the chainId property of each ENS entry is also Hex rather than string. (#1367)
    • This requires a state migration
  • BREAKING: The methods get, set, and delete have been updated to accept and return chain IDs as 0x-prefixed hex strings, rather than decimal strings. (#1367)
  • Bump @metamask/utils from 5.0.1 to 5.0.2 (#1271)

Fixed

  • Fix ENS controller failure to initialize after switching networks (#1362)

@metamask/gas-fee-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: The getChainId constructor parameter now expects a Hex return type rather than a decimal string (#1367)
  • Add @metamask/utils dependency
  • BREAKING: The gas fee controller messenger now requires the NetworkController:stateChange event instead of the NetworkController:providerConfigChange event (#1329)
  • BREAKING: Update @metamask/network-controller dependency and peer dependency

@metamask/keyring-controller

Added

  • Add support for encryption keys (#1342)
    • The configuration option cacheEncryptionKey has been added, along with two new state properties (encryptionKey and encryptionSalt) and a new method (submitEncryptionKey)
    • All new state and config entries are optional, so this will have no effect if you're not using this feature.
  • Make addNewAccount idempotent (#1298)
    • The addNewAccount method now takes an optional accountCount parameter. If provided, we ensure that this can be called repeatedly with the same result.
  • Add deprecated getKeyringForAccount and getKeyringsByType methods (#1376, #1386)

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: Change return type of createNewVaultAndRestore from string | number[] to Uint8Array (#1349)
  • BREAKING: Change return type of verifySeedPhrase from string to Uint8Array (#1338)
  • BREAKING: Replace validatePassword with verifyPassword (#1348)
    • verifyPassword is asynchronous, unlike validatePassword which was not.
    • verifyPassword does not return a boolean to indicate whether the password is valid. Instead an error is thrown when it's invalid.
  • BREAKING: createNewVaultAndKeychain will now skip vault creation if one already exists, rather than replacing it (#1324)
    • If you do want to replace a vault if one exists, you will have to remove it first before this is called.
  • BREAKING: importAccountWithStrategy and addNewAccount no longer update the selected address (#1296, #1309)
    • If you want the newly imported account to be selected, you will have to do that manually after this is called.
  • BREAKING: Change importAccountWithStrategy return type (#1295)
    • importAccountWithStrategy now returns an object with keyringState and importedAccountAddress, rather than just the keyring state.
  • BREAKING: Change addNewAccount return type (#1294)
    • addNewAccount now returns an object with keyringState and addedAccountAddress, rather than just the keyring state.
  • BREAKING: Add @metamask/preferences-controller peer dependency (#1393)
  • Bump @metamask/eth-keyring-controller from 10.0.0 to 10.0.1 (#1280)
  • Bump @metamask/eth-sig-util from 5.0.2 to 5.0.3 (#1278)
  • Update @metamask/preferences-controller dependency

Fixed

  • Improve validation of from address in signTypedMessage (#1293)
  • Improve private key validation in importAccountWithStrategy (#1297)
    • A more helpful error is now thrown when the given private key has the wrong length
  • Keep vault state in sync with the internal EthKeyringController vault state (#1384)
    • Previously the vault state would never be updated after construction, becoming stale as account changes were made
    • The old behavior was especially confusing because the subscribe method is overridden to return state change events from the internal EthKeyingController state, resulting in state change events being out of sync with controller state. They should be the same now.

@metamask/message-manager

Added

  • Add getAllMessages and setMetadata methods to message managers (#1364)
    • A new optional metadata property has been added to the message type as well
  • Add support for deferred signing (#1364)
    • deferSetAsSigned has been added as a message parameter. This is used to tell the signature controller to not mark this message as signed when the keyring is asked to sign it.
  • Add the setMessageStatusInProgress method to set a message status to inProgress (#1339)

Changed

  • BREAKING: The getCurrentChainId constructor parameter for each message manager now expects a Hex return type rather than a decimal string (#1367)
    • Note that while every message manager class accepts this as a constructor parameter, it's only used by the TypedMessageManager at the moment
  • Add @metamask/utils dependency (#1370)

@metamask/network-controller

Added

  • The events networkWillChange and networkDidChange are emitted during setProviderType, setActiveNetwork, resetConnection, and rollbackToPreviousProvider (#1336)
    • The networkWillChange event is emitted before the network is switched (before the network status is cleared),
    • The networkDidChange event is emitted after the new provider is setup (but before it has finished initializing).
  • Add destroy method (#1330)
  • Add events infuraIsBlocked and infuraIsUnblocked (#1264)
  • Add NetworkController:getState action constant (#1329)

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: The providerConfig type and state property have changed. The chainId property is now Hex rather than a decimal string (#1367)
    • This requires a state migration
    • This affects the return value of the NetworkController:getProviderConfig and NetworkController:getState actions.
  • BREAKING: The NetworkConfiguration type and the networkConfigurations state property have changed. The chainId property on each configuration is now Hex rather than a decimal string. (#1367)
    • This requires a state migration
    • This change affects the upsertNetworkConfiguration method, which takes a network configuration as the first parameter
    • This affects the return value of the NetworkController:getState action
  • Allow overlapping lookupNetwork calls (#1375)
    • lookupNetwork no longer uses a mutex, meaning that a lookup can be initiated before the previous one has finished. This allows for faster network switching
    • When there is an overlap in lookupNetwork calls, the older one is aborted before events are emitted and before state changes
  • BREAKING: Change networkDetails format (#1326)
    • Previously networkDetails was { isEIP1559Compatible: boolean }, now it is { EIPS: { [eipNumber: number]: boolean } }
  • BREAKING: Update NetworkController to use a simpler middleware stack derived from pieces of eth-json-rpc-middleware instead of web3-provider-engine (#1116)
    • A call to eth_chainId on a custom network will now return the chainId in the provider config rather than the chain ID returned by the network.
    • A call to eth_chainId on a built-in Infura network will now return a hard-coded chain ID rather than the chain ID returned by the network.
    • A call to net_version on a built-in Infura network will now return a hard-coded network ID rather than the network ID returned by the network.
    • Previously, RPC requests with an object as the first parameter (e.g. eth_call) were "sanitized" (i.e. unknown properties were removed from this first parameter, and any hex strings were normalized). This no longer happens. Instead these requests will pass through to the network unchanged.
    • A call to eth_getBalance, eth_getBlockByNumber, eth_getCode, eth_getTransactionCount, or eth_call will now be intercepted such that a block tag parameter of "latest" will be replaced with the latest known block number before being passed to the network.
      • This substitution makes it more likely that we can return a cached response to the request.
    • Previously, a eth_getTransactionCount request with a block tag of "pending" would be intercepted and given a result from our nonce cache (if the cache was populated for the given address). This nonce cache was updated upon each call to eth_sendRawTransaction based on the nonce of the transaction being sent. The whole nonce cache was also cleared upon a call to evm_revert. This no longer happens, and these RPC methods will be passed to the network unchanged.
      • If you were using this to get a suggested next nonce, you can instead use the nonceTracker that @metamask/transaction-controller exposes
    • A call to web3_clientVersion is no longer intercepted to return a static result of "ProviderEngine/v<version>/javascript"
    • A call to net_listening is no longer intercepted to return a static result of true
    • A call to eth_hashrate is no longer intercepted to return a static result of "0x00"
    • A call to eth_mining is no longer intercepted to return a static result of false
    • Previously, eth_subscribe and eth_unsubscribe would never hit the network; instead, the behavior was polyfilled by polling the network for new blocks. Additionally, the newPendingTransactions parameter for eth_subscribe was unsupported. This polyfill is no longer present, and eth_subscribe and eth_unsubscribe are passed through to the network unchanged.
      • Consumers wishing to recreate the prior behavior and use the block tracker to power subscriptions may employ the middleware provided by the eth-json-rpc-filters package.
    • Previously, eth_newFilter, eth_newBlockFilter, eth_newPendingTransactionFilter, eth_uninstallFilter, eth_getFilterChanges, and eth_getFilterLogs would never hit the network; instead, the behavior was polyfilled by polling the network for new blocks and recording updates for registered filters. This polyfill is no longer present, and these RPC methods are passed through to the network unchanged.
      • Consumers wishing to recreate the prior behavior and use the block tracker to power filters may employ the middleware provided by the eth-json-rpc-filters package.
    • Interfacing with a network that exposes a websocket is no longer supported.
  • BREAKING: The methods initializeProvider, setActiveNetwork, and resetConnection will now throw if the provider config is of type rpc but is missing an RPC URL or a chain ID. (#1316)
    • Previously the chain ID was not required to setup the provider.
    • Previously if the RPC URL was omitted, no error would be thrown but the provider would not be setup.
  • BREAKING: The method setProviderType will now throw when passed the type rpc. (#1316)
    • Previously no error would be thrown but the provider would not be setup.
  • BREAKING: Update type of blockTracker property exposed by getProviderAndBlockTracker from any to SwappableProxy<PollingBlockTracker> (#1303)
  • BREAKING: Rename provider configuration property rpcTarget to rpcUrl (#1292)
  • BREAKING: The network status will now be "blocked" rather than "unavailable" when the user is blocked by Infura (#1264)
  • BREAKING: The infuraProjectId constructor parameter is now required (#1276)
  • BREAKING: The exported Provider type has been updated to better reflect the provider type returned by the network controller (#1266)
    • Previously this was set to any. Now it returns a type that mostly matches the provider returned (some semi-internal properties are omitted)
    • This affects the exported ProviderProxy type as well, which wraps the Provider type
  • Support hex and number net_version responses (#1380)
  • Bump @metamask/utils from 5.0.1 to 5.0.2 (#1271)
  • Bump dependency eth-json-rpc-infura (now @metamask/eth-json-rpc-infura) from ^7.0.0 to ^8.0.0. (#1116)
  • Add dependency eth-json-rpc-middleware ^11.0.0 (#1116)
  • Add dependency eth-json-rpc-provider ^1.0.0 (#1116)
  • Add dependency eth-block-tracker ^7.0.0 (#1116)
  • Add dependency json-rpc-engine ^6.1.0 (#1116)

Removed

  • BREAKING: Remove providerConfigChange event (#1329)
    • Consumers are encouraged to subscribe to NetworkController:stateChange with a selector function that returns providerConfig if they want to perform an action when providerConfig changes.
  • BREAKING: The built-in "localhost" network has been removed (#1313)

Fixed

  • Update network details in lookupNetwork even when network ID is unchanged (#1379)
  • Fix error when rollbackToPreviousProvider is called when the previous network is a custom network with a missing or invalid id (#1223)
    • In that situation, rollbackToPreviousProvider used to throw an error. Now it correctly rolls back instead.

@metamask/notification-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • Add @metamask/utils dependency (#1275)

@metamask/permission-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: Update @metamask/approval-controller dependency and peer dependency
  • The export permissionRpcMethods has a slightly different type; the second generic type variable of the getPermissions handler is now undefined rather than void (#1372)
  • Add @metamask/utils dependency (#1275)
  • Remove @metamask/types dependency (#1372)
  • Change type of constructor parameter unrestrictedMethods to be readonly (#1395)

Removed

  • BREAKING: Remove namespaced permissions (#1337)
    • Namespaced permissions are no longer supported. Consumers should replace namespaced permissions with equivalent caveat-based implementations.
  • BREAKING: Remove targetKey concept (#1337)
    • The target key/name distinction only existed to support namespaced permissions, which are removed as of this release. Henceforth, permissions only have "names".
    • The targetKey property of permission specifications has been renamed to targetName.

@metamask/phishing-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)

@metamask/preferences-controller

Changed

  • BREAKING: Bump to Node 16 (#1262)

@metamask/rate-limit-controller

Changed

  • BREAKING: Allow RateLimitController to define a rate-limit per method (#1355)
    • The constructor implementations option now maps API names to objects with a method property, rather than mapping to a function. This object may also have rateLimitCount and rateLimitTimeout properties, allowing custom rate limits for that method.
  • BREAKING: Bump to Node 16 (#1262)

@metamask/signature-controller

Added

  • Add support for deferred signing (#1364)
    • If the parameter deferSetAsSigned is set, the message won't be set as signed when the keyring is asked to sign it
  • Emit the event ${methodName}:signed when the keying is asked to sign a message (#1364)
  • Add methods setTypedMessageInProgress and setPersonalMessageInProgress to set a message status to inProgress (#1339)

Changed

  • BREAKING: The constructor option getCurrentChainId now expects a Hex return value rather than string (#1367)
  • BREAKING: Update @metamask/approval-controller dependency and add it as a peer dependency (#1393)
  • Add @metamask/utils dependency (#1367)

@metamask/transaction-controller

Added

  • Update transaction controller to automatically initiate, finalize, and cancel approval requests as transactions move through states (#1241)
    • The ApprovalController:addRequest action will be called when a new transaction is initiated
    • The ApprovalController:rejectRequest action will be called if a transaction fails
    • The ApprovalController:acceptRequest action will be called when a transaction is approved

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: Update @metamask/network-controller dependency and peer dependency (#1367)
    • This affects the getNetworkState and onNetworkStateChange constructor parameters
  • BREAKING: Change format of chain ID in state to Hex (#1367)
    • The chainId property of the Transaction type has been changed from number to Hex
    • The chainId property of the TransactionMeta type has been changed from a decimal string to Hex, and the transaction property has been updated along with the Transaction type (as described above).
    • The state property transactions is an array of TransactionMeta objects, so it has changed according to the description above.
      • This requires a state migration: each entry should have the chainId property converted from a decimal string to Hex, and the transaction.chainId property changed from number to Hex.
    • The addTransaction and estimateGas methods now expect the first parameter (transaction) to use type Hex for the chainId property.
    • The updateTransaction method now expects the transactionMeta parameter to use type Hex for the chainId property (and for the nested transaction.chainId property)
  • BREAKING: Add messenger as required constructor parameter (#1241)
  • BREAKING: Add @metamask/approval-controller as a dependency and peer dependency (#1241, #1393)
  • Add @metamask/utils dependency (#1367)

Fixed

  • Fix inaccurate hard-coded chainId on incoming token transactions (#1366)