Skip to content

feat!: use NetworkKind #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

luisschwab
Copy link
Member

Description

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.
  • FnOnce 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 merge_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:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo +nightly fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@coveralls
Copy link

coveralls commented Jun 1, 2025

Pull Request Test Coverage Report for Build 15377741476

Details

  • 396 of 423 (93.62%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.09%) to 85.642%

Changes Missing Coverage Covered Lines Changed/Added Lines %
wallet/src/keys/bip39.rs 16 17 94.12%
wallet/src/descriptor/dsl.rs 44 46 95.65%
wallet/src/wallet/mod.rs 34 37 91.89%
wallet/src/descriptor/policy.rs 16 22 72.73%
wallet/src/descriptor/mod.rs 66 73 90.41%
wallet/src/keys/mod.rs 89 97 91.75%
Totals Coverage Status
Change from base Build 15311776581: 0.09%
Covered Lines: 7444
Relevant Lines: 8692

💛 - Coveralls

@luisschwab luisschwab self-assigned this Jun 1, 2025
@luisschwab luisschwab added the api A breaking API change label Jun 1, 2025
@luisschwab luisschwab moved this to Needs Review in BDK Wallet Jun 1, 2025
@luisschwab luisschwab modified the milestones: Wallet 3.1.0, Wallet 3.0.0 Jun 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api A breaking API change
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

feat: use new NetworkKind throughout the BDK codebase
2 participants