You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
881df71 chore: rename `merge_network_kinds` to `intersect_network_kinds` (Luis Schwab)
fdb9d13 fix: GeneratableKey options for PrivateKey, Xpriv (valued mammal)
b1d384f feat!(examples,test): use `NetworkKind` (Luis Schwab)
944274a feat!(wallet): use `NetworkKind` (Luis Schwab)
c22aa13 feat!(keys): use `NetworkKind` (Luis Schwab)
ade83b4 feat!(descriptor): use `NetworkKind` (Luis Schwab)
Pull request description:
### Description
Closes#22.
Closes#94.
This PR replaces `bitcoin::Network` for `bitcoin::NetworkKind` where it applies.
I also took the liberty of fixing up and adding comments on the files I touched.
### Changelog
- `wallet_name_from_descriptor()` takes `NetworkKind` instead of `Network`.
- `DescriptorToExtract` takes `NetworkKind` instead of `Network`.
- `impl IntoWalletDescriptor for <T>` takes `Network` instead `NetworkKind`.
- `DescriptorTemplate::build()` takes `NetworkKind` instead of `Network`.
- `ExtendedKey::into_xprv()` takes `NetworkKind` instead of `Network`.
- `ExtendedKey::into_xpub()` takes `NetworkKind` instead of `Network`.
- `DerivableKey::into_extended_key()` examples updated to use `NetworkKind` instead of `Network`.
- `any_network()` renamed to `any_network_kind()`.
- `mainnet_network()` renamed to `mainnet_network_kind()`.
- `test_networks()` renamed to `test_network_kind()`.
- `merge_networks()` renamed to `intersect_network_kinds()`.
- `ValidNetworks` type alias renamed to `ValidNetworkKinds`.
- `GeneratedKey::new()` takes `ValidNetworkKinds` instead of `ValidNetworks`.
- `DescriptorKey::from_public()` takes `ValidNetworkKinds` instead of `ValidNetworks`.
- `DescriptorKey::from_secret()` takes `ValidNetworkKinds` instead of `ValidNetworks`.
- `KeyError::InvalidNetwork` renamed to `KeyError::InvalidNetworkKind`.
- `DescriptorKey::override_valid_networks()` renamed to `override_valid_network_kinds()`.
- Network validation logic updated to use `NetworkKind` instead of `Network`.
- Test network validation now uses `NetworkKind::Test` instead of `Network::{Regtest, Signet, Testnet, Testnet4}`.
- Examples and comments updated to use `NetworkKind` instead of `Network`.
### Checklists
#### All Submissions:
* [X] I've signed all my commits
* [X] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [X] I ran `cargo +nightly fmt` and `cargo clippy` before committing
#### New Features:
* [ ] I've added tests for the new feature
* [X] I've added docs for the new feature
#### Bugfixes:
* [X] This pull request breaks the existing API
* [ ] I've added tests to reproduce the issue which are now passing
* [X] I'm linking the issue being fixed by this PR
ACKs for top commit:
ValuedMammal:
ACK 881df71
oleonardolima:
ACK 881df71
Tree-SHA512: 9da33233db1409764d75fd688c8343f01c624b359df389acbafbab818114b2ffb1d0f1a977ff60ff5f850b8d8de4b74827360a4740954c0d751ce5a60d1cc5af
Copy file name to clipboardExpand all lines: examples/policy.rs
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
// Bitcoin Dev Kit
2
2
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
3
3
//
4
-
// Copyright (c) 2020-2021 Bitcoin Dev Kit Developers
4
+
// Copyright (c) 2020-2025 Bitcoin Dev Kit Developers
5
5
//
6
6
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
7
7
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
@@ -10,11 +10,12 @@
10
10
// licenses.
11
11
12
12
externcrate bdk_wallet;
13
+
13
14
use std::error::Error;
14
15
15
-
use bdk_wallet::bitcoin::Network;
16
16
use bdk_wallet::descriptor::{policy::BuildSatisfaction,ExtractPolicy,IntoWalletDescriptor};
17
17
use bdk_wallet::signer::SignersContainer;
18
+
use bitcoin::NetworkKind;
18
19
19
20
/// This example describes the use of the BDK's [`bdk_wallet::descriptor::policy`] module.
20
21
///
@@ -29,18 +30,17 @@ use bdk_wallet::signer::SignersContainer;
29
30
fnmain() -> Result<(),Box<dynError>>{
30
31
let secp = bitcoin::secp256k1::Secp256k1::new();
31
32
32
-
// The descriptor used in the example
33
-
// The form is "wsh(multi(2, <privkey>, <pubkey>))"
33
+
// The descriptor used in the example. The form is "wsh(multi(2, <privkey>, <pubkey>))".
34
34
let desc = "wsh(multi(2,tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcLNfjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/*,tpubD6NzVbkrYhZ4XHndKkuB8FifXm8r5FQHwrN6oZuWCz13qb93rtgKvD4PQsqC4HP4yhV3tA2fqr2RbY5mNXfM7RxXUoeABoDtsFUq2zJq6YK/1/*))";
35
35
36
36
// Use the descriptor string to derive the full descriptor and a keymap.
37
37
// The wallet descriptor can be used to create a new bdk_wallet::wallet.
38
38
// While the `keymap` can be used to create a `SignerContainer`.
39
39
//
40
40
// The `SignerContainer` can sign for `PSBT`s.
41
-
// a `bdk_wallet::Wallet` internally uses these to handle transaction signing.
42
-
// But they can be used as independent tools also.
0 commit comments