File tree Expand file tree Collapse file tree 6 files changed +228
-289
lines changed Expand file tree Collapse file tree 6 files changed +228
-289
lines changed Original file line number Diff line number Diff line change 11namespace bdk {};
22
33// ------------------------------------------------------------------------
4- // bdk crate - root module
4+ // bdk crate - types module
55// ------------------------------------------------------------------------
66
77enum KeychainKind {
88 "External",
99 "Internal",
1010};
1111
12+ dictionary AddressInfo {
13+ u32 index;
14+ Address address;
15+ KeychainKind keychain;
16+ };
17+
18+ [Enum]
19+ interface AddressIndex {
20+ New();
21+ LastUnused();
22+ Peek(u32 index);
23+ };
24+
25+ dictionary Balance {
26+ u64 immature;
27+
28+ u64 trusted_pending;
29+
30+ u64 untrusted_pending;
31+
32+ u64 confirmed;
33+
34+ u64 trusted_spendable;
35+
36+ u64 total;
37+ };
38+
39+ dictionary LocalUtxo {
40+ OutPoint outpoint;
41+ TxOut txout;
42+ KeychainKind keychain;
43+ boolean is_spent;
44+ };
45+
46+ dictionary TxOut {
47+ u64 value;
48+ Script script_pubkey;
49+ };
50+
1251// ------------------------------------------------------------------------
1352// bdk crate - wallet module
1453// ------------------------------------------------------------------------
@@ -49,33 +88,6 @@ enum ChangeSpendPolicy {
4988 "ChangeForbidden"
5089};
5190
52- dictionary Balance {
53- u64 immature;
54-
55- u64 trusted_pending;
56-
57- u64 untrusted_pending;
58-
59- u64 confirmed;
60-
61- u64 trusted_spendable;
62-
63- u64 total;
64- };
65-
66- dictionary AddressInfo {
67- u32 index;
68- Address address;
69- KeychainKind keychain;
70- };
71-
72- [Enum]
73- interface AddressIndex {
74- New();
75- LastUnused();
76- Peek(u32 index);
77- };
78-
7991interface Wallet {
8092 [Name=new_no_persist, Throws=BdkError]
8193 constructor(Descriptor descriptor, Descriptor? change_descriptor, Network network);
Original file line number Diff line number Diff line change 11use bdk:: bitcoin:: address:: { NetworkChecked , NetworkUnchecked } ;
22use bdk:: bitcoin:: blockdata:: script:: ScriptBuf as BdkScriptBuf ;
3+ use bdk:: bitcoin:: blockdata:: transaction:: TxOut as BdkTxOut ;
34use bdk:: bitcoin:: consensus:: Decodable ;
45use bdk:: bitcoin:: network:: constants:: Network as BdkNetwork ;
56use bdk:: bitcoin:: psbt:: PartiallySignedTransaction as BdkPartiallySignedTransaction ;
@@ -309,3 +310,21 @@ impl From<&OutPoint> for BdkOutPoint {
309310 }
310311 }
311312}
313+
314+ /// A transaction output, which defines new coins to be created from old ones.
315+ #[ derive( Debug , Clone ) ]
316+ pub struct TxOut {
317+ /// The value of the output, in satoshis.
318+ pub value : u64 ,
319+ /// The address of the output.
320+ pub script_pubkey : Arc < Script > ,
321+ }
322+
323+ impl From < & BdkTxOut > for TxOut {
324+ fn from ( tx_out : & BdkTxOut ) -> Self {
325+ TxOut {
326+ value : tx_out. value ,
327+ script_pubkey : Arc :: new ( Script ( tx_out. script_pubkey . clone ( ) ) ) ,
328+ }
329+ }
330+ }
Original file line number Diff line number Diff line change @@ -284,9 +284,12 @@ impl Descriptor {
284284mod test {
285285 use crate :: * ;
286286 use assert_matches:: assert_matches;
287+
287288 use bdk:: descriptor:: DescriptorError :: Key ;
288289 use bdk:: keys:: KeyError :: InvalidNetwork ;
289290
291+ use std:: sync:: Arc ;
292+
290293 fn get_descriptor_secret_key ( ) -> DescriptorSecretKey {
291294 let mnemonic = Mnemonic :: from_string ( "chaos fabric time speed sponsor all flat solution wisdom trophy crack object robot pave observe combine where aware bench orient secret primary cable detect" . to_string ( ) ) . unwrap ( ) ;
292295 DescriptorSecretKey :: new ( Network :: Testnet , Arc :: new ( mnemonic) , None )
You can’t perform that action at this time.
0 commit comments