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