decode .errors json

This commit is contained in:
GroovieGermanikus 2023-11-27 11:06:40 +01:00
parent 6b7140fa3a
commit 70d08fd2a4
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
2 changed files with 12 additions and 7 deletions

View File

@ -28,7 +28,7 @@
</div>
</td>
<td>
<div class="align-items-center text-truncate" style="width:300px">
<div class="d-flex align-items-center text-truncate" style="width:300px">
<span class="font-monospace">
{% if tx.is_executed %}
<a href="https://explorer.solana.com/tx/{{tx.signature}}?cluster={{config.cluster}}">{{tx.signature}}</a>
@ -44,8 +44,8 @@
{% for error in tx.errors_array %}
<tr>
<td>
<span class="font-monospace text-danger">
{{error}}
<span class="font-monospace text-danger" title="Slot {{error.slot}}">
{{error.count}}x&nbsp;&nbsp;{{error.error}}
</span>
</td>
</tr>

View File

@ -36,8 +36,7 @@ def run_query():
for index, row in enumerate(maprows):
row['pos'] = index + 1
row['errors_array'] = json.loads(row['errors'])
row['accounts_used_array'] = json.loads(row['accounts_used'])
map_jsons_in_row(row)
return maprows
@ -72,12 +71,18 @@ def find_transaction_by_sig(tx_sig: str):
assert len(maprows) <= 1, "Tx Sig is primary key - find zero or one"
for row in maprows:
row['errors_array'] = json.loads(row['errors'])
row['accounts_used_array'] = json.loads(row['accounts_used'])
map_jsons_in_row(row)
return maprows
def map_jsons_in_row(row):
if row['errors']:
row['errors_array'] = json.loads(row['errors'])
if row['accounts_used']:
row['accounts_used_array'] = json.loads(row['accounts_used'])
def main():
run_query()