@@ -7,11 +7,11 @@ import com.alexitc.playsonify.core.{FutureApplicationResult, FuturePaginatedResu
7
7
import com .alexitc .playsonify .models .PaginatedQuery
8
8
import com .alexitc .playsonify .validators .PaginatedQueryValidator
9
9
import com .xsn .explorer .data .async .TransactionFutureDataHandler
10
- import com .xsn .explorer .errors .{AddressFormatError , TransactionFormatError , TransactionNotFoundError }
10
+ import com .xsn .explorer .errors .{AddressFormatError , InvalidRawTransactionError , TransactionFormatError , TransactionNotFoundError }
11
11
import com .xsn .explorer .models ._
12
12
import com .xsn .explorer .models .rpc .TransactionVIN
13
13
import org .scalactic .{Bad , Good , One , Or }
14
- import play .api .libs .json .JsValue
14
+ import play .api .libs .json .{ JsObject , JsString , JsValue }
15
15
16
16
import scala .concurrent .{ExecutionContext , Future }
17
17
@@ -89,6 +89,15 @@ class TransactionService @Inject() (
89
89
result.toFuture
90
90
}
91
91
92
+ def sendRawTransaction (hexString : String ): FutureApplicationResult [JsValue ] = {
93
+ val result = for {
94
+ hex <- Or .from(HexString .from(hexString), One (InvalidRawTransactionError )).toFutureOr
95
+ _ <- xsnService.sendRawTransaction(hex).toFutureOr
96
+ } yield JsObject .empty + (" hex" -> JsString (hex.string))
97
+
98
+ result.toFuture
99
+ }
100
+
92
101
private def getTransactionValue (vin : TransactionVIN ): FutureApplicationResult [TransactionValue ] = {
93
102
val valueMaybe = for {
94
103
value <- vin.value
0 commit comments