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
§Modules
- [
attestation
] - Types for Circle’s Iris API attestation responses - [
bridge
] - Core CCTP bridge implementation - [
chain
] - Chain-specific configurations and theCctpV1
trait - [
error
] - Error types and result type alias - [
domain_id
] - CCTP domain ID constants for supported chains - [
message_transmitter
] - MessageTransmitter contract bindings - [
token_messenger
] - TokenMessenger contract bindings
Modules§
- Message
Transmitter - Generated by the following Solidity interface…
- Token
Messenger - Generated by the following Solidity interface…
Structs§
- Attestation
Response - Represents the response from the attestation service
- Bridge
Params - Parameters for bridging USDC
- Bridge
Params Builder - Use builder syntax to set the inputs and finish with
build()
. - Cctp
- CCTP v1 bridge implementation
- Cctp
Builder - Use builder syntax to set the inputs and finish with
build()
. - Token
Messenger Contract - The CCTP v1 Token Messenger contract.
Enums§
- Attestation
Status - Represents the status of the attestation.
- Cctp
Error
Constants§
- ARBITRUM_
DOMAIN_ ID - ARBITRUM_
MESSAGE_ TRANSMITTER_ ADDRESS - https://arbiscan.io/address/0xC30362313FBBA5cf9163F0bb16a0e01f01A896ca
- ARBITRUM_
SEPOLIA_ MESSAGE_ TRANSMITTER_ ADDRESS - https://sepolia.arbiscan.io/address/0xacf1ceef35caac005e15888ddb8a3515c41b4872
- ARBITRUM_
SEPOLIA_ TOKEN_ MESSENGER_ ADDRESS - https://developers.circle.com/stablecoins/evm-smart-contracts
- ARBITRUM_
TOKEN_ MESSENGER_ ADDRESS - https://developers.circle.com/stablecoins/evm-smart-contracts
- AVALANCHE_
DOMAIN_ ID - AVALANCHE_
MESSAGE_ TRANSMITTER_ ADDRESS - https://snowtrace.io/address/0x8186359af5f57fbb40c6b14a588d2a59c0c29880
- AVALANCHE_
TOKEN_ MESSENGER_ ADDRESS - https://developers.circle.com/stablecoins/evm-smart-contracts
- BASE_
DOMAIN_ ID - BASE_
MESSAGE_ TRANSMITTER_ ADDRESS - https://basescan.org/address/0xAD09780d193884d503182aD4588450C416D6F9D4
- BASE_
SEPOLIA_ MESSAGE_ TRANSMITTER_ ADDRESS - https://base-sepolia.blockscout.com/address/0x7865fAfC2db2093669d92c0F33AeEF291086BEFD
- BASE_
SEPOLIA_ TOKEN_ MESSENGER_ ADDRESS - https://developers.circle.com/stablecoins/evm-smart-contracts
- BASE_
TOKEN_ MESSENGER_ ADDRESS - https://developers.circle.com/stablecoins/evm-smart-contracts
- CHAIN_
CONFIRMATION_ CONFIG - DEFAULT_
CONFIRMATION_ TIMEOUT - Default confirmation requirements and timeouts for different chains
- ETHEREUM_
DOMAIN_ ID - ETHEREUM_
MESSAGE_ TRANSMITTER_ ADDRESS - https://etherscan.io/address/0x0a992d191DEeC32aFe36203Ad87D7d289a738F81
- ETHEREUM_
SEPOLIA_ MESSAGE_ TRANSMITTER_ ADDRESS - https://sepolia.etherscan.io/address/0x7865fAfC2db2093669d92c0F33AeEF291086BEFD
- ETHEREUM_
SEPOLIA_ TOKEN_ MESSENGER_ ADDRESS - https://developers.circle.com/stablecoins/evm-smart-contracts
- ETHEREUM_
TOKEN_ MESSENGER_ ADDRESS - https://developers.circle.com/stablecoins/evm-smart-contracts
- IRIS_
API - Circle Iris API environment URLs
- IRIS_
API_ SANDBOX - OPTIMISM_
DOMAIN_ ID - OPTIMISM_
MESSAGE_ TRANSMITTER_ ADDRESS - https://optimistic.etherscan.io/address/0x4D41f22c5a0e5c74090899E5a8Fb597a8842b3e8
- OPTIMISM_
TOKEN_ MESSENGER_ ADDRESS - https://developers.circle.com/stablecoins/evm-smart-contracts
- POLYGON_
CCTP_ V1_ MESSAGE_ TRANSMITTER - https://polygonscan.com/address/0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE
- POLYGON_
CCTP_ V1_ TOKEN_ MESSENGER - https://developers.circle.com/stablecoins/evm-smart-contracts
- POLYGON_
DOMAIN_ ID - UNICHAIN_
CCTP_ V1_ MESSAGE_ TRANSMITTER - https://uniscan.xyz/address/0x353bE9E2E38AB1D19104534e4edC21c643Df86f4
- UNICHAIN_
CCTP_ V1_ TOKEN_ MESSENGER - https://uniscan.xyz/address/0x4e744b28E787c3aD0e810eD65A24461D4ac5a762
- UNICHAIN_
DOMAIN_ ID
Traits§
- CctpV1
- Trait for chains that support CCTP bridging
Functions§
- get_
chain_ confirmation_ config - Gets the chain-specific confirmation configuration
Type Aliases§
- Attestation
Bytes - The bytes of the attestation.
- Result