From 687998035b73eaa0f7ef39a9267a16546a96fd9f Mon Sep 17 00:00:00 2001 From: Fuyao Zhao Date: Sat, 23 Nov 2024 02:17:26 +0800 Subject: [PATCH] adjust nodes --- README.md | 1 - api/data.md | 30 ++++++++++--------- api/debug-and-simulation.md | 5 +++- best-practices/best-way-to-manage-nodejs.md | 12 ++------ best-practices/cost-reduction.md | 2 -- .../how-to-handle-proxy-contracts.md | 2 -- best-practices/multi-chain-support.md | 2 +- best-practices/performance-tuning.md | 2 -- .../processor-state-and-execution-order.md | 2 +- best-practices/upgrade-sdk-version.md | 4 +-- quickstart.md | 6 ++-- setup.md | 2 +- 12 files changed, 29 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index b26e5cd..da2e31c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,6 @@ If there are issues or problem can't be resolved in the doc, please contact us * [Telegram](https://t.me/sentioxyz) * For the documentation issues, you can contact (Telegram:qiaokan@) directly. - [block:html] { "html": "
quickstart
Quickstart
" diff --git a/api/data.md b/api/data.md index c5bf93f..04788a3 100644 --- a/api/data.md +++ b/api/data.md @@ -9,7 +9,7 @@ For subgraph project, you could use both [SQL API](https://docs.sentio.xyz/refer ## Insight API -The easiest way to build query is through UI, you could first create an insight chart, +The easiest way to build query is through UI, you could first create an insight chart, and then @@ -82,21 +82,24 @@ curl -L -X POST 'https://app.sentio.xyz/api/v1/metrics/sentio/coinbase/query_ran When configuring a time range, you can specify the `start` and `end` times, as well as the `step` interval and `timezone`. Below are the details on how to set these parameters: 1. **Start and End Time**: - - **"now"**: Represents the current time, usually used in the `end` field. - - **"now-x[dmsy]"**: Represents the time range starting from the last specified period until now. For example, `now-30d` means the last 30 days from now. The units can be: - - "s" for seconds - - "m" for minutes - - "d" for days - - "w" for weeks - - "mo" for months - - "y" for years - - **Milliseconds since January 1, 1970, UTC**: You can specify a precise time using the number of milliseconds since the Unix epoch (January 1, 1970, UTC). For example, `1716430188709`. + + - **"now"**: Represents the current time, usually used in the `end` field. + - **"now-x[dmsy]"**: Represents the time range starting from the last specified period until now. For example, `now-30d` means the last 30 days from now. The units can be: + - "s" for seconds + - "m" for minutes + - "d" for days + - "w" for weeks + - "mo" for months + - "y" for years + - **Milliseconds since January 1, 1970, UTC**: You can specify a precise time using the number of milliseconds since the Unix epoch (January 1, 1970, UTC). For example, `1716430188709`. 2. **Step**: - - The interval time of data in seconds. This controls how frequently data points should appear in your range. For example, if you set `step` to `3600`, data points will appear at one-hour intervals. Please note that the actual step may be adjusted if the interval is short but the date range is long. Typically, the total number of data points should not exceed 1000. + + - The interval time of data in seconds. This controls how frequently data points should appear in your range. For example, if you set `step` to `3600`, data points will appear at one-hour intervals. Please note that the actual step may be adjusted if the interval is short but the date range is long. Typically, the total number of data points should not exceed 1000. 3. **Timezone**: - - Specify the timezone using the tz database name. You can find the appropriate timezone from this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For example, `America/New_York` or `Asia/Tokyo`. + + - Specify the timezone using the tz database name. You can find the appropriate timezone from this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For example, `America/New_York` or `Asia/Tokyo`. #### Example Configuration @@ -118,7 +121,6 @@ Here’s an example configuration that uses these parameters: This configuration ensures that you get hourly data points for the last 30 days, adjusted to the specified timezone. - ## SQL API For SQL API, go to "Data Studio" -> "SQL Editor", write your query and then click "Export as cURL" @@ -140,7 +142,7 @@ curl -L -X POST 'https://app.sentio.xyz/api/v1/analytics/sentio/coinbase/sql/exe ## Cache Control -Each API could directly control cache strategy by adding an `cachePolicy` field as follow. The default cache behavior is have a long cache TTL and short refresh TTL, so the query is cached most of the time but if it's stale trigger background refreshing. +Each API could directly control cache strategy by adding an `cachePolicy` field as follow. The default cache behavior is have a long cache TTL and short refresh TTL, so the query is cached most of the time but if it's stale trigger background refreshing. ``` { diff --git a/api/debug-and-simulation.md b/api/debug-and-simulation.md index 599f0ac..d901e92 100644 --- a/api/debug-and-simulation.md +++ b/api/debug-and-simulation.md @@ -5,6 +5,7 @@ slug: debug-and-simulation --- ## Debug API + ### Get Indexed Call Trace API to get Sentio call trace. It takes `txId.txHash` and `networkId` arguments, where the first is transaction hash, and the second is the numeric ethereum chain ID. An example call looks like the following. @@ -15,7 +16,7 @@ curl --header 'api-key: ' \ --location 'https://app.sentio.xyz/api/v1/solidity/call_trace?txId.txHash=0x4564f9720643fcf54732172d1f29b9a5f16991ca5ae171307181851c37511089&networkId=1' ``` -The results looks very similar to the normal [Ethereum call trace](https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers). But we have an additional `startIndex` and `startIndex` on each trace entry even for the LOG, representing the execution order in the trace. +The results looks very similar to the normal [Ethereum call trace](https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers). But we have an additional `startIndex` and `startIndex` on each trace entry even for the LOG, representing the execution order in the trace. This allows you to build chart that marks the order of fund flow. @@ -32,7 +33,9 @@ curl --header 'api-key: ' \ An extra `withInternalCalls=true` parameter could be attach to fetch the decoded trace, which will give you the function info, decoded parameters of both external and internal call trace. ## Simulation API + ### Create simulation + #### Single Simulation The simulation body should be included in the request body. You can follow the example below. diff --git a/best-practices/best-way-to-manage-nodejs.md b/best-practices/best-way-to-manage-nodejs.md index c0c409a..94e4949 100644 --- a/best-practices/best-way-to-manage-nodejs.md +++ b/best-practices/best-way-to-manage-nodejs.md @@ -23,23 +23,17 @@ Then you can follow the instructions:
> ℹ️ -> +> > Make sure you restart the terminal or run `source ~/.zshrc` - Then you can run this command to install node of a specific version ```bash -nvm install 16 -nvm install 18 +nvm install 22 ``` If you have multiple versions, you can use this command to switch versions ```bash -nvm use 18 -nvm use 16 +nvm use 22 ``` - - - diff --git a/best-practices/cost-reduction.md b/best-practices/cost-reduction.md index 92caf2a..80b2b54 100644 --- a/best-practices/cost-reduction.md +++ b/best-practices/cost-reduction.md @@ -8,8 +8,6 @@ hidden: false [metrics](metrics "mention")has the lowest unit cost. If you can use metrics without [avoid-high-cardinality](avoid-high-cardinality "mention"), it is always the best option to achieve best query speed and lowest cost. - - ## Reduce interval from onTimeInterval, onBlockInterval or onVersionInterval From [handlers-and-filters](handlers-and-filters "mention"), we introduced that processor could wake up and execute a handler, then emit some data. You could always adjust the interval to reduce the frequency, thus reduce the cost. diff --git a/best-practices/how-to-handle-proxy-contracts.md b/best-practices/how-to-handle-proxy-contracts.md index ceb9818..9fd4049 100644 --- a/best-practices/how-to-handle-proxy-contracts.md +++ b/best-practices/how-to-handle-proxy-contracts.md @@ -8,8 +8,6 @@ It is very common that users are using proxy contracts on EVM chain. For proxy c * Sentio needs ABI for the underlying implementation contract. You can find the proxy contract address from etherscan as follows - -
* In processor binding, it does not matter which address you bind with. Sentio can work with both the proxy address or the underlying contract address. diff --git a/best-practices/multi-chain-support.md b/best-practices/multi-chain-support.md index c6f59b8..52b022d 100644 --- a/best-practices/multi-chain-support.md +++ b/best-practices/multi-chain-support.md @@ -4,4 +4,4 @@ categorySlug: best-practices hidden: false --- -Sentio allows users to write monitoring code in the same processor for different chains (**Yes, Even for EVM and non-EVM chains!!**). This is pretty convenient for monitoring multi-chain application. See [this](https://github.com/sentioxyz/sentio-processors/tree/main/projects/pyth) for an example. +Sentio allows users to write monitoring code in the same processor for different chains (**Yes, Even for EVM and non-EVM chains!!**). This is pretty convenient for monitoring multi-chain application. See [this](https://github.com/sentioxyz/sentio-processors/tree/main/projects/pyth) for an example. diff --git a/best-practices/performance-tuning.md b/best-practices/performance-tuning.md index a550b2a..2b81f7e 100644 --- a/best-practices/performance-tuning.md +++ b/best-practices/performance-tuning.md @@ -8,8 +8,6 @@ hidden: false It is possible that you have too much data, one trick you can do is to use [#resolution](metrics-in-processors#resolution "mention") to reduce the number of data points stored. Note, this is for [#gauge](metrics#gauge "mention")only at this moment. - - ## My Processor backfill is too slow, what should I do? Check if you are making too many **Node RPC** calls in the processor, this might cause a major slow down. One trick is to reduce the intervals from `onBlockInterval` and `onTimeInterval`. diff --git a/best-practices/processor-state-and-execution-order.md b/best-practices/processor-state-and-execution-order.md index 8c039e3..be6391e 100644 --- a/best-practices/processor-state-and-execution-order.md +++ b/best-practices/processor-state-and-execution-order.md @@ -8,6 +8,6 @@ hidden: false Processor is executing (semi-)chronologically: It might not have consistent ordering among all the different [handlers-and-filters](handlers-and-filters "mention"). So please DO NOT ASSUME any order when you write the logic inside the processor. For example, if you are using global variables, please **DO NOT assume** if ordering of access from different handlers. -## State +## State **DO NOT** assume processor in-memory state is restart-safe. Thus, please **DO NOT rely** on global variables being persistent at all time. diff --git a/best-practices/upgrade-sdk-version.md b/best-practices/upgrade-sdk-version.md index ab33d25..cc4b5a4 100644 --- a/best-practices/upgrade-sdk-version.md +++ b/best-practices/upgrade-sdk-version.md @@ -9,7 +9,5 @@ You can upgrade your SDK version by modifying `package.json`
> ℹ️ -> +> > You can track the latest version from [https://www.npmjs.com/package/@sentio/sdk](https://www.npmjs.com/package/@sentio/sdk) - - diff --git a/quickstart.md b/quickstart.md index 05e2d23..49891b9 100644 --- a/quickstart.md +++ b/quickstart.md @@ -5,10 +5,9 @@ hidden: false --- > ℹ️ -> +> > In this section, we will show you how to set up a simple project to monitor an ERC20 contract. - ## Step 1: Create a Sentio Account Simply go to [https://app.sentio.xyz](https://app.sentio.xyz) and login/create your account. @@ -35,10 +34,9 @@ npx @sentio/cli@latest create The commands will generate a template project based on [X2Y2 token](https://github.com/X2Y2-io/x2y2-sdk). This should be a good starting point to write your own processor logic. It is also possible to create template projects for other types of chains, please refer [CLI Reference](cli-reference#sentio-create). > ℹ️ -> +> > You can directly **modify the code (**`src/processor.ts`**)** to fit your use case as well. - Sentio has a list of builtin ABIs. We also support custom ABIs for your own project. See [decoding-from-custom-abis](decoding-from-custom-abis "mention") for more details. For more information on how to write a processor you can refer to [processor-basic](processor-basic "mention") diff --git a/setup.md b/setup.md index 32dfaa8..d7d2c38 100644 --- a/setup.md +++ b/setup.md @@ -6,7 +6,7 @@ hidden: false ## Before you begin -Sentio requires users to install [**node (v18+)**](https://nodejs.dev/en/) before uploading user code. +Sentio requires users to install [**node (v22+)**](https://nodejs.dev/en/) before uploading user code. To install node, please follow the instructions [here](https://nodejs.dev/en/).