Created
January 21, 2023 17:13
-
-
Save Reecepbcups/a441286bb082fa53d181eba1270e9998 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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