Skip to content

Commit 3448160

Browse files
author
Łukasz Gąsior
committed
Rename 'functionName' param to 'function'; fix chain config msg
1 parent ce3d726 commit 3448160

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/main/scala/io/iohk/ethereum/jsonrpc/EthService.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ object EthService {
122122
gas: Option[BigInt],
123123
gasPrice: BigInt,
124124
value: BigInt,
125-
functionName: Option[String] = None,
125+
function: Option[String] = None,
126126
arguments: Option[Seq[ByteString]] = None,
127127
contractCode: Option[ByteString])
128128

@@ -571,8 +571,8 @@ class EthService(
571571
import req.tx
572572

573573
val args = tx.arguments.getOrElse(Nil)
574-
val dataEither = (tx.functionName, tx.contractCode) match {
575-
case (Some(functionName), None) => Right(rlp.encode(RLPList(functionName, args)))
574+
val dataEither = (tx.function, tx.contractCode) match {
575+
case (Some(function), None) => Right(rlp.encode(RLPList(function, args)))
576576
case (None, Some(contractCode)) => Right(rlp.encode(RLPList(contractCode, args)))
577577
case _ => Left(JsonRpcErrors.InvalidParams("Iele transaction should contain either functionName or contractCode"))
578578
}

src/main/scala/io/iohk/ethereum/jsonrpc/IeleJsonMethodsImplicits.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object IeleJsonMethodsImplicits extends JsonMethodsImplicits {
1919
gas <- optionalQuantity(obj \ "gas")
2020
gasPrice <- optionalQuantity(obj \ "gasPrice")
2121
value <- optionalQuantity(obj \ "value")
22-
functionName = (obj \ "functionName").extractOpt[String]
22+
function = (obj \ "function").extractOpt[String]
2323
contractCode <- toEitherOpt((obj \ "contractCode").extractOpt[String].map(extractBytes))
2424
arguments = (obj \ "arguments").extractOpt[Seq[String]].map(_.map(in => ByteString(decode(in))))
2525
} yield IeleCallTx(
@@ -28,7 +28,7 @@ object IeleJsonMethodsImplicits extends JsonMethodsImplicits {
2828
gas = gas,
2929
gasPrice = gasPrice.getOrElse(0),
3030
value = value.getOrElse(0),
31-
functionName = functionName,
31+
function = function,
3232
contractCode = contractCode,
3333
arguments = arguments)
3434
}
@@ -78,7 +78,7 @@ object IeleJsonMethodsImplicits extends JsonMethodsImplicits {
7878

7979
nonce <- optionalQuantity("nonce")
8080

81-
functionName = input.get("functionName").flatMap(_.extractOpt[String])
81+
function = input.get("function").flatMap(_.extractOpt[String])
8282

8383
arguments = input.get("arguments").flatMap(_.extractOpt[Seq[String]].map(_.map(in => ByteString(decode(in)))))
8484

@@ -88,7 +88,7 @@ object IeleJsonMethodsImplicits extends JsonMethodsImplicits {
8888
case None => Right(None)
8989
}
9090

91-
} yield IeleTransactionRequest(from, to, value, gas, gasPrice, nonce, functionName, arguments, contractCode)
91+
} yield IeleTransactionRequest(from, to, value, gas, gasPrice, nonce, function, arguments, contractCode)
9292
}
9393

9494
implicit val iele_sendTransaction = new JsonDecoder[SendIeleTransactionRequest] {

src/main/scala/io/iohk/ethereum/jsonrpc/PersonalService.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ class PersonalService(
166166
import request.tx
167167

168168
val args = tx.arguments.getOrElse(Nil)
169-
val dataEither = (tx.functionName, tx.contractCode) match {
170-
case (Some(functionName), None) => Right(rlp.encode(RLPList(functionName, args)))
169+
val dataEither = (tx.function, tx.contractCode) match {
170+
case (Some(function), None) => Right(rlp.encode(RLPList(function, args)))
171171
case (None, Some(contractCode)) => Right(rlp.encode(RLPList(contractCode, args)))
172172
case _ => Left(JsonRpcErrors.InvalidParams("Iele transaction should contain either functionName or contractCode"))
173173
}

src/main/scala/io/iohk/ethereum/jsonrpc/TestJsonMethodsImplicits.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ object TestJsonMethodsImplicits extends JsonMethodsImplicits {
2626
private def extractBlockchainParams(blockchainParamsJson: JValue): Either[JsonRpcError, BlockchainParams] = {
2727
for {
2828
eIP150ForkBlock <- extractQuantity(blockchainParamsJson \ "EIP150ForkBlock")
29-
eIP158ForkBlock <- extractQuantity(blockchainParamsJson \ "EIP150ForkBlock")
30-
accountStartNonce <- extractQuantity(blockchainParamsJson \ "EIP150ForkBlock")
29+
eIP158ForkBlock <- extractQuantity(blockchainParamsJson \ "EIP158ForkBlock")
30+
accountStartNonce <- extractQuantity(blockchainParamsJson \ "accountStartNonce")
3131
allowFutureBlocks <- Try((blockchainParamsJson \ "allowFutureBlocks").extract[Boolean]).toEither.left.map(_ => InvalidParams())
32-
blockReward <- extractQuantity(blockchainParamsJson \ "EIP150ForkBlock")
33-
byzantiumForkBlock <- extractQuantity(blockchainParamsJson \ "EIP150ForkBlock")
34-
homesteadForkBlock <- extractQuantity(blockchainParamsJson \ "EIP150ForkBlock")
35-
maximumExtraDataSize <- extractQuantity(blockchainParamsJson \ "EIP150ForkBlock")
32+
blockReward <- extractQuantity(blockchainParamsJson \ "blockReward")
33+
byzantiumForkBlock <- extractQuantity(blockchainParamsJson \ "byzantiumForkBlock")
34+
homesteadForkBlock <- extractQuantity(blockchainParamsJson \ "homesteadForkBlock")
35+
maximumExtraDataSize <- extractQuantity(blockchainParamsJson \ "maximumExtraDataSize")
3636
} yield BlockchainParams(eIP150ForkBlock, eIP158ForkBlock, accountStartNonce, allowFutureBlocks, blockReward,
3737
byzantiumForkBlock, homesteadForkBlock, maximumExtraDataSize)
3838
}

src/main/scala/io/iohk/ethereum/jsonrpc/TransactionRequest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ case class IeleTransactionRequest(
3333
gasLimit: Option[BigInt] = None,
3434
gasPrice: Option[BigInt] = None,
3535
nonce: Option[BigInt] = None,
36-
functionName: Option[String] = None,
36+
function: Option[String] = None,
3737
arguments: Option[Seq[ByteString]] = None,
3838
contractCode: Option[ByteString])

0 commit comments

Comments
 (0)