toncenter / ton-http-api

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

Add response typings for some API methods. #25

Closed heyqbnk closed 2 years ago

heyqbnk commented 2 years ago

Added typings for /getAddressInformation and /getExtendedAddressInformation

Can not be sure they are 100% correct because they are based on results of methods execution from official API endpoint: https://toncenter.com/api/v2/

Let me know if everything is fine here and I will drop more typings for other methods.

slavafomin commented 2 years ago

@wolframdeus I guess we should take types from the original TL specification (see the example). It would be also a good idea to preserve the type names. However, take into account how these responses are transformed in the Python code.

slavafomin commented 2 years ago

Also, looking at the implementation, the state field could have a more narrow definition, i.e.: state: Literal['uninitialized', 'frozen', 'active'] instead of more general state: str.

And it would be nice to use generics for e.g. TonResponse if possible.