zcash-android-wallet-sdk / cash.z.wallet.sdk.ext / java.math.BigDecimal

Extensions for java.math.BigDecimal

convertCurrency

Convert this value from one currency to the other, based on given price and whether this value is USD. If starting with USD -> End with ZEC. If starting with ZEC -> End with USD.

fun BigDecimal.convertCurrency(zecPrice: BigDecimal, isUsd: Boolean): BigDecimal

convertUsdToZec

Convert this USD value to ZEC, using the given price per ZEC. Start with USD -> End with ZEC.

fun BigDecimal?.convertUsdToZec(zecPrice: BigDecimal): BigDecimal

convertZecToUsd

Convert this ZEC value to USD, using the given price per ZEC. Start with ZEC -> End with USD.

fun BigDecimal?.convertZecToUsd(zecPrice: BigDecimal): BigDecimal

convertZecToZatoshi

Convert a ZEC value into Zatoshi. Start with ZEC -> End with Zatoshi.

fun BigDecimal?.convertZecToZatoshi(): Long

toUsd

Format a BigDecimal USD value as a BigDecimal USD value, right-padded to the given number of fraction digits. Start with USD -> End with USD.

fun BigDecimal?.toUsd(decimals: Int = USD_FORMATTER.maximumFractionDigits): BigDecimal

toUsdString

Format a USD value into USD with the given number of decimal places, represented as a string. Start with USD -> end with USD.

fun BigDecimal?.toUsdString(maxDecimals: Int = USD_FORMATTER.maximumFractionDigits, minDecimals: Int = USD_FORMATTER.minimumFractionDigits): String

toZec

Format a BigDecimal ZEC value as a BigDecimal ZEC value, right-padded to the given number of fraction digits. Start with ZEC -> End with ZEC.

fun BigDecimal?.toZec(decimals: Int = ZEC_FORMATTER.maximumFractionDigits): BigDecimal

toZecString

Format a Zatoshi value into ZEC with the given number of decimal places, represented as a string. Start with ZeC -> End with ZEC.

fun BigDecimal?.toZecString(maxDecimals: Int = ZEC_FORMATTER.maximumFractionDigits, minDecimals: Int = ZEC_FORMATTER.minimumFractionDigits): String