Update app.py
Browse files
app.py
CHANGED
|
@@ -1,51 +1,59 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
import
|
| 4 |
import requests
|
| 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 |
else:
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
# Prompt the user to enter their wallet address
|
| 36 |
-
wallet_address = input("Please enter your wallet address: ")
|
| 37 |
-
required_amount = float(input("Please enter the required amount: "))
|
| 38 |
-
|
| 39 |
-
# Run the check
|
| 40 |
-
token_mint_address = "ReplaceWithYourTokenMintAddress"
|
| 41 |
-
asyncio.run(check_wallet(wallet_address, token_mint_address, required_amount))
|
| 42 |
-
|
| 43 |
-
# Install required dependencies:
|
| 44 |
-
# pip install solana requests
|
| 45 |
-
|
| 46 |
-
"""
|
| 47 |
-
This script is designed to check if a given Solana wallet holds a certain token and the required amount.
|
| 48 |
-
To use this script:
|
| 49 |
-
1. Replace "ReplaceWithYourTokenMintAddress" with the actual token mint address.
|
| 50 |
-
2. The script will prompt the user to paste their wallet address and required token amount.
|
| 51 |
-
"""
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
|
| 3 |
+
import streamlit as st
|
| 4 |
import requests
|
| 5 |
|
| 6 |
+
st.title("Solana Wallet Verifier")
|
| 7 |
+
|
| 8 |
+
# Input fields for the wallet address and token mint address
|
| 9 |
+
wallet_address = st.text_input("Enter your Solana wallet address:")
|
| 10 |
+
token_mint_address = st.text_input("Enter the token mint address:")
|
| 11 |
+
|
| 12 |
+
if st.button("Verify"):
|
| 13 |
+
if wallet_address and token_mint_address:
|
| 14 |
+
try:
|
| 15 |
+
# Solana RPC endpoint
|
| 16 |
+
rpc_endpoint = "https://api.mainnet-beta.solana.com"
|
| 17 |
+
|
| 18 |
+
# Prepare the request payload
|
| 19 |
+
payload = {
|
| 20 |
+
"jsonrpc": "2.0",
|
| 21 |
+
"id": 1,
|
| 22 |
+
"method": "getTokenAccountsByOwner",
|
| 23 |
+
"params": [
|
| 24 |
+
wallet_address,
|
| 25 |
+
{"mint": token_mint_address},
|
| 26 |
+
{"encoding": "jsonParsed"}
|
| 27 |
+
]
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
# Send the request
|
| 31 |
+
response = requests.post(rpc_endpoint, json=payload)
|
| 32 |
+
result = response.json()
|
| 33 |
+
|
| 34 |
+
# Check if any token accounts were found
|
| 35 |
+
if 'result' in result and 'value' in result['result'] and len(result['result']['value']) > 0:
|
| 36 |
+
# Get the balance (assuming only one account for simplicity)
|
| 37 |
+
token_account = result['result']['value'][0]
|
| 38 |
+
balance_info = token_account['account']['data']['parsed']['info']['tokenAmount']
|
| 39 |
+
amount = int(balance_info['amount']) # amount in the smallest unit
|
| 40 |
+
|
| 41 |
+
# Adjust for token decimals
|
| 42 |
+
decimals = balance_info['decimals']
|
| 43 |
+
adjusted_amount = amount / (10 ** decimals)
|
| 44 |
+
|
| 45 |
+
# Compare the adjusted amount to thresholds
|
| 46 |
+
if adjusted_amount >= 3333333:
|
| 47 |
+
st.success("✅ Guaranteed OG Status")
|
| 48 |
+
elif adjusted_amount >= 333333:
|
| 49 |
+
st.success("✅ Guaranteed WLT Status")
|
| 50 |
+
elif adjusted_amount >= 33333:
|
| 51 |
+
st.success("✅ Guaranteed WLR Status")
|
| 52 |
+
else:
|
| 53 |
+
st.error("You do not meet any status requirements.")
|
| 54 |
+
else:
|
| 55 |
+
st.error("Token account not found or zero balance.")
|
| 56 |
+
except Exception as e:
|
| 57 |
+
st.error(f"An error occurred: {e}")
|
| 58 |
else:
|
| 59 |
+
st.warning("Please enter both wallet address and token mint address.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|