Contents

getCurrencySpecificationread-only#

Get the currency specification (input and rendering rules) for a currency scope.

Request:

The request must be a GetCurrencySpecificationRequest object.

Response:

On success, the result is a GetCurrencySpecificationResponse object.

Details:

The specification recorded for the given scope is returned. For the demonstration currencies KUDOS and TESTKUDOS, a hard-coded specification is returned. When no specification is known for the scope, a default with two fractional digits derived from the currency name is returned.

interface GetCurrencySpecificationRequest {
  scope: ScopeInfo;
}
interface GetCurrencySpecificationResponse {
  currencySpecification: CurrencySpecification;
}
// Currency scope, discriminated on the "type" field.
type ScopeInfo =
  | ScopeInfoGlobal
  | ScopeInfoExchange
  | ScopeInfoAuditor
  | ScopeInfoExchangeLegacyKeys;
type ScopeInfoGlobal = {
  type: ScopeType.Global;
  currency: string;
};
type ScopeInfoExchange = {
  type: ScopeType.Exchange;
  currency: string;
  url: string;
};
type ScopeInfoAuditor = {
  type: ScopeType.Auditor;
  currency: string;
  url: string;
};
type ScopeInfoExchangeLegacyKeys = {
  type: ScopeType.ExchangeLegacyKeys;
  currency: string;
  url: string;

  // The superseded key the funds were issued under.
  masterPub: string;
};
enum ScopeType {
  Global = "global",
  Exchange = "exchange",
  Auditor = "auditor",

  // Funds issued under a master public key the exchange has
  // since replaced.
  ExchangeLegacyKeys = "exchange-legacy-keys",
}
// Input and rendering rules for a currency (see DD51).
interface CurrencySpecification {
  // Name of the currency.
  name: string;

  // How many digits the user may enter after the decimal
  // separator.
  num_fractional_input_digits: Integer;

  // Number of fractional digits to render in normal font and
  // size.
  num_fractional_normal_digits: Integer;

  // Number of fractional digits to render always, padding with
  // zeros if needed.
  num_fractional_trailing_zero_digits: Integer;

  // Map of powers of 10 to alternative currency names / symbols;
  // always has an entry under "0" with the base name, e.g.
  // "0 => €" or "3 => k€".
  alt_unit_names: { [log10: string]: string };

  common_amounts?: AmountString[];
}