This repository contains examples of creating or consuming data using the LogStore technology.
src/basic: publish and query data from a simple streamsrc/listen-to-contract: publish and query data from a stream that listens for smart contract eventssrc/gas-station: consuming data from the Multi-Chain Gas Station public stream
- install using your favorite package manager. e.g.,
npm install - copy
.env.exampleto.envand fill in the required values - find and run scripts inside
package.json
Note: After using the LogStoreClient or the StreamrClient, it's important to destroy them to avoid memory leaks. You are also able to perform this action by using the Explicit Resource Management feature.
Example:
const yourFn = async () => {
const client = new StreamrClient(streamrOptions);
const lsClient = new LogStoreClient(client);
// Here we cleanup the streamr connections
using cleanup = new DisposableStack();
cleanup.defer(() => {
lsClient.destroy();
client.destroy();
});
// operations as normally
}; // -- at the end of this scope, the cleanup will be called- Fork and clone the repository.
- Create a new branch.
- Make and commit your changes.
- Push changes to GitHub.
- Create a pull request.
Notes:
- Some of these examples require you to create and stake the stream before executing it. Find out how to do this using our CLI.
- Log Levels: see
.env.examplefor details aboutLOG_LEVELvariable.
Check out our documentation for more details about the LogStore
Join our Discord to get in touch with the team and community.
