0

I have TxHash and TxInput. How i can get names tokens and amount?

I tried searching for information on how to do this and found a similar solution:

from web3 import Web3
import json
bsc = 'https://bsc-dataseed.binance.org/'
web3 = Web3(Web3.HTTPProvider(bsc))

# uniswap factory address and abi = pancakeswap factory
uniswap_factory = '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73'  
uniswap_factory_abi = json.loads("[{super long abi}]")
contract = web3.eth.contract(address=uniswap_factory, abi=uniswap_factory_abi)

#pancakeswap router abi
panRouterContractAddress = '0x10ED43C718714eb63d5aA57B78B54704E256024E'
panabi = "[{super long abi}]"
contractbuy = web3.eth.contract(address=panRouterContractAddress, abi=panabi)

result = 
web3.eth.get_transaction("0x77c5949df82ce8625d9e578fc696bc7264c99dbea4f763ce1fcdbe59dac5f029")
#tx_json = Web3.toJSON(result)
#json_obj = json.loads(tx_json)

#returns a tupple packed in these two objects
func_obj, func_params = contractbuy.decode_function_input(result["input"])

print(func_params)

but I don't understand where to get the contract ABI

1 Answer 1

1

You can generate the contract ABI using the following command:

solc <filename>.sol --abi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.