forked from StellarSend/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_payment.rs
More file actions
35 lines (32 loc) · 1.11 KB
/
Copy pathbatch_payment.rs
File metadata and controls
35 lines (32 loc) · 1.11 KB
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
use serde::Deserialize;
use uuid::Uuid;
/// One leg of a batch/split payment: pay `amount` of `asset` to `destination`.
#[derive(Debug, Clone, Deserialize)]
pub struct BatchPaymentLeg {
pub destination: String,
pub amount: String,
pub asset_code: String,
pub asset_issuer: Option<String>,
}
/// Request body for POST /api/payments/batch.
///
/// Same non-custodial pattern as /api/payments/send: the client builds and
/// signs a *single* Stellar transaction containing one `Payment` (or
/// `send_batch_payment` Soroban) operation per recipient, then posts the
/// signed XDR here. We relay it once and record one `transactions` row per
/// leg so existing history/reporting keeps working per-recipient.
#[derive(Debug, Deserialize)]
pub struct SendBatchPaymentRequest {
pub source_account: String,
pub signed_xdr: String,
pub legs: Vec<BatchPaymentLeg>,
}
#[derive(Debug, serde::Serialize)]
pub struct BatchPaymentResult {
pub batch_id: Uuid,
pub tx_hash: String,
pub success: bool,
pub ledger: Option<u64>,
pub fee_charged: Option<String>,
pub leg_transaction_ids: Vec<Uuid>,
}