web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.16k stars 543 forks source link

encodeParameters return result is error.... #271

Open dawnvi opened 2 years ago

dawnvi commented 2 years ago

ABI JSON

{ "inputs": [ { "internalType": "address[]", "name": "a", "type": "address[]" }, { "internalType": "bytes[]", "name": "b", "type": "bytes[]" } ], "name": "mingStatic", "outputs": [ { "internalType": "bool[]", "name": "c", "type": "bool[]" }, { "internalType": "bytes[]", "name": "d", "type": "bytes[]" } ], "stateMutability": "view", "type": "function" }


address[] = ["0xA4BA016374696E2f75668F7F21280b23b5dA6624", "0xA4BA016374696E2f75668F7F21280b23b5dA6624"] bytes[] = ["0x06fdde03","0x95d89b41"]

use https://abi.hashex.org/ return abi data

d332f922000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a4ba016374696e2f75668f7f21280b23b5da6624000000000000000000000000a4ba016374696e2f75668f7f21280b23b5da6624000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000406fdde0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000495d89b4100000000000000000000000000000000000000000000000000000000 =========================== run me php code $d= [['0xA4BA016374696E2f75668F7F21280b23b5dA6624','0xA4BA016374696E2f75668F7F21280b23b5dA6624'],['0x06fdde03','0x95d89b41']]; $this->abi->encodeParameters(['address[]','bytes[]'], $d)

return result is d332f922000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a4ba016374696e2f75668f7f21280b23b5da6624000000000000000000000000a4ba016374696e2f75668f7f21280b23b5da66240000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000406fdde0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000495d89b4100000000000000000000000000000000000000000000000000000000 I don't understand why.

dawnvi commented 2 years ago

https://github.com/web3p/web3.php/compare/master...dawnvi:patch-1