io.api.bloxy.model.dto.address.Balance.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bloxy-api Show documentation
Show all versions of bloxy-api Show documentation
Kotlin & Java Library for all available Bloxy API endpoints
package io.api.bloxy.model.dto.address
import io.api.bloxy.model.IModel
/**
* ! NO DESCRIPTION !
*
* @author GoodforGod
* @since 17.11.2018
*/
class Balance(balances: List) : IModel {
companion object {
val empty: Balance = Balance(emptyList())
}
private val balances: Map
init {
this.balances = HashMap()
balances.forEach { b -> this.balances[b.symbol] = b }
}
override fun isEmpty(): Boolean = balances.isEmpty()
fun exist(symbol: String): Boolean {
return this.balances[symbol] != null
}
fun getEth(): CoinBalance {
return get("ETH") ?: CoinBalance()
}
fun get(symbol: String): CoinBalance? {
return this.balances[symbol]
}
fun getAll(): List {
return ArrayList(this.balances.values)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy