Skip to content

Track Transactions

Hook: useTxnStatus

Decent operates a scanner that enables developers to easily track and analyze all of their transactions. The useDecentScan hook is built on the Decent Scan API's.

The useDecentScan hook leverages SWR for efficient polling. This does introduce swr as a peer dependency.



Please refer to the ChainId type in the Box Common types glossary.

type TxnStatusArgs = {
  srcTxHash: ChainId;
  srcChainId: string;

Sample Request & Implementation

export async function sendDecentTransaction({
}: {
  txConfig: BoxActionRequest;
}) {
  const [hash, setHash] = useState(); 
  const [txReceipt, setTxReceipt] = useState(); 
  const { actionResponse, isLoading, error } = useBoxAction(txConfig);
  const { hash } = await sendTransaction(actionResponse?.tx); 
  const { data, isLoading } = useDecentScan({ 
    srcTxHash: hash, 
    srcChainId: txConfig.srcChainId,