From 7f0412a78433131c0d953c045bb9ad02ba9f5052 Mon Sep 17 00:00:00 2001 From: nkohen Date: Fri, 8 Jun 2018 15:43:44 -0500 Subject: [PATCH] Cleanup: Got rid of dummy variables (they are hardcoded for backwards compatibility now), replaced JsArray(vector.map(Json.toJson(_)) pattern with Json.toJson(vector.map), and ran scalafmt --- .../rpc/jsonmodels/NetworkResult.scala | 85 ++++++++++--------- .../rpc/jsonmodels/WalletResult.scala | 5 +- .../rpc/serializers/JsonSerializers.scala | 24 ++++-- 3 files changed, 62 insertions(+), 52 deletions(-) diff --git a/rpc/src/main/scala/org/bitcoins/rpc/jsonmodels/NetworkResult.scala b/rpc/src/main/scala/org/bitcoins/rpc/jsonmodels/NetworkResult.scala index a656ad6939..c1eadf6865 100644 --- a/rpc/src/main/scala/org/bitcoins/rpc/jsonmodels/NetworkResult.scala +++ b/rpc/src/main/scala/org/bitcoins/rpc/jsonmodels/NetworkResult.scala @@ -361,56 +361,57 @@ case class EstimateSmartFeeResult( blocks: Int ) extends NetworkResult -case class GetMemoryInfoResult (locked: MemoryManager) extends NetworkResult +case class GetMemoryInfoResult(locked: MemoryManager) extends NetworkResult case class MemoryManager( - used: Int, - free: Int, - total: Int, - locked: Int, - chunks_used: Int, - chunks_free: Int - ) extends NetworkResult + used: Int, + free: Int, + total: Int, + locked: Int, + chunks_used: Int, + chunks_free: Int +) extends NetworkResult -case class GetMemPoolResult(transactionid: MemPoolTransaction) extends NetworkResult +case class GetMemPoolResult(transactionid: MemPoolTransaction) + extends NetworkResult case class MemPoolTransaction( - size: Int, - fee: Option[Bitcoins], - modifiedfee: Option[Bitcoins], - time: UInt32, - height: Int, - descendantcount: Int, - descendantsize: Int, - descendantfees: Option[Bitcoins], - ancestorcount: Int, - ancestorsize: Int, - ancestorfees: Option[Bitcoins], - wtxid: Transaction, - fees: TransactionFees, - depends: Vector[DoubleSha256Digest], - spentby: Vector[DoubleSha256Digest] - ) extends NetworkResult + size: Int, + fee: Option[Bitcoins], + modifiedfee: Option[Bitcoins], + time: UInt32, + height: Int, + descendantcount: Int, + descendantsize: Int, + descendantfees: Option[Bitcoins], + ancestorcount: Int, + ancestorsize: Int, + ancestorfees: Option[Bitcoins], + wtxid: Transaction, + fees: TransactionFees, + depends: Vector[DoubleSha256Digest], + spentby: Vector[DoubleSha256Digest] +) extends NetworkResult case class TransactionFees( - base: Bitcoins, - modified: Bitcoins, - ancestor: Bitcoins, - descendant: Bitcoins - ) extends NetworkResult + base: Bitcoins, + modified: Bitcoins, + ancestor: Bitcoins, + descendant: Bitcoins +) extends NetworkResult case class GetNetTotalsResult( - totalbytesrecv: Int, - totalbytessent: Int, - timemillis: UInt32, - uploadtarget: NetTarget - ) extends NetworkResult + totalbytesrecv: Int, + totalbytessent: Int, + timemillis: UInt32, + uploadtarget: NetTarget +) extends NetworkResult case class NetTarget( - timeframe: UInt32, - target: Int, - target_reached: Boolean, - serve_historical_blocks: Boolean, - bytes_left_in_cycle: Int, - time_left_in_cycle: UInt32 - ) extends NetworkResult \ No newline at end of file + timeframe: UInt32, + target: Int, + target_reached: Boolean, + serve_historical_blocks: Boolean, + bytes_left_in_cycle: Int, + time_left_in_cycle: UInt32 +) extends NetworkResult diff --git a/rpc/src/main/scala/org/bitcoins/rpc/jsonmodels/WalletResult.scala b/rpc/src/main/scala/org/bitcoins/rpc/jsonmodels/WalletResult.scala index 3b73232519..bff4de18e7 100644 --- a/rpc/src/main/scala/org/bitcoins/rpc/jsonmodels/WalletResult.scala +++ b/rpc/src/main/scala/org/bitcoins/rpc/jsonmodels/WalletResult.scala @@ -67,6 +67,7 @@ case class RpcAddress( account: Option[String]) extends WalletResult -case class ImportMultiResult(success: Boolean, error: Option[ImportMultiError]) extends WalletResult +case class ImportMultiResult(success: Boolean, error: Option[ImportMultiError]) + extends WalletResult -case class ImportMultiError(code: Int, message: String) extends WalletResult \ No newline at end of file +case class ImportMultiError(code: Int, message: String) extends WalletResult diff --git a/rpc/src/main/scala/org/bitcoins/rpc/serializers/JsonSerializers.scala b/rpc/src/main/scala/org/bitcoins/rpc/serializers/JsonSerializers.scala index 3487bc3229..4e7d237ba3 100644 --- a/rpc/src/main/scala/org/bitcoins/rpc/serializers/JsonSerializers.scala +++ b/rpc/src/main/scala/org/bitcoins/rpc/serializers/JsonSerializers.scala @@ -206,15 +206,21 @@ object JsonSerializers { implicit val estimateSmartFeeResultReads: Reads[EstimateSmartFeeResult] = Json.reads[EstimateSmartFeeResult] - implicit val memoryManagerReads: Reads[MemoryManager] = Json.reads[MemoryManager] - implicit val getMemoryInfoResultReads: Reads[GetMemoryInfoResult] = Json.reads[GetMemoryInfoResult] + implicit val memoryManagerReads: Reads[MemoryManager] = + Json.reads[MemoryManager] + implicit val getMemoryInfoResultReads: Reads[GetMemoryInfoResult] = + Json.reads[GetMemoryInfoResult] - implicit val transactionFeesReads: Reads[TransactionFees] = Json.reads[TransactionFees] - implicit val memPoolTransactionReads: Reads[MemPoolTransaction] = Json.reads[MemPoolTransaction] - implicit val getMemPoolAncestorsResultReads: Reads[GetMemPoolResult] = Json.reads[GetMemPoolResult] + implicit val transactionFeesReads: Reads[TransactionFees] = + Json.reads[TransactionFees] + implicit val memPoolTransactionReads: Reads[MemPoolTransaction] = + Json.reads[MemPoolTransaction] + implicit val getMemPoolAncestorsResultReads: Reads[GetMemPoolResult] = + Json.reads[GetMemPoolResult] implicit val netTargetReads: Reads[NetTarget] = Json.reads[NetTarget] - implicit val getNetTotalsResultReads: Reads[GetNetTotalsResult] = Json.reads[GetNetTotalsResult] + implicit val getNetTotalsResultReads: Reads[GetNetTotalsResult] = + Json.reads[GetNetTotalsResult] // Mining Models implicit val miningInfoReads: Reads[GetMiningInfoResult] = @@ -243,6 +249,8 @@ object JsonSerializers { implicit val rpcAddressReads: Reads[RpcAddress] = RpcAddressReads - implicit val importMultiErrorReads: Reads[ImportMultiError] = Json.reads[ImportMultiError] - implicit val importMultiResultReads: Reads[ImportMultiResult] = Json.reads[ImportMultiResult] + implicit val importMultiErrorReads: Reads[ImportMultiError] = + Json.reads[ImportMultiError] + implicit val importMultiResultReads: Reads[ImportMultiResult] = + Json.reads[ImportMultiResult] }