Expand description
§cctp-rs
A production-ready Rust SDK for Circle’s Cross-Chain Transfer Protocol (CCTP).
This library provides a safe, ergonomic interface for bridging USDC across multiple blockchain networks using Circle’s CCTP infrastructure.
§Quick Start
use cctp_rs::{Cctp, CctpError};
use alloy_chains::NamedChain;
use alloy_primitives::FixedBytes;
// Set up providers and create bridge
let eth_provider = ProviderBuilder::new().connect("http://localhost:8545").await?;
let arb_provider = ProviderBuilder::new().connect("http://localhost:8546").await?;
let bridge = Cctp::builder()
.source_chain(NamedChain::Mainnet)
.destination_chain(NamedChain::Arbitrum)
.source_provider(eth_provider)
.destination_provider(arb_provider)
.recipient("0x742d35Cc6634C0532925a3b844Bc9e7595f8fA0d".parse()?)
.build();
// Get attestation for a bridge transaction
let message_hash: FixedBytes<32> = [0u8; 32].into();
let attestation = bridge.get_attestation_with_retry(message_hash, None, None).await?;§Features
- Type-safe contract interactions using Alloy
- Multi-chain support for mainnet and testnet networks
- Comprehensive error handling with detailed error types
- Builder pattern for intuitive API usage
- Extensive test coverage ensuring reliability
§Public API
AttestationResponseandAttestationStatus- Circle’s Iris API attestation typesCctpandBridgeParams- Core CCTP bridge implementationCctpV1- Trait for chain-specific configurationsCctpErrorandResult- Error types for error handling
Modules§
- spans
- OpenTelemetry span helpers for CCTP operations
Structs§
- Attestation
Response - Represents the response from the attestation service
- Bridge
Params - Parameters for bridging USDC
- Cctp
- CCTP v1 bridge implementation
Enums§
- Attestation
Status - Represents the status of the attestation.
- Cctp
Error
Traits§
- CctpV1
- Trait for chains that support CCTP bridging
Type Aliases§
- Attestation
Bytes - The bytes of the attestation.
- Result