1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// -------------------------------------------------------------------------------------------------
// Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
// https://nautechsystems.io
//
// Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -------------------------------------------------------------------------------------------------
//! Venue identifiers and tuning constants for the Lighter adapter.
use ;
use Venue;
use Ustr;
/// Venue name string for Lighter.
pub const LIGHTER: &str = "LIGHTER";
/// Lighter venue identifier.
pub static LIGHTER_VENUE: = new;
/// L2 chain id for Lighter mainnet.
///
/// Mirrors the upstream `lighter-go` constant. Used as the first element of
/// the L2 transaction hash preimage.
pub const LIGHTER_MAINNET_CHAIN_ID: u32 = 304;
/// L2 chain id for Lighter testnet.
///
/// Mirrors `lighter-go`'s testnet chain id and matches the value the oracle
/// generator emits.
pub const LIGHTER_TESTNET_CHAIN_ID: u32 = 300;
/// Nautilus integrator account index on Lighter.
pub const LIGHTER_NAUTILUS_INTEGRATOR_ACCOUNT_INDEX: u64 = 723_813;
/// Venue error code for missing integrator approval.
pub const LIGHTER_ERROR_CODE_INTEGRATOR_NOT_APPROVED: u64 = 21_149;
/// Public docs anchor for integrator approval.
pub const LIGHTER_INTEGRATOR_APPROVAL_DOCS_URL: &str =
"https://nautilustrader.io/docs/nightly/integrations/lighter.html#integrator-attribution";
/// Maximum batch size for `sendTxBatch` on the WebSocket transport.
pub const LIGHTER_MAX_BATCH_TX: usize = 15;
/// Maximum auth-token expiry permitted by the venue (8 hours).
pub const LIGHTER_AUTH_TOKEN_MAX_TTL: Duration = from_secs;
/// Default refresh window before an auth token expires.
///
/// The adapter rotates the auth token this far ahead of expiry to avoid races
/// during long-running WebSocket sessions.
pub const LIGHTER_AUTH_TOKEN_REFRESH_LEAD: Duration = from_secs;
/// Default WebSocket heartbeat interval.
///
/// Lighter requires a frame at least every 2 minutes; we send well below that.
pub const HEARTBEAT_INTERVAL: Duration = from_secs;
/// Base reconnect backoff for the WebSocket client.
pub const RECONNECT_BASE_BACKOFF: Duration = from_millis;
/// Maximum reconnect backoff for the WebSocket client.
pub const RECONNECT_MAX_BACKOFF: Duration = from_secs;
/// Default HTTP request timeout.
pub const HTTP_TIMEOUT: Duration = from_secs;
/// Maximum WebSocket inflight messages per connection (venue-imposed).
pub const INFLIGHT_MAX: usize = 50;
/// Outbound command queue depth before backpressure kicks in.
pub const QUEUE_MAX: usize = 1000;