Skip to content

Commit 140164e

Browse files
committed
feat: chain_id in network enum
1 parent 49dfed6 commit 140164e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/sdk/src/common/types.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,17 @@ impl Network {
569569
}
570570
}
571571

572-
// TODO: complete this
573572
pub fn chain_id(&self) -> u64 {
574-
todo!()
573+
match self {
574+
Self::Devnet => 31_337,
575+
Self::Holesky | Self::HoleskyStage => 17_000,
576+
Self::Hoodi => 560_048,
577+
Self::Mainnet | Self::MainnetStage => 1,
578+
Self::Sepolia => 11_155_111,
579+
Self::Custom(_, _, _) => {
580+
panic!("Custom networks must supply their chain id separately")
581+
}
582+
}
575583
}
576584
}
577585

0 commit comments

Comments
 (0)