| Crates.io | mixin-sdk |
| lib.rs | mixin-sdk |
| version | 0.0.3 |
| created_at | 2021-08-21 06:50:46.770481+00 |
| updated_at | 2021-08-22 10:03:05.109004+00 |
| description | mixin.one network sdk |
| homepage | https://github.com/liuzemei/mixin-rust-sdk/blob/main/README.md |
| repository | https://github.com/liuzemei/mixin-rust-sdk.git |
| max_upload_size | |
| id | 440232 |
| size | 20,855 |
中文版 The rust sdk of mixin.one. Currently, only clients generated by RSA's keystore are supported.
[dependencies] of Cargo.toml in the project[dependencies]
mixin-sdk = "0.0.2"
cargo build to complete the installationuse mixin_sdk::{keystore::Keystore, Client};
async fn test() -> Result<(), Box<std::error::Error>> {
let ks = Keystore::new(Keystore {
client_id: String::from(""),
client_secret: String::from(""),
session_id: String::from(""),
private_key: String::from(""),
pin_token: String::from(""),
pin: String::from(""),
scope: String::from("FULL"),
});
let client = Client::new(ks);
let user = client.user_me().await?;
println!(
"user_id:{}\nfull_name:{}\nidentity_number:{}\n",
user.user_id, user.full_name, user.identity_number
);
Ok(())
}
[dependencies]
mixin-sdk = "0.0.2"
tokio = {version = "1.2.0", features = ["full"]}
main.rsuse mixin_sdk::{keystore::Keystore, Client};
#[tokio::main]
async fn main() {
test().await;
}
async fn test() -> Result<(), Box<std::error::Error>> {
let ks = Keystore::new(Keystore {
client_id: String::from(""),
client_secret: String::from(""),
session_id: String::from(""),
private_key: String::from(""),
pin_token: String::from(""),
pin: String::from(""),
scope: String::from("FULL"),
});
let client = Client::new(ks);
let user = client.user_me().await?;
println!(
"user_id:{}\nfull_name:{}\nidentity_number:{}\n",
user.user_id, user.full_name, user.identity_number
);
Ok(())
}
client_id/client_secret/session_id/private_key/pin_token/pin. If the scope has no special requirements, fill in FULLcargo run in the terminalIf you have any questions, please issue an issue.
Acceptable PRs.
MIT © Richard McRichface