* feat: add coinbase to ccxt fetcher * Remove plain coin from ccxt * Remove coinbase fetcher remainings * Repopulate main manifest
2.5 KiB
How to add a new source
We will use words source and fetcher. Сonsider them to be synonymous.
Select a name for the new source
First, you should select a name for your source.
It should use kebab case, for example: source, good-source, the-best-source.
Source name must be unique, because it will unambiguously identify your source.
Implementation
Implement source (fetcher)
Create a folder with a name of your fetcher in src/fetchers. Place the code of your fetcher inside of this folder and update src/fetchers/index.ts file to export your source. For more information check out BaseFetcher code and implementation of other fetchers, like coingecko, coingecko fetcher, and ecb.
Implement tests
We strongly recommend to implement tests for your fetcher. It's generaly a good practice and it will help you to avoid silly bugs in your code. You can find examples of tests for other fetchers in the test/fetchers folder.
Manifest(s)
- Create a manifest with the name of the newly added fetcher and place it in the manifests folder
- [Optional] If the source should be used in the main redstone provider, run
node tools/manifest/generate-main-manifest.js
Sources config [optional]
Should I do this?
Sources config file is used in the RedStone web app. If you want your source to be visible there you should add it to config and update the app appropriately.
How to add a source to config
- Add source details to the
tools/config/predefined-configs/sources.jsonfile - Run
yarn build. It is required bygenerate-sources-config.jsso it can work correctly - Run
node tools/config/generate-sources-config.jsto generate sources config. It will be saved tosrc/config/sources.json - Download logo for the newly created source
- You can simply download it in browser and save as
<SOURCE_NAME>.<IMG_EXTENSTION> - Or you can run
node tools/cdn-images/download-source-logos.js, but it will download logos for all sources
- You can simply download it in browser and save as
- Upload the source logo to RedStone CDN (manually through AWS S3 web interface)
- Run
node tools/cdn-images/update-sources-config.jsto replace logo urls in sources config with redstone CDN urls - Update
redstone-nodedependency in redstone-app for being able to use the new source config file