watcher-ts/packages/lighthouse-watcher/README.md
Ashwin Phatak 2d493b3838
Run services from transpiled ES5 (#239)
* Transpile ES5 code.

* Use transpiled ES5 code in all packages.

* Refactor tracing-client to transpile ES5 code.

* Order scripts in package json.

* Update readme in packages with new scripts.

* Refactor code to use entity config programatically.

* Remove unused depencdencies.

* Use DEBUG environment for scripts.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-09-02 10:27:56 +05:30

90 lines
1.2 KiB
Markdown

# Lighthouse Watcher
## Setup
Deploy a Lighthouse contract:
```bash
yarn lighthouse:deploy
```
Use the Lighthouse contract address and set `environments/local.toml` to watch the contract.
```toml
[watch]
lighthouse = "0xLighthouseContractAddress"
```
## Run
Build files:
```bash
$ yarn build
```
Run the server:
```bash
$ yarn server
# For development.
$ yarn server:dev
# For specifying config file.
$ yarn server -f environments/local.toml
```
## Test
To test the watcher locally:
Open graphql playground at http://127.0.0.1:3005/graphql and set a subscription query
```graphql
subscription {
onEvent {
block {
hash
number
timestamp
}
tx {
hash
}
contract
eventIndex
event {
__typename
... on StorageRequestEvent {
uploader
cid
config
fileCost
}
}
proof {
data
}
}
}
```
To trigger StorageRequest event locally, run:
```bash
yarn lighthouse:store --lighthouse 0xLighthouseContractAddress --cid testCid --store-config testConfig --file-cost 10
```
### Smoke test
To run a smoke test:
* Start the server.
* Run:
```bash
$ yarn smoke-test
```