Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: add return value for transactions

See original GitHub issue


Provide a simple overview of what you wish to see added. Please include:

Upon making a test for ERC20 Smart contract. We should add a return value for accounts.

tx = contract.myMutableMethod(...)
assert tx.return_value == ...  # .return_value doesn't exist

  • What you are trying to do
  • Why Ape’s current functionality is inadequate to address your goal


Describe the syntax and semantics of how you would like to see this feature implemented. The more detailed the better!

Remember, your feature is much more likely to be included if it does not involve any breaking changes.


Include links to any open issues that must be resolved before this feature can be implemented.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

bantegcommented, Jul 10, 2022

this can be quite easily done now

def get_return_value(tx):
    call_tree = chain.provider.get_call_tree(tx)
    method_abi = Contract(call_tree.address).contract_type.mutable_methods[call_tree.calldata]
    output =, call_tree.returndata)
    if isinstance(output, tuple) and len(output) < 2:
        output = output[0] if len(output) == 1 else None
    return output
fubuloubucommented, Jul 12, 2022

@helloibis might be able to take a stab at adding this to the ReceiptAPI class as a .return_value property, and let it raise if the current provider does not implement .get_call_tree

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get return values when a non view function is called?
Answer.code, gas: 2000000}, function(e, contract) { if (!e) { if(!contract.address) { console.log("Contract transaction send: TransactionHash: " ...
Read more >
Unchecked Return value in Smart Contracts as an attack surface
In the above snippet of code, “Test” Contract can modify “accBalance” variable in “Account” Contract. The return value of the .call() function is...
Read more >
Get contract return values from transaction recepts · Issue #1288
This is a proposal to give clients the ability to easily get contract return values and revert reasons from already completed transactions.
Read more >
NetSuite Applications Suite - Return Authorization (RMA) Forms
Adding Items to Web Store Categories · Featuring Items · Customizing Items in Your Site · Showing Items Without Prices · Using Transaction...
Read more >
Get values from RETURNING * within a transaction
A function runs inside a transaction automatically . You don't need explicit BEGIN / COMMIT. To reuse values you get back from an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found