mirror of
https://github.com/hanzonet/explore.git
synced 2026-10-30 18:16:57 +00:00
* txn withdrawals page stub * add base page layout * add ConnectWallet alert * save search term in page query param * add links to the new page * add functionality to claim button * combine "Connect wallet" and "Claim" buttons * Refactor rollup configuration to introduce ParentChain structure and deprecate legacy environment variables * handle txn claim * allow to pass array of RPC urls for parent chain config * display token value and completion tx hash * fix csp * write tests for arbitrum l2 txn withdrawals * fix ts * review fixes * update screenshots and hide button if the txn is not confirmed yet
44 lines
1.1 KiB
TypeScript
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"/>
|
|
</HStack >
|
|
);
|
|
};
|
|
|
|
export default React.memo(ArbitrumL2TxnWithdrawalsClaimTx);
|