Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Oct 11, 2023
1 parent a190edd commit e35c40d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions starknet-macros/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ work with plain rust types.

For instance:

```rust
```rust,ignore
// Cairo function like fn view_1(self: @ContractState, v: felt252, s: Span<felt252>)
// is generated in rust like:
Expand All @@ -24,7 +24,7 @@ fn view_1(v: FieldElement, s: Vec<FieldElement>);

To generate the bindings for your contract, you can do the following:

```rust
```rust,ignore
use starknet::macros::abigen;
abigen!(MyContract, "/path/to/abi.json");
Expand All @@ -35,7 +35,7 @@ This will generate all the types and two `struct` for the contract:
1. `MyContractReader`, which is use to call `view` functions that are only reading the blockchain state.
To initialize a reader, you need your contract address and a provider:

```rust
```rust,ignore
let rpc_url = Url::parse("http://0.0.0.0:5050").unwrap();
let provider = JsonRpcClient::new(HttpTransport::new(rpc_url.clone()));
let contract_address = FieldElement::from_hex_be("0x123...").unwrap();
Expand All @@ -47,7 +47,7 @@ This will generate all the types and two `struct` for the contract:
2. `MyContract`, which in turn is used to call `external` functions, where a transaction is actually sent to the blockchain.
This one requires an account, to sign those transactions:

```rust
```rust,ignore
let rpc_url = Url::parse("http://0.0.0.0:5050").unwrap();
let provider = JsonRpcClient::new(HttpTransport::new(rpc_url.clone()));
Expand Down Expand Up @@ -75,7 +75,7 @@ In the `ABI`, there is always an `Event` enum, which contains all the events dec

You can then do the following:

```rust
```rust,ignore
let even_page = provider.fetch_events(...);
for e in event_page.events {
let my_event: Event = match e.try_into() {
Expand Down
2 changes: 1 addition & 1 deletion starknet-macros/src/abigen/expand/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ mod tests {
starknet::core::types::FunctionCall {
contract_address: self.address,
entry_point_selector: starknet::macros::selector!("my_func"),
__calldata,
calldata: __calldata,
},
self.call_block_id,
)
Expand Down

0 comments on commit e35c40d

Please sign in to comment.