Skip to content

Commit

Permalink
Fix: Correct payee (#2759)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuul-wq authored Nov 29, 2024
1 parent 669b76f commit 1583fa4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export const Confirmation = ({
</DetailRow>

<hr className="w-full border-filter-border pr-2" />

<DetailRow label={t('staking.confirmation.rewardsDestinationLabel')}>
{confirmStore.destination ? (
<Account accountId={toAccountId(confirmStore.destination)} chain={confirmStore.chain} variant="short" />
Expand Down
8 changes: 5 additions & 3 deletions src/renderer/pages/Operations/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ export const getDestination = (
export const getPayee = (tx: MultisigTransaction): { Account: Address } | string | undefined => {
if (!tx.transaction) return undefined;

if (isProxyTransaction(tx.transaction)) {
return tx.transaction.args.transaction.args.payee;
const args = isProxyTransaction(tx.transaction) ? tx.transaction.args.transaction.args : tx.transaction.args;

if (tx.transaction.type === TransactionType.BATCH_ALL) {
return args.transactions.at(0).args.payee;
}

return tx.transaction.args.payee;
return args.payee;
};

export const getDelegate = (tx: MultisigTransaction): Address | undefined => {
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/pages/Operations/components/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ export const Details = ({ tx, account, extendedChain, signatory }: Props) => {
{payee && (
<DetailRow
label={t('operation.details.payee')}
className={typeof payee === 'string' ? 'pr-0' : 'text-text-secondary'}
className={cnTw('text-text-secondary', { 'pr-0': typeof payee === 'string' })}
>
{typeof payee === 'string' ? (
payee
t('staking.confirmation.restakeRewards')
) : (
<AddressWithExplorers
explorers={explorers}
Expand Down Expand Up @@ -411,7 +411,7 @@ export const Details = ({ tx, account, extendedChain, signatory }: Props) => {
value={delegationVotes}
asset={defaultAsset}
showSymbol={false}
></AssetBalance>
/>
</FootnoteText>
</DetailRow>
)}
Expand All @@ -424,7 +424,7 @@ export const Details = ({ tx, account, extendedChain, signatory }: Props) => {
value={undelegationVotes}
asset={defaultAsset}
showSymbol={false}
></AssetBalance>
/>
</FootnoteText>
</DetailRow>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,12 @@ export const OperationCardDetails = ({ tx, account, extendedChain }: Props) => {
)}

{payee && (
<DetailRow label={t('operation.details.payee')} className={valueClass}>
<DetailRow
label={t('operation.details.payee')}
className={cnTw(valueClass, { 'pr-0': typeof payee === 'string' })}
>
{typeof payee === 'string' ? (
payee
t('staking.confirmation.restakeRewards')
) : (
<AddressWithExplorers
type="short"
Expand Down

0 comments on commit 1583fa4

Please sign in to comment.