vialabs_stellar_common/lib.rs
1//! # VIA Labs Stellar Common
2//!
3//! Common interfaces, types, and utilities for Stellar contracts in the VIA cross-chain messaging system.
4//!
5//! This crate provides the foundational components for building cross-chain applications on Stellar
6//! that integrate with the VIA messaging protocol. It includes interfaces for message clients and
7//! gateways, encoding/decoding utilities, error types, and storage abstractions.
8//!
9//! ## Features
10//!
11//! - **Message Client Interface**: Trait and base implementation for contracts that send and receive
12//! cross-chain messages
13//! - **Message Gateway Interface**: Trait for the gateway contract that routes messages between chains
14//! - **Encoding Utilities**: ABI encoding/decoding for EVM and VIA message formats
15//! - **Error Types**: Comprehensive error handling for cross-chain operations
16//! - **Storage Abstractions**: Common storage keys and data structures
17//! - **Handler Interfaces**: Traits for fee, gas, and POS (Proof of Stake) handlers
18//!
19//! ## Usage
20//!
21//! Add this crate to your `Cargo.toml`:
22//!
23//! ```toml
24//! [dependencies]
25//! vialabs-stellar-common = "0.1.8"
26//! ```
27//!
28//! ## Example
29//!
30//! ```rust,no_run
31//! use vialabs_stellar_common::message_client_v4::MessageClientV4Interface;
32//! use soroban_sdk::{Env, Address};
33//!
34//! // Implement the trait for your contract
35//! #[contractimpl]
36//! impl MessageClientV4Interface for MyContract {
37//! fn message_process(env: &Env, message: ProcessFromGatewayRequest) {
38//! // Handle incoming cross-chain message
39//! }
40//! }
41//! ```
42
43#![no_std]
44
45pub mod encoding;
46pub mod errors;
47pub mod events;
48pub mod fee;
49pub mod gas;
50pub mod message_client_v4;
51pub mod message_gateway_v4;
52pub mod pos;
53pub mod storage;
54pub mod utils;