vialabs-stellar-common 0.1.0

Common interfaces, types, and utilities for Stellar contracts in the VIA cross-chain messaging system
Documentation
vialabs-stellar-common-0.1.0 has been yanked.

Stellar Contract Interfaces

This directory contains shared interfaces, types, and traits that can be used across multiple Stellar contracts.

Structure

contracts/interfaces/
├── Cargo.toml          # Package configuration
├── src/
│   ├── lib.rs          # Main library file that re-exports all interfaces
│   ├── message_gateway_v4.rs  # Message Gateway V4 interface
│   └── token_interface.rs     # Token interface (example)

Usage

In Contract Cargo.toml

Add the interfaces as a dependency:

[dependencies]
soroban-sdk = { workspace = true }
interfaces = { workspace = true }

In Contract Code

Import and use the interfaces:

use vialabs_stellar_commonmessage_gateway_v4::{
    MessageGatewayV4Interface, 
    ProcessRequest, 
    SendRequested,
    SendProcessed
};

use vialabs_stellar_commontoken_interface::TokenInterface;

#[contract]
pub struct MyContract;

#[contractimpl]
impl MessageGatewayV4Interface for MyContract {
    // Implement the interface methods
}

Adding New Interfaces

  1. Create a new file in src/ (e.g., my_interface.rs)
  2. Define your interface traits and types
  3. Add the module to src/lib.rs:
    pub mod my_interface;
    
  4. Optionally re-export commonly used types:
    pub use my_interface::*;
    

Benefits

  • Code Reuse: Share interfaces across multiple contracts
  • Type Safety: Ensure contracts implement the same interface
  • Maintainability: Update interfaces in one place
  • Consistency: Standardize contract interfaces across your project

Example Interfaces

  • message_gateway_v4: Message Gateway V4 contract interface
  • token_interface: Standard token contract interface (example)