xmtp 0.4.0

Safe, ergonomic Rust client SDK for the XMTP messaging protocol
docs.rs failed to build xmtp-0.4.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: xmtp-0.1.0

xmtp

crates.io docs.rs License

Safe, ergonomic Rust SDK for the XMTP messaging protocol.

Wraps the xmtp-sys FFI bindings with idiomatic Rust types, providing a high-level ClientConversationMessage API for E2E encrypted DMs, groups, content types, identity management, ENS resolution, and real-time streaming.

Quick Start

use xmtp::{Client, Env, AlloySigner};

// Create a client and register identity.
let signer = AlloySigner::random()?;
let client = Client::builder()
    .env(Env::Dev)
    .db_path("./alice.db3")
    .build(&signer)?;

// Send a DM.
let conv = client.dm(&"0xBob...".into())?;
conv.send_text("hello from Rust")?;

// Stream messages in real time.
let _handle = xmtp::stream::stream_all_messages(
    &client, None, &[], |msg_id, conv_id| {
        println!("new message {msg_id} in {conv_id}");
    },
)?;

Feature Flags

Feature Default Description
content Content type codecs (text, reactions, replies, attachments, read receipts)
alloy Local private key signer via alloy-signer-local
ledger Ledger hardware wallet signer via alloy-signer-ledger
ens ENS name resolution via alloy-ens + alloy-provider

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.