44 lines
No EOL
1.1 KiB
Kotlin
44 lines
No EOL
1.1 KiB
Kotlin
package com.tangem.blockchain.common
|
|
|
|
import java.math.BigDecimal
|
|
import java.util.*
|
|
|
|
interface Wallet {
|
|
val config: WalletConfig
|
|
val address: String
|
|
val exploreUrl: String?
|
|
val shareUrl: String?
|
|
}
|
|
|
|
class WalletConfig(
|
|
val allowFeeSelection: Boolean,
|
|
val allowFeeInclusion: Boolean,
|
|
var allowExtract: Boolean = false,
|
|
var allowLoad: Boolean = false
|
|
)
|
|
|
|
data class Amount(
|
|
val currencySymbol: String,
|
|
var value: BigDecimal? = null,
|
|
val address: String? = null,
|
|
val decimals: Byte,
|
|
val type: AmountType = AmountType.Coin
|
|
)
|
|
|
|
data class TransactionData(
|
|
val amount: Amount,
|
|
val fee: Amount?,
|
|
val sourceAddress: String,
|
|
val destinationAddress: String,
|
|
var status: TransactionStatus = TransactionStatus.Uncomfirmed
|
|
)
|
|
|
|
enum class AmountType { Coin, Token, Reserve }
|
|
|
|
enum class TransactionStatus {Confirmed, Uncomfirmed}
|
|
|
|
enum class ValidationError { WrongAmount, WrongFee, WrongTotal }
|
|
|
|
interface TransactionValidator {
|
|
fun validateTransaction(amount: Amount, fee: Amount?): EnumSet<ValidationError>
|
|
} |