Skip to main content
After executing a trade, you need to monitor its progress, especially for cross-chain transactions that may take several minutes to complete.
The DZap SDK provides comprehensive status tracking for all trade types, from simple swaps to complex cross-chain bridges.
Rate Limits: Our API and SDK have rate limits in place to ensure fair usage. If you need increased rate limits for your application, please reach out to our team on Telegram.

Basic Status Tracking

Here’s how to check the status of a completed trade:
import { DZapClient } from "@dzap/sdk";

const dZap = DZapClient.getInstance();

const statusResult = await dZap.getTradeTxnStatus({
  txHash: "0x1234567890abcdef...", // Your transaction hash
  chainId: 42161, // Source chain ID
});

console.log("Trade status:", statusResult);

Status Request Parameters

The getTradeTxnStatus function accepts the following parameters:
ParameterTypeRequiredDescription
txHashstringyesThe transaction hash from the executed trade
chainIdnumberyesThe chain ID where the transaction was executed

Status Response Structure

The status response follows the TradeStatusResponse type:
type TradeStatusResponse = {
  [pair: string]: TradeStatusResponseData;
};

type TradeStatusResponseData = {
  srcChainId: number; // Source chain ID
  srcToken: string; // Source token address
  srcAmount: string; // Amount sent
  srcAmountUSD: string; // USD value sent
  srcTxHash: string; // Source transaction hash
  destChainId: number; // Destination chain ID
  destToken: string; // Destination token address
  destAmount: string; // Amount received
  destAmountUSD: string; // USD value received
  destTxHash: string; // Destination transaction hash
  account: string; // User account
  recipient: string; // Recipient address
  outputToken?: string; // Final output token (if different)
  refundTxHash?: string; // Refund transaction hash (if applicable)
  provider: string; // Provider used for the trade
  allowUserTxOnDestChain: boolean; // Whether user action is required
  status: "COMPLETED" | "PENDING" | "FAILED";
};

Best Practices

  1. Implement proper polling intervals - Don’t poll too frequently to avoid rate limits
  2. Handle all status types - Prepare for successful, failed, and pending states
Cross-chain transactions can take anywhere from a few minutes to an hour depending on the bridge used and network congestion.