feat: Add basic project structure and initial crates

- Added basic project structure with workspace and crates:
  `kvstore`, `vault`, `evm_client`, `cli_app`, `web_app`.
- Created initial `Cargo.toml` files for each crate.
- Added placeholder implementations for key components.
- Included initial documentation files (`README.md`, architecture
  docs, repo structure).
- Included initial implementaion for kvstore crate(async API, backend abstraction, separation of concerns, WASM/native support, testability)
- Included native and browser tests for the kvstore crate
This commit is contained in:
2025-05-13 20:24:29 +03:00
commit 9dce815daa
19 changed files with 1213 additions and 0 deletions

26
kvstore/src/traits.rs Normal file
View File

@@ -0,0 +1,26 @@
//! Async trait for key-value storage
use crate::error::Result;
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
/// Async key-value store interface.
///
/// For native (non-wasm32) backends, implementers should be `Send + Sync` to support runtime-agnostic async usage.
/// For WASM (wasm32) backends, `Send + Sync` is not required and types may not implement them.
///
/// Methods:
/// - get
/// - set
/// - remove (was delete)
/// - contains_key (was exists)
/// - keys
/// - clear
pub trait KVStore {
async fn get(&self, key: &str) -> Result<Option<Vec<u8>>>;
async fn set(&self, key: &str, value: &[u8]) -> Result<()>;
async fn remove(&self, key: &str) -> Result<()>;
async fn contains_key(&self, key: &str) -> Result<bool>;
async fn keys(&self) -> Result<Vec<String>>;
async fn clear(&self) -> Result<()>;
}