-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
feat(suite): solana staking transactions #16388
base: develop
Are you sure you want to change the base?
feat(suite): solana staking transactions #16388
Conversation
@@ -36,6 +36,7 @@ export const SYSTEM_PROGRAM_PUBLIC_KEY = '11111111111111111111111111111111'; | |||
// WSOL transfers are denoted as transfers of SOL as well as WSOL, so we use this to filter out SOL values | |||
// when parsing tx effects. | |||
export const WSOL_MINT = 'So11111111111111111111111111111111111111112'; | |||
export const STAKE_PROGRAM_ID = 'Stake11111111111111111111111111111111111111'; |
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.
export const STAKE_PROGRAM_ID = 'Stake11111111111111111111111111111111111111'; | |
export const STAKE_PROGRAM_PUBLIC_KEY = 'Stake11111111111111111111111111111111111111'; |
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.
done, 24fecad
const getSolTransactionStakeTypeName = (stakeType: StakeType) => { | ||
switch (stakeType) { | ||
case 'stake': | ||
return 'Stake'; |
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.
possibly use localised strings?
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.
It would probably be good but I don't know if we want to translate it 😀
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.
We don't use translations for this on Ethereum, which is why I didn't localize them.
@@ -65,8 +85,7 @@ export const SolStakingDashboard = ({ selectedAccount }: SolStakingDashboardProp | |||
/> | |||
</Column> | |||
</DashboardSection> | |||
{/* TODO: implement Transactions component */} | |||
{/* <Transactions /> */} | |||
<Transactions /> |
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.
Remove please
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.
removed 3d2878f
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
if (accountKey) { | ||
dispatch( | ||
fetchAllTransactionsForAccountThunk({ | ||
accountKey, | ||
noLoading: true, | ||
}), | ||
); | ||
} | ||
}, [account, accountKey, dispatch]); |
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.
remove please
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.
same here 3d2878f
const getSolTransactionStakeTypeName = (stakeType: StakeType) => { | ||
switch (stakeType) { | ||
case 'stake': | ||
return 'Stake'; |
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.
It would probably be good but I don't know if we want to translate it 😀
const showFeeRowForSolClaim = transaction?.solanaSpecific?.stakeType === 'claim'; | ||
const showFeeRow = isTxFeePaid(transaction) || showFeeRowForSolClaim; |
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.
is it needed? if yes can you move the logic into isTxFeePaid
?
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 think it's needed. Otherwise, the claim has no fee row. Moved to isTxFeePaid 3d2878f
<Row gap={spacings.xxs} overflow="hidden"> | ||
<span>{getSolTransactionStakeTypeName(solanaStakeType)}</span> | ||
{isSupportedSolStakingNetworkSymbol(transaction.symbol) && | ||
solanaStakeType === 'unstake' && ( |
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.
reuse UnstakingTxAmount
?
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.
done, 3d2878f
// hide amount for solana unstake transactions | ||
if (transaction?.solanaSpecific?.stakeType === 'unstake') { | ||
amount = null; | ||
} |
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.
how is it done for Ethereum?
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.
on Ethereum, the amount for an unstake transaction is always 0, while for Solana, it is non-zero.
if (type === 'delegate') return 'stake'; | ||
if (type === 'deactivate') return 'unstake'; | ||
if (type === 'withdraw') return 'claim'; |
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.
can those type
s be used also for different purposes than stake? @vytick
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.
Yes, but it depends on the referenced program to determine what are the types and what those mean.
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.
So is this decoding ok or not?
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.
Can there be some false positives?
c16ba49
to
22753f5
Compare
Description
This PR adds support for processing Solana staking transactions. It includes:
Related Issue
Resolve
Screenshots: