@@ -12,7 +12,7 @@ pub mod network;
1212pub mod raw_transactions;
1313pub mod wallet;
1414
15- use std:: collections:: BTreeMap ;
15+ use std:: collections:: { BTreeMap , HashMap } ;
1616use std:: path:: Path ;
1717
1818use bitcoin:: address:: { Address , NetworkChecked } ;
@@ -22,9 +22,6 @@ use serde::{Deserialize, Serialize};
2222use crate :: client_sync:: into_json;
2323use crate :: types:: v17:: * ;
2424
25- #[ rustfmt:: skip] // Keep public re-exports separate.
26- pub use crate :: client_sync:: WalletCreateFundedPsbtInput ;
27-
2825crate :: define_jsonrpc_minreq_client!( "v17" ) ;
2926crate :: impl_client_check_expected_server_version!( { [ 170200 ] } ) ;
3027
@@ -174,3 +171,38 @@ pub enum TemplateRules {
174171 /// Taproot supported.
175172 Taproot ,
176173}
174+
175+ /// Input used as parameter to `create_raw_transaction`.
176+ #[ derive( Debug , Serialize ) ]
177+ pub struct Input {
178+ /// The txid of the transaction that contains the UTXO.
179+ pub txid : bitcoin:: Txid ,
180+ /// The vout for the UTXO.
181+ pub vout : u64 ,
182+ /// Sequence number if needed.
183+ pub sequence : Option < bitcoin:: Sequence > ,
184+ }
185+
186+ /// Output used as parameter to `create_raw_transaction`.
187+ // Abuse `HashMap` so we can derive serialize to get the correct JSON object.
188+ #[ derive( Debug , Serialize ) ]
189+ pub struct Output (
190+ /// Map of address to value. Always only has a single item in it.
191+ HashMap < String , f64 > ,
192+ ) ;
193+
194+ impl Output {
195+ /// Creates a single output that serializes as Core expects.
196+ pub fn new ( addr : Address , value : Amount ) -> Self {
197+ let mut map = HashMap :: new ( ) ;
198+ map. insert ( addr. to_string ( ) , value. to_btc ( ) ) ;
199+ Output ( map)
200+ }
201+ }
202+
203+ /// An element in the `inputs` argument of method `walletcreatefundedpsbt`.
204+ #[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
205+ pub struct WalletCreateFundedPsbtInput {
206+ txid : Txid ,
207+ vout : u32 ,
208+ }
0 commit comments