-
-
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?
Changes from all commits
3b7ac0e
22753f5
24fecad
3d2878f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { getTxHeaderSymbol, isSupportedEthStakingNetworkSymbol } from '@suite-common/wallet-utils'; | ||
import { | ||
getTxHeaderSymbol, | ||
isSupportedEthStakingNetworkSymbol, | ||
isSupportedSolStakingNetworkSymbol, | ||
} from '@suite-common/wallet-utils'; | ||
import { AccountTransaction } from '@trezor/connect'; | ||
import { Row } from '@trezor/components'; | ||
import { spacings } from '@trezor/theme'; | ||
import { getNetworkDisplaySymbol, isNetworkSymbol } from '@suite-common/wallet-config'; | ||
import { StakeType } from '@suite-common/wallet-types'; | ||
|
||
import { useTranslation } from 'src/hooks/suite'; | ||
import { WalletAccountTransaction } from 'src/types/wallet'; | ||
|
@@ -65,6 +70,17 @@ const getTransactionMessageId = ({ transaction, isPending }: GetTransactionMessa | |
} | ||
}; | ||
|
||
const getSolTransactionStakeTypeName = (stakeType: StakeType) => { | ||
switch (stakeType) { | ||
case 'stake': | ||
return 'Stake'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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. |
||
case 'unstake': | ||
return 'Unstake'; | ||
case 'claim': | ||
return 'Claim Withdraw Request'; | ||
} | ||
}; | ||
|
||
export const TransactionHeader = ({ transaction, isPending }: TransactionHeaderProps) => { | ||
const { translationString } = useTranslation(); | ||
|
||
|
@@ -78,6 +94,17 @@ export const TransactionHeader = ({ transaction, isPending }: TransactionHeaderP | |
</Row> | ||
); | ||
} | ||
const solanaStakeType = transaction?.solanaSpecific?.stakeType; | ||
if (solanaStakeType) { | ||
return ( | ||
<Row gap={spacings.xxs} overflow="hidden"> | ||
<span>{getSolTransactionStakeTypeName(solanaStakeType)}</span> | ||
{isSupportedSolStakingNetworkSymbol(transaction.symbol) && ( | ||
<UnstakingTxAmount transaction={transaction} /> | ||
)} | ||
</Row> | ||
); | ||
} | ||
|
||
const isMultiTokenTransaction = transaction.tokens.length > 1; | ||
const transactionSymbol = getTxHeaderSymbol(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.
can those
type
s be used also for different purposes than stake? @vytickThere 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.