Skip to content

Transfer Personal Circles Tokens to Different Avatar

Transfers are write operations. Rust runner is not available yet; code samples will be added once writes are supported.

Read-only Rust actions today:

  • Prepare flows via pathfinding (prepare_flow_for_contract) for the intended transfer.
  • Inspect balances and trust relations along the path.
  • Decode transfer-related events.

Write flow (future):

  • Use runner to submit the flow (vertices/edges/streams/coordinates) to the contracts.

Example: prepare a flow for a transfer (read-only)

use circles_pathfinder::{prepare_flow_for_contract, FindPathParams};
use alloy_primitives::U256;
 
#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let params = FindPathParams {
        from: "0x1234567890123456789012345678901234567890".parse()?,
        to: "0x0987654321098765432109876543210987654321".parse()?,
        target_flow: U256::from(1_000_000_000_000_000_000u64),
        use_wrapped_balances: Some(true),
        from_tokens: None,
        to_tokens: None,
        exclude_from_tokens: None,
        exclude_to_tokens: None,
    };
 
    let flow = prepare_flow_for_contract("https://rpc.aboutcircles.com/", params).await?;
    let (vertices, edges, streams, coordinates) = flow.into_contract_params();
    println!("vertices: {}, edges: {}", vertices.len(), edges.len());
 
    // Submit via runner once available.
    Ok(())
}