Skip to content

tetherto/lib-wallet-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lib-wallet-store 💼🗃️

A flexible and extensible library for wallet data storage, supporting multiple storage engine implementations.

💼 Wallet SDK

This library is part of the Wallet SDK.

📚 Table of Contents

🔍 Overview

lib-wallet-store provides a consistent interface for wallet data storage, allowing developers to choose or implement the storage engine that best fits their needs. Whether you need in-memory storage, file-based persistence, or distributed data structures, lib-wallet-store offers a unified API to work with various backend technologies.

✨ Features

  • 🔢 Consistent key-value storage API
  • 🔌 Pluggable storage engine architecture
  • 🔄 Asynchronous operations
  • 🧩 Support for multiple instances
  • 🔐 Designed for wallet data management

🔧 Usage

Here's a quick example of how to use lib-wallet-store with the Hyperbee engine:

const { WalletStoreHyperbee } = require('lib-wallet-store');

async function example() {
  const store = new WalletStoreHyperbee({});
  await store.init();

  await store.put('key1', 'value1');
  const value = await store.get('key1');
  console.log(value); // Outputs: value1

  await store.close();
}

example();

💾 Storage Engines

lib-wallet-store currently supports the following storage engines:

  1. Hyperbee Engine: Utilizes the Hyperbee data structure for efficient and distributed storage.

To implement a new storage engine:

  1. Create a new class that extends the base WalletStore class.
  2. Implement the required methods: init(), get(), put(), delete(), clear(), close(), etc.
  3. Place your implementation in the project's root directory (e.g., wallet-store-yourenginename.js).

🛠 Development

To set up the development environment:

  1. Clone the repository:

    git clone https://github.com/tetherto/lib-wallet-store.git
    cd lib-wallet-store
  2. Install dependencies:

    npm install
  3. Start coding! 👨‍💻👩‍💻

🧪 Testing

We use the Brittle testing framework for our unit tests.

To run the tests:

  1. Make sure you have the testing dependencies installed:

    npm install brittle
  2. Run the tests:

    npm run test

🤝 Contributing

Contributions are welcome! Here are some ways you can contribute:

  • Implement new storage engines
  • Improve existing implementations
  • Add more test cases
  • Enhance documentation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published