toncenter / ton-http-api

HTTP API for TON (The Open Network)
https://toncenter.com
GNU General Public License v3.0
164 stars 27 forks source link

getTransactions not working properly. #37

Closed witer33 closed 2 years ago

witer33 commented 2 years ago
getTransactions
address: EQBUdV7ebJT1bdR-6NggOa1YO0n7gScKZrHAAY3jX5oO515t
limit: 10
lt: 11047435000003
hash: VK9ZSkDlKB34g1rgQ0MczEJd7cOIoLNjyNjPl/iYPEc=

Sending this query, on testnet Toncenter main server, will result in 4 transactions,

1) lt: 11047435000003 hash: VK9ZSkDlKB34g1rgQ0MczEJd7cOIoLNjyNjPl/iYPEc= 2) lt: 11047062000003 hash: +QNVG8jkcfgOE/b9GDcxiPod10SWbSmW8MfAwZxAyzE= 3) lt: 11019981000003 hash: OxSpM0k2FpCwwHlzavRQ0cLqecb4mf38/ygJ6w7V25E= 4) lt: 11019472000003 hash: 61Qs4Q3dU2OFLPAsvf/xTkVwQzHtQBZLvK8DXT+Bv2I=

As you can see, the last 3 lt are lower than the lt passed as an argument. Is this expected to happen? Reading some TonWeb example code I tought this is an unexpected behaviour.

CURL shell command:

curl -X 'GET' \
  'https://testnet.toncenter.com/api/v2/getTransactions?address=EQBUdV7ebJT1bdR-6NggOa1YO0n7gScKZrHAAY3jX5oO515t&limit=10&lt=11047435000003&hash=VK9ZSkDlKB34g1rgQ0MczEJd7cOIoLNjyNjPl%2FiYPEc%3D&to_lt=0&archival=false' \
  -H 'accept: application/json'
dungeon-master-666 commented 2 years ago

Hi @witer33, you are right, currently, parameters names are a bit confusing. This method looks up transactions from the top of the blockchain, therefore lt parameter is the highest lt and to_lt is the lowest. It's counter-intuitive but we can't change it without breaking the current users.