com.wavesplatform.api.http.requests.TxBroadcastRequest.scala Maven / Gradle / Ivy
The newest version!
package com.wavesplatform.api.http.requests
import com.wavesplatform.account.PublicKey
import com.wavesplatform.lang.ValidationError
import com.wavesplatform.transaction.Transaction
import com.wavesplatform.transaction.TxValidationError.GenericError
trait TxBroadcastRequest[A <: Transaction] {
def sender: Option[String]
def senderPublicKey: Option[String]
def toTxFrom(sender: PublicKey): Either[ValidationError, A]
def toTx: Either[ValidationError, A] =
for {
sender <- senderPublicKey match {
case Some(key) => PublicKey.fromBase58String(key)
case None => Left(GenericError("invalid.senderPublicKey"))
}
tx <- toTxFrom(sender)
} yield tx
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy