Reputation: 21
from TonTools import TonCenterClient
import asyncio
async def get_wallet_transactions(client: TonCenterClient, address: str, limit=1):
try:
transactions = await client.get_transactions(address=address, limit=limit)
return transactions
except Exception as e:
print(f"Error fetching transactions: {e}")
return []
async def main():
try:
client = TonCenterClient()
wallet_address = "UQCCDxNsruUYtSHBWL1P10hsheRNEFkohytYbsmsM9sM53Cb"
transactions = await get_wallet_transactions(client, wallet_address)
for transaction in transactions:
print(transaction)
except ModuleNotFoundError as e:
print("Error")
asyncio.run(main())
Result:
Transaction({"type": "out", "utime": 1733854739, "status": true, "hash": "BbF8dumQxYJkyCY/VUQVhkBYHr9yKG9/EKGRkN0luWE=", "value": 0.165780593, "from": "EQCCDxNsruUYtSHBWL1P10hsheRNEFkohytYbsmsM9sM5y1e", "to": "EQBBf4HnTz5lx5xz4yUzCExjWlVKKxL7uXIZIiyu2aLvUuhn", "comment": ""})
I have created this script to get the latest transaction details from my Ton Wallet.
you can see at the result there was from
and to
that refers to the sender wallet address and the receiver wallet address.
But the problem i'm facing is its showing false data. I mean at this result both from & to
addresses are completely different from the actual transaction addresses why?
Also i have reconfirmed the transaction data by opening it on the tonviewer at my browser
Kindly please help if anyone know
Upvotes: 1
Views: 22