Removed utils from p2p and updated names in rpc_utils

This commit is contained in:
coffeepots 2018-11-29 17:08:13 +00:00
parent a5aad977dd
commit 8d4c00cd3f
2 changed files with 4 additions and 11 deletions

View File

@ -29,14 +29,6 @@ import
proc `%`*(value: Time): JsonNode =
result = %value.toSeconds
func toAddress(value: EthAddressStr): EthAddress = hexToPaddedByteArray[20](value.string)
func toHash(value: array[32, byte]): Hash256 {.inline.} =
result.data = value
func toHash(value: EthHashStr): Hash256 {.inline.} =
result = hexToPaddedByteArray[32](value.string).toHash
template balance(addressDb: AccountStateDb, address: EthAddress): GasInt =
# TODO: Account balance u256 but GasInt is int64?
addressDb.getBalance(address).truncate(int64)

View File

@ -9,10 +9,11 @@
import hexstrings, nimcrypto, eth_common, byteutils
func strToAddress*(value: string): EthAddress = hexToPaddedByteArray[20](value)
func toAddress*(value: EthAddressStr): EthAddress = hexToPaddedByteArray[20](value.string)
func toHash*(value: array[32, byte]): Hash256 {.inline.} =
result.data = value
func strToHash*(value: string): Hash256 {.inline.} =
result = hexToPaddedByteArray[32](value).toHash
func toHash*(value: EthHashStr): Hash256 {.inline.} =
result = hexToPaddedByteArray[32](value.string).toHash