Skip to main content

User Account Endpoints

Get comprehensive user account data including balances, permissions, cross-chain deposits, and token mappings.

Get Account Information

Retrieve account details, balances, and permissions for a user address.
curl "https://api.gtxdex.xyz/api/account?address=0x1234..."

Parameters

ParameterTypeRequiredDescription
addressstringYesUser wallet address

Response

{
  "makerCommission": 10,
  "takerCommission": 20,
  "buyerCommission": 0,
  "sellerCommission": 0,
  "canTrade": true,
  "canWithdraw": true,
  "canDeposit": true,
  "updateTime": 1640995200000,
  "accountType": "SPOT",
  "balances": [
    {
      "asset": "ETH",
      "free": "5.25000000",
      "locked": "0.75000000"
    },
    {
      "asset": "USDC",
      "free": "1500.500000",
      "locked": "250.000000"
    }
  ],
  "permissions": ["SPOT"]
}

Response Fields

FieldTypeDescription
makerCommissionnumberMaker fee rate (basis points)
takerCommissionnumberTaker fee rate (basis points)
buyerCommissionnumberBuyer commission (always 0)
sellerCommissionnumberSeller commission (always 0)
canTradebooleanTrading permission status
canWithdrawbooleanWithdrawal permission status
canDepositbooleanDeposit permission status
updateTimenumberLast account update timestamp
accountTypestringAccount type (always “SPOT”)
balancesarrayUser token balances
permissionsarrayAccount permissions

Balance Object

FieldTypeDescription
assetstringToken symbol
freestringAvailable balance
lockedstringLocked balance (in open orders)

Get Cross-Chain Deposits

Retrieve cross-chain deposit history and status for a user.
curl "https://api.gtxdex.xyz/api/cross-chain-deposits?user=0x1234...&limit=50"

Parameters

ParameterTypeRequiredDefaultDescription
userstringYes-User wallet address
statusstringNo-Filter by status
limitnumberNo100Number of deposits to return

Status Values

StatusDescription
PENDINGDeposit initiated but not yet processed
SENTDeposit dispatched to destination chain
RELAYEDDeposit successfully processed on destination

Response

{
  "items": [
    {
      "id": "transfer-0x123...",
      "amount": "1000000000",
      "destinationBlockNumber": "12345678",
      "destinationChainId": 421614,
      "destinationTimestamp": 1640995300,
      "destinationToken": null,
      "destinationTransactionHash": "0xabc...",
      "dispatchMessage": {
        "blockNumber": "12345670",
        "chainId": 11155111,
        "id": "dispatch_123",
        "messageId": "0xdef...",
        "sender": "0x1234...",
        "timestamp": 1640995200,
        "type": "DISPATCH",
        "transactionHash": "0x789..."
      },
      "direction": "DEPOSIT",
      "messageId": "0xdef...",
      "processMessage": {
        "blockNumber": "12345678",
        "chainId": 421614,
        "id": "process_123",
        "messageId": "0xdef...",
        "sender": "0x1234...",
        "timestamp": 1640995300,
        "transactionHash": "0xabc...",
        "type": "PROCESS"
      },
      "sourceToken": "0x456...",
      "sourceChainId": 11155111,
      "sourceBlockNumber": 12345670,
      "sender": "0x1234...",
      "recipient": "0x1234...",
      "sourceTransactionHash": "0x789...",
      "status": "RELAYED",
      "timestamp": 1640995200
    }
  ]
}

Cross-Chain Deposit Fields

FieldTypeDescription
idstringUnique transfer identifier
amountstringDeposit amount (wei)
destinationBlockNumberstringDestination chain block number
destinationChainIdnumberDestination chain ID
destinationTimestampnumberDestination processing timestamp
destinationTransactionHashstringDestination transaction hash
dispatchMessageobjectSource chain message details
directionstringTransfer direction (always “DEPOSIT”)
messageIdstringCross-chain message ID
processMessageobjectDestination chain message details
sourceTokenstringSource token address
sourceChainIdnumberSource chain ID
sourceBlockNumbernumberSource chain block number
senderstringDeposit sender address
recipientstringDeposit recipient address
sourceTransactionHashstringSource transaction hash
statusstringDeposit status
timestampnumberDeposit initiation timestamp

Get Token Mappings

Retrieve cross-chain token mapping information.
curl "https://api.gtxdex.xyz/api/token-mappings?sourceChainId=11155111&targetChainId=421614"

Parameters

ParameterTypeRequiredDefaultDescription
sourceChainIdnumberNo-Source chain ID filter
targetChainIdnumberNo-Target chain ID filter
symbolstringNo-Token symbol filter
isActivebooleanNo-Active status filter
limitnumberNo100Number of mappings to return

Response

{
  "items": [
    {
      "id": "mapping_123",
      "sourceChainId": 11155111,
      "sourceToken": "0x123...",
      "targetChainId": 421614,
      "syntheticToken": "0x456...",
      "symbol": "USDC",
      "sourceDecimals": 6,
      "syntheticDecimals": 6,
      "isActive": true,
      "registeredAt": 1640995200,
      "transactionId": "0x789...",
      "blockNumber": "12345678",
      "timestamp": 1640995200
    }
  ]
}

Token Mapping Fields

FieldTypeDescription
idstringMapping identifier
sourceChainIdnumberSource blockchain chain ID
sourceTokenstringSource token contract address
targetChainIdnumberTarget blockchain chain ID
syntheticTokenstringSynthetic token contract address
symbolstringToken symbol
sourceDecimalsnumberSource token decimal places
syntheticDecimalsnumberSynthetic token decimal places
isActivebooleanWhether mapping is active
registeredAtnumberRegistration timestamp
transactionIdstringRegistration transaction hash
blockNumberstringRegistration block number
timestampnumberRegistration timestamp

Account Analysis Examples

Calculate Total Portfolio Value

async function getPortfolioValue(userAddress, prices) {
  const account = await fetch(
    `https://api.gtxdex.xyz/api/account?address=${userAddress}`
  ).then(r => r.json());
  
  let totalValue = 0;
  
  for (const balance of account.balances) {
    const { asset, free, locked } = balance;
    const totalBalance = parseFloat(free) + parseFloat(locked);
    const price = prices[asset] || 0;
    totalValue += totalBalance * price;
  }
  
  return {
    totalValue,
    breakdown: account.balances.map(b => ({
      asset: b.asset,
      balance: parseFloat(b.free) + parseFloat(b.locked),
      value: (parseFloat(b.free) + parseFloat(b.locked)) * (prices[b.asset] || 0)
    }))
  };
}

Monitor Cross-Chain Deposits

async function monitorDeposits(userAddress) {
  const deposits = await fetch(
    `https://api.gtxdex.xyz/api/cross-chain-deposits?user=${userAddress}&limit=10`
  ).then(r => r.json());
  
  return deposits.items.map(deposit => ({
    id: deposit.id,
    amount: deposit.amount,
    status: deposit.status,
    fromChain: deposit.sourceChainId,
    toChain: deposit.destinationChainId,
    age: Date.now() - (deposit.timestamp * 1000),
    txHash: deposit.sourceTransactionHash
  }));
}

Check Trading Fees

async function getTradingFees(userAddress) {
  const account = await fetch(
    `https://api.gtxdex.xyz/api/account?address=${userAddress}`
  ).then(r => r.json());
  
  return {
    makerFee: account.makerCommission / 10000, // Convert basis points to percentage
    takerFee: account.takerCommission / 10000,
    makerFeePercent: `${account.makerCommission / 100}%`,
    takerFeePercent: `${account.takerCommission / 100}%`
  };
}

Real-Time Account Updates

For real-time balance updates, use the WebSocket API:
const ws = new WebSocket('wss://ws.gtxdex.xyz');

// Subscribe to account updates
ws.send(JSON.stringify({
  method: 'SUBSCRIBE',
  params: [`${userAddress}@account`],
  id: 1
}));

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.stream && data.stream.includes('@account')) {
    console.log('Account update:', data.data);
    // Update UI with new balance information
    updateAccountDisplay(data.data);
  }
};

Error Responses

Status CodeErrorDescription
400Address parameter is requiredMissing required address parameter
400User parameter is requiredMissing required user parameter (deposits)
500Failed to fetch account informationInternal server error

Rate Limits

User account endpoints have the following rate limits:
  • Account information: 300 requests per minute per user
  • Cross-chain deposits: 200 requests per minute per user
  • Token mappings: 600 requests per minute
Account balance data is updated in real-time as trades execute and deposits/withdrawals are processed.

Chain IDs Reference

Common chain IDs used in GTX DEX:
ChainChain IDDescription
Ethereum Sepolia11155111Ethereum testnet
Arbitrum Sepolia421614Arbitrum testnet
GTX Devnet1802GTX native devnet
Cross-chain operations may take several minutes to complete depending on network congestion and bridge processing times.