Cloudflare worker used to retrieve and cache from the Filecoin PDP Service Providers.
Create indexer/.dev.vars file with the following content:
SECRET_HEADER_KEY=X-SECRET-KEY
SECRET_HEADER_VALUE=SecretToken
CHAINALYSIS_API_KEY=YourChainalysisApiKey
Create piece-retriever/.dev.vars file with the following content:
BOT_TOKENS="{\"secret\":\"dev\"}"
Create terminator/.dev.vars file with the following content:
FILCDN_CONTROLLER_ADDRESS_PRIVATE_KEY=0xSomePrivateKey
-
Install dependencies
npm install -
Run tests
npm test -
Fix linting and formatting issues:
npm run lint:fix
After you make any change affecting the content of the env object, run the following command to update the auto-generated TypeScript definitions:
npm run build:types
-
Choose a wallet address you will use for the requests, e.g.
0x123. -
Edit your
/etc/hostsfile and add an entry for0x123.localhost:127.0.0.1»foo.localhost -
Start the retriever worker locally
npm start -w piece-retriever
npm start -w indexer
Run the following command to reset the wrangler local environment, including the local database:
rm -rf db/.wranglerIn order to deploy your worker via Github Actions, you need to have a Cloudflare API token.
Add generated API token to Github secrets as CLOUDFLARE_API_TOKEN.
After setting up secrets, you can push your code to Github and worker will be deployed to production environment automatically.