Skip to content

Commit 9bd6ea8

Browse files
committed
Update ChainId inner representation to Felt
1 parent b85bf99 commit 9bd6ea8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/core.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ use once_cell::sync::Lazy;
99
use primitive_types::H160;
1010
use serde::{Deserialize, Serialize};
1111
use starknet_crypto::FieldElement;
12+
use starknet_types_core::felt::Felt;
1213

1314
use crate::crypto::PublicKey;
1415
use crate::hash::{pedersen_hash_array, PoseidonHash, StarkFelt, StarkHash};
1516
use crate::serde_utils::{BytesAsHex, PrefixedBytesAsHex};
1617
use crate::transaction::{Calldata, ContractAddressSalt};
17-
use crate::{impl_from_through_intermediate, StarknetApiError};
18+
use crate::{impl_from_through_intermediate, stark_felt, StarknetApiError};
1819

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

2324
impl ChainId {
24-
pub fn as_hex(&self) -> String {
25-
format!("0x{}", hex::encode(&self.0))
25+
pub fn as_hex(&self) -> Felt {
26+
stark_felt!(format!("0x{}", hex::encode(&self.0)))
2627
}
2728
}
2829

0 commit comments

Comments
 (0)