diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0723347..b4c064c 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -50,5 +50,5 @@ jobs: with: toolchain: 1.70 - run: cargo test - - run: cargo test --no-default-features + - run: cargo test --no-default-features --workspace --exclude foundation-ffi - run: cargo test --all-features diff --git a/Cargo.toml b/Cargo.toml index cfc330c..57f32d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ homepage = "https://github.com/Foundation-Devices/foundation-rs" arbitrary = { version = "1", features = ["derive"] } bech32 = { version = "0.9", default-features = false } bip39 = { version = "2", default-features = false } -bitcoin = { version = "0.30", default-features = false } +bitcoin = { version = "0.31", default-features = false } bitcoin_hashes = { version = "0.13", default-features = false } bs58 = "0.5" crc = "3" diff --git a/test-vectors/src/lib.rs b/test-vectors/src/lib.rs index 51b4fba..1cf6283 100644 --- a/test-vectors/src/lib.rs +++ b/test-vectors/src/lib.rs @@ -105,11 +105,11 @@ mod blockchain_commons { #[serde(rename_all = "kebab-case")] pub enum CryptoHDKeyVector { Xpub { - key: bitcoin::bip32::ExtendedPubKey, + key: bitcoin::bip32::Xpub, origin: Option, }, Xprv { - key: bitcoin::bip32::ExtendedPrivKey, + key: bitcoin::bip32::Xpriv, }, } diff --git a/urtypes/src/registry/crypto_address.rs b/urtypes/src/registry/crypto_address.rs index eb7f1b3..0f565bd 100644 --- a/urtypes/src/registry/crypto_address.rs +++ b/urtypes/src/registry/crypto_address.rs @@ -47,8 +47,8 @@ impl<'a> TryFrom<&'a bitcoin::Address> for C fn try_from( address: &'a bitcoin::Address, ) -> Result { - let kind = AddressKind::try_from(&address.payload).ok(); - let data = data_from_payload(&address.payload)?; + let kind = AddressKind::try_from(address.payload()).ok(); + let data = data_from_payload(address.payload())?; Ok(Self { info: None, @@ -66,14 +66,14 @@ impl<'a> TryFrom<&'a bitcoin::Address> for Cry use crate::registry::CoinType; use bitcoin::Network; - let network = match address.network { + let network = match address.network() { Network::Bitcoin => CryptoCoinInfo::NETWORK_MAINNET, Network::Testnet => CryptoCoinInfo::NETWORK_BTC_TESTNET, _ => return Err(InterpretAddressError::UnsupportedNetwork), }; let info = CryptoCoinInfo::new(CoinType::BTC, network); - let kind = AddressKind::try_from(&address.payload).ok(); - let data = data_from_payload(&address.payload)?; + let kind = AddressKind::try_from(address.payload()).ok(); + let data = data_from_payload(address.payload())?; Ok(Self { info: Some(info), @@ -212,7 +212,7 @@ impl TryFrom<&bitcoin::address::Payload> for AddressKind { type Error = UnknownAddressType; fn try_from(value: &bitcoin::address::Payload) -> Result { - use bitcoin::address::{Payload, WitnessVersion}; + use bitcoin::{address::Payload, blockdata::script::witness_version::WitnessVersion}; let kind = match value { Payload::PubkeyHash(_) => AddressKind::P2PKH, diff --git a/urtypes/src/registry/crypto_hdkey.rs b/urtypes/src/registry/crypto_hdkey.rs index 636b5c2..90a4e6e 100644 --- a/urtypes/src/registry/crypto_hdkey.rs +++ b/urtypes/src/registry/crypto_hdkey.rs @@ -26,10 +26,10 @@ impl<'a> CryptoHDKey<'a> { } #[cfg(feature = "bitcoin")] -impl<'a> TryFrom<&'a bitcoin::bip32::ExtendedPrivKey> for CryptoHDKey<'a> { +impl<'a> TryFrom<&'a bitcoin::bip32::Xpriv> for CryptoHDKey<'a> { type Error = InterpretExtendedKeyError; - fn try_from(xprv: &'a bitcoin::bip32::ExtendedPrivKey) -> Result { + fn try_from(xprv: &'a bitcoin::bip32::Xpriv) -> Result { use crate::registry::CoinType; if xprv.depth == 0 { @@ -67,10 +67,10 @@ impl<'a> TryFrom<&'a bitcoin::bip32::ExtendedPrivKey> for CryptoHDKey<'a> { } #[cfg(feature = "bitcoin")] -impl<'a> TryFrom<&'a bitcoin::bip32::ExtendedPubKey> for CryptoHDKey<'a> { +impl<'a> TryFrom<&'a bitcoin::bip32::Xpub> for CryptoHDKey<'a> { type Error = InterpretExtendedKeyError; - fn try_from(xpub: &'a bitcoin::bip32::ExtendedPubKey) -> Result { + fn try_from(xpub: &'a bitcoin::bip32::Xpub) -> Result { use crate::registry::CoinType; Ok(Self::DerivedKey(DerivedKey {