This project demonstrates how to use the w3io-partner-space-and-time
crate to interact with the Space and Time decentralized data warehouse.
-
Copy
.env.example
to.env
and fill in your credentials:cp .env.example .env
-
Edit
.env
with your Space and Time credentials:SPACE_AND_TIME_BISCUIT_USERID
: Your Space and Time user IDSPACE_AND_TIME_BISCUIT_PRIVATE_KEY
: Your private key in hex formatSPACE_AND_TIME_API_KEY
: Your API key (optional, for low-level API access)
Run the main examples:
cargo run
Run integration tests (requires valid credentials):
cargo test -- --ignored
Demonstrates querying public blockchain data from the Polygon dataset.
Shows how to create new users and manage authentication.
Examples of creating tables, inserting data, querying, and deleting records.
Uses the low-level Space and Time API directly for custom operations.
Demonstrates creating biscuits for fine-grained access control.
- Authentication: Secure user authentication using Ed25519 keypairs
- SQL Queries: Execute SQL queries against decentralized data
- Table Management: Create and manage your own tables
- Biscuits: Fine-grained permission management using Biscuit tokens
- Subscriptions: Create and manage user subscriptions
use w3io_partner_space_and_time::{SxT, SxTUser};
// Load and authenticate user
let sxt = SxT::new()?;
let sxt = sxt.authenticate().await?;
// Execute queries
let results = sxt.execute_query::<MyType>("SELECT * FROM table".to_string()).await?;
use w3io_partner_space_and_time::{SxTTable, TableAccessType};
// Create table instance
let table = SxTTable::new("schema", "table", None, user, TableAccessType::PublicRead);
// Create, insert, select, delete
table.create("id INT PRIMARY KEY, name VARCHAR(100)".to_string()).await?;
table.insert("id, name", "(1, 'test')").await?;
table.select::<MyType>("*", "WHERE id = 1").await?;
table.delete("WHERE id = 1").await?;