File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,18 @@ impl<Pk: MiniscriptKey> Descriptor<Pk> {
277277 Ok ( Descriptor :: Bare ( Bare :: new ( ms) ?) )
278278 }
279279
280+ // Wrap with sh
281+
282+ /// Create a new sh wrapper for the given wpkh descriptor
283+ pub fn new_sh_with_wpkh ( wpkh : Wpkh < Pk > ) -> Self {
284+ Descriptor :: Sh ( Sh :: new_with_wpkh ( wpkh) )
285+ }
286+
287+ /// Create a new sh wrapper for the given wsh descriptor
288+ pub fn new_sh_with_wsh ( wsh : Wsh < Pk > ) -> Self {
289+ Descriptor :: Sh ( Sh :: new_with_wsh ( wsh) )
290+ }
291+
280292 // sorted multi
281293
282294 /// Create a new sh sortedmulti descriptor with threshold `k`
Original file line number Diff line number Diff line change @@ -175,6 +175,13 @@ impl<Pk: MiniscriptKey> Sh<Pk> {
175175 } )
176176 }
177177
178+ /// Create a new p2sh wrapper for the given wsh descriptor
179+ pub fn new_with_wsh ( wsh : Wsh < Pk > ) -> Self {
180+ Self {
181+ inner : ShInner :: Wsh ( wsh) ,
182+ }
183+ }
184+
178185 /// Create a new p2sh wrapped wsh sortedmulti descriptor from threshold
179186 /// `k` and Vec of `pks`
180187 pub fn new_wsh_sortedmulti ( k : usize , pks : Vec < Pk > ) -> Result < Self , Error > {
@@ -191,6 +198,13 @@ impl<Pk: MiniscriptKey> Sh<Pk> {
191198 inner : ShInner :: Wpkh ( Wpkh :: new ( pk) ?) ,
192199 } )
193200 }
201+
202+ /// Create a new p2sh wrapper for the given wpkh descriptor
203+ pub fn new_with_wpkh ( wpkh : Wpkh < Pk > ) -> Self {
204+ Self {
205+ inner : ShInner :: Wpkh ( wpkh) ,
206+ }
207+ }
194208}
195209
196210impl < Pk : MiniscriptKey + ToPublicKey > Sh < Pk > {
You can’t perform that action at this time.
0 commit comments