From 320794338da9e34e5ce5e85369f10e7cfe4371f4 Mon Sep 17 00:00:00 2001 From: thunderbiscuit Date: Fri, 18 Oct 2024 10:51:50 -0400 Subject: [PATCH] refactor: use TxIn type from bitcoin-ffi --- bdk-ffi/Cargo.lock | 2 +- bdk-ffi/Cargo.toml | 4 +++- bdk-ffi/src/bdk.udl | 10 ++++------ bdk-ffi/src/bitcoin.rs | 25 +------------------------ bdk-ffi/src/lib.rs | 2 +- 5 files changed, 10 insertions(+), 33 deletions(-) diff --git a/bdk-ffi/Cargo.lock b/bdk-ffi/Cargo.lock index fee7d1a0..cf5b640b 100644 --- a/bdk-ffi/Cargo.lock +++ b/bdk-ffi/Cargo.lock @@ -288,7 +288,7 @@ dependencies = [ [[package]] name = "bitcoin-ffi" version = "0.1.2" -source = "git+https://github.com/bitcoindevkit/bitcoin-ffi?tag=v0.1.2#402a23a94424c9ca554874d58499d5b5709fd593" +source = "git+https://github.com/bitcoindevkit/bitcoin-ffi#87557448f9109b2cab5cc7bd45018ae9be54c738" dependencies = [ "bitcoin", "thiserror", diff --git a/bdk-ffi/Cargo.toml b/bdk-ffi/Cargo.toml index 8974c853..10d9b810 100644 --- a/bdk-ffi/Cargo.toml +++ b/bdk-ffi/Cargo.toml @@ -22,7 +22,9 @@ bdk_wallet = { version = "=1.0.0-beta.5", features = ["all-keys", "keys-bip39", bdk_core = { version = "0.3.0" } bdk_esplora = { version = "0.19.0", default-features = false, features = ["std", "blocking", "blocking-https-rustls"] } bdk_electrum = { version = "0.19.0", default-features = false, features = ["use-rustls-ring"] } -bitcoin-ffi = { git = "https://github.com/bitcoindevkit/bitcoin-ffi", tag = "v0.1.2" } +bitcoin-ffi = { git = "https://github.com/bitcoindevkit/bitcoin-ffi", ref = "165f910f560a51545f93b3eab496cc92ad210aa8" } +#bitcoin-ffi = { path = "../../bitcoin-ffi" } +#bitcoin-ffi = { git = "https://github.com/bitcoindevkit/bitcoin-ffi", tag = "v0.1.2" } uniffi = { version = "=0.28.0" } thiserror = "1.0.58" diff --git a/bdk-ffi/src/bdk.udl b/bdk-ffi/src/bdk.udl index 1c716777..99906334 100644 --- a/bdk-ffi/src/bdk.udl +++ b/bdk-ffi/src/bdk.udl @@ -714,12 +714,7 @@ interface Psbt { string json_serialize(); }; -dictionary TxIn { - OutPoint previous_output; - Script script_sig; - u32 sequence; - sequence> witness; -}; + // ------------------------------------------------------------------------ // types defined in external crate bitcoin-ffi @@ -743,6 +738,9 @@ typedef extern Txid; [External="bitcoin_ffi"] typedef extern OutPoint; +[External="bitcoin_ffi"] +typedef extern TxIn; + [ExternalInterface="bitcoin_ffi"] typedef extern FeeRateError; diff --git a/bdk-ffi/src/bitcoin.rs b/bdk-ffi/src/bitcoin.rs index 5bb702b0..53c3c25e 100644 --- a/bdk-ffi/src/bitcoin.rs +++ b/bdk-ffi/src/bitcoin.rs @@ -2,8 +2,8 @@ use crate::error::{ AddressParseError, FromScriptError, PsbtError, PsbtParseError, TransactionError, }; -use bitcoin_ffi::OutPoint; use bitcoin_ffi::Script; +use bitcoin_ffi::TxIn; use bdk_wallet::bitcoin::address::{NetworkChecked, NetworkUnchecked}; use bdk_wallet::bitcoin::consensus::encode::serialize; @@ -14,7 +14,6 @@ use bdk_wallet::bitcoin::Address as BdkAddress; use bdk_wallet::bitcoin::Network; use bdk_wallet::bitcoin::Psbt as BdkPsbt; use bdk_wallet::bitcoin::Transaction as BdkTransaction; -use bdk_wallet::bitcoin::TxIn as BdkTxIn; use bdk_wallet::bitcoin::TxOut as BdkTxOut; use bdk_wallet::serde_json; @@ -200,28 +199,6 @@ impl From for Psbt { } } -#[derive(Debug, Clone)] -pub struct TxIn { - pub previous_output: OutPoint, - pub script_sig: Arc