mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* add prefix to API resources * fix pw tests * refactor config * remove unnecessary prefixes in resource names * fixes * update screenshots
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
|
|
import useApiQuery from 'lib/api/useApiQuery';
|
|
import { TX_INTERPRETATION } from 'stubs/txInterpretation';
|
|
import * as DetailedInfo from 'ui/shared/DetailedInfo/DetailedInfo';
|
|
import DetailedInfoActionsWrapper from 'ui/shared/DetailedInfo/DetailedInfoActionsWrapper';
|
|
import TxInterpretation from 'ui/shared/tx/interpretation/TxInterpretation';
|
|
|
|
interface Props {
|
|
hash?: string;
|
|
isTxDataLoading: boolean;
|
|
}
|
|
|
|
const TxDetailsActionsInterpretation = ({ hash, isTxDataLoading }: Props) => {
|
|
const txInterpretationQuery = useApiQuery('general:tx_interpretation', {
|
|
pathParams: { hash },
|
|
queryOptions: {
|
|
enabled: Boolean(hash) && !isTxDataLoading,
|
|
placeholderData: TX_INTERPRETATION,
|
|
refetchOnMount: false,
|
|
},
|
|
});
|
|
|
|
const actions = txInterpretationQuery.data?.data.summaries;
|
|
|
|
if (!actions || actions.length < 2) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<DetailedInfoActionsWrapper isLoading={ isTxDataLoading || txInterpretationQuery.isPlaceholderData } type="tx">
|
|
{ actions.map((action, index: number) => (
|
|
<TxInterpretation
|
|
key={ index }
|
|
summary={ action }
|
|
isLoading={ isTxDataLoading || txInterpretationQuery.isPlaceholderData }
|
|
/>
|
|
),
|
|
) }
|
|
</DetailedInfoActionsWrapper>
|
|
<DetailedInfo.ItemDivider/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default TxDetailsActionsInterpretation;
|