Accelernate commited on
Commit
edbe8ca
Β·
verified Β·
1 Parent(s): ab0a8b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -52
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 Address
9
- TOKEN_MINT_ADDRESS = "PR9SDkf1SxrJqSXzQyoR17VdGZ1ZgWMiRcS5VtYmis1"
10
-
11
- else:
12
- TOKEN_MINT_ADDRESS = "9yT1p7grHJh3uKw3sp9XrQwNtCtAKDa8mqpMW2Y9BLz5"
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
- # Prepare the request payload
24
- payload = {
25
- "jsonrpc": "2.0",
26
- "id": 1,
27
- "method": "getTokenAccountsByOwner",
28
- "params": [
29
- wallet_address,
30
- {"mint": TOKEN_MINT_ADDRESS},
31
- {"encoding": "jsonParsed"}
32
- ]
33
- }
34
-
35
- # Send the request
36
- response = requests.post(rpc_endpoint, json=payload)
37
- result = response.json()
38
-
39
- # Check if any token accounts were found
40
- if (
41
- 'result' in result and
42
- 'value' in result['result'] and
43
- len(result['result']['value']) > 0
44
- ):
45
- # Get the balance (assuming only one account for simplicity)
46
- token_account = result['result']['value'][0]
47
- balance_info = token_account['account']['data']['parsed']['info']['tokenAmount']
48
- amount = int(balance_info['amount']) # amount in the smallest unit
49
-
50
- # Adjust for token decimals
51
- decimals = balance_info['decimals']
52
- adjusted_amount = amount / (10 ** decimals)
53
-
54
- # Display the amount the user holds
55
- st.write(f"You hold {adjusted_amount:,.0f} tokens.")
56
-
57
- # Compare the adjusted amount to thresholds
58
- if adjusted_amount >= 3333333:
59
- st.success("βœ… Guaranteed OG Status")
60
- elif adjusted_amount >= 333333:
61
- st.success("βœ… Guaranteed WLT Status")
62
- elif adjusted_amount >= 33333:
63
- st.success("βœ… Guaranteed WLR Status")
64
  else:
65
- st.error("You don't have enough tokens yet πŸ‘»")
 
 
 
 
 
 
 
 
66
  else:
67
- adjusted_amount = 0
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"{adjusted_amount:,.0f}" # Replace with your actual Token Amount field name
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)