Skip to content

polywrap/rust-wrap-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

polywrap-banner

Rust Client codecov

Implementation of the Polywrap client in Rust.

Installation

Add this to your Cargo.toml:

[dependencies]
polywrap = 0.1.9

Getting started

Create a new Polywrap Client Config Builder instance, add the bundles you want to use, and then create a new Polywrap Client instance from the builder.

use polywrap::*;

#[derive(Serialize)]
struct Sha3_256Args {
    message: String,
}

fn main() {
    let mut config = ClientConfig::new();
    config.add(SystemClientConfig::default().into());
    let client = Client::new(config.build());

    let result = client.invoke::<String>(
        &uri!("wrapscan.io/polywrap/sha3@1.0"),
        "sha3_256",
        Some(&to_vec(
            &Sha3_256Args {
                message: "Hello Polywrap!".to_string(),
            }
        ).unwrap()),
        None,
        None
    );

    match result {
        Ok(v) => println!("{}", v),
        Err(e) => panic!("{}", e),
    }
}

Resources

Contributions

Please check out our contributing guide for guidelines about how to proceed.