Skip to content

Commit

Permalink
Merge pull request #6 from uma-universal-money-address/feat/conversti…
Browse files Browse the repository at this point in the history
…ondetails

Tweak conversion mechanics to be more explicit and safe.
  • Loading branch information
jklein24 authored Dec 20, 2023
2 parents a598816 + 5deceed commit 44e4232
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion uma-sdk/src/commonMain/kotlin/me/uma/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.serialization.json.encodeToJsonElement
import kotlinx.serialization.json.put

const val MAJOR_VERSION = 0
const val MINOR_VERSION = 1
const val MINOR_VERSION = 2
const val UMA_VERSION_STRING = "$MAJOR_VERSION.$MINOR_VERSION"

/**
Expand Down
17 changes: 10 additions & 7 deletions uma-sdk/src/commonMain/kotlin/me/uma/protocol/Currency.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ data class Currency @JvmOverloads constructor(
* Estimated millisats per smallest "unit" of this currency (eg. 1 cent in USD).
*/
@SerialName("multiplier")
val millisatoshiPerUnit: Long,
val millisatoshiPerUnit: Double,

/**
* Minimum amount that can be sent in this currency. This is in the smallest unit of the currency
Expand All @@ -41,13 +41,16 @@ data class Currency @JvmOverloads constructor(
val maxSendable: Long,

/**
* Number of digits after the decimal point for display on the sender side. For example,
* in USD, by convention, there are 2 digits for cents - $5.95. in this case, `decimals`
* would be 2. Note that the multiplier is still always in the smallest unit (cents). This field
* is only for display purposes. The sender should assume zero if this field is omitted, unless
* they know the proper display format of the target currency.
* The number of digits after the decimal point for display on the sender side, and to add clarity
* around what the "smallest unit" of the currency is. For example, in USD, by convention, there are 2 digits for
* cents - $5.95. In this case, `decimals` would be 2. Note that the multiplier is still always in the smallest
* unit (cents). In addition to display purposes, this field can be used to resolve ambiguity in what the multiplier
* means. For example, if the currency is "BTC" and the multiplier is 1000, really we're exchanging in SATs, so
* `decimals` would be 8.
*
* For details on edge cases and examples, see https://github.com/uma-universal-money-address/protocol/blob/main/umad-04-lnurlp-response.md.
*/
val decimals: Int? = null,
val decimals: Int,
) {
fun toJson() = Json.encodeToString(this)
}

0 comments on commit 44e4232

Please sign in to comment.