diff --git a/packages/app/src/systems/Transaction/component/TxInput/TxInput.stories.tsx b/packages/app/src/systems/Transaction/component/TxInput/TxInput.stories.tsx index b18ffa992..3c5964ed0 100644 --- a/packages/app/src/systems/Transaction/component/TxInput/TxInput.stories.tsx +++ b/packages/app/src/systems/Transaction/component/TxInput/TxInput.stories.tsx @@ -1,3 +1,4 @@ +import { VStack } from '@fuels/ui'; import type { Meta, StoryObj } from '@storybook/react'; import { @@ -18,12 +19,11 @@ export default meta; type Story = StoryObj; export const Asset: Story = { - render: () => , -}; - -export const AssetUnknown: Story = { render: () => ( - + + + + ), }; diff --git a/packages/app/src/systems/Transaction/component/__mocks__/tx.ts b/packages/app/src/systems/Transaction/component/__mocks__/tx.ts deleted file mode 100644 index 47b0e298e..000000000 --- a/packages/app/src/systems/Transaction/component/__mocks__/tx.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { mocks } from '@fuel-explorer/graphql'; -import { bn } from '@fuel-ts/math'; -import { dayjs } from '~/systems/Core/utils/dayjs'; - -const status = mocks.aSuccessStatus({ - __typename: 'SuccessStatus', - block: mocks.aBlock({ - transactions: [], - }), -}); - -const date = dayjs().subtract(1, 'day'); - -export const TX_MOCK = mocks.aTransaction({ - id: '0x78d13f111bf301324f34f2a7eaffc546d39598d156af38e7c4ef9fe61ea2c46a', - time: { - __typename: 'ParsedTime', - fromNow: date.fromNow(), - full: dayjs().format('DD MMM YYYY - HH:mm:ss A'), - }, - totalAccounts: 2, - totalAssets: 3, - totalOperations: 4, - gasUsed: bn(1), - status, -}); diff --git a/packages/app/src/systems/Transaction/screens/TxScreen/TxScreen.tsx b/packages/app/src/systems/Transaction/screens/TxScreen/TxScreen.tsx index 90e06cdee..35e01e5e3 100644 --- a/packages/app/src/systems/Transaction/screens/TxScreen/TxScreen.tsx +++ b/packages/app/src/systems/Transaction/screens/TxScreen/TxScreen.tsx @@ -1,6 +1,10 @@ 'use client'; -import type { GroupedInput, Maybe } from '@fuel-explorer/graphql'; +import type { + GroupedInput, + GroupedOutput, + Maybe, +} from '@fuel-explorer/graphql'; import { bn } from '@fuel-ts/math'; import { Grid, Heading, VStack } from '@fuels/ui'; @@ -8,6 +12,7 @@ import { TxAccountItem } from '../../component/TxAccountItem/TxAccountItem'; import { TxAssetItem } from '../../component/TxAssetItem/TxAssetItem'; import { TxBreadcrumb } from '../../component/TxBreadcrumb/TxBreadcrumb'; import { TxInput } from '../../component/TxInput/TxInput'; +import { TxOutput } from '../../component/TxOutput/TxOutput'; import { TxSummary } from '../../component/TxSummary/TxSummary'; import type { TransactionNode, TxAccountType } from '../../types'; @@ -67,6 +72,17 @@ export function TxScreen({ transaction: tx }: TxScreenProps) { /> ))} + + + Outputs + + {tx.groupedOutputs?.map((output) => ( + + ))} + ); @@ -78,3 +94,11 @@ function getInputId(input?: Maybe) { if (input.type === 'InputContract') return input.contractId; return input.sender; } + +function getOutputId(output?: Maybe) { + if (!output) return 0; + if (output.type === 'ContractOutput') return output.inputIndex; + if (output.type === 'ContractCreated') return output.contract?.id ?? 0; + if (output.type === 'MessageOutput') return output.recipient; + return output.assetId; +} diff --git a/packages/graphql/src/queries/tx-fragments.graphql b/packages/graphql/src/queries/tx-fragments.graphql index 4a553999f..97e8ef543 100644 --- a/packages/graphql/src/queries/tx-fragments.graphql +++ b/packages/graphql/src/queries/tx-fragments.graphql @@ -160,4 +160,18 @@ fragment TransactionItem on Transaction { data owner } + groupedOutputs { + type + totalAmount + outputs { + ...TransactionOutput + } + contract { + id + } + to + assetId + inputIndex + recipient + } } diff --git a/packages/graphql/src/schemas/fullschema.graphql b/packages/graphql/src/schemas/fullschema.graphql index 480044211..3f1ffe0e2 100644 --- a/packages/graphql/src/schemas/fullschema.graphql +++ b/packages/graphql/src/schemas/fullschema.graphql @@ -224,12 +224,6 @@ type Genesis { messagesRoot: Bytes32! } -enum GroupedInputType { - InputCoin - InputContract - InputMessage -} - type GroupedInput { assetId: AssetId contractId: ContractId @@ -242,6 +236,12 @@ type GroupedInput { type: GroupedInputType } +enum GroupedInputType { + InputCoin + InputContract + InputMessage +} + type GroupedOutput { assetId: AssetId contract: Contract