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

fix: use 2 instead of ORDER_BY_DESC for txs queries #265

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/staketaxcsv/atom/api_lcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def account_exists(wallet_address):
def _get_txs(wallet_address, is_sender, offset, sleep_seconds):
uri_path = "/cosmos/tx/v1beta1/txs"
query_params = {
"order_by": "ORDER_BY_DESC",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure if this is necessary right now? But maybe if the cosmos hub goes to v0.46.x it will be?

"order_by": 2,
"pagination.limit": LIMIT_PER_QUERY,
"pagination.offset": offset,
"pagination.count_total": True,
Expand Down
4 changes: 2 additions & 2 deletions src/staketaxcsv/common/ibc/api_lcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _get_txs(self, wallet_address, events_type, offset, limit, sleep_seconds):
"pagination.limit": limit,
"pagination.offset": offset,
"pagination.count_total": True,
"order_by": "ORDER_BY_DESC",
"order_by": 2,
}

if events_type == EVENTS_TYPE_SENDER:
Expand All @@ -83,7 +83,7 @@ def get_txs(self, wallet_address, events_type, offset=0, limit=TXS_LIMIT_PER_QUE
elems = data["tx_responses"]
next_offset = offset + limit if len(elems) == limit else None

if wallet_address.startswith("evmos"):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the existing code was accounting for evmos being on v0.46.x? This should handle the case where pagination is empty because post v0.46.x it is not used. After applying this fix, I was able to successfully generate a regen csv

if data["pagination"] is None:
total_count_txs = int(data["total"])
else:
total_count_txs = int(data["pagination"]["total"])
Expand Down
2 changes: 1 addition & 1 deletion src/staketaxcsv/luna1/api_lcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _query(cls, uri_path, query_params, sleep_seconds=1):
def _get_txs(cls, wallet_address, events_type, offset, limit, sleep_seconds):
uri_path = "/cosmos/tx/v1beta1/txs"
query_params = {
"order_by": "ORDER_BY_DESC",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question?

"order_by": 2,
"pagination.limit": limit,
"pagination.offset": offset,
"pagination.count_total": True,
Expand Down