Update app.py
Browse files
app.py
CHANGED
|
@@ -5,12 +5,14 @@ import requests
|
|
| 5 |
|
| 6 |
st.title("Solana Wallet Verifier")
|
| 7 |
|
| 8 |
-
#
|
|
|
|
|
|
|
|
|
|
| 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
|
| 14 |
try:
|
| 15 |
# Solana RPC endpoint
|
| 16 |
rpc_endpoint = "https://api.mainnet-beta.solana.com"
|
|
@@ -22,7 +24,7 @@ if st.button("Verify"):
|
|
| 22 |
"method": "getTokenAccountsByOwner",
|
| 23 |
"params": [
|
| 24 |
wallet_address,
|
| 25 |
-
{"mint":
|
| 26 |
{"encoding": "jsonParsed"}
|
| 27 |
]
|
| 28 |
}
|
|
@@ -32,7 +34,11 @@ if st.button("Verify"):
|
|
| 32 |
result = response.json()
|
| 33 |
|
| 34 |
# Check if any token accounts were found
|
| 35 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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']
|
|
@@ -56,4 +62,4 @@ if st.button("Verify"):
|
|
| 56 |
except Exception as e:
|
| 57 |
st.error(f"An error occurred: {e}")
|
| 58 |
else:
|
| 59 |
-
st.warning("Please enter
|
|
|
|
| 5 |
|
| 6 |
st.title("Solana Wallet Verifier")
|
| 7 |
|
| 8 |
+
# Fixed Token Mint Address
|
| 9 |
+
TOKEN_MINT_ADDRESS = "PR9SDkf1SxrJqSXzQyoR17VdGZ1ZgWMiRcS5VtYmis1"
|
| 10 |
+
|
| 11 |
+
# Input field for the wallet address
|
| 12 |
wallet_address = st.text_input("Enter your Solana wallet address:")
|
|
|
|
| 13 |
|
| 14 |
if st.button("Verify"):
|
| 15 |
+
if wallet_address:
|
| 16 |
try:
|
| 17 |
# Solana RPC endpoint
|
| 18 |
rpc_endpoint = "https://api.mainnet-beta.solana.com"
|
|
|
|
| 24 |
"method": "getTokenAccountsByOwner",
|
| 25 |
"params": [
|
| 26 |
wallet_address,
|
| 27 |
+
{"mint": TOKEN_MINT_ADDRESS},
|
| 28 |
{"encoding": "jsonParsed"}
|
| 29 |
]
|
| 30 |
}
|
|
|
|
| 34 |
result = response.json()
|
| 35 |
|
| 36 |
# Check if any token accounts were found
|
| 37 |
+
if (
|
| 38 |
+
'result' in result and
|
| 39 |
+
'value' in result['result'] and
|
| 40 |
+
len(result['result']['value']) > 0
|
| 41 |
+
):
|
| 42 |
# Get the balance (assuming only one account for simplicity)
|
| 43 |
token_account = result['result']['value'][0]
|
| 44 |
balance_info = token_account['account']['data']['parsed']['info']['tokenAmount']
|
|
|
|
| 62 |
except Exception as e:
|
| 63 |
st.error(f"An error occurred: {e}")
|
| 64 |
else:
|
| 65 |
+
st.warning("Please enter your wallet address.")
|