palinurus_core/lib.rs
1//! Palinurus — minimal wasm32-wasip2-friendly Solana substrate for ZeroClaw WIT tool plugins.
2//!
3//! Track C (DePIN) core for the Superteam Brasil × ZeroClaw bounty. MIT-licensed.
4//! Pure logic, no wasm dependency — host-testable with `cargo test`; the plugins
5//! import this as a crates.io dependency and compile it into their `wasm32-wasip2`
6//! components.
7//!
8//! `solana-sdk` / `solana-program` cannot be compiled inside a WIT component (they
9//! pull in syscall stubs that don't build for `wasm32-wasip2`). This crate hand-rolls
10//! only the primitives a Solana tool plugin needs:
11//! - PDA derivation (`pda::find_program_address`) — reimplementation of
12//! `solana_program::Pubkey::find_program_address` using `sha2` + `curve25519-dalek`.
13//! - (more modules landing as the build progresses: base58, borsh helpers,
14//! versioned-tx construction, durable-nonce handling, RPC over the host's
15//! `wasi:http`, response shaping to ~200 tokens).
16
17pub mod base58;
18pub mod borsh;
19pub mod pda;
20pub mod response;
21pub mod rpc;
22pub mod durable_nonce;
23pub mod versioned_tx;
24
25pub use base58::Pubkey;
26pub use borsh::{memo_ix_data, CreateAttestationIxData};
27pub use pda::{find_program_address, is_on_curve};
28pub use response::{estimate_tokens, shape_account_info, shape_attestation_result, shape_signatures, short_pubkey, AccountKind};
29pub use rpc::{parse_account_info, parse_blockhash, parse_send_tx, parse_signatures, rpc_request, rpc_result, MockRpc, Rpc, RpcError, WakiRpc};
30pub use durable_nonce::{build_with_durable_nonce, nonce_advance_ix, nonce_authorize_ix, parse_nonce_account, NonceAccount, NonceData, NonceError, NonceState, NonceVersion};
31pub use versioned_tx::{build_unsigned, serialize as serialize_tx, AccountMeta, Instruction, MessageHeader, MessageV0, VersionedTransaction};