Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,13 @@
|
|
| 1 |
-
# app.py
|
| 2 |
-
|
| 3 |
import streamlit as st
|
| 4 |
import requests
|
| 5 |
|
| 6 |
st.title("Verify π»")
|
| 7 |
|
| 8 |
-
# Fixed Token Mint
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
# Input field for the wallet address
|
| 15 |
wallet_address = st.text_input("Enter your Solana wallet address:")
|
|
@@ -20,52 +18,57 @@ if st.button("Verify"):
|
|
| 20 |
# Solana RPC endpoint
|
| 21 |
rpc_endpoint = "https://api.mainnet-beta.solana.com"
|
| 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 |
-
st.
|
| 62 |
-
elif adjusted_amount >= 33333:
|
| 63 |
-
st.success("β
Guaranteed WLR Status")
|
| 64 |
else:
|
| 65 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
else:
|
| 67 |
-
|
| 68 |
-
st.error("No tokens found, try another address.")
|
| 69 |
|
| 70 |
# Log the query to Google Form
|
| 71 |
try:
|
|
@@ -73,7 +76,7 @@ if st.button("Verify"):
|
|
| 73 |
|
| 74 |
form_data = {
|
| 75 |
'entry.1721628210': wallet_address, # Replace with your actual Wallet Address field name
|
| 76 |
-
'entry.1357327531': f"{
|
| 77 |
}
|
| 78 |
|
| 79 |
response = requests.post(form_url, data=form_data)
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
|
| 4 |
st.title("Verify π»")
|
| 5 |
|
| 6 |
+
# Fixed Token Mint Addresses
|
| 7 |
+
TOKEN_MINT_ADDRESSES = [
|
| 8 |
+
"PR9SDkf1SxrJqSXzQyoR17VdGZ1ZgWMiRcS5VtYmis1", # Original mint address
|
| 9 |
+
"9yT1p7grHJh3uKw3sp9XrQwNtCtAKDa8mqpMW2Y9BLz5" # Additional mint address
|
| 10 |
+
]
|
| 11 |
|
| 12 |
# Input field for the wallet address
|
| 13 |
wallet_address = st.text_input("Enter your Solana wallet address:")
|
|
|
|
| 18 |
# Solana RPC endpoint
|
| 19 |
rpc_endpoint = "https://api.mainnet-beta.solana.com"
|
| 20 |
|
| 21 |
+
total_adjusted_amount = 0
|
| 22 |
+
|
| 23 |
+
for token_mint_address in TOKEN_MINT_ADDRESSES:
|
| 24 |
+
# Prepare the request payload
|
| 25 |
+
payload = {
|
| 26 |
+
"jsonrpc": "2.0",
|
| 27 |
+
"id": 1,
|
| 28 |
+
"method": "getTokenAccountsByOwner",
|
| 29 |
+
"params": [
|
| 30 |
+
wallet_address,
|
| 31 |
+
{"mint": token_mint_address},
|
| 32 |
+
{"encoding": "jsonParsed"}
|
| 33 |
+
]
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
# Send the request
|
| 37 |
+
response = requests.post(rpc_endpoint, json=payload)
|
| 38 |
+
result = response.json()
|
| 39 |
+
|
| 40 |
+
# Check if any token accounts were found
|
| 41 |
+
if (
|
| 42 |
+
'result' in result and
|
| 43 |
+
'value' in result['result'] and
|
| 44 |
+
len(result['result']['value']) > 0
|
| 45 |
+
):
|
| 46 |
+
# Get the balance (assuming only one account for simplicity)
|
| 47 |
+
token_account = result['result']['value'][0]
|
| 48 |
+
balance_info = token_account['account']['data']['parsed']['info']['tokenAmount']
|
| 49 |
+
amount = int(balance_info['amount']) # amount in the smallest unit
|
| 50 |
+
|
| 51 |
+
# Adjust for token decimals
|
| 52 |
+
decimals = balance_info['decimals']
|
| 53 |
+
adjusted_amount = amount / (10 ** decimals)
|
| 54 |
+
|
| 55 |
+
# Add to total amount
|
| 56 |
+
total_adjusted_amount += adjusted_amount
|
| 57 |
+
|
| 58 |
+
# Display the amount the user holds for each token
|
| 59 |
+
st.write(f"You hold {adjusted_amount:,.0f} tokens for mint address {token_mint_address}.")
|
|
|
|
|
|
|
| 60 |
else:
|
| 61 |
+
st.write(f"No tokens found for mint address {token_mint_address}.")
|
| 62 |
+
|
| 63 |
+
# Compare the total adjusted amount to thresholds
|
| 64 |
+
if total_adjusted_amount >= 333333:
|
| 65 |
+
st.success("β
Guaranteed OG Status")
|
| 66 |
+
elif total_adjusted_amount >= 33333:
|
| 67 |
+
st.success("β
Guaranteed WLT Status")
|
| 68 |
+
elif total_adjusted_amount >= 3333:
|
| 69 |
+
st.success("β
Guaranteed WLR Status")
|
| 70 |
else:
|
| 71 |
+
st.error("You don't have enough tokens yet π»")
|
|
|
|
| 72 |
|
| 73 |
# Log the query to Google Form
|
| 74 |
try:
|
|
|
|
| 76 |
|
| 77 |
form_data = {
|
| 78 |
'entry.1721628210': wallet_address, # Replace with your actual Wallet Address field name
|
| 79 |
+
'entry.1357327531': f"{total_adjusted_amount:,.0f}" # Replace with your actual Token Amount field name
|
| 80 |
}
|
| 81 |
|
| 82 |
response = requests.post(form_url, data=form_data)
|