|
|
@ -157,7 +157,7 @@ defmodule EthereumJSONRPC.EncoderTest do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "decode_result/1" do |
|
|
|
describe "decode_result/1" do |
|
|
|
test "correclty decodes the blockchain result" do |
|
|
|
test "correctly decodes the blockchain result" do |
|
|
|
result = %{ |
|
|
|
result = %{ |
|
|
|
id: "sum", |
|
|
|
id: "sum", |
|
|
|
jsonrpc: "2.0", |
|
|
|
jsonrpc: "2.0", |
|
|
@ -173,7 +173,7 @@ defmodule EthereumJSONRPC.EncoderTest do |
|
|
|
assert Encoder.decode_result({result, selector}) == {"sum", {:ok, [42]}} |
|
|
|
assert Encoder.decode_result({result, selector}) == {"sum", {:ok, [42]}} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "correclty handles the blockchain error response" do |
|
|
|
test "correctly handles the blockchain error response" do |
|
|
|
result = %{ |
|
|
|
result = %{ |
|
|
|
error: %{ |
|
|
|
error: %{ |
|
|
|
code: -32602, |
|
|
|
code: -32602, |
|
|
@ -193,7 +193,7 @@ defmodule EthereumJSONRPC.EncoderTest do |
|
|
|
{"sum", {:error, "(-32602) Invalid params: Invalid hex: Invalid character 'x' at position 134."}} |
|
|
|
{"sum", {:error, "(-32602) Invalid params: Invalid hex: Invalid character 'x' at position 134."}} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "correclty decodes string types" do |
|
|
|
test "correctly decodes string types" do |
|
|
|
result = |
|
|
|
result = |
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000441494f4e00000000000000000000000000000000000000000000000000000000" |
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000441494f4e00000000000000000000000000000000000000000000000000000000" |
|
|
|
|
|
|
|
|
|
|
|