Skip to content

Commit

Permalink
Language change from default -> maximum
Browse files Browse the repository at this point in the history
  • Loading branch information
mollykarcher committed Nov 11, 2024
1 parent 371e544 commit 86f8b66
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/build/guides/dapps/frontend-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ This is made possible by using the `server.getEvents` method which allows you to

We will be editing the `CounterPage` component to read events from the counter smart contract immediately the page loads to get the initial counter value and update instead of using "Unknown". Before we continue, please take a look at the [contract code](https://github.com/stellar/soroban-examples/blob/main/events/src/lib.rs). In the contract code, an event named `increment` is emitted whenever the `increment` function is called. It is published over 2 topics, `increment` and `COUNTER` and we need to listen to these topics to get the events.

The topics are stored in a data type called `symbol` and we will need to convert both `increment` and `COUNTER` to `symbol` before we can use them in the [`server.getEvents`](https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents) method. By default, soroban RPCs keep track of events for 7 days and you can query events that happened within the last 7 days, so if you need to store events for longer, you may need to make use of an [indexer](/docs/tools/developer-tools/data-indexers).
The topics are stored in a data type called `symbol` and we will need to convert both `increment` and `COUNTER` to `symbol` before we can use them in the [`server.getEvents`](https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents) method. At maximum, soroban RPCs keep track of events for 7 days and you can query events that happened within the last 7 days, so if you need to store events for longer, you may need to make use of an [indexer](/docs/tools/developer-tools/data-indexers).

To use events,we edit our counter page and add the following code:

Expand Down
4 changes: 2 additions & 2 deletions docs/build/guides/events/ingest.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: Ingest events published from a contract
description: Use Soroban RPC's getEvents method for querying events, with a 7 days retention window
description: Use Soroban RPC's getEvents method for querying events, with a 7 day retention window
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

Soroban RPC provides a `getEvents` method which allows you to query events from a smart contract. However, the data retention window for these events is 7 days. If you need access to a longer-lived record of these events you'll want to "ingest" the events as they are published, maintaining your own record or database as events are ingested.
Soroban RPC provides a `getEvents` method which allows you to query events from a smart contract. However, the data retention window for these events is 7 days at most. If you need access to a longer-lived record of these events you'll want to "ingest" the events as they are published, maintaining your own record or database as events are ingested.

There are many strategies you can use to ingest and keep the events published by a smart contract. Among the simplest might be using a community-developed tool such as [Mercury](https://mercurydata.app) which will take all the infrastructure work off your plate for a low subscription fee.

Expand Down
2 changes: 1 addition & 1 deletion docs/learn/encyclopedia/contract-development/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Events are the mechanism that applications off-chain can use to monitor changes

:::info

Events are ephemeral, the data retention window is 7 days. See the [ingestion guide](../../../build/guides/events/ingest.mdx) to learn how to work with this constraint.
Events are ephemeral, the data retention window is a maximum of 7 days. See the [ingestion guide](../../../build/guides/events/ingest.mdx) to learn how to work with this constraint.

:::

Expand Down
2 changes: 1 addition & 1 deletion openrpc/src/stellar-rpc/methods/getEvents.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "getEvents",
"summary": "returns contract events",
"description": "Clients can request a filtered list of events emitted by a given ledger range.\n\nSoroban-RPC will support querying within a maximum 7 days of recent ledgers.\n\nNote, this could be used by the client to only prompt a refresh when there is a new ledger with relevant events. It should also be used by backend Dapp components to \"ingest\" events into their own database for querying and serving.\n\nIf making multiple requests, clients should deduplicate any events received, based on the event's unique id field. This prevents double-processing in the case of duplicate events being received.\n\nBy default soroban-rpc retains the most recent 7 days of events.",
"description": "Clients can request a filtered list of events emitted by a given ledger range.\n\nSoroban-RPC will support querying within a maximum 7 days of recent ledgers.\n\nNote, this could be used by the client to only prompt a refresh when there is a new ledger with relevant events. It should also be used by backend Dapp components to \"ingest\" events into their own database for querying and serving.\n\nIf making multiple requests, clients should deduplicate any events received, based on the event's unique id field. This prevents double-processing in the case of duplicate events being received.\n\nBy default soroban-rpc retains the most recent 24 hours of events.",
"externalDocs": {
"url": "https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents"
},
Expand Down
2 changes: 1 addition & 1 deletion static/stellar-rpc.openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{
"name": "getEvents",
"summary": "returns contract events",
"description": "Clients can request a filtered list of events emitted by a given ledger range.\n\nSoroban-RPC will support querying within a maximum 7 days of recent ledgers.\n\nNote, this could be used by the client to only prompt a refresh when there is a new ledger with relevant events. It should also be used by backend Dapp components to \"ingest\" events into their own database for querying and serving.\n\nIf making multiple requests, clients should deduplicate any events received, based on the event's unique id field. This prevents double-processing in the case of duplicate events being received.\n\nBy default soroban-rpc retains the most recent 7 days of events.",
"description": "Clients can request a filtered list of events emitted by a given ledger range.\n\nSoroban-RPC will support querying within a maximum 7 days of recent ledgers.\n\nNote, this could be used by the client to only prompt a refresh when there is a new ledger with relevant events. It should also be used by backend Dapp components to \"ingest\" events into their own database for querying and serving.\n\nIf making multiple requests, clients should deduplicate any events received, based on the event's unique id field. This prevents double-processing in the case of duplicate events being received.\n\nBy default soroban-rpc retains the most recent 24 hours of events.",
"externalDocs": {
"url": "https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents"
},
Expand Down

0 comments on commit 86f8b66

Please sign in to comment.