Skip to content

Commit

Permalink
Merge branch 'develop' into fix/remove-scroll-to-bottom-transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistevam authored Oct 21, 2024
2 parents e2e346a + 81f4678 commit 35c228a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@ import { DecodedTransactionDataResponse } from '../../../../../../../shared/type
import { useConfirmContext } from '../../../../context/confirm';
import { hasTransactionData } from '../../../../../../../shared/modules/transaction.utils';

export function useDecodedTransactionData(): AsyncResult<
DecodedTransactionDataResponse | undefined
> {
export function useDecodedTransactionData(
transactionTypeFilter?: string,
): AsyncResult<DecodedTransactionDataResponse | undefined> {
const { currentConfirmation } = useConfirmContext<TransactionMeta>();

const currentTransactionType = currentConfirmation?.type;
const chainId = currentConfirmation?.chainId as Hex;
const contractAddress = currentConfirmation?.txParams?.to as Hex;
const transactionData = currentConfirmation?.txParams?.data as Hex;
const transactionTo = currentConfirmation?.txParams?.to as Hex;

return useAsyncResult(async () => {
if (!hasTransactionData(transactionData) || !transactionTo) {
if (
!hasTransactionData(transactionData) ||
!transactionTo ||
(transactionTypeFilter &&
currentTransactionType !== transactionTypeFilter)
) {
return undefined;
}

Expand Down
5 changes: 3 additions & 2 deletions ui/pages/confirmations/components/confirm/title/title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,12 @@ const ConfirmTitle: React.FC = memo(() => {

let isRevokeSetApprovalForAll = false;
let revokePending = false;
const decodedResponse = useDecodedTransactionData(
TransactionType.tokenMethodSetApprovalForAll,
);
if (
currentConfirmation?.type === TransactionType.tokenMethodSetApprovalForAll
) {
const decodedResponse = useDecodedTransactionData();

isRevokeSetApprovalForAll = getIsRevokeSetApprovalForAll(
decodedResponse.value,
);
Expand Down

0 comments on commit 35c228a

Please sign in to comment.