Closed paouvrard closed 3 years ago
I don't think that we need separate databases for accounts because the minter/unlocker doesn't need to be the recipient of a transfer, so this flexibility is good. I only see the edgecase where a user changes eth accounts between an approve and a lock: metamask will show an always failing tx before it is broadcasted so the user can check the sender account on the transfer information. Bridge instances will be separated by domain name, so each app can be identical which makes the app logic simpler as it doesn't require knowledge of different bridges.
I suggest we continue the discussion here https://github.com/near/rainbow-bridge-client/issues/6 as there are many things and UX to consider for supporting multiple bridges from the same dapp UI. This PR was improved to avoid false positive checkStatus errors which might happen when a transfer is in progress and the user changes eth network. Stopping checkStatusAll or checking the eth network at the beginning of a checkStatusAll call would not solve the issue as the eth network may still be changed. The new fix will skip the checkSync / checkUnlock / checkApprove / checkLock if the eth network is incorrect right after the web3 object is created.
Checking the status of a transfer must be done with the same Ethereum network for which that transfer was made i.e matching the bridge. Skip to the next loop until the provider chain id matches the expected chain id.