You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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)
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.
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
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)
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
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.
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
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
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).
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
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
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)
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.
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)
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.
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: 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)