Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VmMad committed Nov 28, 2024
1 parent 917b02a commit 012eb3b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function TransactionReceipt({

{unstakeTypeTransaction ? (
<UnstakeTransactionInfo
activeAddress={activeAddress}
event={unstakeTypeTransaction}
gasSummary={summary?.gas}
renderExplorerLink={renderExplorerLink}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import type { GasSummaryType, RenderExplorerLink, RenderValidatorLogo } from '..
import { useFormatCoin } from '../../../hooks';
import { Divider, KeyValueInfo, Panel } from '@iota/apps-ui-kit';
import { GasSummary } from '../../..';
import { useCurrentAccount } from '@iota/dapp-kit';

interface UnstakeTransactionInfoProps {
activeAddress: string | null;
event: IotaEvent;
gasSummary?: GasSummaryType;
renderValidatorLogo: RenderValidatorLogo;
renderExplorerLink: RenderExplorerLink;
}

export function UnstakeTransactionInfo({
activeAddress,
event,
gasSummary,
renderValidatorLogo: ValidatorLogo,
renderExplorerLink,
}: UnstakeTransactionInfoProps) {
const activeAddress = useCurrentAccount()?.address;
const json = event.parsedJson as {
principal_amount?: number;
reward_amount?: number;
Expand Down
6 changes: 3 additions & 3 deletions apps/core/src/hooks/useGetTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { useCurrentAccount, useIotaClient } from '@iota/dapp-kit';
import { useIotaClient } from '@iota/dapp-kit';
import { type IotaTransactionBlockResponse } from '@iota/iota-sdk/client';
import { type UseQueryResult, useQuery } from '@tanstack/react-query';
import { useTransactionSummary } from './useTransactionSummary';
Expand Down Expand Up @@ -33,17 +33,17 @@ export function useGetTransaction(

export function useGetTransactionWithSummary(
transactionDigest: string,
currentAddress: string,
initialData?: IotaTransactionBlockResponse,
recognizedPackagesList: string[] = [],
) {
const txResponse = useGetTransaction(transactionDigest, { retry: 8, initialData });
const currentAccount = useCurrentAccount();

const { data: transaction } = txResponse;

const summary = useTransactionSummary({
transaction,
currentAddress: currentAccount?.address,
currentAddress,
recognizedPackagesList,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ export function TransactionDialogView({
onClose,
onBack,
}: TransactionViewProps): React.JSX.Element | null {
const { data: transaction, summary } = useGetTransactionWithSummary(txDigest ?? '');
const activeAddress = useCurrentAccount()?.address ?? '';
const { data: transaction, summary } = useGetTransactionWithSummary(
txDigest ?? '',
activeAddress,
);

return (
<DialogLayout>
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/tests/balanceChanges.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ test('check balance changes in Activity', async ({ page, extensionUrl }) => {
await page.getByTestId('nav-activity').click();
await expect(page.getByTestId('link-to-txn').first()).toBeVisible({ timeout });
await page.getByTestId('link-to-txn').first().click();
await expect(page.getByText(`Successfully sent`, { exact: false })).toBeVisible();
await expect(page.getByText(`Successfully received`, { exact: false })).toBeVisible();
});

0 comments on commit 012eb3b

Please sign in to comment.