lightning_signer/
wallet.rs

1use bitcoin::bip32::DerivationPath;
2use bitcoin::secp256k1::PublicKey;
3use bitcoin::{Address, Network, ScriptBuf};
4
5use crate::util::status::Status;
6
7/// A layer-1 wallet used by Validator
8pub trait Wallet {
9    /// True if the wallet can spend the given output with a derived key
10    fn can_spend(
11        &self,
12        child_path: &DerivationPath,
13        script_pubkey: &ScriptBuf,
14    ) -> Result<bool, Status>;
15
16    /// Returns true if the given destination Lightning payee is in the node's allowlist
17    fn allowlist_contains_payee(&self, payee: PublicKey) -> bool;
18
19    /// True if the script_pubkey is in the node's allowlist
20    fn allowlist_contains(&self, script_pubkey: &ScriptBuf, path: &DerivationPath) -> bool;
21
22    /// Returns the network
23    fn network(&self) -> Network;
24
25    /// Returns the native segwit address at path
26    fn get_native_address(&self, child_path: &DerivationPath) -> Result<Address, Status>;
27
28    /// Returns the p2tr address at path
29    fn get_taproot_address(&self, child_path: &DerivationPath) -> Result<Address, Status>;
30
31    /// Returns the wrapped segwit address at path
32    #[deprecated(since = "0.9.0", note = "Use native addresses instead")]
33    fn get_wrapped_address(&self, child_path: &DerivationPath) -> Result<Address, Status>;
34}