Skip to content

usherlabs/logstore-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cover image

Log Store Examples

This repository contains examples of creating or consuming data using the LogStore technology.

  • src/basic: publish and query data from a simple stream
  • src/listen-to-contract: publish and query data from a stream that listens for smart contract events
  • src/gas-station: consuming data from the Multi-Chain Gas Station public stream

How to run it?

  • install using your favorite package manager. e.g., npm install
  • copy .env.example to .env and 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

How to contribute?

  1. Fork and clone the repository.
  2. Create a new branch.
  3. Make and commit your changes.
  4. Push changes to GitHub.
  5. 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.example for details about LOG_LEVEL variable.

Check out our documentation for more details about the LogStore

Join our Discord to get in touch with the team and community.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published