From 7a15b3145dc82273708fa0ad81196589c2f6806f Mon Sep 17 00:00:00 2001 From: Dominic Letz Date: Tue, 10 Sep 2024 17:11:27 +0200 Subject: [PATCH] Fix dio_edgev2 return --- lib/json.ex | 6 +++--- lib/network/rpc.ex | 2 +- test/rpc_test.exs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/json.ex b/lib/json.ex index 2d9d8f5..dac7c5b 100644 --- a/lib/json.ex +++ b/lib/json.ex @@ -12,7 +12,7 @@ defmodule Json do end defp conv_validate(conv) do - Keyword.merge([all_hex: false], conv) + conv end def decode!(binary) do @@ -61,8 +61,8 @@ defmodule Json do "0x" end - defp do_encode(bin, conv) when is_binary(bin) do - if conv[:all_hex] == false and String.printable?(bin) do + defp do_encode(bin, _conv) when is_binary(bin) do + if String.printable?(bin) do bin else Base16.encode(bin, false) diff --git a/lib/network/rpc.ex b/lib/network/rpc.ex index 9f205f6..0a1a17b 100644 --- a/lib/network/rpc.ex +++ b/lib/network/rpc.ex @@ -88,7 +88,7 @@ defmodule Network.Rpc do envelope = %{"id" => {:raw, id}, "jsonrpc" => "2.0"} |> Map.merge(ret) - |> Json.prepare!(all_hex: method == "dio_edgev2") + |> Json.prepare!() {code, envelope} end diff --git a/test/rpc_test.exs b/test/rpc_test.exs index 0ada783..c652376 100644 --- a/test/rpc_test.exs +++ b/test/rpc_test.exs @@ -108,7 +108,7 @@ defmodule RpcTest do "id" => 1, "jsonrpc" => "2.0", "result" => %{ - "blockNumber" => blockNum, + "blockNumber" => _blockNum, "contractAddress" => nil, "cumulativeGasUsed" => _variable, "from" => ^from,