Open desi opened 8 months ago
To implement this ticket, it seems that we would want to:
FetchTradesInfoParamsMetadata
type to replace chainId
with networkClientId
(NOTE: this will be a breaking change because this is stored in state)SwapsControllerOptions
type to remove provider
optionopts.provider
, this.#provider
, this.#ethersProvider
and this.#ethersProviderChainId
fetchAndSetQuotes
:
chainId
parameter with a networkClientId
parameterNetworkController:getNetworkClientById
to fetch the network client from the ID_getERC20Allowance
_setSwapsNetworkConfig
#ethersProvider
and #ethersProviderChainId
getTopQuoteWithCalculatedSavings
:
networkClientId
in an options bagNetworkController:getNetworkClientById
to fetch the network client from the ID, then get the chain ID from the network client's configurationnetworkClientId
to this.#getEIP1559GasFeeEstimates
networkClientId
(and maybe still chainId
?) to #getLayer1GasFee
getEIP1559GasFeeEstimates
and getLayer1GasFee
arguments to accept a networkClientId
option in an options bag_getERC20Allowance
to take a network client; create an Ethers provider on the fly before passing along to Ethers' Contract class_setSwapsNetworkConfig
to take a chain ID rather than inferring it#ethersProvider
and #ethersProviderChainId
properties_getCurrentChainId
methodwithController
helper for this controller and convert tests to use it as neededmessengerMock
to add new NetworkController:getNetworkClientById
as needed (might need to copy mockGetNetworkClientById
helper from core
?)I am going to have to revisit this to ensure that the controller is fully multichain-compatible.
I have not updated the estimate, just noting a change in scope here. I may create a new ticket to capture this work but I will talk to the team tomorrow about it.
I have asked the Swaps team whether all of what I wrote above would be necessary to complete this ticket. Waiting to hear back before continuing.
Confirmed in standup today that we do need to support polling for simultaneous networks, and we are okay with overwriting state data when switching networks.
What is this about?
Make SwapsController support multichain.
The swaps controller currently relies upon the "globally selected network". It should be refactored such that each chain interaction is made by methods that include a networkClientId parameter, which determines which network client/chain is used.
Scenario
No response
Design
No response
Technical Details
N/A
Threat Modeling Framework
N/A
Acceptance Criteria
networkClientId
.Stakeholder review needed before the work gets merged
References
No response