Skip to content

Instantly share code, notes, and snippets.

@Reecepbcups
Created January 21, 2023 17:13
Show Gist options
  • Save Reecepbcups/a441286bb082fa53d181eba1270e9998 to your computer and use it in GitHub Desktop.
Save Reecepbcups/a441286bb082fa53d181eba1270e9998 to your computer and use it in GitHub Desktop.
import json
import os
from requests import get
current_dir = os.path.dirname(os.path.realpath(__file__))
unconfirmed_txs_file = os.path.join(current_dir, "unconfirmed_txs.json")
def get_txs():
url = "https://juno-testnet-rpc.polkachu.com/unconfirmed_txs?limit=50"
response = get(url)
return response.json()["result"]["txs"]
decodedTxs = []
for idx, tx in enumerate(get_txs()):
if len(tx) > 5000:
print("contract")
# could base64 decode if you wanted wanted too (from base64 import b64decode)
continue
j = json.loads(os.popen(f"junod tx decode {tx}").read())
decodedTxs.append(j)
with open(unconfirmed_txs_file, "w") as f:
json.dump(decodedTxs, f, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment