@xo-cash/state
v0.0.2
Published
XO Cash state management and storage package for the XO Engine
Maintainers
Readme
@xo-cash/state
XO state management and storage package for the XO Engine. This package provides a unified interface for managing local state persistence and synchronization with remote state servers.
⚠️ This project is in early development phase. Use it only if you understand what you are doing and accept the risks. Do not use funds you are not willing to lose. Minor version bumps may introduce breaking changes
Overview
The state package is responsible for:
- Local State Persistence: Storing and retrieving XO templates, invitations, locking bytecodes, unspent outputs, and events
- Storage Abstraction: Providing a consistent API across different storage backends (Supported: IndexedDB and SQLite)
- State Synchronization: Managing state sync with remote servers
Installation
npm install @xo-cash/stateBasic Setup
import { createStorageAdapter, StorageType, State } from '@xo-cash/state';
// Create a storage adapter
const storage = await createStorageAdapter({
storageType: StorageType.INDEXEDDB,
databasePath: './',
databaseFilename: 'XO',
});
// Create a state instance
const state = new state(storage);
// Use the state
await state.storeTemplate(template);
const template = await state.getTemplate('template-id');Links
License
MIT
