watcher-ts/packages/lighthouse-watcher
Ashwin Phatak a7ec3d8da8
Add APGL license and copyright notices (#212)
* Add license & copyright declarations for add-watcher.

* Add copyright declarations for cache.

* Add copyright declarations for erc20-watcher.

* Add copyright declarations for ipld-eth-client.

* Add copyright declarations for tracing-client.

* Add copyright declarations for uni-watcher.

* Add copyright declarations for solidity-mapper.

* Add copyright declarations for uni-info-watcher.

* Add copyright declarations for util.

* Add copyright declarations for lighthouse-watcher.

* Change license identifier in .sol files.

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-12 15:28:13 +05:30
..
environments Remove unused settings from lighthouse config. (#210) 2021-08-12 10:33:23 +05:30
src Add APGL license and copyright notices (#212) 2021-08-12 15:28:13 +05:30
tasks Add APGL license and copyright notices (#212) 2021-08-12 15:28:13 +05:30
test/contracts Lighthouse watcher (#205) 2021-08-11 17:27:49 +05:30
.eslintignore Lighthouse watcher (#205) 2021-08-11 17:27:49 +05:30
.eslintrc.json Lighthouse watcher (#205) 2021-08-11 17:27:49 +05:30
.gitignore Lighthouse watcher (#205) 2021-08-11 17:27:49 +05:30
.mocharc.yml Lighthouse watcher (#205) 2021-08-11 17:27:49 +05:30
hardhat.config.ts Lighthouse watcher (#205) 2021-08-11 17:27:49 +05:30
package.json Add APGL license and copyright notices (#212) 2021-08-12 15:28:13 +05:30
README.md Lighthouse watcher (#205) 2021-08-11 17:27:49 +05:30
tsconfig.json Lighthouse watcher (#205) 2021-08-11 17:27:49 +05:30

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

Run the server:

$ yarn server

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