2018-06-20 17:27:32 +00:00
|
|
|
# Nimbus
|
|
|
|
# Copyright (c) 2018 Status Research & Development GmbH
|
|
|
|
# Licensed under either of
|
|
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
|
|
# at your option.
|
|
|
|
# This file may not be copied, modified, or distributed except according to
|
|
|
|
# those terms.
|
2018-07-26 21:48:01 +00:00
|
|
|
import strutils, nimcrypto, eth_common, stint, eth_trie/[memdb, types]
|
|
|
|
import
|
2018-08-23 03:38:00 +00:00
|
|
|
json_rpc/server, ../vm_state, ../db/[db_chain, state_db],
|
2018-08-22 21:40:05 +00:00
|
|
|
../constants, ../config, hexstrings
|
2018-06-20 17:27:32 +00:00
|
|
|
|
|
|
|
proc setupCommonRPC*(server: RpcServer) =
|
|
|
|
server.rpc("web3_clientVersion") do() -> string:
|
|
|
|
result = NimbusIdent
|
|
|
|
|
2018-08-22 21:40:05 +00:00
|
|
|
server.rpc("web3_sha3") do(data: HexDataStr) -> string:
|
|
|
|
var rawdata = nimcrypto.fromHex(data.string)
|
2018-06-20 17:27:32 +00:00
|
|
|
result = "0x" & $keccak_256.digest(rawdata)
|