-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 add u256 and event decode and encode
BREAKING CHANGE: 🧨 y
- Loading branch information
1 parent
ad642db
commit 6ae5697
Showing
9 changed files
with
559 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::fs::File; | ||
|
||
use ola_lang_abi::{Abi, FixedArray4}; | ||
|
||
fn main() { | ||
// Parse ABI JSON file | ||
let abi: Abi = { | ||
let file = File::open("examples/BookExample.json").expect("failed to open ABI file"); | ||
|
||
serde_json::from_reader(file).expect("failed to parse ABI") | ||
}; | ||
|
||
let topics = vec![ | ||
FixedArray4([ | ||
876009939773297099, | ||
9423535973325601276, | ||
68930750687700470, | ||
16776232995860792718, | ||
]), | ||
FixedArray4([0, 0, 0, 10]), | ||
FixedArray4([ | ||
1298737262017568572, | ||
12445360621592034485, | ||
13004999764278192581, | ||
3441866816748036873, | ||
]), | ||
]; | ||
|
||
let data = vec![5, 104, 101, 108, 108, 111]; | ||
|
||
// Decode | ||
let (evt, decoded_data) = abi | ||
.decode_log_from_slice(&topics, &data) | ||
.expect("failed decoding log"); | ||
|
||
println!("event: {}\ndata: {:?}", evt.name, decoded_data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.