Crate vialabs_stellar_common

Crate vialabs_stellar_common 

Source
Expand description

§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:

[dependencies]
vialabs-stellar-common = "0.1.8"

§Example

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
    }
}

Modules§

encoding
errors
events
fee
gas
message_client_v4
message_gateway_v4
pos
storage
utils