feat: add frigate electrum based RPC methods - #16
Conversation
server.version, blockchain.silentpayments.subscribe and blockchain.silentpayments.unsubscribe225fc0c to
885cd2f
Compare
|
Thanks for the PR! Note that it needs a rebase now with the recent merges. |
… `blockchain.silentpayments.unsubscribe`
oleonardolima
left a comment
There was a problem hiding this comment.
In https://github.com/sparrowwallet/frigate#serverfeatures it mentions the new field in server.features, is it not needed by bdk-sp ?
|
@sdmg15 I just thought this now during the call, but you could also try adding support for these in https://github.com/bitcoindevkit/rust-electrum-client, not sure if the architecture there supports it though. |
noahjoeris
left a comment
There was a problem hiding this comment.
Thanks for updating @sdmg15 !
I left a few more comments
|
@noahjoeris Thanks for the reviews. I've applied the changes. |
noahjoeris
left a comment
There was a problem hiding this comment.
Thanks again for updating man. Almost there 🚀
Could you also add doc comments to the pub fields you added?
| GetFeeHistogram, | ||
| Banner, | ||
| Ping, | ||
| Custom |
There was a problem hiding this comment.
any reason you dropped Custom here?
There was a problem hiding this comment.
Thanks for catching this, I chose the wrong gen_pending_request_types! between the two former existing one.
| if let Some(start_height) = self.start_height { | ||
| params.push(start_height.into()); | ||
| } | ||
|
|
||
| if let Some(labels) = &self.labels { | ||
| params.push(serde_json::Value::Null); | ||
| params.push(labels.clone().into()); | ||
| } |
There was a problem hiding this comment.
This is not correct like this.
| if let Some(start_height) = self.start_height { | |
| params.push(start_height.into()); | |
| } | |
| if let Some(labels) = &self.labels { | |
| params.push(serde_json::Value::Null); | |
| params.push(labels.clone().into()); | |
| } | |
| match (self.start_height, &self.labels) { | |
| (Some(start_height), Some(labels)) => { | |
| params.extend([start_height.into(), labels.clone().into()]); | |
| } | |
| (Some(start_height), None) => params.push(start_height.into()), | |
| (None, Some(labels)) => { | |
| params.extend([serde_json::Value::Null, labels.clone().into()]); | |
| } | |
| (None, None) => {} | |
| } |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
| pub struct SpUnsubscribe { | ||
| pub scan_priv_key: bitcoin::secp256k1::SecretKey, | ||
| pub scan_pub_key: bitcoin::secp256k1::PublicKey, |
| /// A request to subscribe to payment outputs belonging to the provided keys | ||
| /// | ||
| /// This corresponds to the `"blockchain.silentpayments.subscribe"` Frigate Electrum RPC method. | ||
| /// It returns The silent payment address that has been subscribed. |
There was a problem hiding this comment.
| /// It returns The silent payment address that has been subscribed. | |
| /// It returns the silent payment address that has been subscribed. |
| /// It returns The silent payment address that has been subscribed.This should cancel any scans that | ||
| /// may be currently running for this address. |
There was a problem hiding this comment.
| /// It returns The silent payment address that has been subscribed.This should cancel any scans that | |
| /// may be currently running for this address. | |
| /// It returns the silent payment address that has been unsubscribed. This should cancel any scans | |
| /// that may be currently running for this address. |
| /// | ||
| /// Supported Frigate version <= 1.4.1 | ||
| /// | ||
| /// See: See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentsunsubscribe |
There was a problem hiding this comment.
| /// See: See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentsunsubscribe | |
| /// See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentsunsubscribe |
| } | ||
| } | ||
|
|
||
| /// A request to unsubscribe to payment outputs belonging to the provided keys |
There was a problem hiding this comment.
| /// A request to unsubscribe to payment outputs belonging to the provided keys | |
| /// A request to unsubscribe from payment outputs belonging to the provided keys |
| //! | ||
| //! - [`Notification::Header`] for `"blockchain.headers.subscribe"` | ||
| //! - [`Notification::ScriptHash`] for `"blockchain.scripthash.subscribe"` | ||
| //! - [`Notification::SpSubscribe`] for `"blockchain.silentpayments.subscribe"` |
There was a problem hiding this comment.
This will not resolve without the frigate feature.
maybe use:
//! - `"blockchain.silentpayments.subscribe"` (requires the `frigate` feature)
| /// | ||
| /// Supported Frigate version: <= 1.4.1 | ||
| /// | ||
| /// See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentssubscribe |
There was a problem hiding this comment.
| /// See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentssubscribe | |
| /// See: <https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentssubscribe> |
| /// A notification indicating new confirmed transactions | ||
| /// | ||
| /// Corresponds to `"blockchain.silentpayments.subscribe"` Frigate Electrum notification method |
There was a problem hiding this comment.
| /// A notification indicating new confirmed transactions | |
| /// | |
| /// Corresponds to `"blockchain.silentpayments.subscribe"` Frigate Electrum notification method | |
| /// A notification indicating new transactions. | |
| /// | |
| /// Corresponds to `"blockchain.silentpayments.subscribe"` Frigate Electrum notification method. |
This PR adds supports for additional RPC methods provided by Frigate electrum based RPC server.
The added methods are:
server.version: This is the first message sent to establish connection with serverblockchain.silentpayments.subscribe: This takes a spend public key and a scan private key and return outputs belonging to the them.blockchain.silentpayments.unsubscribe: This takes a spend public key and a scan private key and unsubscribe from notifications.Some context:
This is useful for the PR opened at bitcoindevkit/bdk-sp#48 which is doing integration of frigate ephemeral scanning.
Opening this PR in order to receive feedback.
Reference:
https://github.com/sparrowwallet/frigate/
Supported Frigate version 1.3.2