Skip to main content

Crate metaflux_client

Crate metaflux_client 

Source
Expand description

§metaflux-client — Rust SDK for the MetaFlux L1

A typed client for the MetaFlux (MTF) derivatives L1. Every type, request shape, and channel discriminator follows the wire convention: snake_case JSON, plain-integer numerics (sizes / prices on fixed-point planes), and market_id rather than coin.

The SDK signs and submits the node’s full signed-action surface — perp and spot orders, TWAP, modify / batch, leverage and margin, vaults, staking, agent / account settings, and spot-margin / Earn — and reads market and account state over REST and WebSocket.

§Modules

  • wallet — secp256k1 keypair + EIP-712 signer (deterministic nonces).
  • rest/info, /exchange, /explorer HTTP endpoints.
  • ws — WebSocket subscriptions, reconnect + heartbeat.
  • types — domain types shared by all transports.
  • faucet — devnet / testnet test-USDC faucet helper.
  • error — single ClientError thiserror enum.

§Quick start

use metaflux_client::{Client, wallet::Wallet};

let wallet = Wallet::from_hex(&std::env::var("MTF_PRIVATE_KEY")?)?;
let client = Client::new("https://devnet-gateway.mtf.exchange")?;
let markets = client.rest().info().markets().await?;
println!("{} markets available", markets.len());

Re-exports§

pub use error::ClientError;
pub use faucet::FaucetResponse;
pub use faucet::request_faucet;
pub use rest::RestClient;
pub use types::MarketId;
pub use types::OrderId;
pub use types::VaultId;
pub use wallet::Wallet;

Modules§

error
Crate-wide error type.
faucet
Devnet / testnet faucet helper.
mip3
MIP-3 builder kit — typed deploy params, gas-auction helpers, presets.
rest
REST client — /info, /exchange, /explorer MTF-native endpoints.
types
Domain types shared by all transports.
wallet
Wallet — secp256k1 keypair management + EIP-712 signing.
ws
WebSocket client — MTF-native subscriptions with reconnect-with-backoff.

Structs§

Client
Top-level convenience bundle.