Skip to content

Commit

Permalink
add jq patch to sort coins
Browse files Browse the repository at this point in the history
  • Loading branch information
dasanchez committed Nov 20, 2023
1 parent b58f67b commit 1dcb546
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cosmos_genesis_tinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,13 @@ def replace_validator(self, old_validator: Validator, new_validator: Validator):
self.preprocessing_file],
check=True)

# Sort coins in bank balances
self.log_step("Sorting balances coins")
subprocess.run(f"jq '.app_state.bank.balances |= map(.coins |= sort_by(.denom))' {self.preprocessing_file} > sorted.json",
check=True, shell=True)
subprocess.run(f"mv sorted.json {self.preprocessing_file}",
check=True, shell=True)

def load_file(self, path):
"""
Loads a genesis file from the given path
Expand Down

0 comments on commit 1dcb546

Please sign in to comment.