-
Notifications
You must be signed in to change notification settings - Fork 149
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/cardinal-labs/cardinal-staking-ui/EbhPuwZGwcAhsbhXfAysF5Yab5vp [Deployment for c85ebeb failed] |
pages/index.tsx
Outdated
const transaction = await unstake(connection, wallet as Wallet, { | ||
stakePoolId: STAKE_POOL_ID, | ||
originalMintId: token.stakeEntry.parsed.originalMint, | ||
}) | ||
await executeTransaction(connection, wallet as Wallet, transaction, {}) |
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.
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() |
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.
rename to refreshStakedTokens
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) | ||
}) |
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.
any reason this function isnt async
and using await
rather than .then
No description provided.