acta-maker-sdk 0.8.0

Rust SDK for the Acta options RFQ venue on Solana: maker and vault-operator WebSocket clients, order signing, chain builders
Documentation
#![warn(rust_2018_idioms, unreachable_pub, unused_must_use)]
#![forbid(unsafe_code)]
#![warn(clippy::all)]
#![allow(clippy::module_name_repetitions)]
#![cfg_attr(feature = "ws-client", doc = include_str!("../README.md"))]
#![cfg_attr(
    not(feature = "ws-client"),
    doc = "Rust SDK for Acta options market makers. Enable the `ws-client` feature for the WebSocket client and its documented examples."
)]

pub mod error;
pub mod io_observer;
pub mod network;
pub mod nonce;
pub mod orders;
pub mod quote;
pub mod signing;
pub mod types;
pub mod wire;
pub mod ws;

pub use error::ActaSdkError;
pub use network::{DEVNET_API, DEVNET_WS, MAINNET_API, MAINNET_WS};

pub const WS_PROTOCOL_VERSION: &str = "1.1.0";

/// The same on devnet and mainnet; `/api/v1/venue` `program_id` is authoritative.
pub const ACTA_PROGRAM_ID: [u8; 32] =
    solana_pubkey::pubkey!("33Ezs5eoa16QyPW8wifnyz2nCyMEcq2crqkVBNjnTE8U").to_bytes();

pub use quote::{QuoteBuildError, QuoteBuilder, RfqBinding};

pub use types::PRICE_SCALE;
pub use types::QuoteExpiry;
pub use types::ids::{
    Balance, ChainId, ChainPositionType, ChainPositionTypeParseError, ChainTerms, Decimals,
    DurationSeconds, MarketId, Nonce, OptionTerms, OrderId, OrderVersion, PositionRevision,
    PositionType, Price, Quantity, QuoteCount, RfqVersion, Slot, Strike, TakerSide, TimeoutSeconds,
    TradeCount, UserId, Volume,
};
pub use types::invite::{
    REFERRAL_CODE_MAX_LEN, REFERRAL_CODE_MIN_LEN, RESERVED_CODES, ReferralCode,
    ReferralCodeFormatError, TakerStatus, is_reserved,
};
pub use types::vault::{
    VaultDelegatePermissions, VaultLeg, VaultOperatorKind, VaultStagingStep, VaultSwapDirection,
    VaultSwapMode,
};
pub use types::{Address32, AddressError};
pub use types::{PhysicalPremium, physical_premium, total_premium_quote_atoms};

#[cfg(feature = "chain")]
pub mod chain;

#[cfg(feature = "http")]
pub mod http;

#[cfg(feature = "ws-client")]
pub use ws::client::{PreparedClientMessage, ServerClose, WsClient, WsTransportConfig};

#[cfg(feature = "ws-client")]
pub use ws::error::{WsClientError, WsResult, WsTransportConfigError};
#[cfg(feature = "ws-client")]
pub use ws::maker::{
    MakerClientError, MakerDataClient, MakerDataRequest, MakerDataRequestError, MakerQuoteClient,
    MakerResponse, PagedRequest,
};
#[cfg(all(feature = "ws-client", feature = "test-helpers"))]
pub use ws::managed::ManagedWsTestPeer;
#[cfg(feature = "ws-client")]
pub use ws::managed::{
    GapPolicy, MakerWsEndpoint, ManagedInbound, ManagedMessageReceiver, ManagedReceiveError,
    ManagedWsConfig, ManagedWsConfigError, ManagedWsError, ManagedWsEvent, ManagedWsHandle,
    ManagedWsState, ManagedWsTerminationReason, OutboundMessageError, SendAwaitError, SendTicket,
    WaitUntilReadyError, normalize_maker_data_ws_url, normalize_maker_ws_url,
    normalize_maker_ws_url_for_endpoint, spawn_managed_ws,
};
pub use ws::market_decimals::{MarketDecimals, TokenDecimals};
pub use ws::types::{ClientMessage, ServerMessage};
#[cfg(all(feature = "vault", feature = "http"))]
pub use ws::vault::{FleetListing, VaultFleet, VaultFleetConfig};
#[cfg(all(feature = "vault", feature = "chain-rpc"))]
pub use ws::vault::{SaleDesk, SaleError, SaleOutcome, SaleStage, SignedSale, VaultSale};
#[cfg(feature = "vault")]
pub use ws::vault::{
    SendGate, Ungated, VaultClientError, VaultOperatorClient, VaultOperatorConfig, VaultProjection,
    VaultProjectionReceiver, VaultRequestError, VaultTxError,
};

pub use nonce::{AtomicNonceGenerator, NonceError, NonceGenerator};
pub use orders::{
    BytesSigner, ORDER_DOMAIN_TAG, ORDER_ID_LEN, ORDER_PREIMAGE_LEN, OrderError, OrderPreimageArgs,
    SignerLike, build_order_preimage, compute_order_id, hash_order_preimage, order_id_hex,
    order_preimage_hex, sign_order_id_base58, sign_order_id_bytes,
    sign_order_id_from_base58_keypair, sign_order_id_with_async_signer, sign_order_id_with_signer,
    sign_order_id_with_signer_base58, verify_order_id_signature_base58,
    verify_order_id_signature_bytes,
};
pub use signing::{AsyncSignerLike, SigningError, SigningFuture};
pub use wire::{
    WireError, decode_base58_32, decode_base58_64, decode_hex_32, encode_base58, encode_hex,
};

pub mod spreads;

pub use types::{InvalidProductSet, ProductSet};

pub mod paging;