Last active
April 6, 2024 03:28
-
-
Save sbarratt/6316e2bcf11b7639d62f3703a35adec4 to your computer and use it in GitHub Desktop.
Wormhole bulk eligibility checker
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 argparse | |
import requests | |
def get_allocation(address, blockchain): | |
id = { | |
"sol": 1, | |
"eth": 2, | |
"sui": 21, | |
"aptos": 22, | |
"inj": 19, | |
"terra": 3, | |
"algorand": 8, | |
"osmosis": 20, | |
}[blockchain] | |
url = f"https://prod-flat-files-min.wormhole.com/{address}_{id}.json" | |
response = requests.get(url) | |
if response.status_code == 200: | |
data = response.json() | |
allocation = data['amount'] * 1e-9 | |
print(f"{address}: {allocation}") | |
else: | |
print(f"{address}: 0") | |
def main(): | |
parser = argparse.ArgumentParser(description=""" | |
Fetch allocation for addresses from a file in a blockchain. | |
Put files in addresses.txt (one per line). | |
Usage: python wormhole.py addresses.txt eth | |
""") | |
parser.add_argument("address_file", help="Path to the file containing addresses (.txt).") | |
parser.add_argument("blockchain", help="Blockchain (sol/eth/sui/aptos/inj/terra/algorand/osmosis).") | |
args = parser.parse_args() | |
assert args.blockchain in ["sol", "eth"], "Only support sol/eth" | |
with open(args.address_file, 'r') as file: | |
addresses = file.readlines() | |
for address in addresses: | |
address = address.strip() | |
get_allocation(address, args.blockchain) | |
if __name__ == "__main__": | |
main() |
ATJrqxNYvQKUkxufAvrCYtFwvcNCFMVpNRqgv5V6PcY3
headers = {
'Referer': 'https://airdrop.wormhole.com/',
'User-Agent': xxxxxxxxxxxxx'
}
Include this in your script if you consistently get 404 errors
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
8S9CU3bXDMQJqcC145nQJb7RHTDqPh5Z5q6hZ3cPUFyp