Skip to content

Instantly share code, notes, and snippets.

@patcito
Created February 21, 2026 01:41
Show Gist options
  • Select an option

  • Save patcito/9b3030378c01c97d4a3d1df0d81bc961 to your computer and use it in GitHub Desktop.

Select an option

Save patcito/9b3030378c01c97d4a3d1df0d81bc961 to your computer and use it in GitHub Desktop.

/mm/lend — New userTransactions Field

What changed

When a ?user=0x... query param is provided, each chain object in the response now includes a userTransactions array containing the user's deposit/withdraw/borrow/repay history on that chain.

Response shape

{
  "chains": [
    {
      "chainId": 146,
      "chainName": "Sonic",
      "globalMetrics": { ... },
      "userMetrics": { ... },
      "assets": [ ... ],
      // NEW FIELD ↓
      "userTransactions": [
        {
          "tokenSymbol": "USDC",
          "chainName": "Sonic",
          "action": "deposit",       // "deposit" | "withdraw" | "borrow" | "repay"
          "amount": 1000.5,          // float, in token units (human-readable)
          "amountUsd": 1000.5,       // float, USD value at current token price
          "timestamp": "2025-06-15 14:30:00",  // UTC, format "YYYY-MM-DD HH:MM:SS"
          "txHash": "0xabc..."
        },
        ...
      ]
    }
  ]
}

Behavior

Scenario userTransactions value
No ?user= param null
User has no transactions on that chain null
User has transactions Array of up to 100 entries, newest first

Field details

Field Type Description
tokenSymbol string e.g. "USDC", "WETH" — matches assets[].symbol
chainName string e.g. "Sonic" — same as parent chain object
action string One of: "deposit", "withdraw", "borrow", "repay"
amount float Token amount in human-readable units (already divided by decimals)
amountUsd float amount * currentTokenPrice — uses the same price shown in assets[].tokenprice
timestamp string UTC datetime, format "2006-01-02 15:04:05"
txHash string Transaction hash, can be used to link to block explorer

Notes

  • Transactions are sorted by timestamp descending (newest first), capped at 100 per chain.
  • amountUsd uses the current token price, not the price at time of transaction.
  • The tokenSymbol maps 1:1 to entries in the assets array — you can cross-reference for decimals, full name, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment