verify / app.py
Accelernate's picture
Update app.py
c896c68 verified
raw
history blame
2.34 kB
# app.py
import streamlit as st
import requests
st.title("Solana Wallet Verifier")
# Input fields for the wallet address and token mint address
wallet_address = st.text_input("Enter your Solana wallet address:")
token_mint_address = st.text_input("Enter the token mint address:")
if st.button("Verify"):
if wallet_address and token_mint_address:
try:
# Solana RPC endpoint
rpc_endpoint = "https://api.mainnet-beta.solana.com"
# 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)
# Compare the adjusted amount to thresholds
if adjusted_amount >= 3333333:
st.success("βœ… Guaranteed OG Status")
elif adjusted_amount >= 333333:
st.success("βœ… Guaranteed WLT Status")
elif adjusted_amount >= 33333:
st.success("βœ… Guaranteed WLR Status")
else:
st.error("You do not meet any status requirements.")
else:
st.error("Token account not found or zero balance.")
except Exception as e:
st.error(f"An error occurred: {e}")
else:
st.warning("Please enter both wallet address and token mint address.")