Skip to content
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: Add information to msg transaction cards #104

Merged
merged 4 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/components/nav/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ export function Header({ pathName }: { pathName: string }) {
<a className={navLinkClass()} target="_blank" href={links.home} rel="noopener noreferrer">
About
</a>
<Link href="/api-docs" className={navLinkClass('/api-docs')}>
{/* <Link href="/api-docs" className={navLinkClass('/api-docs')}>
API
</Link>
</Link> */}
<a
className={navLinkClass()}
target="_blank"
Expand Down Expand Up @@ -95,11 +95,11 @@ export function Header({ pathName }: { pathName: string }) {
Settings
</MobileNavLink>
),
(c: Fn) => (
<MobileNavLink href="/api" closeDropdown={c} key="API">
API
</MobileNavLink>
),
// (c: Fn) => (
// <MobileNavLink href="/api" closeDropdown={c} key="API">
// API
// </MobileNavLink>
// ),
(c: Fn) => (
<MobileNavLink href={docLinks.home} closeDropdown={c} key="Docs">
Docs
Expand Down
6 changes: 6 additions & 0 deletions src/features/messages/MessageDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import CheckmarkIcon from '../../images/icons/checkmark-circle.svg';
import { useMultiProvider, useStore } from '../../store';
import { Message, MessageStatus } from '../../types';
import { logger } from '../../utils/logger';
import { getHumanReadableDuration } from '../../utils/time';
import { getChainDisplayName, isEvmChain } from '../chains/utils';
import { useMessageDeliveryStatus } from '../deliveryStatus/useMessageDeliveryStatus';

Expand Down Expand Up @@ -84,6 +85,10 @@ export function MessageDetails({ messageId, message: messageFromUrlParams }: Pro
isPiMsg,
} = message;

const duration = destination?.timestamp
? getHumanReadableDuration(destination.timestamp - origin.timestamp, 3)
: undefined;

const showTimeline =
!isPiMsg &&
isEvmChain(multiProvider, originChainId) &&
Expand Down Expand Up @@ -120,6 +125,7 @@ export function MessageDetails({ messageId, message: messageFromUrlParams }: Pro
domainId={destinationDomainId}
status={status}
transaction={destination}
duration={duration}
debugResult={debugResult}
isStatusFetching={isDeliveryStatusFetching}
isPiMsg={isPiMsg}
Expand Down
24 changes: 23 additions & 1 deletion src/features/messages/cards/TransactionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function DestinationTransactionCard({
domainId,
status,
transaction,
duration,
debugResult,
isStatusFetching,
isPiMsg,
Expand All @@ -57,6 +58,7 @@ export function DestinationTransactionCard({
domainId: DomainId;
status: MessageStatus;
transaction?: MessageTx;
duration?: string;
debugResult?: MessageDebugResult;
isStatusFetching: boolean;
isPiMsg?: boolean;
Expand All @@ -74,6 +76,7 @@ export function DestinationTransactionCard({
transaction={transaction}
chainId={chainId}
domainId={domainId}
duration={duration}
blur={blur}
/>
);
Expand Down Expand Up @@ -190,16 +193,18 @@ function TransactionDetails({
chainId,
domainId,
transaction,
duration,
blur,
}: {
chainId: ChainId;
domainId: DomainId;
transaction: MessageTx;
duration?: string;
blur: boolean;
}) {
const multiProvider = useMultiProvider();

const { hash, from, timestamp, blockNumber } = transaction;
const { hash, from, timestamp, blockNumber, mailbox } = transaction;

const txExplorerLink =
hash && !new BigNumber(hash).isZero()
Expand Down Expand Up @@ -230,6 +235,14 @@ function TransactionDetails({
showCopy={true}
blurValue={blur}
/>
<KeyValueRow
label="Mailbox:"
labelWidth="w-16"
display={mailbox}
displayWidth="w-60 sm:w-64"
showCopy={true}
blurValue={blur}
/>
{!!timestamp && (
<KeyValueRow
label="Time:"
Expand All @@ -247,6 +260,15 @@ function TransactionDetails({
displayWidth="w-60 sm:w-64"
blurValue={blur}
/>
{duration && (
<KeyValueRow
label="Duration:"
labelWidth="w-16"
display={duration}
displayWidth="w-60 sm:w-64"
blurValue={blur}
/>
)}
{txExplorerLink && (
<a
className={`block ${styles.textLink}`}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface MessageTx extends MessageTxStub {
nonce: number;
gasLimit: number;
gasPrice: number;
effectiveGasPrice;
effectiveGasPrice: number;
gasUsed: number;
cumulativeGasUsed: number;
maxFeePerGas: number;
Expand Down
Loading