File size: 3,827 Bytes
c896c68 ff8e009 baba299 c896c68 34176ed f26b47f 34176ed f1374b9 c896c68 f1374b9 c896c68 edbe8ca 34176ed edbe8ca 34176ed c896c68 34176ed edbe8ca 153df2a edbe8ca 153df2a c896c68 edbe8ca 583e7eb 9eb29d0 edbe8ca 583e7eb c896c68 ff8e009 f1374b9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
import streamlit as st
import requests
st.title("Verify π»")
# Fixed Token Mint Addresses (hidden from user)
TOKEN_MINT_ADDRESSES = {
"$TRICK": "EAXn2aA4GRE4p7r5q77NynHnQhaWnU5Pw66GSWQ4pump", # TRICK token mint address
"$TREAT": "3JqD4oUp1YzvzGWF2WJjrELr4QkW1GDLyFdtYnukpump" # TREAT token mint address
}
# Input field for the wallet address
wallet_address = st.text_input("Enter your Solana wallet address:")
if st.button("Verify"):
if wallet_address:
try:
# Solana RPC endpoint
rpc_endpoint = "https://api.mainnet-beta.solana.com"
total_adjusted_amount = 0
# Loop through token types (TRICK and TREAT)
for token_name, token_mint_address in TOKEN_MINT_ADDRESSES.items():
# Prepare the request payload
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenAccountsByOwner",
"params": [
wallet_address,
{"mint": token_mint_address},
{"encoding": "jsonParsed"}
]
}
# Send the request
response = requests.post(rpc_endpoint, json=payload)
result = response.json()
# Check if any token accounts were found
if (
'result' in result and
'value' in result['result'] and
len(result['result']['value']) > 0
):
# Get the balance (assuming only one account for simplicity)
token_account = result['result']['value'][0]
balance_info = token_account['account']['data']['parsed']['info']['tokenAmount']
amount = int(balance_info['amount']) # amount in the smallest unit
# Adjust for token decimals
decimals = balance_info['decimals']
adjusted_amount = amount / (10 ** decimals)
# Add to total amount
total_adjusted_amount += adjusted_amount
# Display the amount the user holds for each token (TRICK or TREAT)
st.write(f"You hold {adjusted_amount:,.0f} {token_name} tokens.")
else:
st.write(f"No {token_name} tokens found.")
# Compare the total adjusted amount to thresholds
if total_adjusted_amount >= 333333:
st.success("β
Guaranteed OG Status")
elif total_adjusted_amount >= 33333:
st.success("β
Guaranteed Trencher Status")
elif total_adjusted_amount >= 3333:
st.success("β
Guaranteed Raider Status")
else:
st.error("You don't have enough tokens yet π»")
# Log the query to Google Form
try:
form_url = "https://docs.google.com/forms/d/e/1FAIpQLSfsLawJnLd14ZGd8-fsbTdqGSsCSESe1w8Zd39wigDn6pvokQ/formResponse"
form_data = {
'entry.1721628210': wallet_address, # Replace with your actual Wallet Address field name
'entry.1357327531': f"{total_adjusted_amount:,.0f}" # Replace with your actual Token Amount field name
}
response = requests.post(form_url, data=form_data)
if response.status_code != 200:
st.warning("Failed to log data to Google Form.")
except Exception as e:
st.warning(f"Failed to log data to Google Form: {e}")
except Exception as e:
st.error(f"An error occurred: {e}")
else:
st.warning("Please enter your wallet address.")
|