core icon indicating copy to clipboard operation
core copied to clipboard

QueuedRequestController: Fix list of methods that should have requests enqueued and/or switch the globally selected network

Open jiexi opened this issue 1 year ago • 0 comments

Explanation

Previously we were not properly enqueuing requests that could trigger a confirmation notification as well as not switching networks for methods that either require it or would exhibit unexpected UI/UX without doing so beforehand. This PR improves the specificity of which methods should be handled differently in the queued request flow which covers many methods not previously handled correctly.

References

See: https://github.com/MetaMask/metamask-extension/pull/22865#issuecomment-1996054533

Changelog

@metamask/queued-request-controller

  • FIXED: QueuedRequestMiddleware now enqueues the following methods that can trigger confirmations:
    • eth_sendTransaction
    • eth_sendRawTransaction
    • wallet_switchEthereumChain
    • wallet_addEthereumChain
    • wallet_watchAsset
    • eth_signTypedData_v4
    • personal_sign
    • wallet_requestPermissions
    • wallet_requestSnaps
    • wallet_snap
    • wallet_invokeSnap
    • eth_decrypt
    • eth_sign
    • eth_requestAccounts
    • eth_getEncryptionPublicKey
  • FIXED: QueuedRequestController.enqueueRequest() now ensures the globally selected network matches the dapp selected network before processing the following methods:
    • eth_sendTransaction
    • eth_sendRawTransaction
    • wallet_switchEthereumChain
    • wallet_addEthereumChain
    • wallet_watchAsset
    • eth_signTypedData_v4
    • personal_sign

Checklist

  • [x] I've updated the test suite for new or updated code as appropriate
  • [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate

jiexi avatar Mar 15 '24 21:03 jiexi