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