@@ -656,3 +656,93 @@ impl Request for Ping {
656656 ( "server.ping" . into ( ) , vec ! [ ] )
657657 }
658658}
659+
660+ /// A request to establish connection with Frigate Electrum client
661+ ///
662+ /// This corresponds to the `"server.version"` Frigate Electrum RPC method
663+ ///
664+ /// See: https://github.com/sparrowwallet/frigate
665+ #[ cfg( feature = "frigate" ) ]
666+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
667+ pub struct Version {
668+ pub client_name : CowStr ,
669+ pub version : CowStr ,
670+ }
671+
672+ #[ cfg( feature = "frigate" ) ]
673+ impl Request for Version {
674+ type Response = Vec < String > ;
675+
676+ fn to_method_and_params ( & self ) -> MethodAndParams {
677+ (
678+ "server.version" . into ( ) ,
679+ vec ! [ self . client_name. clone( ) . into( ) , self . version. clone( ) . into( ) ] ,
680+ )
681+ }
682+ }
683+
684+ /// A request to subscribe to payment outputs belonging to the provided keys
685+ ///
686+ /// This corresponds to the `"blockchain.silentpayments.subscribe"` Frigate Electrum RPC method.
687+ /// It returns The silent payment address that has been subscribed.
688+ ///
689+ /// See: https://github.com/sparrowwallet/frigate#blockchainsilentpaymentssubscribe
690+ #[ cfg( feature = "frigate" ) ]
691+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
692+ pub struct SpSubscribe {
693+ pub scan_priv_key : bitcoin:: secp256k1:: SecretKey ,
694+ pub scan_pub_key : bitcoin:: secp256k1:: PublicKey ,
695+ pub start_height : Option < u32 > ,
696+ pub labels : Option < Vec < u32 > > ,
697+ }
698+
699+ #[ cfg( feature = "frigate" ) ]
700+ impl Request for SpSubscribe {
701+ type Response = String ;
702+
703+ fn to_method_and_params ( & self ) -> MethodAndParams {
704+ let mut params = vec ! [
705+ serde_json:: json!( self . scan_priv_key) ,
706+ serde_json:: json!( self . scan_pub_key) ,
707+ ] ;
708+
709+ if let Some ( start_height) = self . start_height {
710+ params. push ( start_height. into ( ) ) ;
711+ }
712+
713+ if let Some ( labels) = & self . labels {
714+ params. push ( labels. clone ( ) . into ( ) ) ;
715+ }
716+
717+ ( "blockchain.silentpayments.subscribe" . into ( ) , params)
718+ }
719+ }
720+
721+ /// A request to unsubscribe to payment outputs belonging to the provided keys
722+ ///
723+ /// This corresponds to the `"blockchain.silentpayments.unsubscribe"` Frigate Electrum RPC method.
724+ /// It returns The silent payment address that has been subscribed.This should cancel any scans that
725+ /// may be currently running for this address.
726+ ///
727+ /// See: https://github.com/sparrowwallet/frigate#blockchainsilentpaymentsunsubscribe
728+ #[ cfg( feature = "frigate" ) ]
729+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
730+ pub struct SpUnSubscribe {
731+ pub scan_priv_key : bitcoin:: secp256k1:: SecretKey ,
732+ pub scan_pub_key : bitcoin:: secp256k1:: PublicKey ,
733+ }
734+
735+ #[ cfg( feature = "frigate" ) ]
736+ impl Request for SpUnSubscribe {
737+ type Response = String ;
738+
739+ fn to_method_and_params ( & self ) -> MethodAndParams {
740+ (
741+ "blockchain.silentpayments.unsubscribe" . into ( ) ,
742+ vec ! [
743+ serde_json:: json!( self . scan_priv_key) ,
744+ serde_json:: json!( self . scan_pub_key) ,
745+ ] ,
746+ )
747+ }
748+ }
0 commit comments