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",
}
]
}
Referring to the UniswapX swagger docs to query orders...
sortKey=createdAt&desc=false, it returns orders starting with"createdAt": 1677266409.sortKey=createdAt&desc=true, it returns orders starting with"createdAt": 1677247163306.Notice the first query returns
createdAtwith 10 digits, but the second query returnscreatedAtwith 13 digits. This means the orders API containcreatedAtvalues 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
{ "orders": [ { "createdAt": 1677266409, "orderHash": "0xe632accbc66d256b06a1dc086674c3e1ad35389f4a5092844514297fd2696fc9", }, { "createdAt": 1677480309, "orderHash": "0x65d4f575a1a108d72268bc8ef68c5ff137d3ea42b0620feebb15c9dca4a85711", }, { "createdAt": 1677482239, "orderHash": "0x21e918919abf507cdaa53024da41c26a22ed088876c059abda8599a6884b9e38", } ] }{ "orders": [ { "createdAt": 1677247163306, "orderHash": "0xa733542f84862db1f545d72914b7dcda5da1886549dcee99758cfc7dc644c88b", }, { "createdAt": 1677243562051, "orderHash": "0xd6c796e22c2d6daac545067503618fb17338c5480146a7c68406035b4d239de5", }, { "createdAt": 1677239962653, "orderHash": "0x474fe0fd8ca33303eb66a4983571cd1ce8f446e40ea4f3e7a7fdfba119188581", } ] }