1use crate::pattern::Pattern;
2
3#[derive(Debug, Clone)]
4pub struct KeyExport {
5 pub label: String,
6 pub value: String,
7 pub hint: Option<String>,
8}
9
10#[derive(Debug, Clone)]
11pub struct KeypairResult {
12 pub address: String,
13 pub exports: Vec<KeyExport>,
14}
15
16pub enum GrindAttempt {
18 Solana(solana_sdk::signature::Keypair),
19 Secret32([u8; 32]),
21}
22
23pub trait ChainGrinder: Send + Sync + Clone {
24 fn id(&self) -> &'static str;
25 fn display_name(&self) -> &'static str;
26
27 fn grind_attempt(&self) -> (String, GrindAttempt);
29
30 fn finalize(&self, attempt: GrindAttempt) -> KeypairResult;
32
33 fn build_pattern(
34 &self,
35 prefix: Option<&str>,
36 suffix: Option<&str>,
37 exact: bool,
38 ) -> Result<Pattern, String>;
39 fn expected_attempts(&self, pattern: &Pattern) -> f64;
40 fn matches(&self, address: &str, pattern: &Pattern) -> bool;
41 fn supports_exact_case(&self) -> bool;
42 fn pattern_hint(&self) -> &'static str;
43}