Crates.io | src5-rs |
lib.rs | src5-rs |
version | 2.0.0 |
source | src |
created_at | 2023-06-23 18:43:28.752827 |
updated_at | 2024-02-13 13:06:01.534351 |
description | Utility for generating SRC5 interfaces ids from Cairo traits |
homepage | https://github.com/ericnordelo/src5-rs |
repository | https://github.com/ericnordelo/src5-rs |
max_upload_size | |
id | 898521 |
size | 90,281 |
Utility for generating SRC5 interfaces ids from Cairo traits, using Cairo source code as input.
cargo install src5-rs
Run src5_rs parse <PATH_TO_CAIRO_FILE>
for generating the interface ids for all the non-generic traits in the file.
As an example, copy this code into a file in your filesystem:
trait IAccount {
fn __execute__(calls: Array<Call>) -> Array<Span<felt252>>;
fn __validate__(calls: Array<Call>) -> felt252;
fn __validate_declare__(class_hash: felt252) -> felt252;
fn is_valid_signature(message: felt252, signature: Array<felt252>) -> u32;
fn supports_interface(interface_id: u32) -> bool;
}
Notice you don't need to define or import types that are defined inside corelib, but custom Structs and Enums must be defined in the file.
Run the parse subcommand passing the path to the file as parameter:
src5_rs parse path/to/the/file
You should see the following output in the terminal:
Licensed under the MIT license.