forked from ChainBuff/open-sol-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpump.py
More file actions
25 lines (19 loc) · 846 Bytes
/
pump.py
File metadata and controls
25 lines (19 loc) · 846 Bytes
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
import httpx
from solbot_cache.cached import cached
from solbot_common.config import settings
from solbot_common.utils.shyft import ShyftAPI
@cached(ttl=None)
async def is_pumpfun_token(mint_address):
shyft_api = ShyftAPI(settings.api.shyft_api_key)
resp = await shyft_api.get_token_info(mint_address)
metadata_uri = resp.get('metadata_uri')
if not metadata_uri:
return False
# 2. Fetch the off-chain metadata JSON asynchronously
async with httpx.AsyncClient(timeout=10.0) as client:
meta_resp = await client.get(metadata_uri)
meta_resp.raise_for_status()
metadata = meta_resp.json()
created_on = metadata.get("createdOn") or metadata.get("created_on")
# 3. Check if it originated from pump.fun
return isinstance(created_on, str) and "pump.fun" in created_on.lower()