Skip to content

Commit

Permalink
adjust nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
zfy0701 committed Nov 22, 2024
1 parent 8fa821f commit 6879980
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 41 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<div class=\"embed\"><a class=\"embed-link\" href=\"quickstart\"><div class=\"embed-body\"><small class=\"embed-provider\"><code style=\"font-family:var(--md-code-font, monospace)\">quickstart</code></small><div style=\"font-size: 15px\">Quickstart</div></div></a></div>"
Expand Down
30 changes: 16 additions & 14 deletions api/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,&#x20;
The easiest way to build query is through UI, you could first create an insight chart,

and then

Expand Down Expand Up @@ -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

Expand All @@ -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"
Expand All @@ -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.&#x20;
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.

```
{
Expand Down
5 changes: 4 additions & 1 deletion api/debug-and-simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -15,7 +16,7 @@ curl --header 'api-key: <API_KEY>' \
--location 'https://app.sentio.xyz/api/v1/solidity/call_trace?txId.txHash=0x4564f9720643fcf54732172d1f29b9a5f16991ca5ae171307181851c37511089&#x26;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.&#x20;
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.

Expand All @@ -32,7 +33,9 @@ curl --header 'api-key: <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.
Expand Down
12 changes: 3 additions & 9 deletions best-practices/best-way-to-manage-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,17 @@ Then you can follow the instructions:
<figure><img src="https://raw.githubusercontent.com/sentioxyz/docs/main/.gitbook/assets/image (31) (1).png" alt=""><figcaption></figcaption></figure>

> ℹ️
>
>
> 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
```



2 changes: 0 additions & 2 deletions best-practices/cost-reduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 0 additions & 2 deletions best-practices/how-to-handle-proxy-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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



<figure><img src="https://raw.githubusercontent.com/sentioxyz/docs/main/.gitbook/assets/proxy.gif" alt=""><figcaption></figcaption></figure>

* 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.
2 changes: 1 addition & 1 deletion best-practices/multi-chain-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.&#x20;
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.
2 changes: 0 additions & 2 deletions best-practices/performance-tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
2 changes: 1 addition & 1 deletion best-practices/processor-state-and-execution-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&#x20;
## State

**DO NOT** assume processor in-memory state is restart-safe. Thus, please **DO NOT rely** on global variables being persistent at all time.
4 changes: 1 addition & 3 deletions best-practices/upgrade-sdk-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ You can upgrade your SDK version by modifying `package.json`
<figure><img src="https://raw.githubusercontent.com/sentioxyz/docs/main/.gitbook/assets/image (3) (1) (2).png" alt=""><figcaption></figcaption></figure>

> ℹ️
>
>
> You can track the latest version from [https://www.npmjs.com/package/@sentio/sdk](https://www.npmjs.com/package/@sentio/sdk)

6 changes: 2 additions & 4 deletions quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.&#x20;
Expand All @@ -35,10 +34,9 @@ npx @sentio/cli@latest create <project name>
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).&#x20;

> ℹ️
>
>
> 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.&#x20;

For more information on how to write a processor you can refer to [processor-basic](processor-basic "mention")
Expand Down
2 changes: 1 addition & 1 deletion setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).

Expand Down

0 comments on commit 6879980

Please sign in to comment.