Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UniswapX orders API contains mixed second/millisecond timestamps #208

Open
unnawut opened this issue Nov 15, 2023 · 0 comments
Open

UniswapX orders API contains mixed second/millisecond timestamps #208

unnawut opened this issue Nov 15, 2023 · 0 comments

Comments

@unnawut
Copy link

unnawut commented Nov 15, 2023

Referring to the UniswapX swagger docs to query orders...

  • When sorted with sortKey=createdAt&desc=false, it returns orders starting with "createdAt": 1677266409.
  • When sorted with sortKey=createdAt&desc=true, it returns orders starting with "createdAt": 1677247163306.

Notice the first query returns createdAt with 10 digits, but the second query returns createdAt with 13 digits. This means the orders API contain createdAt values with both second and millisecond units, making the sort unusable. Orders in milliseconds from 9 months ago are interpreted as newer than orders today in seconds.

Reproducible steps

curl -X 'GET' \
  'https://api.uniswap.org/v2/orders?limit=3&sortKey=createdAt&desc=false&chainId=1' \
  -H 'accept: application/json'
{
  "orders": [
    {
      "createdAt": 1677266409,
      "orderHash": "0xe632accbc66d256b06a1dc086674c3e1ad35389f4a5092844514297fd2696fc9",
    },
    {
      "createdAt": 1677480309,
      "orderHash": "0x65d4f575a1a108d72268bc8ef68c5ff137d3ea42b0620feebb15c9dca4a85711",
    },
    {
      "createdAt": 1677482239,
      "orderHash": "0x21e918919abf507cdaa53024da41c26a22ed088876c059abda8599a6884b9e38",
    }
  ]
}
curl -X 'GET' \
  'https://api.uniswap.org/v2/orders?limit=3&sortKey=createdAt&desc=true&chainId=1' \
  -H 'accept: application/json'
{
  "orders": [
    {
      "createdAt": 1677247163306,
      "orderHash": "0xa733542f84862db1f545d72914b7dcda5da1886549dcee99758cfc7dc644c88b",
    },
    {
      "createdAt": 1677243562051,
      "orderHash": "0xd6c796e22c2d6daac545067503618fb17338c5480146a7c68406035b4d239de5",
    },
    {
      "createdAt": 1677239962653,
      "orderHash": "0x474fe0fd8ca33303eb66a4983571cd1ce8f446e40ea4f3e7a7fdfba119188581",
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant