Support amount-specific negative-risk redemptions and wallet receipts

This commit is contained in:
2026-12-03 13:17:04 +08:00
parent 98eece1c50
commit 3bec895a0a
9 changed files with 199 additions and 22 deletions
+9
View File
@@ -178,6 +178,8 @@ pub(crate) enum Command {
Redeem {
market: String,
account: String,
#[serde(default, deserialize_with = "redeem_amounts")]
amounts_micros: Option<[i64; 2]>,
},
Resolve {
market: String,
@@ -194,3 +196,10 @@ pub(crate) enum TimeInForce {
Fak,
Fok,
}
// Only an omitted field selects full redemption. An explicit null must not spend a balance.
fn redeem_amounts<'de, D: serde::Deserializer<'de>>(
input: D,
) -> Result<Option<[i64; 2]>, D::Error> {
<[i64; 2]>::deserialize(input).map(Some)
}