From 83b2cab7f25cf6aad907e2d49c39ab9303a723c0 Mon Sep 17 00:00:00 2001 From: antiyro <74653697+antiyro@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:35:12 +0200 Subject: [PATCH] fix: :zap: Added latest starknet-types-core release to support Starkhash trait + block number as Id new impl (#23) --- Cargo.toml | 2 +- src/id.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 39979e6..1b23a4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ serde = { version = "1.0.195", default-features = false, features = [ "derive", "alloc", ] } -starknet-types-core = { version = "0.0.11", default-features = false, features = [ +starknet-types-core = { git = "https://github.com/starknet-io/types-rs", branch = "main", default-features = false, features = [ "hash", "parity-scale-codec", ] } diff --git a/src/id.rs b/src/id.rs index 763c86a..f0e4bd4 100644 --- a/src/id.rs +++ b/src/id.rs @@ -11,6 +11,12 @@ pub trait Id: hash::Hash + PartialEq + Eq + PartialOrd + Ord + Debug + Copy + De #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy, Default)] pub struct BasicId(u64); +impl BasicId { + pub fn new(id: u64) -> Self { + BasicId(id) + } +} + impl Id for BasicId { fn to_bytes(&self) -> Vec { self.0.to_be_bytes().to_vec()