Skip to content

Commit

Permalink
Update ChainId inner representation to Felt
Browse files Browse the repository at this point in the history
  • Loading branch information
nsiregar committed Mar 31, 2024
1 parent b85bf99 commit 7c74e5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use once_cell::sync::Lazy;
use primitive_types::H160;
use serde::{Deserialize, Serialize};
use starknet_crypto::FieldElement;
use starknet_types_core::felt::Felt;

use crate::crypto::PublicKey;
use crate::hash::{pedersen_hash_array, PoseidonHash, StarkFelt, StarkHash};
Expand All @@ -18,11 +19,11 @@ use crate::{impl_from_through_intermediate, StarknetApiError};

/// A chain id.
#[derive(Clone, Debug, Display, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct ChainId(pub String);
pub struct ChainId(pub Felt);

impl ChainId {
pub fn as_hex(&self) -> String {
format!("0x{}", hex::encode(&self.0))
format!("0x{}", hex::encode(&self.0.to_string()))
}
}

Expand Down

0 comments on commit 7c74e5d

Please sign in to comment.