-
Notifications
You must be signed in to change notification settings - Fork 258
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
Jon/fix/earn-2 #5370
base: develop
Are you sure you want to change the base?
Jon/fix/earn-2 #5370
Conversation
Specifically for wallets created from this scene
From Discover tab only, in case they have an open stake position already.
6c53cf9
to
61797c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bug introduced with parallelizing fetchStakePosition calls where the discover cards aren't shown until all of the stake positions are fetched. If you separate the discover cards from the portfolio cards then you could generate the discover cards very quickly and then loop over the fetchStakePosition promises in batches or whatever. To get the cards quickly
const [stakePlugins, setStakePlugins] = React.useState<StakePlugin[]>(() => [])
useAsyncEffect(
async () => {
const out = []
for (const pluginId of Object.keys(currencyConfigMap)) {
const moarPlugins = await getStakePlugins(pluginId)
out.push(...moarPlugins)
}
setStakePlugins(out)
},
[],
'EarnScene Initialize Stake Plugins'
)
For the discover card list, loop over these stake plugins and call getPolicies. For portfolio card list, loop over these stake plugins and call getPolicies with the wallet as part of the filter and then do the work to call fetchStakePosition.
d4987d5
to
21ec4f7
Compare
21ec4f7
to
f8aa16e
Compare
|
||
const renderPortfolioItem = (portfolioStakeInfo: PortfolioStakeInfo, currencyInfo: EdgeCurrencyInfo) => { | ||
const { stakePlugin, stakePolicy, walletStakeInfos } = portfolioStakeInfo | ||
|
||
const handlePress = async () => { | ||
let walletId: string | undefined | ||
let stakePosition | ||
|
||
const matchingWallets = wallets.filter((wallet: EdgeCurrencyWallet) => wallet.currencyInfo.pluginId === currencyInfo.pluginId) | ||
if (matchingWallets.length === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last tiny change then we should get this back in QAs hands: we don't need to look at matchingWallets in renderPortfolioItem since we already have walletStakeInfos. Remove matchingWallets and replace the length check with walletStakeInfos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember doing this intentionally for new positions from new wallets but I will have to check what the exact situation was and if it's still applicable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, assuming the last requested change is made
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have: