7

using web3 (python3) I am trying to decode InputData of the BSC transaction as seen on BscScan enter image description here

In some solutions I've found code below is being used:

import web3
from web3.contract import Contract
...
contract = web3.eth.contract(address=Web3.toChecksumAddress(tokenAddress), abi=abi)
contract.functions.decode_function_input(transaction.input)

However, the abi's doesn't seem to have this function "decode_function_input" defined, as I am getting an error:

"web3.exceptions.ABIFunctionNotFound: ("The function 'decode_function_input' was not found in this contract's abi. ", 'Are you sure you provided the correct contract abi?')"

I am 100% that the abi is correct. Also, on BscScan contract raw view, the function 'decode_function_input' indeed is not present.

Any other solutions, how to decode the Input Data?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Penko_Mlakar
  • 79
  • 1
  • 4

1 Answers1

0

It's not contract.functions.decode_function_input, it is contract.decode_function_input()

TylerH
  • 20,799
  • 66
  • 75
  • 101
Mr. AdityaYT
  • 51
  • 1
  • 6
  • 1
    It seems that I've forgotten the include the correct syntax and error due to so many tries. I have the code as you specified, however, I am getting this error: "ValueError: Could not find any function with matching selector" – Penko_Mlakar Jan 24 '22 at 17:16
  • 1
    I've figured it out!!! I thought I need to use tokenAddress and ABI for the token in question, while it was the pancakeswap V2 router address that was actually required! – Penko_Mlakar Jan 24 '22 at 17:26