-
Notifications
You must be signed in to change notification settings - Fork 391
refactor(sdk): Remove NetworkArg + Make functions that accept Network methods of Network
#1598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f6caa0d
c221ae4
48fa154
e525096
cd58390
a86bf1e
709e130
4d04fb3
8e00949
de8237d
413aada
a98da8a
4922d46
efd4308
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,7 @@ use std::fmt::Display; | |||||
| use std::fmt::Formatter; | ||||||
| use std::str::FromStr; | ||||||
|
|
||||||
| use clap::ValueEnum; | ||||||
| use ethers::core::k256::ecdsa::SigningKey; | ||||||
| use ethers::signers::Signer; | ||||||
| use ethers::signers::Wallet; | ||||||
|
|
@@ -11,6 +12,7 @@ use ethers::types::transaction::eip712::Eip712; | |||||
| use ethers::types::transaction::eip712::Eip712Error; | ||||||
| use ethers::types::Address; | ||||||
| use ethers::types::Signature; | ||||||
| use ethers::types::H160; | ||||||
| use ethers::types::U256; | ||||||
| use lambdaworks_crypto::merkle_tree::{ | ||||||
| merkle::MerkleTree, proof::Proof, traits::IsMerkleTreeBackend, | ||||||
|
|
@@ -396,14 +398,38 @@ pub enum GetNonceResponseMessage { | |||||
| InvalidRequest(String), | ||||||
| } | ||||||
|
|
||||||
| #[derive(Debug, Clone, Copy)] | ||||||
| #[derive(Debug, Clone, Copy, ValueEnum)] | ||||||
| pub enum Network { | ||||||
| Devnet, | ||||||
| Holesky, | ||||||
| HoleskyStage, | ||||||
| Mainnet, | ||||||
| } | ||||||
|
|
||||||
| impl Network { | ||||||
| pub fn get_batcher_payment_service_address(&self) -> ethers::types::H160 { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: pass by copy:
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch! @Oppen
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that |
||||||
| match self { | ||||||
| Self::Devnet => H160::from_str("0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650").unwrap(), | ||||||
| Self::Holesky => H160::from_str("0x815aeCA64a974297942D2Bbf034ABEe22a38A003").unwrap(), | ||||||
| Self::HoleskyStage => { | ||||||
| H160::from_str("0x7577Ec4ccC1E6C529162ec8019A49C13F6DAd98b").unwrap() | ||||||
| } | ||||||
| Self::Mainnet => H160::from_str("0xb0567184A52cB40956df6333510d6eF35B89C8de").unwrap(), | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| pub fn get_aligned_service_manager_address(&self) -> ethers::types::H160 { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: pass by copy:
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch! @Oppen |
||||||
| match self { | ||||||
| Self::Devnet => H160::from_str("0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8").unwrap(), | ||||||
| Self::Holesky => H160::from_str("0x58F280BeBE9B34c9939C3C39e0890C81f163B623").unwrap(), | ||||||
| Self::HoleskyStage => { | ||||||
| H160::from_str("0x9C5231FC88059C086Ea95712d105A2026048c39B").unwrap() | ||||||
| } | ||||||
| Self::Mainnet => H160::from_str("0xeF2A435e5EE44B2041100EF8cbC8ae035166606c").unwrap(), | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| impl FromStr for Network { | ||||||
| type Err = String; | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.