tbdex icon indicating copy to clipboard operation
tbdex copied to clipboard

Clarify what the possible values are for "amount"

Open andresuribe87 opened this issue 2 years ago • 3 comments

Many fields use a data type of string to represent numbers. The description of the fields mention an "amount". Some examples include:

  • Offering.payoutUnitsPerPayinUnit
  • CurrencyDetails.currencyCode
  • CurrencyDetails.minSubunits

It would be helpful to clarify what possible values are for those fields. One proposal below.

Define a data type that is Decimal. The data type Decimal is serialized as a string. The only possible values of a string such that it would be correctly deserialized would be values that match the regex /^\d*\.?\d*$/ (or similar).

andresuribe87 avatar Dec 08 '23 21:12 andresuribe87

Possible duplicate of https://github.com/TBD54566975/tbdex/issues/199, which includes discussion of other aspects of currency representation as well.

diehuxx avatar Dec 08 '23 22:12 diehuxx

Add to spec: use 3 digits beyond the currency's significant digits for amount representation.

phoebe-lew avatar Dec 11 '23 21:12 phoebe-lew

notes from tbdex office hours:

seems like everyone is on board. can add a decimal definition in the definitions.json json schema and use that as a $ref for all amount values

mistermoe avatar Dec 11 '23 21:12 mistermoe