@@ -3,6 +3,8 @@ use crate::error::{
33 PsbtParseError , TransactionError ,
44} ;
55use crate :: error:: { ParseAmountError , PsbtFinalizeError } ;
6+ use crate :: keys:: DerivationPath ;
7+
68use crate :: { impl_from_core_type, impl_hash_like, impl_into_core_type} ;
79use std:: collections:: HashMap ;
810
@@ -502,31 +504,35 @@ impl Display for Transaction {
502504 }
503505}
504506
505- #[ derive( Clone , Debug , uniffi:: Record ) ]
507+ #[ derive( Clone , Debug ) ]
508+ #[ derive( uniffi:: Record ) ]
506509pub struct TapScriptEntry {
507510 /// script (reuse existing `Script` FFI type)
508511 pub script : Arc < Script > ,
509512 /// leaf version
510513 pub leaf_version : u8 ,
511514}
512515
513- #[ derive( Clone , Debug , uniffi:: Record , Hash , Eq , PartialEq ) ]
516+ #[ derive( Clone , Debug ) ]
517+ #[ derive( uniffi:: Record ) ]
514518pub struct TapKeyOrigin {
515519 /// leaf hashes as hex strings
516520 pub tap_leaf_hashes : Vec < String > ,
517521 /// key source
518522 pub key_source : KeySource ,
519523}
520524
521- #[ derive( Clone , Debug , uniffi:: Record , Hash , Eq , PartialEq ) ]
525+ #[ derive( Clone , Debug ) ]
526+ #[ derive( uniffi:: Record ) ]
522527pub struct KeySource {
523528 /// A fingerprint
524529 pub fingerprint : String ,
525530 /// A BIP-32 derivation path.
526- pub path : String ,
531+ pub path : Arc < DerivationPath > ,
527532}
528533
529- #[ derive( Clone , Debug , uniffi:: Record , Hash , Eq , PartialEq ) ]
534+ #[ derive( Clone , Debug , Hash , Eq , PartialEq ) ]
535+ #[ derive( uniffi:: Record ) ]
530536pub struct Key {
531537 /// The type of this PSBT key.
532538 pub type_value : u8 ,
@@ -535,7 +541,8 @@ pub struct Key {
535541 pub key : Vec < u8 > ,
536542}
537543
538- #[ derive( Clone , Debug , uniffi:: Record , Hash , Eq , PartialEq ) ]
544+ #[ derive( Clone , Debug , Hash , Eq , PartialEq ) ]
545+ #[ derive( uniffi:: Record ) ]
539546pub struct ProprietaryKey {
540547 /// Proprietary type prefix used for grouping together keys under some
541548 /// application and avoid namespace collision
@@ -546,7 +553,8 @@ pub struct ProprietaryKey {
546553 pub key : Vec < u8 > ,
547554}
548555
549- #[ derive( Clone , Debug , uniffi:: Record , Hash , Eq , PartialEq ) ]
556+ #[ derive( Clone , Debug , Hash , Eq , PartialEq ) ]
557+ #[ derive( uniffi:: Record ) ]
550558pub struct ControlBlock {
551559 /// The internal key.
552560 pub internal_key : Vec < u8 > ,
@@ -558,7 +566,8 @@ pub struct ControlBlock {
558566 pub leaf_version : u8 ,
559567}
560568
561- #[ derive( Clone , Debug , uniffi:: Record , Hash , Eq , PartialEq ) ]
569+ #[ derive( Clone , Debug , Hash , Eq , PartialEq ) ]
570+ #[ derive( uniffi:: Record ) ]
562571pub struct TapScriptSigKey {
563572 /// An x-only public key, used for verification of Taproot signatures and serialized according to BIP-340.
564573 pub xonly_pubkey : String ,
@@ -568,7 +577,8 @@ pub struct TapScriptSigKey {
568577}
569578
570579/// A key-value map for an input of the corresponding index in the unsigned transaction.
571- #[ derive( Clone , Debug , uniffi:: Record ) ]
580+ #[ derive( Clone , Debug ) ]
581+ #[ derive( uniffi:: Record ) ]
572582pub struct Input {
573583 /// The non-witness transaction this input spends from. Should only be
574584 /// `Option::Some` for inputs which spend non-segwit outputs or
@@ -655,7 +665,7 @@ impl From<&BdkInput> for Input {
655665 pk. to_string ( ) ,
656666 KeySource {
657667 fingerprint : fingerprint. to_string ( ) ,
658- path : deriv_path. to_string ( ) ,
668+ path : Arc :: new ( deriv_path. clone ( ) . into ( ) ) ,
659669 } ,
660670 )
661671 } )
@@ -723,7 +733,7 @@ impl From<&BdkInput> for Input {
723733 tap_leaf_hashes : v. 0 . iter ( ) . map ( |h| h. to_string ( ) ) . collect ( ) ,
724734 key_source : KeySource {
725735 fingerprint : v. 1 . 0 . to_string ( ) ,
726- path : v. 1 . 1 . to_string ( ) ,
736+ path : Arc :: new ( v. 1 . 1 . clone ( ) . into ( ) ) ,
727737 } ,
728738 } ;
729739 ( key, value)
0 commit comments