papyrus_common/
lib.rs

1use serde::{Deserialize, Serialize};
2use starknet_api::block::{BlockHash, BlockNumber};
3use starknet_types_core::felt::Felt;
4
5pub mod block_hash;
6pub mod class_hash;
7pub mod deprecated_class_abi;
8pub mod metrics;
9pub mod pending_classes;
10pub mod state;
11pub mod state_diff_commitment;
12pub mod storage_query;
13pub mod transaction_hash;
14
15#[derive(Copy, Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
16pub struct BlockHashAndNumber {
17    pub block_hash: BlockHash,
18    pub block_number: BlockNumber,
19}
20
21#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
22pub struct TransactionOptions {
23    /// Transaction that shouldn't be broadcasted to StarkNet. For example, users that want to
24    /// test the execution result of a transaction without the risk of it being rebroadcasted (the
25    /// signature will be different while the execution remain the same). Using this flag will
26    /// modify the transaction version by setting the 128-th bit to 1.
27    pub only_query: bool,
28}
29
30pub(crate) fn usize_into_felt(u: usize) -> Felt {
31    u128::try_from(u).expect("Expect at most 128 bits").into()
32}