Files
explore/ui/txnWithdrawals/arbitrumL2/ArbitrumL2TxnWithdrawalsClaimTx.tsx
enochleeandGitHub 4c78f91771 display copy button for tx hashes in relevant components (#3031)
* default TxEntity.noCopy to false
remove redundant noCopy=false
restore noCopy for tx hashes in this components

This commit has no essential change, order than defaulting noCopy for TxEntity to false, and reversing the use of the prop

* To reflect new default of TxEntity and UserOpEntity

Updated tests to with-no-copy from with-copy
remove outdated screenshots
Regenerate screenshot for new default

* display copy button for tx hash

In the following pages:
/txs, /internal-txs
/token-transfers
/address/txs, /address/token-transfers(tab)
/deposits, /withdrawals
/batches[id]/txs(tab)
/advanced-filter

* update snapshots

* update snapshots
2025-10-21 17:28:01 +02:00

44 lines
1.1 KiB
TypeScript

import { HStack, Spinner } from '@chakra-ui/react';
import React from 'react';
import { useWaitForTransactionReceipt } from 'wagmi';
import config from 'configs/app';
import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1';
const rollupFeature = config.features.rollup;
interface Props {
isPending: boolean;
hash: string;
onSuccess: () => void;
onError: (error: Error) => void;
}
const ArbitrumL2TxnWithdrawalsClaimTx = ({ isPending, hash, onSuccess, onError }: Props) => {
const { status, error } = useWaitForTransactionReceipt({
hash: hash as `0x${ string }`,
chainId: rollupFeature.isEnabled ? Number(rollupFeature.parentChain.id) : undefined,
query: { enabled: isPending },
});
React.useEffect(() => {
switch (status) {
case 'success':
onSuccess();
break;
case 'error':
onError(error);
break;
}
}, [ status, error, onSuccess, onError ]);
return (
<HStack columnGap={ 2 } lineHeight="32px">
{ isPending && <Spinner size="sm"/> }
<TxEntityL1 hash={ hash } noIcon maxW="160px" noCopy/>
</HStack >
);
};
export default React.memo(ArbitrumL2TxnWithdrawalsClaimTx);