diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt index 2dcf5360..0e89b490 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt @@ -108,23 +108,25 @@ class DefaultEthereumMethods( } override fun executeHardcoded(method: String): ByteArray { + // note that the value is in json representation, i.e. if it's a string it should be with quotes, + // that's why "\"0x0\"", "\"1\"", etc. But just "true" for a boolean, or "[]" for array. val json = when (method) { "net_version" -> { when { Chain.ETHEREUM == chain -> { - "1" + "\"1\"" } Chain.ETHEREUM_CLASSIC == chain -> { - "1" + "\"1\"" } Chain.TESTNET_MORDEN == chain -> { - "2" + "\"2\"" } Chain.TESTNET_KOVAN == chain -> { - "42" + "\"42\"" } Chain.TESTNET_GOERLI == chain -> { - "5" + "\"5\"" } else -> throw RpcException(-32602, "Invalid chain") } diff --git a/testing/trial/src/test/groovy/io/emeraldpay/dshackle/testing/trial/proxy/HardcodedCallsSpec.groovy b/testing/trial/src/test/groovy/io/emeraldpay/dshackle/testing/trial/proxy/HardcodedCallsSpec.groovy index b2c033e3..eeb9d550 100644 --- a/testing/trial/src/test/groovy/io/emeraldpay/dshackle/testing/trial/proxy/HardcodedCallsSpec.groovy +++ b/testing/trial/src/test/groovy/io/emeraldpay/dshackle/testing/trial/proxy/HardcodedCallsSpec.groovy @@ -19,7 +19,7 @@ class HardcodedCallsSpec extends Specification { when: def act = client.execute("net_version", []) then: - act.result == 1 + act.result == "1" act.error == null }