Implementation of the Polywrap client in Rust.
Add this to your Cargo.toml:
[dependencies]
polywrap = 0.1.6Create 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::*;
use serde::*;
#[derive(Serialize)]
struct CatArgs {
cid: String,
#[serde(rename = "ipfsProvider")]
ipfs_provider: String,
}
fn main() {
let mut config = PolywrapClientConfig::new();
config.add(SystemClientConfig::default().into());
let client = PolywrapClient::new(config.build());
let result = client.invoke::<ByteBuf>(
uri!("wrapscan.io/polywrap/[email protected]"),
"cat",
Some(&to_vec(
&CatArgs {
cid: "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR".to_string(),
ipfs_provider: "https://ipfs.io".to_string(),
}
).unwrap()),
None,
None
);
if result.is_err() {
// Handle error
};
println!(
"Cat Result: {}",
String::from_utf8(result.unwrap().to_vec()).unwrap()
);
}Please check out our contributing guide for guidelines about how to proceed.
