Skip to main content

acta_maker_sdk/
lib.rs

1#![warn(rust_2018_idioms, unreachable_pub, unused_must_use)]
2#![forbid(unsafe_code)]
3#![warn(clippy::all)]
4#![allow(clippy::module_name_repetitions)]
5#![cfg_attr(feature = "ws-client", doc = include_str!("../README.md"))]
6#![cfg_attr(
7    not(feature = "ws-client"),
8    doc = "Rust SDK for Acta options market makers. Enable the `ws-client` feature for the WebSocket client and its documented examples."
9)]
10
11pub mod error;
12pub mod network;
13pub mod nonce;
14pub mod orders;
15pub mod quote;
16pub mod signing;
17pub mod types;
18pub mod wire;
19pub mod ws;
20
21pub use error::ActaSdkError;
22pub use network::{DEVNET_API, DEVNET_WS, MAINNET_API, MAINNET_WS};
23
24pub const WS_PROTOCOL_VERSION: &str = "1.0.0";
25
26pub const ACTA_PROGRAM_ID: [u8; 32] =
27    solana_pubkey::pubkey!("33Ezs5eoa16QyPW8wifnyz2nCyMEcq2crqkVBNjnTE8U").to_bytes();
28
29pub use quote::{QuoteBuildError, QuoteBuilder, RfqBinding};
30
31pub use types::PRICE_SCALE;
32pub use types::QuoteExpiry;
33pub use types::ids::{
34    Balance, ChainId, Decimals, DurationSeconds, MarketId, Nonce, OrderId, OrderVersion,
35    PositionType, PositionTypeParseError, Price, Quantity, QuoteCount, RfqVersion, Slot, Strike,
36    TimeoutSeconds, TradeCount, UserId, Volume,
37};
38pub use types::invite::{
39    REFERRAL_CODE_MAX_LEN, REFERRAL_CODE_MIN_LEN, RESERVED_CODES, ReferralCode,
40    ReferralCodeFormatError, TakerStatus, is_reserved,
41};
42pub use types::total_premium_quote_atoms;
43pub use types::vault::{
44    VaultDelegatePermissions, VaultOperatorKind, VaultSwapDirection, VaultSwapMode,
45};
46
47#[cfg(feature = "chain")]
48pub mod chain;
49
50#[cfg(feature = "http")]
51pub mod http;
52
53#[cfg(feature = "ws-client")]
54pub use ws::client::{PreparedClientMessage, ServerClose, WsClient, WsTransportConfig};
55
56#[cfg(feature = "ws-client")]
57pub use ws::error::{WsClientError, WsResult, WsTransportConfigError};
58#[cfg(feature = "ws-client")]
59pub use ws::maker::{
60    MakerClientError, MakerDataClient, MakerDataRequest, MakerDataRequestError, MakerQuoteClient,
61    MakerResponse,
62};
63#[cfg(all(feature = "ws-client", feature = "test-helpers"))]
64pub use ws::managed::ManagedWsTestPeer;
65#[cfg(feature = "ws-client")]
66pub use ws::managed::{
67    GapPolicy, MakerWsEndpoint, ManagedInbound, ManagedMessageReceiver, ManagedReceiveError,
68    ManagedWsConfig, ManagedWsConfigError, ManagedWsError, ManagedWsEvent, ManagedWsHandle,
69    ManagedWsState, ManagedWsTerminationReason, OutboundMessageError, SendAwaitError, SendTicket,
70    WaitUntilReadyError, normalize_maker_data_ws_url, normalize_maker_ws_url,
71    normalize_maker_ws_url_for_endpoint, spawn_managed_ws,
72};
73pub use ws::market_decimals::{MarketDecimals, TokenDecimals};
74pub use ws::types::{ClientMessage, ServerMessage};
75#[cfg(all(feature = "vault", feature = "http"))]
76pub use ws::vault::{FleetListing, VaultFleet, VaultFleetConfig};
77#[cfg(all(feature = "vault", feature = "chain-rpc"))]
78pub use ws::vault::{SaleDesk, SaleError, SaleOutcome, SaleStage, SignedSale, VaultSale};
79#[cfg(feature = "vault")]
80pub use ws::vault::{
81    SendGate, Ungated, VaultClientError, VaultOperatorClient, VaultOperatorConfig, VaultProjection,
82    VaultProjectionReceiver, VaultRequestError, VaultTxError,
83};
84
85pub use nonce::{AtomicNonceGenerator, NonceError, NonceGenerator};
86pub use orders::{
87    BytesSigner, ORDER_DOMAIN_TAG, ORDER_ID_LEN, ORDER_PREIMAGE_LEN, OrderError, OrderPreimageArgs,
88    SignerLike, build_order_preimage, compute_order_id, hash_order_preimage, order_id_hex,
89    order_preimage_hex, sign_order_id_base58, sign_order_id_bytes,
90    sign_order_id_from_base58_keypair, sign_order_id_with_async_signer, sign_order_id_with_signer,
91    sign_order_id_with_signer_base58, verify_order_id_signature_base58,
92    verify_order_id_signature_bytes,
93};
94pub use signing::{AsyncSignerLike, SigningError, SigningFuture};
95pub use wire::{
96    WireError, decode_base58_32, decode_base58_64, decode_hex_32, encode_base58, encode_hex,
97};