Releases: Forest-Protocols/provider-template
v3.2.0
Features
- "Best practices and tips" documentation is added
- Typos from the current documentations are fixed
- [IMPORTANT] Ability to read private keys from
providers.jsonfile is removed. Please pass your private keys to the daemon via environment variables
Fixes
- SDK dependency updated
- Block processed logs converted from INFO to DEBUG
- Added more error handlers to prevent crashes
- Added persistent XMTP session (database) into
data/directory. Be sure that it has the correct permissions (777) if you run in Docker container - Dockerfile uses proper layering.
v3.1.0
Features
- Ability to define Protocol address to be listened via an Environment variable. If the variable is not set, uses the first registered Protocol.
Fixes
- Update SDK dependency
- Use
nonceManagerfor Provider account in order to handle concurrent transactions - Catch the errors from Agreement creation and deletion events
- Bug related with if the block doesn't contain any TX (mostly happen in local dev environment), the block is not saving as processed to the database.
v3.0.0
Breaking Changes
- XMTP v2 will end support by May 1. Now Provider template uses XMTP v3 and this version doesn't have backward compatibility. No need to do additional work, just update your provider template. Check for more info.
Features
- Rate limit feature is added and can be configurable via
RATE_LIMITenv variable. - Forest Registry smart contract address can be given as an env variable.
Fixes
- If the OpenAPI spec file is not readable, then send
Not Foundresponse back. Old implementation was sending "OK" with an empty body
v2.0.0
⚠️ Breaking Changes
Naming conventions
All of the followings words are replaced;
- Product Category -> Protocol
- Product Category Owner -> Protocol Owner
- Forest Protocol -> Forest Network
These naming conventions are applied on the documentation and code level. That means if you are using a method or variable that includes one of the words above in its name, you'll need to update them as well.
Also don't forget to update params/body of your endpoints with the new naming convention (for instance pc -> pt)
The processed block storing approach
In the previous approach, we were saving all of the processed blocks to the database which is an unnecessary action. Now only the latest processed block are saved to the database. So you need to delete the old records. Otherwise the daemon will get the first record as the latest processed block which may be wrong.
Connect to the database via psql or any other tool that you prefer. If you are using docker in order to run daemon, you can use the following command to run psql:
docker exec -it <database container name or ID> psql -U postgresYou can check container name and ID via
docker ps -acommand.
Then run the SQL query below:
DELETE FROM blockchain_transactions WHERE height NOT IN (
SELECT height FROM blockchain_transactions ORDER BY height DESC LIMIT 1
);READMEs are moved to docs folder
All of the README files are renamed that represents their content and moved to the docs folder. Only the main README file is left in the root of the repository in order to make it visible on GitHub. Don't forget to align the content of your READMEs with the updated ones (for instance new READMEs includes new CLI commands which applies naming convention).
⚙️ Features
Ability to read provider configuration from env variables
Now it is possible to pass private keys of the providers directly via environment variables without using providers.json file. To do that you need to follow the naming convention below for the environment variables:
PROVIDER_PRIVATE_KEY_<provider tag>=
BILLING_PRIVATE_KEY_<provider tag>=
OPERATOR_PRIVATE_KEY_<provider tag>=For instance if you have "main" tag, your environment variables would look like this;
PROVIDER_PRIVATE_KEY_main="0x...."
BILLING_PRIVATE_KEY_main="0x...."
OPERATOR_PRIVATE_KEY_main="0x...."Example OpenAPI spec within data/spec.yaml
Added an example spec file which you can refactor according to your Protocol definition.
Healthcheck server
Added a simple healthcheck server with Express. It only has one endpoint which is /health. Default port is 3000 but you can change it via PORT environment variable.
Some new READMEs are added:
- How to synchronize your repository with the base one
- How to write OpenAPI spec for your Protocol
🩹 Fixes
Use body or params in GET /resources endpoint
Now /resources endpoint can use either body or params in order to take parameters from the request.
GET /resources endpoint accepts pc or pt
Because of the new naming convention, now /resources endpoint accept either pc (for backward compatibility) or pt as Protocol (formerly Product Category) address within params/body params
providers.json file ignored by Docker by default
.dockerignore is updated. Now it only ignores providers.json instead of the whole data directory. So you can easily include that data directory (which has publicly accessible data) within your containers except providers.json (which has senstive data)