openzeppelin_relayer/constants/
stellar_transaction.rs

1//! Constants for Stellar transaction processing.
2//!
3//! This module contains default values used throughout the Stellar transaction
4//! handling logic, including fees, retry delays, and timeout thresholds.
5
6use chrono::Duration;
7
8pub const STELLAR_DEFAULT_TRANSACTION_FEE: u32 = 100;
9/// Default maximum fee for fee-bump transactions (0.1 XLM = 1,000,000 stroops)
10pub const STELLAR_DEFAULT_MAX_FEE: i64 = 1_000_000;
11/// Maximum number of operations allowed in a Stellar transaction
12pub const STELLAR_MAX_OPERATIONS: usize = 100;
13
14/// Horizon API base URL for Stellar mainnet
15pub const STELLAR_HORIZON_MAINNET_URL: &str = "https://horizon.stellar.org";
16/// Horizon API base URL for Stellar testnet
17pub const STELLAR_HORIZON_TESTNET_URL: &str = "https://horizon-testnet.stellar.org";
18
19// Status check scheduling
20/// Initial delay before first status check (in seconds)
21/// Set to 2s for faster detection of transaction state changes
22pub const STELLAR_STATUS_CHECK_INITIAL_DELAY_SECONDS: i64 = 2;
23
24// Other delays
25/// Default delay (in seconds) for retrying transaction after bad sequence error
26pub const STELLAR_BAD_SEQUENCE_RETRY_DELAY_SECONDS: i64 = 2;
27
28// Transaction validity
29/// Default transaction validity duration (in minutes) for sponsored transactions
30/// Provides reasonable time for users to review and submit while ensuring transaction doesn't expire too quickly
31pub const STELLAR_SPONSORED_TRANSACTION_VALIDITY_MINUTES: i64 = 2;
32
33/// Get status check initial delay duration
34pub fn get_stellar_status_check_initial_delay() -> Duration {
35    Duration::seconds(STELLAR_STATUS_CHECK_INITIAL_DELAY_SECONDS)
36}
37
38/// Get sponsored transaction validity duration
39pub fn get_stellar_sponsored_transaction_validity_duration() -> Duration {
40    Duration::minutes(STELLAR_SPONSORED_TRANSACTION_VALIDITY_MINUTES)
41}