Removed utils from p2p and updated names in rpc_utils
This commit is contained in:
parent
a5aad977dd
commit
8d4c00cd3f
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue