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

1.2 KiB

Lighthouse Watcher

Setup

Deploy a Lighthouse contract:

yarn lighthouse:deploy

Use the Lighthouse contract address and set environments/local.toml to watch the contract.

[watch]
  lighthouse = "0xLighthouseContractAddress"

Run

Build files:

$ yarn build

Run the server:

$ 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

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:

yarn lighthouse:store --lighthouse 0xLighthouseContractAddress --cid testCid --store-config testConfig --file-cost 10

Smoke test

To run a smoke test:

  • Start the server.

  • Run:

    $ yarn smoke-test