mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 15:31:38 +02:00
fix(lws): serialize XMR/WOW atomic amounts as strings (u64 > 2^53 safe)
XMR/WOW atomic amounts (piconero/wownoshi) can exceed 2^53, which a JavaScript number cannot hold exactly, so a large balance or output was silently rounded when the wallet JSON.parsed it. Serialize every atomic amount (balance total_received/locked/pending, spent + unspent output amounts, history totals) as a decimal string; heights, indices, counts, and fee params stay numbers. utoipa value_type=String keeps the OpenAPI honest. Tests assert the string wire contract for a 2^53+1 value.
This commit is contained in:
+10
-23
@@ -3728,15 +3728,11 @@
|
||||
"minimum": 0
|
||||
},
|
||||
"locked_balance": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"minimum": 0
|
||||
"type": "string"
|
||||
},
|
||||
"pending_balance": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Unconfirmed (mempool) received — 0-conf. `0` until the LWS reports mempool\nrows (the monero-lws mempool feature); never negative.",
|
||||
"minimum": 0
|
||||
"type": "string",
|
||||
"description": "Unconfirmed (mempool) received — 0-conf. `0` until the LWS reports mempool\nrows (the monero-lws mempool feature); never negative."
|
||||
},
|
||||
"scanned_height": {
|
||||
"type": "integer",
|
||||
@@ -3756,9 +3752,8 @@
|
||||
"minimum": 0
|
||||
},
|
||||
"total_received": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"minimum": 0
|
||||
"type": "string",
|
||||
"example": "12345000000000"
|
||||
},
|
||||
"transaction_count": {
|
||||
"type": "integer",
|
||||
@@ -4626,9 +4621,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"minimum": 0
|
||||
"type": "string"
|
||||
},
|
||||
"key_image": {
|
||||
"type": "string"
|
||||
@@ -4742,15 +4735,11 @@
|
||||
"type": "string"
|
||||
},
|
||||
"total_received": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"minimum": 0
|
||||
"type": "string"
|
||||
},
|
||||
"total_sent": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "\"Possible\" sent — candidate spends, not authoritative.",
|
||||
"minimum": 0
|
||||
"type": "string",
|
||||
"description": "\"Possible\" sent — candidate spends, not authoritative."
|
||||
},
|
||||
"unlock_time": {
|
||||
"type": "integer",
|
||||
@@ -4776,9 +4765,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"minimum": 0
|
||||
"type": "string"
|
||||
},
|
||||
"global_index": {
|
||||
"type": "integer",
|
||||
|
||||
Reference in New Issue
Block a user