Documentation
API Reference
Types
Transaction

Transaction

PureTransaction

This type is generic and represents a transaction object. It can be a trade, a withdraw or a deposit.

type PureTransaction = {
  from: PureCefiInfoTx | DefiInfoTx;
  to: PureCefiInfoTx | DefiInfoTx;
  type: "transfer" | "swap" | "trade" | "deposit" | "withdrawal";
};

See PureCefiInfoTx and DefiInfoTx for more information.

PureCefiInfoTx:

type PureCefiInfoTx = {
  account: {
    exchangeId: string;
    exchangeInstanceId: string;
  };
  wallet: {
    depositAddress: string;
    walletType: WalletType;
  };
  transaction: {
    amount: number;
    refAmount?: number;
    tokenSymbol: string;
    transactionId: string;
    fee: Fee;
    status: TxStatus;
    timestamp: number;
    transactionHash: string; // available soon
  };
};
  • account - object
    Contains the account information.
  • account.exchangeId - string
    The ID of the exchange involved in the transaction.
  • account.exchangeInstanceId - string
    The exchange instance ID.
  • wallet - object
    Contains the wallet information.
  • wallet.depositAddress - string
    The deposit address.
  • wallet.walletType - WalletType
    The wallet type involved in the transaction.
  • transaction - object
    Contains the transaction information.
  • transaction.amount - number
    The amount of the transaction.
  • transaction.refAmount - number
    The amount of the transaction in USD.
  • transaction.tokenSymbol - string
    The token symbol.
  • transaction.transactionId - string
    The exchange transaction ID.
  • transaction.fee - Fee
    The fee of the transaction.
  • transaction.status - TxStatus
    The status of the transaction.
  • transaction.timestamp - number
    The timestamp of the transaction, in milliseconds.
    The timestamp might differ from the actual transaction timestamp up to 5 seconds.
  • transaction.transactionHash - string
    The transaction hash, once available.

DefiInfoTx

type DefiInfoTx = {
  account: {
    address: string;
    network: string;
  };
  transaction: {
    transactionHash: string;
    fee: Fee;
    status: TxStatus;
    timestamp: number;
    tokens: {
      amount: number;
      refAmount?: number;
      tokenSymbol: string;
      address: string;
    }[];
  };
};
  • account.address - string
    The DeFi address involved in the transaction.
  • account.network - string
    The network of the DeFi address. See Supported Networks for the list of supported networks.
  • transaction - object
    Contains the transaction information.
  • transaction.transactionHash - string
    The transaction hash.
  • transaction.fee - Fee
    The fee of the transaction.
  • transaction.status - TxStatus
    The status of the transaction.
  • transaction.timestamp - number
    The timestamp of the transaction, in milliseconds.
    The timestamp might differ from the actual transaction timestamp up to 5 seconds.
  • transaction.tokens - object[]
    Contains information about the tokens involved in the transaction.
  • transaction.tokens.amount - number
    The amount of the token.
  • transaction.tokens.refAmount - number
    The amount of the token in USD.
  • transaction.tokens.tokenSymbol - string
    The token symbol.
  • transaction.tokens.address - string
    The token address.

TxStatus

enum TxStatus {
  PENDING = "pending",
  OK = "ok",
  CANCELLED = "cancelled",
  FAILED = "failed",
}