Skip to content

Creation of Organizations

Organisation registration is exposed through Sdk::register_organisation(...).

The SDK:

  • pins the supplied profile
  • submits registerOrganization
  • returns the submitted transactions and best-effort typed avatar
use std::sync::Arc;
 
use circles_sdk::{EoaContractRunner, Sdk, config};
use circles_types::Profile;
 
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let runner = Arc::new(
        EoaContractRunner::connect(
            "https://rpc.aboutcircles.com/",
            "0xYOUR_PRIVATE_KEY",
        )
        .await?,
    );
    let sdk = Sdk::new(config::gnosis_mainnet(), Some(runner))?;
    let profile = Profile {
        name: "Example Org".into(),
        description: Some("Shared operational wallet".into()),
        preview_image_url: None,
        image_url: None,
        location: None,
        geo_location: None,
        extensions: None,
    };
 
    let registered = sdk.register_organisation("Example Org", &profile).await?;
    println!("submitted {} tx(s)", registered.txs.len());
    Ok(())
}