Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs on events #223

Merged
merged 6 commits into from
Jan 11, 2024
Merged

Docs on events #223

merged 6 commits into from
Jan 11, 2024

Conversation

timothymcmackin
Copy link
Collaborator

@timothymcmackin timothymcmackin commented Dec 22, 2023

@timothymcmackin timothymcmackin self-assigned this Dec 22, 2023
@timothymcmackin timothymcmackin requested a review from a team as a code owner December 22, 2023 21:56
Copy link

vercel bot commented Dec 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-staging ✅ Ready (Inspect) Visit Preview Jan 10, 2024 1:50pm

onedebos
onedebos previously approved these changes Jan 2, 2024
beatalipska
beatalipska previously approved these changes Jan 2, 2024
@timothymcmackin timothymcmackin changed the title First draft of a topic on events Docs on events Jan 9, 2024
@@ -16,6 +16,7 @@ Unlike functions and API endpoints, entrypoints do not return a value directly t
To return a value from a smart contract, you can use one of these methods:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be misleading, as onchain Views is indeed a way for returning value from contract to contract. But the Events is not. It's an indirect way, as an off-chain routine is needed for triggering following up actions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this to:

  • Use Views to return data to smart contracts or off-chain applications
  • Use Events to return data to off-chain applications

date: 28 December 2023
---

Events are operations that allow smart contracts to send information to off-chain applications.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

  • If we want to be more precise, it's one type of internal operation of Tezos.
  • "send" could be a bit misleading here, as it could make people think it's a way to actively trigger or execute an off-chain application from a smart contract.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trimmed this down to:

Events are a type of internal operation on Tezos. Smart contracts emit events and off-chain applications can listen for events to know when things happen on the chain.


```json
{
"opHash": "onw8EwWVnZbx2yBHhL72ECRdCPBbw7z1d5hVCJxp7vzihVELM2m",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

We can actually find the result here (click view RPC JSON). It's more clear that Event is an internal operation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it enough to say this? Is there an RPC call I can do from the command line to get that JSON? Might be good to mention that.

You can see the complete content of the event operation by looking up the operation hash in a block explorer. For example, to see the operation in the previous example, look up the operation onw8EwWVnZbx2yBHhL72ECRdCPBbw7z1d5hVCJxp7vzihVELM2m.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :)

@timothymcmackin timothymcmackin merged commit 0fedff7 into staging Jan 11, 2024
4 checks passed
@timothymcmackin timothymcmackin deleted the events branch January 11, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants