simolus3 / web3dart

Ethereum library, written in Dart.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for struct type defined in contract?

cryptobys-rami opened this issue · comments

commented

Hi - Can I pass a struct (which I've defined in my contract) as an argument to a function call to my contract from my flutter app?

This is not currently supported by the generator, but you could pass the struct as a list of elements I think.

commented

I wonder whether lists in dart and structs in solidity are serialised the same way?

They should be. In the solidity ABI, structs are described as tuples which web3dart maps to Dart lists.

commented

I can confirm I've managed to pass as a list as you suggested - thank you.

One issue I'm struggling with is that im making contract calls which should revert (I know that because they revert on my JS script) - however from my flutter app all I get back is the transaction hash. Is it the case that there's no support for this in the library? or do I just not know how to find it? Basically they are require statements in my contract which should fail due to the arguments I'm sending across (they fail through my JS test script). Thanks.

commented

For good order, ill close this issue as the original issue is solved. Also good to know that I've managed to verify a signature signed off chain, passed into my flutter app, and submitted to the contract for verification. Wouldn't have worked unless the data matched perfectly.