1

I have a function in my smart contract called getRandomNumer, and it returns a bytes32. However, in brownie, when I make a transaction it returns the transaction receipt.

How do I get the return value?

requestId = vrf_consumer.getRandomNumber(get_seed, {'from': accounts[0]})
1

You want to use .call which will simulate the transaction going through. Just to note, if you send the transaction again, and then call .call again, it will be different. Here are some examples;

requestId is the transaction receipt:

requestId = vrf_consumer.getRandomNumber(get_seed, {'from': accounts[0]})

requestId is the requestId (returned value):

requestId = vrf_consumer.getRandomNumber.call(get_seed, {'from': accounts[0]})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.