commit 4aac30230b57758fe2b3acd057d77b3082eea67b
parent 73338e3a1ae0dd3826e0e0bb1aff23ee13a1f430
Author: MS <ms@taler.net>
Date: Thu, 5 Oct 2023 15:52:12 +0200
New type for decimal number.
Diffstat:
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/core/.api-common.rst.swp b/core/.api-common.rst.swp
Binary files differ.
diff --git a/core/.api-corebank.rst.swp b/core/.api-corebank.rst.swp
Binary files differ.
diff --git a/core/api-common.rst b/core/api-common.rst
@@ -306,6 +306,17 @@ Large numbers
Large numbers such as RSA blinding factors and 256 bit keys, are transmitted
as other binary data in Crockford Base32 encoding.
+Decimal numbers
+^^^^^^^^^^^^^^^
+
+..
+ FIXME: explain the representation with strings.
+
+.. ts:def:: DecimalNumber
+
+ // Number with at most 8 fractional digits.
+ type DecimalNumber = string;
+
Timestamps
^^^^^^^^^^
diff --git a/core/api-corebank.rst b/core/api-corebank.rst
@@ -933,16 +933,16 @@ Conversion rates
interface ConversionRatesResponse {
// Exchange rate to buy the local currency from the external one
- buy_at_ratio: FractionalNumber;
+ buy_at_ratio: DecimalNumber;
// Exchange rate to sell the local currency for the external one
- sell_at_ratio: FractionalNumber;
+ sell_at_ratio: DecimalNumber;
// Fee to subtract after applying the buy ratio.
- buy_in_fee: FractionalNumber;
+ buy_in_fee: DecimalNumber;
// Fee to subtract after applying the sell ratio.
- sell_out_fee: FractionalNumber;
+ sell_out_fee: DecimalNumber;
}
For example, given a local currency LC, a fiat currency FC,