Skip to content

Instantly share code, notes, and snippets.

@joshwolff1
joshwolff1 / gist:298e8251e43ff9b4815028683b1ca17d
Created December 18, 2021 22:31
check_mint_from_candy_tx_success.py
import requests
if __name__ == '__main__':
api_key_id = None
api_secret_key = None
tx_signature_succeeded = "2vsU2QVdAvQL1o2UQ37zwNiRFmAbv1DVHKP5Fi9MhWkf2bYC5iBobA6DHFAJSa1fCoFYCXzRCWCJrj9nQcvmPLty"
tx_signature_failed = "4FVw9dBA8KLLWvKZwjxfgkhKeq6F8PGDRVoqt1YKync3u8CRVeVxbhtVGUAVtPKksK2USLRxqyCrrUUZsZtBxq6C"
@joshwolff1
joshwolff1 / search_candy_machines.py
Created December 18, 2021 22:13
Search candy machines
import requests
SEARCH_CANDY_MACHINES_ENDPOINT = "https://api.theblockchainapi.com/v1/solana/nft/candy_machine/search"
def get_headers(api_key_id, secret_key):
headers = dict()
if secret_key:
headers["APISecretKey"] = secret_key
@joshwolff1
joshwolff1 / cryptography_signing_helper.py
Last active December 14, 2021 21:17
Python, using the cryptopgraphy package: Create public key and private key, save the keys, load the keys, sign a message, and verify a message
from cryptography.hazmat.primitives import serialization as crypto_serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.backends import default_backend as crypto_default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives import serialization
from cryptography.exceptions import InvalidSignature
import time
import json
@joshwolff1
joshwolff1 / recursive_get_dict.py
Created March 19, 2020 04:42
Convert Lambda / AWS Stream Dictionary to Regular Dictionary
from decimal import *
def recursive_get_dict(my_dict, use_decimal=True):
"""
:param my_dict: The dict to be converted, which is assumed to come from the record from the DynamoDB stream
:param use_decimal: Whether or not to use Decimal or int for the type for the number
:return: A dictionary converted from this format {"username" : {"S" : "beto"}} to this format {"username": "beto"}
"""
if type(my_dict) is not dict:
@joshwolff1
joshwolff1 / gremlin-python_abstractions.py
Last active March 15, 2022 11:50
Some abstractions for the gremlin-python module.
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
# I use a property instead of directly setting the ID because I could not get it to work, and this works
# just as well for now. I'd imagine setting the id directly is better for runtime.
# If you figure out how to set the id directly with gremlin-python, feel free to make a pull request and I'll merge it.
IDENTIFICATION_PROPERTY = 'identification'
WEIGHT_PROPERTY = 'weight'
"""