kopanitsa / web3-arduino

an Arduino (or ESP32) library to use web3 on Ethereum platform.
MIT License
105 stars 45 forks source link

data encoding fails for specific type lengths #13

Open TbLtzk opened 5 years ago

TbLtzk commented 5 years ago

while data encoding works fine for uint, it fails for uint256

The correct functionality is already there. It does just not trigger. Ill come up with a fix for this...

TbLtzk commented 5 years ago

The issue is that sizeof("uint") returns 5 and not 4 as you expected.

The sizeof operator for string literals counts the terminating \0

JoaoCampos89 commented 5 years ago

@TbLtzk This fix worked! Before I cannot send data to the contract, now it works!

phoax commented 5 years ago

It works with uint, but it still not works with string and address. Any clue ?

TbLtzk commented 5 years ago

This issue does not apply to stringand address, because there are no variants of these types with specific length (there is no address32 or something). However, with all my PRs combined, we managed to submit a transaction at least with address parameter to the kovan testnet.

VDelport commented 1 year ago

@phoax @JoaoCampos89 @TbLtzk I am currently having the same problem. I want to pass a parameter to a smart contract function and just set that parameter to 0 or 1 in the smart contract function. Unfortunately this doesn't work no matter what data type I give the parameter, i.e. H. it doesn't work for me either with uint.

Do you still have the smart contract and the ESP program and would you please only post the relevant source code lines of the smart contract function and the ESP32 program here?