perpl-sdk 0.2.2

Rust SDK for the Perpl decentralized perpetuals exchange
Documentation

Perpl DEX SDK.

Overview

Convenient in-memory cache of on-chain exchange state.

Use [state::SnapshotBuilder] to capture initial state snapshot, then [stream::raw] to catch up with the recent state and keep snapshot up to date.

Use [types::OrderRequest] to prepare order requests to send them with [crate::abi::dex::Exchange::ExchangeInstance::execOrdersV2].

The deployed contract may lag behind the revision the SDK targets, so the snapshot detects the contract's [state::ContractFeatures] and degrades gracefully rather than failing on a missing selector.

See ./tests for examples.

Limitations/follow-ups

  • Funding events processing is to follow.

  • Current version relies on log polling to implement reliably continuous stream of events. Future versions could improve indexing latency by utilizing WebSocket subscriptions and/or Monad execution events.

  • Test coverage is far below reasonable.

Features

Feature Default Description
display yes Enables [std::fmt::Display] implementation for state types.
testing yes Enables [testing] module.

Testing

[testing] module provides a local testing environment with collateral token and exchange smart contracts deployed.