lightning_signer/
wallet.rs

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