Skip to content

Commit

Permalink
add custom url
Browse files Browse the repository at this point in the history
  • Loading branch information
zkbenny committed Jun 16, 2024
1 parent e582ca6 commit 0f49cb8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions provider/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use std::str::FromStr;

/// Network to be used for a zklink client.
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub enum Network {
/// Mainnet.
Expand All @@ -12,6 +12,8 @@ pub enum Network {
TestNet,
/// Develop network
DevNet,
/// Custom url
Custom(String),
}

impl Network {
Expand All @@ -20,6 +22,7 @@ impl Network {
Network::MainNet => "https://api-v1.zk.link",
Network::TestNet => "https://aws-gw-v2.zk.link",
Network::DevNet => "https://dev-gw-v1.zk.link",
Network::Custom(s) => &s,

Check failure on line 25 in provider/src/network.rs

View workflow job for this annotation

GitHub Actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

error: this expression creates a reference which is immediately dereferenced by the compiler --> provider/src/network.rs:25:35 | 25 | Network::Custom(s) => &s, | ^^ help: change this to: `s` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings`
}
}
}
Expand All @@ -32,7 +35,7 @@ impl FromStr for Network {
"mainet" => Ok(Network::MainNet),
"testnet" => Ok(Network::TestNet),
"devnet" => Ok(Network::DevNet),
_ => Err(RpcError::InvalidNetwork),
_ => Ok(Network::Custom(s.to_string())),
}
}
}

0 comments on commit 0f49cb8

Please sign in to comment.