Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
fix: the response-tx of refund-status should be linked to source chain
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Mar 28, 2024
1 parent 1564be5 commit a84db95
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/components/record-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { BaseBridge } from "@/bridges";
import { GQL_HISTORY_RECORD_BY_ID } from "@/config";
import { HistoryRecordReqParams, HistoryRecordResData } from "@/types";
import { HistoryRecordReqParams, HistoryRecordResData, RecordResult } from "@/types";
import ComponentLoading from "@/ui/component-loading";
import CountdownRefresh from "@/ui/countdown-refresh";
import { bridgeFactory, getChainConfig } from "@/utils";
Expand Down Expand Up @@ -66,21 +66,19 @@ export default function RecordDetail(props: Props) {
<Item label="Status" tips="The status of the cross-chain transaction: Success, Pending, or Refunded.">
<TransactionStatus record={record?.historyRecordById} />
</Item>
<Item
label="Source Tx Hash"
tips="Unique character string (TxID) assigned to every verified transaction on the Source Chain."
>
<Item label="Request Tx Hash" tips="Unique character string (TxID) assigned to every verified transaction.">
<TransactionHash
chain={record?.historyRecordById?.fromChain}
txHash={record?.historyRecordById?.requestTxHash}
/>
</Item>
<Item
label="Target Tx Hash"
tips="Unique character string (TxID) assigned to every verified transaction on the Target Chain."
>
<Item label="Response Tx Hash" tips="Unique character string (TxID) assigned to every verified transaction.">
<TransactionHash
chain={record?.historyRecordById?.toChain}
chain={
isRefundStatus(record?.historyRecordById?.result)
? record?.historyRecordById?.fromChain
: record?.historyRecordById?.toChain
}
txHash={record?.historyRecordById?.responseTxHash}
/>
</Item>
Expand Down Expand Up @@ -152,3 +150,11 @@ function Item({ label, tips, children }: PropsWithChildren<{ label: string; tips
function Divider() {
return <div className="h-[1px] w-full bg-white/10" />;
}

function isRefundStatus(result: RecordResult | undefined) {
return (
result === RecordResult.PENDING_TO_CONFIRM_REFUND ||
result === RecordResult.PENDING_TO_REFUND ||
result === RecordResult.REFUNDED
);
}

0 comments on commit a84db95

Please sign in to comment.