/types-rs

🐺 Starknet Rust types 🦀

Primary LanguageRustMIT LicenseMIT

types-rs

🐺 Starknet Rust types 🦀

GitHub Workflow Status Project license Pull Requests welcome Rust docs Rust crate

This repository is an initiative by a group of maintainers to address the fragmentation in the Starknet Rust ecosystem and improve its interoperability. The key motivation behind this repository is to standardize the representation of the Felt (Field Element) type in Rust, which is massively used as the core and atomic type of the Cairo language and its Virtual Machine.

The Felt type is currently defined in many different crates and repositories, resulting in increased code complexity and performance issues due to the need for numerous conversions. This repository aims to mitigate these issues by providing a universal Felt type in Rust.

Crates

This repository hosts two crates:

  • starknet-types-core: This crate provides the universal Felt (Field Element) type for Cairo and STARK proofs. It also focuses on Starknet types related to computation and execution, requiring performance and optimization for specific arithmetic and cryptographic operations.

  • starknet-types-rpc: This crate deals with Starknet types used in RPC communication, serde, and transport.

Usage

You can include any of these crates in your library via crates.io or as a git dependency. For example, to include the starknet-types-core crate, add the following to your Cargo.toml:

As a crates.io dependency:

[dependencies]
starknet-types-core = "0.1.0"

As a git dependency:

[dependencies]
starknet-types-core = { git = "https://github.com/starknet-io/types-rs.git", version = "0.1.0", default-features = false, features = ["serde"] }

Build from source

To build the crates from source, clone the repository and run the following command:

cargo build --release

Testing

To run the tests, clone the repository and run the following command:

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.