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, VaultLeg, VaultOperatorKind, VaultStagingStep, VaultSwapDirection,
45 VaultSwapMode,
46};
47
48#[cfg(feature = "chain")]
49pub mod chain;
50
51#[cfg(feature = "http")]
52pub mod http;
53
54#[cfg(feature = "ws-client")]
55pub use ws::client::{PreparedClientMessage, ServerClose, WsClient, WsTransportConfig};
56
57#[cfg(feature = "ws-client")]
58pub use ws::error::{WsClientError, WsResult, WsTransportConfigError};
59#[cfg(feature = "ws-client")]
60pub use ws::maker::{
61 MakerClientError, MakerDataClient, MakerDataRequest, MakerDataRequestError, MakerQuoteClient,
62 MakerResponse,
63};
64#[cfg(all(feature = "ws-client", feature = "test-helpers"))]
65pub use ws::managed::ManagedWsTestPeer;
66#[cfg(feature = "ws-client")]
67pub use ws::managed::{
68 GapPolicy, MakerWsEndpoint, ManagedInbound, ManagedMessageReceiver, ManagedReceiveError,
69 ManagedWsConfig, ManagedWsConfigError, ManagedWsError, ManagedWsEvent, ManagedWsHandle,
70 ManagedWsState, ManagedWsTerminationReason, OutboundMessageError, SendAwaitError, SendTicket,
71 WaitUntilReadyError, normalize_maker_data_ws_url, normalize_maker_ws_url,
72 normalize_maker_ws_url_for_endpoint, spawn_managed_ws,
73};
74pub use ws::market_decimals::{MarketDecimals, TokenDecimals};
75pub use ws::types::{ClientMessage, ServerMessage};
76#[cfg(all(feature = "vault", feature = "http"))]
77pub use ws::vault::{FleetListing, VaultFleet, VaultFleetConfig};
78#[cfg(all(feature = "vault", feature = "chain-rpc"))]
79pub use ws::vault::{SaleDesk, SaleError, SaleOutcome, SaleStage, SignedSale, VaultSale};
80#[cfg(feature = "vault")]
81pub use ws::vault::{
82 SendGate, Ungated, VaultClientError, VaultOperatorClient, VaultOperatorConfig, VaultProjection,
83 VaultProjectionReceiver, VaultRequestError, VaultTxError,
84};
85
86pub use nonce::{AtomicNonceGenerator, NonceError, NonceGenerator};
87pub use orders::{
88 BytesSigner, ORDER_DOMAIN_TAG, ORDER_ID_LEN, ORDER_PREIMAGE_LEN, OrderError, OrderPreimageArgs,
89 SignerLike, build_order_preimage, compute_order_id, hash_order_preimage, order_id_hex,
90 order_preimage_hex, sign_order_id_base58, sign_order_id_bytes,
91 sign_order_id_from_base58_keypair, sign_order_id_with_async_signer, sign_order_id_with_signer,
92 sign_order_id_with_signer_base58, verify_order_id_signature_base58,
93 verify_order_id_signature_bytes,
94};
95pub use signing::{AsyncSignerLike, SigningError, SigningFuture};
96pub use wire::{
97 WireError, decode_base58_32, decode_base58_64, decode_hex_32, encode_base58, encode_hex,
98};