Skip to content
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

Staking and unstaking flow #1

Merged
merged 5 commits into from
Apr 13, 2022
Merged

Staking and unstaking flow #1

merged 5 commits into from
Apr 13, 2022

Conversation

gchatz22
Copy link
Member

No description provided.

@linear
Copy link

linear bot commented Apr 11, 2022

@vercel
Copy link

vercel bot commented Apr 11, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/cardinal-labs/cardinal-staking-ui/EbhPuwZGwcAhsbhXfAysF5Yab5vp
✅ Preview: Failed

[Deployment for c85ebeb failed]

pages/index.tsx Outdated Show resolved Hide resolved
pages/index.tsx Outdated
Comment on lines 91 to 95
const transaction = await unstake(connection, wallet as Wallet, {
stakePoolId: STAKE_POOL_ID,
originalMintId: token.stakeEntry.parsed.originalMint,
})
await executeTransaction(connection, wallet as Wallet, transaction, {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could maybe try having like a batchSize of a few (like 4 would probably work) and then using withUnstake to add them to a single transaction and do those in batches of 4

useEffect(() => {
const interval = setInterval(
(function getTokenAccountsInterval(): () => void {
refreshTokenAccounts()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to refreshStakedTokens

Comment on lines 48 to 61
getStakeEntryDatas(connection, new PublicKey(stakedAddress))
.then((tokenDatas) => {
let tokensWithMetadata = tokenDatas.filter((td) => td.metadata)
// tokensWithMetadata = filterTokens(config.filters, tokensWithMetadata)
setStakedTokenDatas(tokensWithMetadata)
})
.catch((e) => {
console.log(e)
setError(`${e}`)
})
.finally(() => {
setStakedLoaded(true)
setStakedRefreshing(false)
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason this function isnt async and using await rather than .then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants