File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -405,6 +405,9 @@ interface Address {
405405 [Throws=BdkError]
406406 constructor(string address);
407407
408+ [Name=from_script, Throws=BdkError]
409+ constructor(Script script, Network network);
410+
408411 Payload payload();
409412
410413 Network network();
Original file line number Diff line number Diff line change @@ -269,6 +269,12 @@ impl Address {
269269 . map_err ( |e| BdkError :: Generic ( e. to_string ( ) ) )
270270 }
271271
272+ fn from_script ( script : Arc < Script > , network : Network ) -> Result < Self , BdkError > {
273+ BdkAddress :: from_script ( & script. script , network)
274+ . map ( |a| Address { address : a } )
275+ . map_err ( |e| BdkError :: Generic ( e. to_string ( ) ) )
276+ }
277+
272278 fn payload ( & self ) -> Payload {
273279 match & self . address . payload . clone ( ) {
274280 BdkPayload :: PubkeyHash ( pubkey_hash) => Payload :: PubkeyHash {
You can’t perform that action at this time.
0 commit comments