chia-blockchain/chia/wallet/transaction_sorting.py
Matt Hauff c6637455b3
Added sorting functionality to /get_transactions (#9278)
* Added sorting functionality to /get_transactions

* Added comment about reversals

* Add determinism and clean up reversal

* Change default back to 50
2021-12-10 15:19:58 -08:00

13 lines
379 B
Python

import enum
class SortKey(enum.Enum):
CONFIRMED_AT_HEIGHT = "order by confirmed_at_height {ASC}"
RELEVANCE = "order by confirmed {ASC}, confirmed_at_height {DESC}, created_at_time {DESC}"
def ascending(self) -> str:
return self.value.format(ASC="ASC", DESC="DESC")
def descending(self) -> str:
return self.value.format(ASC="DESC", DESC="ASC")