Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #63 from ar-io/update-readme
Browse files Browse the repository at this point in the history
chore(readme): add example for syncing state
  • Loading branch information
dtfiedler authored Nov 21, 2023
2 parents 3357bf4 + 35fa9eb commit dd84862
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ e.g.
curl localhost:3000/v1/contract/bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U
```

For more advanced features of Warp caching and state evaluation (e.g. D.R.E nodes), refer to the [Warp] documentation.
For more advanced features of Warp caching and state evaluation (e.g. [D.R.E nodes]), refer to the [Warp] documentation.

### LMDB
### SQLite

This service uses the `warp-contracts-lmdb` for storing contract state. The LMDB is stored in the `./cache` directory. To clear the LMDB, run:
This service uses the `warp-contracts-sqlite` for storing contract state. The sqlite database is stored in the `./cache` directory. To clear the Warp cache, run:

```shell
rm -rf ./cache
Expand All @@ -65,6 +65,17 @@ rm -rf ./cache

By default, the service will load `Contract-Manifest` tags for state evaluation.

### Syncing State

Similar to [D.R.E nodes], the service can be configured to sync state for a given contract. This is useful for contracts with large number of interactions that may take a long time to evaluate locally. To sync state from this service via [Warp], you can use `syncState()` with the `/v1/contract/${CONTRACT_ID}` endpoint:

```js
const contract = await warp
.contract(CONTRACT_TX_ID)
.setEvaluationOptions(evaluationOptions)
.syncState(`https://api.arns.app/v1/contract/${CONTRACT_TX_ID}`);
```

## Configuration

The service can be configured using environment variables. The following environment variables are supported:
Expand Down Expand Up @@ -122,3 +133,4 @@ https://api.arns.app/api-docs
[prettier]: https://prettier.io/
[eslint]: https://eslint.org/
[Warp]: https://academy.warp.cc/docs/docs-intro
[D.R.E nodes]: https://academy.warp.cc/docs/dre/overview

0 comments on commit dd84862

Please sign in to comment.