get-currency-specification.rst (1970B)
1 .. ts:op:: getCurrencySpecification 2 :read-only: 3 4 Get the currency specification (input and rendering rules) for a 5 currency scope. 6 7 **Request:** 8 9 The request must be a `GetCurrencySpecificationRequest` object. 10 11 **Response:** 12 13 On success, the result is a `GetCurrencySpecificationResponse` 14 object. 15 16 **Details:** 17 18 The specification recorded for the given scope is returned. For 19 the demonstration currencies ``KUDOS`` and ``TESTKUDOS``, a 20 hard-coded specification is returned. When no specification is 21 known for the scope, a default with two fractional digits 22 derived from the currency name is returned. 23 24 .. ts:def:: GetCurrencySpecificationRequest 25 26 interface GetCurrencySpecificationRequest { 27 scope: ScopeInfo; 28 } 29 30 .. ts:def:: GetCurrencySpecificationResponse 31 32 interface GetCurrencySpecificationResponse { 33 currencySpecification: CurrencySpecification; 34 } 35 36 .. ts:def:: ScopeType 37 38 enum ScopeType { 39 Global = "global", 40 Exchange = "exchange", 41 Auditor = "auditor", 42 43 // Funds issued under a master public key the exchange has 44 // since replaced. 45 ExchangeLegacyKeys = "exchange-legacy-keys", 46 } 47 48 .. ts:def:: CurrencySpecification 49 50 // Input and rendering rules for a currency (see DD51). 51 interface CurrencySpecification { 52 // Name of the currency. 53 name: string; 54 55 // How many digits the user may enter after the decimal 56 // separator. 57 num_fractional_input_digits: Integer; 58 59 // Number of fractional digits to render in normal font and 60 // size. 61 num_fractional_normal_digits: Integer; 62 63 // Number of fractional digits to render always, padding with 64 // zeros if needed. 65 num_fractional_trailing_zero_digits: Integer; 66 67 // Map of powers of 10 to alternative currency names / symbols; 68 // always has an entry under "0" with the base name, e.g. 69 // "0 => €" or "3 => k€". 70 alt_unit_names: { [log10: string]: string }; 71 72 common_amounts?: AmountString[]; 73 }