I have in a contract:
function createCourt() external returns (uint256) {
uint256 _id = ++nonce;
courtOwners[_id] = msg.sender;
return _id;
}
Now, when I try to call this function from web3.js I stumble an impossibility to return values.
I was recommened to use events instead to return a value. But if I and another user calls createCourt()
:
function createCourt() external {
uint256 _id = ++nonce;
courtOwners[_id] = msg.sender;
emit CourtCreated(_id);
}
how can I determine which of several events returned my court, not another one?
Or any other way to get the court number after I create it?