Skip to content

Commit cdec63e

Browse files
docs: remove 0.x api docs
1 parent bcb77c4 commit cdec63e

File tree

6 files changed

+2
-191
lines changed

6 files changed

+2
-191
lines changed

bdk-ffi/src/bitcoin.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::io::Cursor;
1414
use std::str::FromStr;
1515
use std::sync::{Arc, Mutex};
1616

17-
/// A Bitcoin script.
1817
#[derive(Clone, Debug, PartialEq, Eq)]
1918
pub struct Script(pub(crate) BdkScriptBuf);
2019

@@ -36,13 +35,9 @@ impl From<BdkScriptBuf> for Script {
3635
}
3736

3837
pub enum Network {
39-
/// Mainnet Bitcoin.
4038
Bitcoin,
41-
/// Bitcoin's testnet network.
4239
Testnet,
43-
/// Bitcoin's signet network.
4440
Signet,
45-
/// Bitcoin's regtest network.
4641
Regtest,
4742
}
4843

@@ -69,7 +64,6 @@ impl From<BdkNetwork> for Network {
6964
}
7065
}
7166

72-
/// A Bitcoin address.
7367
#[derive(Debug, PartialEq, Eq)]
7468
pub struct Address {
7569
inner: BdkAddress<NetworkChecked>,
@@ -141,7 +135,6 @@ impl From<BdkAddress> for Address {
141135
}
142136
}
143137

144-
/// A Bitcoin transaction.
145138
#[derive(Debug, Clone, PartialEq, Eq)]
146139
pub struct Transaction {
147140
inner: BdkTransaction,
@@ -242,7 +235,6 @@ impl PartiallySignedTransaction {
242235
// txid.to_hex()
243236
// }
244237

245-
/// Return the transaction.
246238
pub(crate) fn extract_tx(&self) -> Arc<Transaction> {
247239
let tx = self.inner.lock().unwrap().clone().extract_tx();
248240
Arc::new(tx.into())
@@ -293,12 +285,9 @@ impl From<BdkPartiallySignedTransaction> for PartiallySignedTransaction {
293285
}
294286
}
295287

296-
/// A reference to a transaction output.
297288
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
298289
pub struct OutPoint {
299-
/// The referenced transaction's txid.
300290
pub txid: String,
301-
/// The index of the referenced output in its transaction's vout.
302291
pub vout: u32,
303292
}
304293

@@ -311,12 +300,9 @@ impl From<&OutPoint> for BdkOutPoint {
311300
}
312301
}
313302

314-
/// A transaction output, which defines new coins to be created from old ones.
315303
#[derive(Debug, Clone)]
316304
pub struct TxOut {
317-
/// The value of the output, in satoshis.
318305
pub value: u64,
319-
/// The address of the output.
320306
pub script_pubkey: Arc<Script>,
321307
}
322308

bdk-ffi/src/descriptor.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,6 @@ impl Descriptor {
276276
}
277277
}
278278

279-
// // The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
280-
// // These tests should not be used to verify `bdk` behavior that is already tested in the `bdk`
281-
// // crate.
282279
#[cfg(test)]
283280
mod test {
284281
use crate::*;

bdk-ffi/src/keys.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@ use std::ops::Deref;
1818
use std::str::FromStr;
1919
use std::sync::{Arc, Mutex};
2020

21-
/// Mnemonic phrases are a human-readable version of the private keys.
22-
/// Supported number of words are 12, 15, 18, 21 and 24.
2321
pub(crate) struct Mnemonic {
2422
inner: BdkMnemonic,
2523
}
2624

2725
impl Mnemonic {
28-
/// Generates Mnemonic with a random entropy
2926
pub(crate) fn new(word_count: WordCount) -> Self {
3027
// TODO 4: I DON'T KNOW IF THIS IS A DECENT WAY TO GENERATE ENTROPY PLEASE CONFIRM
3128
let mut rng = rand::thread_rng();
@@ -38,22 +35,18 @@ impl Mnemonic {
3835
Mnemonic { inner: mnemonic }
3936
}
4037

41-
/// Parse a Mnemonic with given string
4238
pub(crate) fn from_string(mnemonic: String) -> Result<Self, BdkError> {
4339
BdkMnemonic::from_str(&mnemonic)
4440
.map(|m| Mnemonic { inner: m })
4541
.map_err(|e| BdkError::Generic(e.to_string()))
4642
}
4743

48-
/// Create a new Mnemonic in the specified language from the given entropy.
49-
/// Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length.
5044
pub(crate) fn from_entropy(entropy: Vec<u8>) -> Result<Self, BdkError> {
5145
BdkMnemonic::from_entropy(entropy.as_slice())
5246
.map(|m| Mnemonic { inner: m })
5347
.map_err(|e| BdkError::Generic(e.to_string()))
5448
}
5549

56-
/// Returns Mnemonic as string
5750
pub(crate) fn as_string(&self) -> String {
5851
self.inner.to_string()
5952
}
@@ -164,7 +157,6 @@ impl DescriptorSecretKey {
164157
})
165158
}
166159

167-
/// Get the private key as bytes.
168160
pub(crate) fn secret_bytes(&self) -> Vec<u8> {
169161
let inner = &self.inner;
170162
let secret_bytes: Vec<u8> = match inner {
@@ -262,9 +254,6 @@ impl DescriptorPublicKey {
262254
}
263255
}
264256

265-
// // The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
266-
// // These tests should not be used to verify `bdk` behavior that is already tested in the `bdk`
267-
// // crate.
268257
#[cfg(test)]
269258
mod test {
270259
use crate::keys::{DerivationPath, DescriptorPublicKey, DescriptorSecretKey, Mnemonic};

bdk-ffi/src/lib.rs

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -36,86 +36,4 @@ use bdk::KeychainKind;
3636

3737
uniffi::include_scaffolding!("bdk");
3838

39-
// #[derive(Debug, Clone)]
40-
// pub struct TxIn {
41-
// pub previous_output: OutPoint,
42-
// pub script_sig: Arc<Script>,
43-
// pub sequence: u32,
44-
// pub witness: Vec<Vec<u8>>,
45-
// }
46-
//
47-
// impl From<&BdkTxIn> for TxIn {
48-
// fn from(tx_in: &BdkTxIn) -> Self {
49-
// TxIn {
50-
// previous_output: OutPoint {
51-
// txid: tx_in.previous_output.txid.to_string(),
52-
// vout: tx_in.previous_output.vout,
53-
// },
54-
// script_sig: Arc::new(Script {
55-
// inner: tx_in.script_sig.clone(),
56-
// }),
57-
// sequence: tx_in.sequence.0,
58-
// witness: tx_in.witness.to_vec(),
59-
// }
60-
// }
61-
// }
62-
63-
// /// The method used to produce an address.
64-
// #[derive(Debug)]
65-
// pub enum Payload {
66-
// /// P2PKH address.
67-
// PubkeyHash { pubkey_hash: Vec<u8> },
68-
// /// P2SH address.
69-
// ScriptHash { script_hash: Vec<u8> },
70-
// /// Segwit address.
71-
// WitnessProgram {
72-
// /// The witness program version.
73-
// version: WitnessVersion,
74-
// /// The witness program.
75-
// program: Vec<u8>,
76-
// },
77-
// }
78-
79-
// /// The result after calling the TxBuilder finish() function. Contains unsigned PSBT and
80-
// /// transaction details.
81-
// pub struct TxBuilderResult {
82-
// pub(crate) psbt: Arc<PartiallySignedTransaction>,
83-
// pub transaction_details: TransactionDetails,
84-
// }
85-
//
86-
// uniffi::deps::static_assertions::assert_impl_all!(Wallet: Sync, Send);
87-
//
88-
// // The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
89-
// // These tests should not be used to verify `bdk` behavior that is already tested in the `bdk`
90-
// // crate.
91-
// #[cfg(test)]
92-
// mod test {
93-
// use super::Transaction;
94-
// use crate::Network::Regtest;
95-
// use crate::{Address, Payload};
96-
// use assert_matches::assert_matches;
97-
// use bdk::bitcoin::hashes::hex::FromHex;
98-
// use bdk::bitcoin::util::address::WitnessVersion;
99-
//
100-
// // Verify that bdk-ffi Transaction can be created from valid bytes and serialized back into the same bytes.
101-
// #[test]
102-
// fn test_transaction_serde() {
103-
// let test_tx_bytes = Vec::from_hex("020000000001031cfbc8f54fbfa4a33a30068841371f80dbfe166211242213188428f437445c91000000006a47304402206fbcec8d2d2e740d824d3d36cc345b37d9f65d665a99f5bd5c9e8d42270a03a8022013959632492332200c2908459547bf8dbf97c65ab1a28dec377d6f1d41d3d63e012103d7279dfb90ce17fe139ba60a7c41ddf605b25e1c07a4ddcb9dfef4e7d6710f48feffffff476222484f5e35b3f0e43f65fc76e21d8be7818dd6a989c160b1e5039b7835fc00000000171600140914414d3c94af70ac7e25407b0689e0baa10c77feffffffa83d954a62568bbc99cc644c62eb7383d7c2a2563041a0aeb891a6a4055895570000000017160014795d04cc2d4f31480d9a3710993fbd80d04301dffeffffff06fef72f000000000017a91476fd7035cd26f1a32a5ab979e056713aac25796887a5000f00000000001976a914b8332d502a529571c6af4be66399cd33379071c588ac3fda0500000000001976a914fc1d692f8de10ae33295f090bea5fe49527d975c88ac522e1b00000000001976a914808406b54d1044c429ac54c0e189b0d8061667e088ac6eb68501000000001976a914dfab6085f3a8fb3e6710206a5a959313c5618f4d88acbba20000000000001976a914eb3026552d7e3f3073457d0bee5d4757de48160d88ac0002483045022100bee24b63212939d33d513e767bc79300051f7a0d433c3fcf1e0e3bf03b9eb1d70220588dc45a9ce3a939103b4459ce47500b64e23ab118dfc03c9caa7d6bfc32b9c601210354fd80328da0f9ae6eef2b3a81f74f9a6f66761fadf96f1d1d22b1fd6845876402483045022100e29c7e3a5efc10da6269e5fc20b6a1cb8beb92130cc52c67e46ef40aaa5cac5f0220644dd1b049727d991aece98a105563416e10a5ac4221abac7d16931842d5c322012103960b87412d6e169f30e12106bdf70122aabb9eb61f455518322a18b920a4dfa887d30700").unwrap();
104-
// let new_tx_from_bytes = Transaction::new(test_tx_bytes.clone()).unwrap();
105-
// let serialized_tx_to_bytes = new_tx_from_bytes.serialize();
106-
// assert_eq!(test_tx_bytes, serialized_tx_to_bytes);
107-
// }
108-
//
109-
// // Verify that bdk-ffi Address.payload includes expected WitnessProgram variant, version and program bytes.
110-
// #[test]
111-
// fn test_address_witness_program() {
112-
// let address =
113-
// Address::new("bcrt1qqjn9gky9mkrm3c28e5e87t5akd3twg6xezp0tv".to_string()).unwrap();
114-
// let payload = address.payload();
115-
// assert_matches!(payload, Payload::WitnessProgram { version, program } => {
116-
// assert_eq!(version,WitnessVersion::V0);
117-
// assert_eq!(program, Vec::from_hex("04a6545885dd87b8e147cd327f2e9db362b72346").unwrap());
118-
// });
119-
// assert_eq!(address.network(), Regtest);
120-
// }
121-
// }
39+
// TODO: TxIn, Payload

bdk-ffi/src/types.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,14 @@ use bdk::LocalUtxo as BdkLocalUtxo;
99

1010
use std::sync::Arc;
1111

12-
/// A output script and an amount of satoshis.
1312
pub struct ScriptAmount {
1413
pub script: Arc<Script>,
1514
pub amount: u64,
1615
}
1716

18-
/// A derived address and the index it was found at.
1917
pub struct AddressInfo {
20-
/// Child index of this address.
2118
pub index: u32,
22-
/// Address.
2319
pub address: Arc<Address>,
24-
/// Type of keychain.
2520
pub keychain: KeychainKind,
2621
}
2722

@@ -35,22 +30,9 @@ impl From<BdkAddressInfo> for AddressInfo {
3530
}
3631
}
3732

38-
/// The address index selection strategy to use to derived an address from the wallet's external
39-
/// descriptor.
4033
pub enum AddressIndex {
41-
/// Return a new address after incrementing the current descriptor index.
4234
New,
43-
/// Return the address for the current descriptor index if it has not been used in a received
44-
/// transaction. Otherwise return a new address as with AddressIndex::New.
45-
/// Use with caution, if the wallet has not yet detected an address has been used it could
46-
/// return an already used address. This function is primarily meant for situations where the
47-
/// caller is untrusted; for example when deriving donation addresses on-demand for a public
48-
/// web page.
4935
LastUnused,
50-
/// Return the address for a specific descriptor index. Does not change the current descriptor
51-
/// index used by `AddressIndex::New` and `AddressIndex::LastUsed`.
52-
/// Use with caution, if an index is given that is less than the current descriptor index
53-
/// then the returned address may have already been used.
5436
Peek { index: u32 },
5537
}
5638

@@ -96,17 +78,11 @@ impl From<&BdkAddressIndex> for AddressIndex {
9678
}
9779

9880
pub struct Balance {
99-
// All coinbase outputs not yet matured
10081
pub immature: u64,
101-
/// Unconfirmed UTXOs generated by a wallet tx
10282
pub trusted_pending: u64,
103-
/// Unconfirmed UTXOs received from an external wallet
10483
pub untrusted_pending: u64,
105-
/// Confirmed and immediately spendable balance
10684
pub confirmed: u64,
107-
/// Get sum of trusted_pending and confirmed coins
10885
pub trusted_spendable: u64,
109-
/// Get the whole balance visible to the wallet
11086
pub total: u64,
11187
}
11288

0 commit comments

Comments
 (0)