Skip to content

Commit 6bcbf56

Browse files
committed
feat: update README
1 parent 606c0f5 commit 6bcbf56

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ Run `src5_rs parse <PATH_TO_CAIRO_FILE>` for generating the interface ids for al
2121
As an example, copy this code into a file in your filesystem:
2222

2323
```
24-
struct Call {
25-
to: ContractAddress,
26-
selector: felt252,
27-
calldata: Array<felt252>
28-
}
29-
3024
trait IAccount {
3125
fn __execute__(calls: Array<Call>) -> Array<Span<felt252>>;
3226
fn __validate__(calls: Array<Call>) -> felt252;

src/src5_rs/core/parser/cairo_function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{Result, Ok};
1+
use anyhow::{Ok, Result};
22
// Module for handling Cairo functions
33
use cairo_lang_compiler::db::RootDatabase;
44
use cairo_lang_syntax::node::kind::SyntaxKind;

src/src5_rs/core/src5_type.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Module for computing SRC5 compliant types
2-
use anyhow::{Result, Ok, bail};
2+
use anyhow::{bail, Ok, Result};
33
use cairo_lang_compiler::db::RootDatabase;
44
use cairo_lang_syntax::node::{kind::SyntaxKind, SyntaxNode};
55
use std::collections::HashMap;
@@ -118,8 +118,13 @@ fn get_src5_type_from_expr_path_node(
118118
src5_type.push('(');
119119
// Resolve each member type
120120
for ty in struct_type.members_types.iter() {
121-
let src5_type_for_ty =
122-
get_src5_type_from_type_clause_nodes_kind(db, ty, structs, enums, replacements)?;
121+
let src5_type_for_ty = get_src5_type_from_type_clause_nodes_kind(
122+
db,
123+
ty,
124+
structs,
125+
enums,
126+
replacements,
127+
)?;
123128
src5_type.push_str(&src5_type_for_ty);
124129
src5_type.push(',');
125130
}
@@ -133,8 +138,13 @@ fn get_src5_type_from_expr_path_node(
133138
src5_type.push_str("E(");
134139
// Resolve each member type
135140
for ty in enum_type.variants_types.iter() {
136-
let src5_type_for_ty =
137-
get_src5_type_from_type_clause_nodes_kind(db, ty, structs, enums, replacements)?;
141+
let src5_type_for_ty = get_src5_type_from_type_clause_nodes_kind(
142+
db,
143+
ty,
144+
structs,
145+
enums,
146+
replacements,
147+
)?;
138148
src5_type.push_str(&src5_type_for_ty);
139149
src5_type.push(',');
140150
}

tests/cairo_code/account.cairo

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
use starknet::ContractAddress;
2-
3-
struct Call {
4-
to: ContractAddress,
5-
selector: felt252,
6-
calldata: Array<felt252>
7-
}
2+
use starknet::account::Call;
83

94
trait IAccount {
10-
fn __execute__(calls: Array<Call>) -> Array<Span<Result<Option<Call>,System>>>;
5+
fn __execute__(calls: Array<Call>) -> Array<Span<felt252>>;
116
fn __validate__(calls: Array<Call>) -> felt252;
127
fn __validate_declare__(class_hash: felt252) -> felt252;
138
fn is_valid_signature(message: felt252, signature: Array<felt252>) -> u32;
149
fn supports_interface(interface_id: u32) -> bool;
15-
}
10+
}

0 commit comments

Comments
 (0)