-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/dapp refactor ethereum provider #2702
Feature/dapp refactor ethereum provider #2702
Commits on May 5, 2021
-
dapp: remove connect dialog and first time connect
The connect dialog does nothing anymore. It shows the first time the user connects and has the configuration option to use a subkey (which defaults to true). Besides that is just delays the connection. Also it does not add any valid information in terms of that the subkey gets regenerated each time the user connects anyways. But after all the major reason to get rid of this stuff is because of the upcoming connection manager. Thereby it will become obsolete anyway. With this step to remove it, it helps to clean the code a little to provide a more flat basement to draft on.
Configuration menu - View commit details
-
Copy full SHA for 1e50b86 - Browse repository at this point
Copy the full SHA 1e50b86View commit details -
dapp: simplify connection status management
Due to multiple historic changes, the connection status got kinda complicated. This could be simplified by getting rid of the global loading state. Also is the status now directly part of the state and is no more a derived property. This simplified a few old test which haven't been refactored yet. In general it simplifies the usage/management and readability.
Configuration menu - View commit details
-
Copy full SHA for ca78978 - Browse repository at this point
Copy the full SHA ca78978View commit details -
dapp: remove unused no provider state
This must have been forgotten at some point in time.
Configuration menu - View commit details
-
Copy full SHA for e888f0b - Browse repository at this point
Copy the full SHA e888f0bView commit details -
dapp: make raiden service class more independent
The RaidenService class is closely tight to the Web3Provider and ConfigProvider classes. At best it should not even know those exist. Rather a higher level ("dirty") module should orchestrate the usage between them. This is important as in future there will be different provider options with according configurations. To loose the components, the RaidenService now takes all necessary values - including the ethereum provider instance - as parameters. It is now the Home view components job to get the provider and configuration to connect the SDK. Later it is possible to opt in as user to specify different providers and configurations with visual components.
Configuration menu - View commit details
-
Copy full SHA for 61e2bd6 - Browse repository at this point
Copy the full SHA 61e2bd6View commit details -
dapp: rename account parameter for raiden service
The whole usage of account, address, main, raiden-*, ... is quite confusing/inconsistent in the dApp. To keep the changes minimal for the moment, this just makes clear for this specific part what the parameter is actually about.
Configuration menu - View commit details
-
Copy full SHA for af11831 - Browse repository at this point
Copy the full SHA af11831View commit details -
dapp: add direct error handling for raiden service
The too complex RaidenService connect function gets more and more simplified and less tight to its environment. One part it still did was to evaluate different errors of the SDK and push error states to the Vuex store. There they got picked up by the Home view component which uses another component to translate and display them to the user. Futhermore the stores state got used for the condiational flow. This is completely over the top. The Home view component calls the RaidenService plugin directly. Thereby it can get errors directly and handle them directly. The whole detour is just not necessary. Moving the error handling directly into the caller is more naturual and heavily reduces the complexity of the whole information flow and the RaidenService class. Furthermore the translation of errors was kinda cumbersome as well. Plus is was hard to extend, especially for a more generic scenario not only for connecting. Therefore this got simplified as well, allwing to strip the whole NoAccessMessage component. In future extension it probably makes sense to have a small Vue plugin or a Mixin to map the error codes to translation keys at a single place.
Configuration menu - View commit details
-
Copy full SHA for fd5c709 - Browse repository at this point
Copy the full SHA fd5c709View commit details -
The dialog which handles the upload of a backup state got broken. This was causes by the recent changes of the RaidenService connect function. But actually the dialog must not call the connect function anyway. Rather the backup is stored into the Vuex store and there gets picked up by the next connection procedure. This was rather an uncontrolled behavior which eventually could cause bugs. Cleaning this up also removes the origin issue. Furthermore while working on this, I detected that the backup state never gets cleared from the store while the browser tab is active. This means is the user connects with a backup, then logs out and reconnets again, it would again use the backup state and overwrite any change that got applied in-between or causes a failure at the SDK. To fix this, the backup state gets cleared when the connection prodedure finishes.
Configuration menu - View commit details
-
Copy full SHA for c2b18e0 - Browse repository at this point
Copy the full SHA c2b18e0View commit details -
dapp: unify ethereum provider to json rpc provider
The custom EthereumProvider type was a tool to act between the type conjunction of the SDKs interface and the actual connection methods as used by the dApp. This could be simplified to make sure that all connection methods return an JsonRpcProvider. In fact the last not unified method was the String as direct URL of an Json RPC server. Within the SDK this is a one-liner to pack it into a JsonRpcProvider object. As it (heavily) simplifies the typing in the dApp it is good to just do the packing right here. This is especially attractive when having the planned connection manager in mind.
Configuration menu - View commit details
-
Copy full SHA for c8f3a23 - Browse repository at this point
Copy the full SHA c8f3a23View commit details
Commits on May 6, 2021
-
dapp: refactor web3 provider with new design
This commit does not add any new feature to the dApp, but refactors the design how the dApp gets an Ethereum connection and account to instantiate the SDK. This new approach has been developed to prepare the The new design introduces an abstract class which represents an Ethereum connection, holding the actual network/RPC provider and the account to use for signing. This abstract class gets them implemented by all the various connection methods the dApp provides. The intention is to have a nice and clean type system where the logic to instantiate the SDK and connect the dApp does not care about where the connection comes from, but just takes everything that implements this interface. Thereby the logic handling the connection process can be easily decoupled and stays static, no matter how many new connection methods get added or removed. Furthermore is must not care (not yet ready) about how the connections get configured. This allows the user to take interactively control over the configuration instead of a static file served by the web-server. After all, for the moment, the Home view component that handles the connection just gets a connection instance and passes its properties to the SDK. The selection and instantiation of the connection however is now done in the former components was well. This is the part that becomes replaced with the connection manager at a later point. Furthermore the does this approach improves the testability of the touched components. The connection process module is static and independently testable from the connection method. And each connection method can be tested individually. Mocking becomes (theoretically) easy. All by the bounding interface that tights everything together.
Configuration menu - View commit details
-
Copy full SHA for 589ba42 - Browse repository at this point
Copy the full SHA 589ba42View commit details