Track Wallet Activity
Retrieves transaction history, token balances, and real-time activities of a wallet.
// def get_wallet_activity(wallet_address):
url = f"{BASE_URL}/api/wallet/{wallet_address}"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
wallet_data = response.json()
return wallet_data
except requests.exceptions.RequestException as e:
print(f"Error fetching wallet activity: {e}")
return None
# Example wallet address
WALLET_ADDRESS = "EXAMPLE_WALLET"
# Fetch and display wallet activity
wallet_activity = get_wallet_activity(WALLET_ADDRESS)
if wallet_activity:
print("Wallet Activity:")
print(wallet_activity)
Response Example:
//{
"wallet": "EXAMPLE_WALLET",
"balance": "250 SOL",
"tokens": [
{"token": "TOKEN_A", "symbol": "TKA", "balance": 100},
{"token": "TOKEN_B", "symbol": "TKB", "balance": 50}
],
"recent_transactions": [
{
"tx_hash": "0x123",
"type": "buy",
"token": "TOKEN_A",
"amount": 20,
"timestamp": "2024-02-14T13:10:30Z"
},
{
"tx_hash": "0x456",
"type": "sell",
"token": "TOKEN_B",
"amount": 10,
"timestamp": "2024-02-14T13:15:45Z"
}
]
}
Last updated