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 io_observer;
13pub mod network;
14pub mod nonce;
15pub mod orders;
16pub mod quote;
17pub mod signing;
18pub mod types;
19pub mod wire;
20pub mod ws;
21
22pub use error::ActaSdkError;
23pub use network::{DEVNET_API, DEVNET_WS, MAINNET_API, MAINNET_WS};
24
25pub const WS_PROTOCOL_VERSION: &str = "1.1.0";
26
27pub const ACTA_PROGRAM_ID: [u8; 32] =
29 solana_pubkey::pubkey!("33Ezs5eoa16QyPW8wifnyz2nCyMEcq2crqkVBNjnTE8U").to_bytes();
30
31pub use quote::{QuoteBuildError, QuoteBuilder, RfqBinding};
32
33pub use types::PRICE_SCALE;
34pub use types::QuoteExpiry;
35pub use types::ids::{
36 Balance, ChainId, ChainPositionType, ChainPositionTypeParseError, ChainTerms, Decimals,
37 DurationSeconds, MarketId, Nonce, OptionTerms, OrderId, OrderVersion, PositionRevision,
38 PositionType, Price, Quantity, QuoteCount, RfqVersion, Slot, Strike, TakerSide, TimeoutSeconds,
39 TradeCount, UserId, Volume,
40};
41pub use types::invite::{
42 REFERRAL_CODE_MAX_LEN, REFERRAL_CODE_MIN_LEN, RESERVED_CODES, ReferralCode,
43 ReferralCodeFormatError, TakerStatus, is_reserved,
44};
45pub use types::vault::{
46 VaultDelegatePermissions, VaultLeg, VaultOperatorKind, VaultStagingStep, VaultSwapDirection,
47 VaultSwapMode,
48};
49pub use types::{Address32, AddressError};
50pub use types::{PhysicalPremium, physical_premium, total_premium_quote_atoms};
51
52#[cfg(feature = "chain")]
53pub mod chain;
54
55#[cfg(feature = "http")]
56pub mod http;
57
58#[cfg(feature = "ws-client")]
59pub use ws::client::{PreparedClientMessage, ServerClose, WsClient, WsTransportConfig};
60
61#[cfg(feature = "ws-client")]
62pub use ws::error::{WsClientError, WsResult, WsTransportConfigError};
63#[cfg(feature = "ws-client")]
64pub use ws::maker::{
65 MakerClientError, MakerDataClient, MakerDataRequest, MakerDataRequestError, MakerQuoteClient,
66 MakerResponse, PagedRequest,
67};
68#[cfg(all(feature = "ws-client", feature = "test-helpers"))]
69pub use ws::managed::ManagedWsTestPeer;
70#[cfg(feature = "ws-client")]
71pub use ws::managed::{
72 GapPolicy, MakerWsEndpoint, ManagedInbound, ManagedMessageReceiver, ManagedReceiveError,
73 ManagedWsConfig, ManagedWsConfigError, ManagedWsError, ManagedWsEvent, ManagedWsHandle,
74 ManagedWsState, ManagedWsTerminationReason, OutboundMessageError, SendAwaitError, SendTicket,
75 WaitUntilReadyError, normalize_maker_data_ws_url, normalize_maker_ws_url,
76 normalize_maker_ws_url_for_endpoint, spawn_managed_ws,
77};
78pub use ws::market_decimals::{MarketDecimals, TokenDecimals};
79pub use ws::types::{ClientMessage, ServerMessage};
80#[cfg(all(feature = "vault", feature = "http"))]
81pub use ws::vault::{FleetListing, VaultFleet, VaultFleetConfig};
82#[cfg(all(feature = "vault", feature = "chain-rpc"))]
83pub use ws::vault::{SaleDesk, SaleError, SaleOutcome, SaleStage, SignedSale, VaultSale};
84#[cfg(feature = "vault")]
85pub use ws::vault::{
86 SendGate, Ungated, VaultClientError, VaultOperatorClient, VaultOperatorConfig, VaultProjection,
87 VaultProjectionReceiver, VaultRequestError, VaultTxError,
88};
89
90pub use nonce::{AtomicNonceGenerator, NonceError, NonceGenerator};
91pub use orders::{
92 BytesSigner, ORDER_DOMAIN_TAG, ORDER_ID_LEN, ORDER_PREIMAGE_LEN, OrderError, OrderPreimageArgs,
93 SignerLike, build_order_preimage, compute_order_id, hash_order_preimage, order_id_hex,
94 order_preimage_hex, sign_order_id_base58, sign_order_id_bytes,
95 sign_order_id_from_base58_keypair, sign_order_id_with_async_signer, sign_order_id_with_signer,
96 sign_order_id_with_signer_base58, verify_order_id_signature_base58,
97 verify_order_id_signature_bytes,
98};
99pub use signing::{AsyncSignerLike, SigningError, SigningFuture};
100pub use wire::{
101 WireError, decode_base58_32, decode_base58_64, decode_hex_32, encode_base58, encode_hex,
102};
103
104pub mod spreads;
105
106pub use types::{InvalidProductSet, ProductSet};
107
108pub mod paging;