neo-project / neo-express

Neo Private Net optimized for development scenarios
MIT License
35 stars 37 forks source link

Add support to 'await' the contract run command #433

Open lock9 opened 7 months ago

lock9 commented 7 months ago

Is your feature request related to a problem? Please describe. Neo Express will only return the transaction results if you send the --results flag. However, these transactions aren't saved. If we use the --account parameter, the transaction is saved but the response is the transaction hash and not the results.

Describe the solution you'd like Add a flag or equivalent to the contract run feature (using an account parameter) to return the transaction results instead of the transaction hash.

Additional context The output can be too verbose if we include all the transaction fields. It could print the existing 'results' fields plus the transaction hash:

VM State:     FAULT
Gas Consumed: 1111470
Exception:   Index was outside the bounds of the array.
Transaction: <hash>
chenzhitong commented 1 month ago

Is it possible to do it this way: Call the contract once with --result flag, then send the transaction out with --account flag, although the transaction hash will change, the script executed will be the same. This would accomplish what you need, output the contract execution result, and send the transaction.

I think the "options" parameter of the neoxp command is now too much and a bit complicated to use. It's better not to add new options. (if the above is feasible)

chenzhitong commented 1 month ago

The output can be too verbose if we include all the transaction fields. It could print the existing 'results' fields plus the transaction hash: VM State: FAULT Gas Consumed: 1111470 Exception: Index was outside the bounds of the array. Transaction:

I think the most important reason is that the result of running locally may be different from the result of the transaction executing on the blockchain (e.g. the execution result is related to the block height, related to the random number, related to the storage area), and directly outputting the execution result and the transaction will cause an error.