Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,19 @@ jobs:
working-directory: sdk/rust

- name: Clippy
run: cargo clippy --all-targets -- -D warnings
run: |
cargo clippy --all-targets -- -D warnings
cargo clippy --all-targets --features cli -- -D warnings
working-directory: sdk/rust

- name: Build
run: cargo build --all-targets
run: |
cargo build --all-targets
cargo build --all-targets --features cli
working-directory: sdk/rust

- name: Test
run: cargo test
run: |
cargo test
cargo test --features cli
working-directory: sdk/rust
127 changes: 127 additions & 0 deletions sdk/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions sdk/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ chrono = { version = "0.4", default-features = false, features = ["clock"] }
thiserror = "2"
async-trait = "0.1"

# CLI binary only (the `tinyplace` bin). Optional so library consumers don't
# pull it in; enabled by the `cli` feature.
clap = { version = "4", features = ["derive"], optional = true }

# Signal protocol (E2E encryption) primitives. Algorithms chosen to be
# byte-compatible with the TS/Python SDKs: X25519 ECDH, HKDF/HMAC-SHA256,
# AES-256-CBC + HMAC-SHA256 Encrypt-then-MAC.
Expand All @@ -36,6 +40,14 @@ hmac = "0.12"
aes = "0.8"
cbc = { version = "0.1", features = ["alloc"] }

[features]
cli = ["dep:clap"]

[[bin]]
name = "tinyplace"
path = "src/cli/main.rs"
required-features = ["cli"]

[dev-dependencies]
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
wiremock = "0.6"
Expand Down
30 changes: 30 additions & 0 deletions sdk/rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,36 @@ let signer = LocalSigner::from_solana_secret_key(base58_secret)?;
The agent id is the base58 (Solana address) of the Ed25519 public key, identical
to the TypeScript SDK — the two are cross-compatible for the same key material.

## CLI

The crate ships an optional `tinyplace` binary (behind the `cli` feature) for
driving the SDK from the shell. Output is JSON by default; pass `--format md`
for Markdown.

```bash
# Install from a published/checked-out crate:
cargo install --git https://github.com/tinyhumansai/tiny.place tinyplace --features cli
# Or run from a checkout:
cargo run --features cli -- <command>
```

Configuration is read from `~/.tinyplace/config.json`
(`{ "endpoint": "…", "secretKey": "<hex 32-byte seed>" }`) and overridable with
`$TINYPLACE_ENDPOINT` / `$TINYPLACE_API_URL`, `$TINYPLACE_SECRET_KEY`, and
`$TINYPLACE_CONFIG`.

```bash
tinyplace whoami # agent id + public key (needs a key)
tinyplace lookup @alice # resolve a handle's identity
tinyplace groups --q ai --limit 20 # browse public groups
tinyplace pricing quote --base SOL --quote USDC
tinyplace pricing networks # assets / pairs / networks / gas
tinyplace debug # non-secret diagnostics
```

This first cut covers read-only commands; encrypted messaging and on-chain
flows remain TypeScript-only (see [Scope](#scope)).

## Layout

- `client` — [`TinyPlaceClient`], one field per API namespace.
Expand Down
3 changes: 2 additions & 1 deletion sdk/rust/src/api/groups.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Groups API. Mirrors `sdk/typescript/src/api/groups.ts`.

use rand::RngCore as _;
use serde::Deserialize;
use serde::{Deserialize, Serialize};

use crate::error::Result;
use crate::http::HttpClient;
Expand All @@ -14,6 +14,7 @@ use crate::types::{
use crate::util::encode;

/// Wrapper for the `{ groups: [...] }` list response.
#[derive(Debug, Clone, Serialize)]
pub struct GroupListResponse {
pub groups: Vec<GroupMetadata>,
}
Expand Down
10 changes: 5 additions & 5 deletions sdk/rust/src/api/pricing.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
//! Pricing. Mirrors `sdk/typescript/src/api/pricing.ts`.

use serde::Deserialize;
use serde::{Deserialize, Serialize};

use crate::error::Result;
use crate::http::HttpClient;
use crate::types::{GasEstimate, PriceHistory, PriceQuote, SupportedChain, TradePair};

#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PriceAsset {
pub symbol: String,
#[serde(default)]
pub address: Option<String>,
pub decimals: i64,
}

#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PriceAssets {
pub assets: Vec<PriceAsset>,
}

#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TradePairs {
pub pairs: Vec<TradePair>,
}

#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SupportedNetworks {
pub networks: Vec<SupportedChain>,
}
Expand Down
Loading
Loading