| Crates.io | playtron-sdk |
| lib.rs | playtron-sdk |
| version | 1.0.0 |
| created_at | 2025-07-29 15:38:22.96572+00 |
| updated_at | 2025-07-29 15:38:22.96572+00 |
| description | Playtron GameOS SDK for Rust |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1772476 |
| size | 68,223 |
The Playtron GameOS Rust SDK enables seamless integration with Playtron-native features including PACT attestation, Sui wallet signing, and system-level utilities like the virtual keyboard and browser. This SDK supports both Linux and Windows (via Wine/Proton).
1.70+tokio runtime for async executionsui-sdk, bcs, and base64 dependenciesAdd to your Cargo.toml:
[dependencies]
playtron-sdk = { git = "https://github.com/playtrontech/playtron-sdk-rs" }
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11", features = ["json", "gzip"] }
base64 = "0.21"
bcs = "0.1"
sui_sdk = { git = "https://github.com/mystenlabs/sui", package = "sui-sdk"}
let manager = playtron_sdk::manager::Manager::new().await?;
if manager.is_playtron().await? {
println!("Running on Playtron!");
}
use playtron_sdk::pact::AttestationClient;
let attestation_client = AttestationClient::new();
let session_info = attestation_client.create_session().await?;
let quote = attestation_client.get_quote(&session_info.nonce)?;
Send the quote to the PACT server:
let client = reqwest::Client::new();
let url = "https://pact.playtron.one/api/v1/session/attest";
let res = client
.post(url)
.header("Content-Type", "application/json")
.header("X-Session-Id", &session_info.session_id)
.body(quote)
.send()
.await?;
use playtron_sdk::sui::Sui;
let sui = Sui::new().await?;
let address = sui.get_address().await;
let result = sui.sign_message("provider_app_id".to_owned(), "hello".to_owned()).await?;
println!("Signature: {}", result);
let tx_base64 = simple_coin_transfer_txn(sender, receiver, Some(100_000_000));
let result = sui.sign_and_execute_transaction("provider_app_id".to_owned(), tx_base64).await?;
let tx_base64 = simple_coin_transfer_txn(sender, receiver, Some(100_000_000));
let result = sui.sign_transaction("provider_app_id".to_owned(), tx_base64).await?;
let manager = playtron_sdk::manager::Manager::new().await?;
// Show keyboard
manager.show_keyboard().await?;
// Open a browser
manager.open_browser("https://google.com".to_owned()).await?;
// Wait and close
tokio::time::sleep(Duration::from_secs(5)).await;
manager.close_browser().await?;
Ensure libplaytron.so and playtron.dll are installed to the appropriate Wine system paths.
This is done automatically from GameOS if SDK is being launched as a game.
See LICENSE for details.