-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move config to verify level & utilize ArgGroups
- Loading branch information
1 parent
4a9f0fd
commit 34522c8
Showing
11 changed files
with
147 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,26 @@ | ||
use super::base::VerificationInterface; | ||
use async_trait::async_trait; | ||
use sncast::{helpers::configuration::CastConfig, Network}; | ||
use sncast::Network; | ||
|
||
pub struct VoyagerVerificationInterface { | ||
pub network: Network, | ||
} | ||
|
||
impl VoyagerVerificationInterface { | ||
pub fn new(network: Network) -> Self { | ||
VoyagerVerificationInterface { network } | ||
} | ||
pub base_url: String, | ||
} | ||
|
||
#[async_trait] | ||
impl VerificationInterface for VoyagerVerificationInterface { | ||
fn gen_explorer_url(&self, config: CastConfig) -> String { | ||
let base_api_url = match config.verification_base_url { | ||
fn new(network: Network, base_url: Option<String>) -> Self { | ||
let base_url = match base_url { | ||
Some(custom_base_api_url) => custom_base_api_url.clone(), | ||
None => match self.network { | ||
None => match network { | ||
Network::Mainnet => "https://api.voyager.online/beta".to_string(), | ||
Network::Sepolia => "https://sepolia-api.voyager.online/beta".to_string(), | ||
}, | ||
}; | ||
|
||
format!("{base_api_url}/class-verify-v2") | ||
VoyagerVerificationInterface { base_url } | ||
} | ||
|
||
fn gen_explorer_url(&self) -> String { | ||
format!("{}/class-verify-v2", self.base_url) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
use super::base::VerificationInterface; | ||
use async_trait::async_trait; | ||
use sncast::{helpers::configuration::CastConfig, Network}; | ||
use sncast::Network; | ||
|
||
pub struct WalnutVerificationInterface { | ||
pub base_url: String, | ||
pub network: Network, | ||
} | ||
|
||
impl WalnutVerificationInterface { | ||
pub fn new(network: Network) -> Self { | ||
WalnutVerificationInterface { network } | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl VerificationInterface for WalnutVerificationInterface { | ||
fn gen_explorer_url(&self, config: CastConfig) -> String { | ||
let api_base_url = match config.verification_base_url { | ||
fn new(network: Network, base_url: Option<String>) -> Self { | ||
let base_url = match base_url { | ||
Some(custom_base_api_url) => custom_base_api_url.clone(), | ||
None => "https://api.walnut.dev".to_string(), | ||
}; | ||
|
||
WalnutVerificationInterface { base_url, network } | ||
} | ||
|
||
fn gen_explorer_url(&self) -> String { | ||
let path = match self.network { | ||
Network::Mainnet => "/v1/sn_main/verify", | ||
Network::Sepolia => "/v1/sn_sepolia/verify", | ||
}; | ||
format!("{api_base_url}{path}") | ||
format!("{}{}", self.base_url, path) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
mod helpers; | ||
mod voyager; | ||
mod walnut; |
Oops, something went wrong.