Spaces:
Sleeping
Sleeping
File size: 1,017 Bytes
d5fa359 2b4e914 d5fa359 2b4e914 d5fa359 2b4e914 6c55499 94fc647 2b4e914 d5fa359 2b4e914 d5fa359 2b4e914 d5fa359 6c55499 2b4e914 d5fa359 2b4e914 d5fa359 2b4e914 d5fa359 a3839ff |
1 2 3 4 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 33 34 35 36 37 38 |
import httpx
async def TokenCheck(address):
url = "https://mainnet.helius-rpc.com/?api-key=4e833ada-d32c-48c5-b020-c11b2253f25b"
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getTokenAccountsByOwner",
"params": [
address,
{"mint": "ENwLiycC5yWgWVTCYn6A4277HD5cFygxtxBuUuE3pump"},
{"encoding": "jsonParsed"}
],
}
try:
async with httpx.AsyncClient() as client:
response = await client.post(url, json=payload)
response.raise_for_status()
data = response.json()
except Exception:
return False
token_accounts = data.get("result", {}).get("value")
if not token_accounts:
return False
try:
account_info = token_accounts[0]["account"]["data"]["parsed"]["info"]
token_amount = account_info["tokenAmount"]
ui_amount = float(token_amount.get("uiAmount"))
except:
return False
return ui_amount >= 100000
|