Following the web3 documentation https://web3py.readthedocs.io/en/stable/examples.html#looking-up-transactions , I can get the transaction information like i have done below.
But it seems like i cant get the exact amount of token swapped in the transaction? In the random transaction in the example the person swapped 55 BUSD for 20,997.266937044506585321 Shit coin tokens, how can i accesss that information?
from web3 import Web3
import json
bsc = 'https://bsc-dataseed.binance.org/'
web3 = Web3(Web3.HTTPProvider(bsc))
result = web3.eth.get_transaction("0x77c5949df82ce8625d9e578fc696bc7264c99dbea4f763ce1fcdbe59dac5f029")
tx_json = Web3.toJSON(result)
json_obj = json.loads(tx_json)
print(json_obj)
output:
{'blockHash': '0x337d54009908f38c18b23bb5c22a1d0f204619513a76d4f8906708616e37f9cd', 'blockNumber': 19758221, 'from': '0x6Fa03B624d296ca2ecAbc75740228Ee9E0d018Ec', 'gas': 624870, 'gasPrice': 50000
00000, 'hash': '0x77c5949df82ce8625d9e578fc696bc7264c99dbea4f763ce1fcdbe59dac5f029', 'input': '0x5c11d795000000000000000000000000000000000000000000000002fb474098f67c000000000000000000000000000000
000000000000000000044cd383c04096e0098700000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006fa03b624d296ca2ecabc75740228ee9e0d018ec00000000000000000000000000000
00000000000000000000000000062d9eb130000000000000000000000000000000000000000000000000000000000000003000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000bb4cdb9c
bd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000031b35fdaa0780a75dd08a1a631c03e34fcef7173', 'nonce': 117, 'to': '0x10ED43C718714eb63d5aA57B78B54704E256024E', 'transactionIndex': 45, 'value
': 0, 'type': '0x0', 'v': 147, 'r': '0xbcf641aaa83dc321f185d961fde7625b7ad09a86390646015c8b92193186adcb', 's': '0x33546afae31ff2b87d797ed45abe7ad3494760578d36791ff03a76dc11446d7e'}