Skip to main content

polyoxide_relay/
lib.rs

1//! # polyoxide-relay
2//!
3//! Gasless transaction relay client for Polymarket's Safe and Proxy wallet infrastructure.
4//!
5//! This crate enables submitting on-chain transactions through Polymarket's relayer service,
6//! which pays gas fees on behalf of users. It supports two wallet types:
7//!
8//! - **Safe wallets** — Gnosis Safe multisig contracts (must be deployed before first use)
9//! - **Proxy wallets** — lightweight proxy contracts that auto-deploy on first transaction
10//!
11//! ## Authentication
12//!
13//! Relay operations require a private key for EIP-712 transaction signing and optional
14//! builder API credentials (`BUILDER_API_KEY`, `BUILDER_SECRET`, `BUILDER_PASS_PHRASE`)
15//! for authenticated relay submission.
16//!
17//! ## Example
18//!
19//! ```no_run
20//! use polyoxide_relay::{RelayClient, BuilderAccount, BuilderConfig};
21//!
22//! # async fn example() -> Result<(), polyoxide_relay::RelayError> {
23//! let config = BuilderConfig::new("key".into(), "secret".into(), None);
24//! let account = BuilderAccount::new("0xprivatekey...", Some(config))?;
25//! let client = RelayClient::from_account(account)?;
26//!
27//! let latency = client.ping().await?;
28//! println!("Relay API latency: {}ms", latency.as_millis());
29//! # Ok(())
30//! # }
31//! ```
32
33mod client;
34mod config;
35mod error;
36mod types;
37
38pub use client::RelayClient;
39pub use config::{BuilderConfig, ContractConfig};
40pub use error::RelayError;
41pub use types::{SafeTransaction, SafeTx, TransactionRequest, WalletType};
42
43mod account;
44
45pub use account::BuilderAccount;