-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from starknet-id/feat/add_braavos_quests
fix: braavos achievement
- Loading branch information
Showing
4 changed files
with
34 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ async-trait = "0.1.68" | |
percent-encoding = "2.3.0" | ||
chrono = "0.4.19" | ||
lazy_static = "1.4.0" | ||
regex = "1.10.0" |
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,23 +1,39 @@ | ||
use crate::models::Nft; | ||
use regex::Regex; | ||
|
||
pub fn is_braavos_whitelisted(nft: &Nft) -> bool { | ||
let whitelist = vec![ | ||
"Starknet Onboarding Journey NFT", | ||
"Starknet Identity Journey", | ||
"Starknet Exchange Journey", | ||
"Starknet Mobile Journey", | ||
"Starknet Journey Coin NFT", | ||
lazy_static::lazy_static! { | ||
static ref BRAAVOS_WHITELIST : Vec<Regex> = vec![ | ||
Regex::new(r"Starknet Onboarding Journey( NFT)?").unwrap(), | ||
Regex::new(r"Starknet Identity Journey").unwrap(), | ||
Regex::new(r"Starknet Exchange Journey").unwrap(), | ||
Regex::new(r"Starknet Mobile Journey").unwrap(), | ||
Regex::new(r"(Starknet Journey Coin NFT|starknet-journey-coin)").unwrap() | ||
]; | ||
} | ||
|
||
pub fn is_braavos_whitelisted(nft: &Nft, unique_nfts: &mut Vec<String>) { | ||
if let Some(name) = nft.name.as_ref() { | ||
return whitelist.contains(&name.as_str()); | ||
for pattern in &*BRAAVOS_WHITELIST { | ||
if pattern.is_match(name) && !unique_nfts.contains(name) { | ||
unique_nfts.push(name.clone()); | ||
return; | ||
} | ||
} | ||
} | ||
false | ||
} | ||
|
||
pub fn is_argent_whitelisted(_nft: &Nft) -> bool { | ||
true | ||
pub fn is_argent_whitelisted(nft: &Nft, unique_nfts: &mut Vec<String>) { | ||
if let Some(name) = nft.name.as_ref() { | ||
if !unique_nfts.contains(name) { | ||
unique_nfts.push(name.to_string()); | ||
} | ||
} | ||
} | ||
|
||
pub fn is_carbonable_whitelisted(_nft: &Nft) -> bool { | ||
true | ||
pub fn is_carbonable_whitelisted(nft: &Nft, unique_nfts: &mut Vec<String>) { | ||
if let Some(name) = nft.name.as_ref() { | ||
if !unique_nfts.contains(name) { | ||
unique_nfts.push(name.to_string()); | ||
} | ||
} | ||
} |