Hi
Is it possible to return an array from a function call? Specifically, I want an array of IDs of in-progress crowd-funding opportunities from a crowd-funding contract.
The documentation is unclear on this and I can't find any examples.
Thanks if you can help
James
0 ·
Comments
https://github.com/ethereum/wiki/wiki/Solidity-Tutorial#arrays
The feature is quite high on the priority list, though.
Note that due to a limitation of the EVM, returning variably-sized arrays from message-calls will only work for transactions, not internal calls. The reason is that the size of the returned data has to be known beforehand.
I am also listening to state changes and transaction calls in the contract via events, which are working reliably for me, but they can only be used to track events (I think) while the client is listening. My simple use-case would be a mechanism for a web-app to connect to a node, and retrieve all in-progress items in a contract (e.g. a crowd-funding contract, which can support multiple simultaneous funding drives). I see that the filter watch can specify a from and to: block, so I will test whether a JSON / HTML UI client can disconnect from the node and then reconnect later and start listening again, and pick up all events from the last time it connected. But it would still imply that the UI client needs to maintain the contract state, based on events it accumulated, rather than being able to query multiple records in the contract in one go.
An alternative would be for a standalone application to maintain parallel state in a separate database, but this forms a single point of failure.
Please shout if I am completely misunderstanding the issue