@iqprotocol/abstract-storage
v0.15.1
Published
This package is part of [IQ Protocol JS SDK.](https://github.com/iqlabsorg/iq-sdk-js)
Downloads
1
Keywords
Readme
Abstract Storage
This package is part of IQ Protocol JS SDK.
| :exclamation: The package is in development and breaking changes should be expected. Use at your own risk! | |:------------------------------------------------------------------------------------------------------------------|
The IQ Protocol off-chain state management is storage agnostic and relies on storage providers to implement required functionality.
This package provides AccountStore
class which can be extended to implement store specific provider.
Use this package when you want to implement a new storage provider.
Installation
yarn add @iqprotocol/abstract-storage
Usage
All AccountStore
implementations use built-in account state validator by default. It is also possible to provide a custom validator.
import { AccountStore, AccountStateValidator } from '@iqprotocol/abstract-storage';
class CustomStore extends AccountStore {
// ...
}
class CustomAccountStateValidator implements AccountStateValidator {
// ...
}
const validator = new CustomAccountStateValidator();
const customStore = new CustomStore({ validator });