1 unstable release

new 0.7.1 Oct 28, 2024

#737 in Magic Beans

Download history 148/week @ 2024-10-26

148 downloads per month
Used in 2 crates (via sn-trie-proofs)

MIT license

490KB
11K SLoC

starknet-types-rpc

# starknet-types-rpc

`starknet-types-rpc` is a crate dealing with Starknet types used in RPC communication, serde, and transport. This crate is part of an initiative to standardize the representation of the `Felt` type in Rust, reducing code complexity and improving performance across the Starknet Rust ecosystem.

## Usage

Include `starknet-types-rpc` in your library by adding the following to your `Cargo.toml`:

```toml
[dependencies]
starknet-types-rpc = { version = "0.0.2", git = "https://github.com/starknet-io/types-rs" }

Build from source

The crate is built in two steps:

Generating bindings against the Starknet OpenRPC specification

The specification is hosted on Starknet's repository (link).

Bindings are generated using openrpc-gen.

After having built openrpc-gen, you can use the following command to generate the final generated Rust files:

make all

NOTE: Currently the starknet_trace_api_openrpc file requires a modification for starknet_simulateTransactions (nested schema in the result, see previous version for infos)

Note that this first step is normally already done for you upon cloning the repository.

Building the generated files

Once this is done, you can build the crate with:

cargo build --release

Testing

Clone the repository and navigate to the starknet-types-rpc directory. Then run:

cargo test

Contributing

Contributions are welcome! Please read our contributing guidelines for more information.

License

This repository is licensed under the MIT License, see LICENSE for more information.

Dependencies

~1.6–2.7MB
~58K SLoC