Skip to content

Commit

Permalink
docs: document the Felt type
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI authored and incrypto32 committed Jan 22, 2024
1 parent d9593ab commit 3a9c18d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chain/starknet/src/felt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ use std::{
use graph::anyhow;
use serde::{de::Visitor, Deserialize};

/// Represents the primitive `FieldElement` type used in Starknet. Each `FieldElement` is 252-bit
/// in size.
#[derive(Clone, PartialEq, Eq)]
pub struct Felt([u8; 32]);

struct FeltVisitor;

impl Debug for Felt {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "0x{}", hex::encode(&self.0))
write!(f, "0x{}", hex::encode(self.0))
}
}

Expand Down

0 comments on commit 3a9c18d

Please sign in to comment.