Skip to content

Commit

Permalink
fix: 4/n review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhikumar98 committed Sep 25, 2023
1 parent e6f4c24 commit a8bd41c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { formatTokenAmount } from '../../utils';
import { ContactSupportButton } from './ContactSupportButton';
import { Container } from './TransactionDetailsPage.style';
import type { ExtendedTransactionInfo, StatusResponse } from '@lifi/sdk';
import { buildRouteExecutionFromTransactionHistory } from '../../utils/converters';
import { buildRouteFromTxHistory } from '../../utils/converters';

export const TransactionDetailsPage: React.FC = () => {
// const data = useTransactionHistoryById();
Expand All @@ -45,10 +45,7 @@ export const TransactionDetailsPage: React.FC = () => {

const transactionHistory: StatusResponse = state?.transactionHistory;

const routeExecution = buildRouteExecutionFromTransactionHistory(
transactionHistory,
tools,
);
const routeExecution = buildRouteFromTxHistory(transactionHistory, tools);

const headerStoreContext = useHeaderStoreContext();
const [open, setOpen] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const TransactionHistoryItem: React.FC<{
);

if (!sending.token?.chainId || !receiving.token?.chainId) {
// @eugene how to handle this case?
return null;
}

Expand Down
8 changes: 3 additions & 5 deletions packages/widget/src/utils/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import type {
import type { RouteExecution } from '../stores';
import type { ToolsResponse } from '@lifi/sdk';

const buildProcessFromTransactionHistory = (
txHistory: StatusResponse,
): Process[] => {
const buildProcessFromTxHistory = (txHistory: StatusResponse): Process[] => {
const sending = txHistory.sending as ExtendedTransactionInfo;
const receiving = txHistory.receiving as ExtendedTransactionInfo;

Expand Down Expand Up @@ -77,7 +75,7 @@ const buildProcessFromTransactionHistory = (
return process;
};

export const buildRouteExecutionFromTransactionHistory = (
export const buildRouteFromTxHistory = (
txHistory: StatusResponse,
tools?: ToolsResponse,
) => {
Expand Down Expand Up @@ -192,7 +190,7 @@ export const buildRouteExecutionFromTransactionHistory = (
integrator: '',
execution: {
status: 'DONE', // can be FAILED
process: buildProcessFromTransactionHistory(txHistory),
process: buildProcessFromTxHistory(txHistory),
fromAmount: sending.amount,
toAmount: receiving.amount,
toToken: receiving.token,
Expand Down

0 comments on commit a8bd41c

Please sign in to comment.