63 lines
2.0 KiB
Python
63 lines
2.0 KiB
Python
import requests
|
|
|
|
# --- 配置 ---
|
|
ADDRESS = "0xADcA20376A6CdCBd232577ac830F4116eC863DcF"
|
|
# Polygonscan API (使用公共接口)
|
|
POLYGONSCAN_API = "https://api.polygonscan.com/api"
|
|
|
|
|
|
def diagnose_wallet(addr):
|
|
print(f"探针启动: 正在扫描地址 {addr}\n")
|
|
|
|
# 1. 检查 USDC.e 余额 (Polymarket 必须资产)
|
|
# USDC.e 合约地址: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
|
|
usdc_contract = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
|
|
|
|
params = {
|
|
"module": "account",
|
|
"action": "tokenbalance",
|
|
"contractaddress": usdc_contract,
|
|
"address": addr,
|
|
"tag": "latest"
|
|
}
|
|
|
|
try:
|
|
r = requests.get(POLYGONSCAN_API, params=params).json()
|
|
balance = int(r.get('result', 0)) / 1e6
|
|
print(f"💵 当前 USDC.e 余额: {balance:.2f} USD")
|
|
if balance < 1:
|
|
print("⚠️ 警告: 余额不足 1 美元,之前的买入操作极大概率失败了。")
|
|
except:
|
|
print("❌ 无法获取 USDC 余额")
|
|
|
|
# 2. 检查最近的交易记录
|
|
print("\n--- 最近 5 条链上交易记录 ---")
|
|
tx_params = {
|
|
"module": "account",
|
|
"action": "tokentx",
|
|
"address": addr,
|
|
"startblock": 0,
|
|
"endblock": 99999999,
|
|
"page": 1,
|
|
"offset": 5,
|
|
"sort": "desc"
|
|
}
|
|
|
|
try:
|
|
r = requests.get(POLYGONSCAN_API, params=tx_params).json()
|
|
txs = r.get('result', [])
|
|
if not txs or isinstance(txs, str):
|
|
print("📭 链上查无交易。结论: 之前的买入脚本未能在链上发出任何指令。")
|
|
else:
|
|
for tx in txs:
|
|
print(f"🕒 时间: {tx.get('timeStamp')}")
|
|
print(
|
|
f"📦 代币: {tx.get('tokenSymbol')} | 数量: {int(tx.get('value')) / 10 ** int(tx.get('tokenDecimal')):.2f}")
|
|
print(f"🔗 Hash: {tx.get('hash')[:20]}...")
|
|
print("-" * 20)
|
|
except:
|
|
print("❌ 无法获取交易记录")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
diagnose_wallet(ADDRESS) |