-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Problem with decoding complex types returned from contract function #2607
Comments
Web3.js is using the AbiCoder of ethers.js. Could you please open an issue in the ethers.js repository? |
I am confident that the problem lies on the Web3.js side and as I have written i have already fixed this, AbiCoder from ethers.js works correctly. |
Can you explain to me closer why it should be a problem with Web3.js? |
Method afterExecution in class CallContractMethod in web3-eth-contract/src/methods/CallContractMethod.js passes string to AbiCoder's method decodeParameter instead of AbiOutput and because of this, information about tuple's components is lost. Now it's: return this.abiCoder.decodeParameter(outputs[0].type, response); instead of: return this.abiCoder.decodeParameter(outputs[0], response); I fixed this in my fork already but I'm still investigating the use of decodeParameter method because I can see 'type' field from AbiOutput instance being passed to this function on one other occasion. |
Thanks! I've missed that case. Will fix and release it asap. |
Description
I am trying to call a method from blockchain contract which returns single value of type tuple[]:
part of ABI JSON regarding getAllUsers function:
on remix.ethereum.org when i call the function i get:
Expected behavior
users should be [["0xf2D38fC631d4FCFbAeDB274D2b95C436ab75a1B4", ...]]
Actual behavior
users is [[]]
Additional notes
I have already found the source of this error, will create PR soon.
Versions
The text was updated successfully, but these errors were encountered: