Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on call tronWeb.utils.abi.decodeParamsV2ByABI() #464

Closed
VannaKarenina opened this issue Dec 12, 2023 · 1 comment
Closed

error on call tronWeb.utils.abi.decodeParamsV2ByABI() #464

VannaKarenina opened this issue Dec 12, 2023 · 1 comment

Comments

@VannaKarenina
Copy link

error on call

tronWeb.utils.abi.decodeParamsV2ByABI(
        {
          "constant": false,
          "outputs": [
            {
              "name": "_to",
              "type": "address"
            },
            {
              "name": "_value",
              "type": "uint256"
            }
          ],
          "name": "transfer",
          "payable": false,
          "stateMutability": "nonpayable",
          "type": "function"
        },   
'a9059cbb00000000000000000000004112afe011e48f1bb557b3f3305431b25325e841c9000000000000000000000000000000000000000000000000000000000002e630'
)

transaction: https://tronscan.org/#/transaction/074da622d44ff303b756dc8a4a1bcc02944a28fcbdcadf350ec1376c4738daca

error:
invalid arrayify value (argument=\"value\", value=\"a9059cbb00000000000000000000004112afe011e48f1bb557b3f3305431b25325e841c9000000000000000000000000000000000000000000000000000000000002e630\", code=INVALID_ARGUMENT, version=bytes/5.7.0)"}

@start940315
Copy link
Contributor

First, the leading 8 chars of your data is the hash of the function, you have to remove it.
Then, since we are using ethers decoder, you have to remove the leading '41' of your address in data.
Last, data should be prefixed with '0x'.
So finally, you need to change data to '0x00000000000000000000000012afe011e48f1bb557b3f3305431b25325e841c9000000000000000000000000000000000000000000000000000000000002e630';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants