From 14b1d9d49c32dfcdaac2cdce546a9f209daa4df5 Mon Sep 17 00:00:00 2001 From: Hleb Albau Date: Wed, 20 Sep 2017 19:30:08 +0300 Subject: [PATCH] #3 define kotlin model --- .../kotlin/fund/cyber/node/model/Bitcoin.kt | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 core/src/main/kotlin/fund/cyber/node/model/Bitcoin.kt diff --git a/core/src/main/kotlin/fund/cyber/node/model/Bitcoin.kt b/core/src/main/kotlin/fund/cyber/node/model/Bitcoin.kt new file mode 100644 index 00000000..e6095e70 --- /dev/null +++ b/core/src/main/kotlin/fund/cyber/node/model/Bitcoin.kt @@ -0,0 +1,92 @@ +package fund.cyber.node.model + +import java.math.BigDecimal +import java.math.BigInteger +import java.time.Instant + +/* +* +* Items Previews +* +*/ + +data class BitcoinBlockPreview( + val hash: String, + val height: BigInteger, + val time: Instant, + val merkleroot: String, + val size: Int +) : ItemPreview + +data class BitcoinTransactionPreview( + val hash: String, + val lock_time: Instant, + val block_number: BigInteger, + val fee: BigDecimal +) : ItemPreview + +/* +* +* Bitcoin block +* +*/ + +data class BitcoinBlock( + val hash: String, + val height: BigInteger, + val time: Instant, + val nonce: Int, + val merkleroot: String, + val size: Int, + val version: Int, + val weight: Int, + val bits: Int, + val difficulty: BigInteger, + val txs: List +) : Item + +data class BitcoinBlockTransaction( + val fee: BigDecimal, + val lock_time: Instant, + val ins: List, + val outs: List +) + +data class BitcoinBlockTransactionIO( + val address: String, + val amount: BigDecimal +) + +/* +* +* Bitcoin transaction +* +*/ + +data class BitcoinTransaction( + val hash: String, + val block_number: BigInteger, + val coinbase: String?, + val lock_time: Instant, + val fee: BigDecimal, + val total_input: BigDecimal, + val total_output: BigDecimal, + val ins: List, + val outs: List +) : Item + +data class BitcoinTransactionIn( + val address: String, + val amount: BigDecimal, + val asm: String, + val tx_hash: String, + val tx_out: String +) + +data class BitcoinTransactionOut( + val address: String, + val amount: BigDecimal, + val asm: String, + val out: Short, + val required_signatures: Short +) \ No newline at end of file