Open
Conversation
We want to fetch the owner stakes only once so the best place for fetching this data is one-shot listener effect.
We should register listener in different file than the one in which it is defined otherwise we may run into an issue with webpack import orddering. Here we create a common function that should register all listeners and we call this fn after creating a store and after resetting the store.
Use the `Stake` type from the threshold ts lib- this removes the `preConfig` filed from the `StakeData` type. The PRE is a staking app so should be stored in a dedicated slice(rewards). We are going to add the PRE app to the rewards slice in a follow-up work.
The PRE is a seprate app so should be stored in the `staking-apps` slice not as a part of the stake data.
|
Preview uploaded to https://preview.dashboard.test.threshold.network/staking-threshold-lib/index.html. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on: #300
This PR moves the contract integration part from hooks to the Threshold-ts library. Thanks to this layer we can separate work between UI and contract integration. Also, it helps to unit test created services and move the "business logic" from the React hooks.
Main changes
Staking in Threshold-ts lib
IApplicaitoninterface and doesn't require authorization- in that case, the PRE app doesn't implement a common interfaceIApplicationin typescript library. Probably in the future we should keep one common interface that every app should implement.React
fetching this data is a one-shot listener and an effect callback will be run on
walletConnectedaction.preConfigfield- the PRE is a separate staking app so we should store it in thestaking-applicationslice.staking-applicationslice- stores the PRE data per staking provider in the same way as forrandom-beaconandecdsaapps. Fetches this data in listener middleware.