@@ -2,20 +2,28 @@ use std::collections::HashMap;
22
33use serde:: Deserialize ;
44
5- use crate :: program:: { EventConfig , Program , ProgramName } ;
5+ use crate :: program:: { EventConfig , ProgramConfig , ProgramName } ;
66
77#[ derive( Deserialize ) ]
88pub struct JitoBellConfig {
99 /// Programs Configuration
10- pub programs : HashMap < ProgramName , Program > ,
10+ pub programs : HashMap < ProgramName , ProgramConfig > ,
1111
1212 /// Block explorer url
1313 pub explorer_url : String ,
1414
15+ /// Squads app URL template
16+ #[ serde( default = "default_squads_app_url_template" ) ]
17+ pub squads_app_url_template : String ,
18+
1519 /// Message Templates
1620 pub message_templates : HashMap < String , String > ,
1721}
1822
23+ fn default_squads_app_url_template ( ) -> String {
24+ "https://app.squads.so/squads/{{multisig}}/transactions/{{transaction}}" . to_string ( )
25+ }
26+
1927impl JitoBellConfig {
2028 /// Get a message template by name, falling back to default
2129 pub fn get_template ( & self , name : & str ) -> Option < & String > {
@@ -25,9 +33,30 @@ impl JitoBellConfig {
2533 }
2634}
2735
36+ #[ cfg( test) ]
37+ mod tests {
38+ use super :: JitoBellConfig ;
39+
40+ #[ test]
41+ fn sample_config_parses ( ) {
42+ let path = std:: path:: Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) )
43+ . parent ( )
44+ . unwrap ( )
45+ . join ( "jito_bell_config_sample.yaml" ) ;
46+ let yaml = std:: fs:: read_to_string ( path) . expect ( "sample config file not found" ) ;
47+ serde_yaml:: from_str :: < JitoBellConfig > ( & yaml)
48+ . expect ( "sample config should deserialize without error" ) ;
49+ }
50+ }
51+
2852impl std:: fmt:: Display for JitoBellConfig {
2953 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
3054 writeln ! ( f, "Explorer URL: {}" , self . explorer_url) ?;
55+ writeln ! (
56+ f,
57+ "Squads App URL Template: {}" ,
58+ self . squads_app_url_template
59+ ) ?;
3160
3261 writeln ! ( f, "Message Templates:" ) ?;
3362 for ( name, template) in & self . message_templates {
@@ -41,6 +70,8 @@ impl std::fmt::Display for JitoBellConfig {
4170 ProgramName :: SplToken2022 => "spl_token2022" ,
4271 ProgramName :: SplStakePool => "spl_stake_pool" ,
4372 ProgramName :: JitoVault => "jito_vault" ,
73+ ProgramName :: SquadsV3 => "squads_v3" ,
74+ ProgramName :: SquadsV4 => "squads_v4" ,
4475 } ;
4576 writeln ! ( f, " Program Name: {}" , program_name) ?;
4677 writeln ! ( f, " Program ID: {}" , program. program_id) ?;
0 commit comments