| Crates.io | ethabi-decode |
| lib.rs | ethabi-decode |
| version | 2.0.0 |
| created_at | 2024-01-15 16:44:24.574653+00 |
| updated_at | 2024-10-01 20:38:09.044181+00 |
| description | Decoding of ABI-encoded data and event logs |
| homepage | |
| repository | https://github.com/Snowfork/ethabi-decode.git |
| max_upload_size | |
| id | 1100490 |
| size | 105,485 |
This library is a codec for ABI-encoded data and event logs. It is a fork of ethabi with a focus on providing decode functionality in environments where libstd may not be available.
For compatibility with constrained no_std environments, the design of this library differs from the the upstream ethabi in several respects, including:
ABI's need to be specified as code rather than being loaded from JSON (No SERDE support).
Use of Vec<u8> instead of std::string::String for owned strings.
Anything to do with human-readable error and display output was excised.
Build without libstd
cargo build --no-default-features
Build with libstd
cargo build
Decode an event log:
use ethabi_decode::{Event, ParamKind, Token};
fn decode_event_log(topics: Vec<H256>, data: Vec<u8>) -> Vec<Token> {
let event = Event {
signature: "SomeEvent(address,int256)",
inputs: vec![
Param { kind: ParamKind::Address, indexed: true },
Param { kind: ParamKind::Int(256), indexed: false },
],
anonymous: false,
};
event.decode(topics, data).unwrap()
}