metalink-app / web3x Goto Github PK
View Code? Open in Web Editor NEWThis project forked from hswick/exw3
(Another) High level Ethereum RPC Client for Elixir
License: Apache License 2.0
This project forked from hswick/exw3
(Another) High level Ethereum RPC Client for Elixir
License: Apache License 2.0
Web3x.Contract.call/3
raises with certain output signatures, particularly when the output type is (uint256[],string[])
.
When calling ABI.decode/3
with the function selector struct, and when calling ABI.decode/2
with the signature string syntax it decodes correctly:
ABI.decode(fs, output_data, :output)
[[1], ["bar"]]
ABI.decode("foo(uint256[],string[])", output_data)
[[1], ["bar"]]
When using the Web3x.Contract module, the following is eventually called within Web3.Abi.decode_output/3
:
ABI.decode("foo((uint256[],string[]))", output_data)
which raises with the following stack trace:
** (MatchError) no match of right hand side value: <<99, 115, 120, 99, 121, 100, 106, 121, 52, 51, 108, 109, 102, 119, 101, 117, 105, 50, 50, 121, 121, 105, 102, 50, 107, 117, 0, 0, 0, 0, 0>>
(ex_abi 0.5.11) lib/abi/type_decoder.ex:371: ABI.TypeDecoder.decode_uint/2
(ex_abi 0.5.11) lib/abi/type_decoder.ex:271: anonymous fn/3 in ABI.TypeDecoder.decode_type/2
(elixir 1.13.0) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(ex_abi 0.5.11) lib/abi/type_decoder.ex:266: ABI.TypeDecoder.decode_type/2
(ex_abi 0.5.11) lib/abi/type_decoder.ex:311: ABI.TypeDecoder.decode_type/3
(ex_abi 0.5.11) lib/abi/type_decoder.ex:333: anonymous fn/3 in ABI.TypeDecoder.decode_type/3
(elixir 1.13.0) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(ex_abi 0.5.11) lib/abi/type_decoder.ex:331: ABI.TypeDecoder.decode_type/3
(ex_abi 0.5.11) lib/abi/type_decoder.ex:188: anonymous fn/3 in ABI.TypeDecoder.do_decode_raw/2
(elixir 1.13.0) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(ex_abi 0.5.11) lib/abi/type_decoder.ex:185: ABI.TypeDecoder.do_decode_raw/2
(ex_abi 0.5.11) lib/abi/type_decoder.ex:179: ABI.TypeDecoder.decode_raw/2
The following lines I believe are the problem, as it wraps the output signature in a another set of parentheses.
output_types = Enum.map(abi[name]["outputs"], fn x -> x["type"] end)
types_signature = format_output_type_signatures(output_types)
output_signature = "#{name}(#{types_signature})"
output_signature
ends up being "foo((uint256[],string[]))"
instead of "foo(uint256[],string[])"
. At least in this case when the types are uint256[] and string[], this raises an error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.