diff --git a/CHANGELOG.md b/CHANGELOG.md index 3156375..4a8a95a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [0.20.0] +#### APIs added +- Make backwards-compatible `v2` to `v1` sends possible. +#### APIs changed +- Removed `contribute_non_nitness_input` from `v1` & `v2`. +- Allow receivers to make `payjoins` out of sweep transactions ([#259](https://github.com/payjoin/rust-payjoin/pull/259)). +- Encode &ohttp= and &exp= parameters in the &pj= URL as a fragment instead of as URI params ([#298](https://github.com/payjoin/rust-payjoin/pull/298)) + ## [0.18.0] This release updates the bindings libraries to `payjoin` version `0.18.0`. #### APIs changed diff --git a/python/CHANGELOG.md b/python/CHANGELOG.md index 0eee2d1..03e2ba2 100644 --- a/python/CHANGELOG.md +++ b/python/CHANGELOG.md @@ -1,3 +1,11 @@ +## [0.20.0] +#### APIs added +- Make backwards-compatible `v2` to `v1` sends possible. +#### APIs changed +- Removed `contribute_non_nitness_input` from `v1` & `v2`. +- Allow receivers to make `payjoins` out of sweep transactions ([#259](https://github.com/payjoin/rust-payjoin/pull/259)). +- Encode &ohttp= and &exp= parameters in the &pj= URL as a fragment instead of as URI params ([#298](https://github.com/payjoin/rust-payjoin/pull/298)) + ## [0.18.0] This release updates the python library to `payjoin` version `0.18.0`. ### Features & Modules diff --git a/python/setup.py b/python/setup.py index a6d1b6d..1da861a 100644 --- a/python/setup.py +++ b/python/setup.py @@ -17,7 +17,7 @@ """ setup( - name='payjoin', + name="payjoin", description="The Python language bindings for the Payjoin Dev Kit", long_description=LONG_DESCRIPTION, long_description_content_type="text/markdown", @@ -25,7 +25,7 @@ zip_safe=False, packages=["payjoin"], package_dir={"payjoin": "./src/payjoin"}, - version='0.18.0', + version="0.20.0", license="MIT or Apache 2.0", has_ext_modules=lambda: True, ) diff --git a/python/src/payjoin/libpayjoin_ffi.dylib b/python/src/payjoin/libpayjoin_ffi.dylib index da9646c..2f33a7f 100755 Binary files a/python/src/payjoin/libpayjoin_ffi.dylib and b/python/src/payjoin/libpayjoin_ffi.dylib differ diff --git a/python/src/payjoin/libpayjoin_ffi.so b/python/src/payjoin/libpayjoin_ffi.so index c1c114c..bb3cc44 100755 Binary files a/python/src/payjoin/libpayjoin_ffi.so and b/python/src/payjoin/libpayjoin_ffi.so differ diff --git a/python/src/payjoin/payjoin_ffi.dll b/python/src/payjoin/payjoin_ffi.dll index 64e85c9..f38176b 100755 Binary files a/python/src/payjoin/payjoin_ffi.dll and b/python/src/payjoin/payjoin_ffi.dll differ diff --git a/python/src/payjoin/payjoin_ffi.py b/python/src/payjoin/payjoin_ffi.py index af567f6..09075af 100644 --- a/python/src/payjoin/payjoin_ffi.py +++ b/python/src/payjoin/payjoin_ffi.py @@ -508,8 +508,6 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_payjoin_ffi_checksum_method_pjuribuilder_pjos() != 46879: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_payjoin_ffi_checksum_method_provisionalproposal_contribute_non_witness_input() != 9161: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_payjoin_ffi_checksum_method_provisionalproposal_contribute_witness_input() != 57615: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_payjoin_ffi_checksum_method_provisionalproposal_finalize_proposal() != 32297: @@ -574,8 +572,6 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_payjoin_ffi_checksum_method_v2payjoinproposal_utxos_to_be_locked() != 8312: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_payjoin_ffi_checksum_method_v2provisionalproposal_contribute_non_witness_input() != 8344: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_payjoin_ffi_checksum_method_v2provisionalproposal_contribute_witness_input() != 9262: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_payjoin_ffi_checksum_method_v2provisionalproposal_finalize_proposal() != 16888: @@ -1051,13 +1047,6 @@ class _UniffiVTableCallbackInterfaceProcessPartiallySignedTransaction(ctypes.Str ctypes.POINTER(_UniffiRustCallStatus), ) _UniffiLib.uniffi_payjoin_ffi_fn_free_provisionalproposal.restype = None -_UniffiLib.uniffi_payjoin_ffi_fn_method_provisionalproposal_contribute_non_witness_input.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_payjoin_ffi_fn_method_provisionalproposal_contribute_non_witness_input.restype = None _UniffiLib.uniffi_payjoin_ffi_fn_method_provisionalproposal_contribute_witness_input.argtypes = ( ctypes.c_void_p, _UniffiRustBuffer, @@ -1394,13 +1383,6 @@ class _UniffiVTableCallbackInterfaceProcessPartiallySignedTransaction(ctypes.Str ctypes.POINTER(_UniffiRustCallStatus), ) _UniffiLib.uniffi_payjoin_ffi_fn_free_v2provisionalproposal.restype = None -_UniffiLib.uniffi_payjoin_ffi_fn_method_v2provisionalproposal_contribute_non_witness_input.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_payjoin_ffi_fn_method_v2provisionalproposal_contribute_non_witness_input.restype = None _UniffiLib.uniffi_payjoin_ffi_fn_method_v2provisionalproposal_contribute_witness_input.argtypes = ( ctypes.c_void_p, _UniffiRustBuffer, @@ -1814,9 +1796,6 @@ class _UniffiVTableCallbackInterfaceProcessPartiallySignedTransaction(ctypes.Str _UniffiLib.uniffi_payjoin_ffi_checksum_method_pjuribuilder_pjos.argtypes = ( ) _UniffiLib.uniffi_payjoin_ffi_checksum_method_pjuribuilder_pjos.restype = ctypes.c_uint16 -_UniffiLib.uniffi_payjoin_ffi_checksum_method_provisionalproposal_contribute_non_witness_input.argtypes = ( -) -_UniffiLib.uniffi_payjoin_ffi_checksum_method_provisionalproposal_contribute_non_witness_input.restype = ctypes.c_uint16 _UniffiLib.uniffi_payjoin_ffi_checksum_method_provisionalproposal_contribute_witness_input.argtypes = ( ) _UniffiLib.uniffi_payjoin_ffi_checksum_method_provisionalproposal_contribute_witness_input.restype = ctypes.c_uint16 @@ -1913,9 +1892,6 @@ class _UniffiVTableCallbackInterfaceProcessPartiallySignedTransaction(ctypes.Str _UniffiLib.uniffi_payjoin_ffi_checksum_method_v2payjoinproposal_utxos_to_be_locked.argtypes = ( ) _UniffiLib.uniffi_payjoin_ffi_checksum_method_v2payjoinproposal_utxos_to_be_locked.restype = ctypes.c_uint16 -_UniffiLib.uniffi_payjoin_ffi_checksum_method_v2provisionalproposal_contribute_non_witness_input.argtypes = ( -) -_UniffiLib.uniffi_payjoin_ffi_checksum_method_v2provisionalproposal_contribute_non_witness_input.restype = ctypes.c_uint16 _UniffiLib.uniffi_payjoin_ffi_checksum_method_v2provisionalproposal_contribute_witness_input.argtypes = ( ) _UniffiLib.uniffi_payjoin_ffi_checksum_method_v2provisionalproposal_contribute_witness_input.restype = ctypes.c_uint16 @@ -3187,8 +3163,6 @@ def write(cls, value: PjUriBuilderProtocol, buf: _UniffiRustBuffer): class ProvisionalProposalProtocol(typing.Protocol): - def contribute_non_witness_input(self, tx: "typing.List[int]",outpoint: "OutPoint"): - raise NotImplementedError def contribute_witness_input(self, txout: "TxOut",outpoint: "OutPoint"): raise NotImplementedError def finalize_proposal(self, process_psbt: "ProcessPartiallySignedTransaction",min_feerate_sat_per_vb: "typing.Optional[int]"): @@ -3224,20 +3198,6 @@ def _make_instance_(cls, pointer): return inst - def contribute_non_witness_input(self, tx: "typing.List[int]",outpoint: "OutPoint") -> None: - _UniffiConverterSequenceUInt8.check_lower(tx) - - _UniffiConverterTypeOutPoint.check_lower(outpoint) - - _uniffi_rust_call_with_error(_UniffiConverterTypePayjoinError,_UniffiLib.uniffi_payjoin_ffi_fn_method_provisionalproposal_contribute_non_witness_input,self._uniffi_clone_pointer(), - _UniffiConverterSequenceUInt8.lower(tx), - _UniffiConverterTypeOutPoint.lower(outpoint)) - - - - - - def contribute_witness_input(self, txout: "TxOut",outpoint: "OutPoint") -> None: _UniffiConverterTypeTxOut.check_lower(txout) @@ -4395,8 +4355,6 @@ def write(cls, value: V2PayjoinProposalProtocol, buf: _UniffiRustBuffer): class V2ProvisionalProposalProtocol(typing.Protocol): - def contribute_non_witness_input(self, tx: "typing.List[int]",outpoint: "OutPoint"): - raise NotImplementedError def contribute_witness_input(self, txout: "TxOut",outpoint: "OutPoint"): raise NotImplementedError def finalize_proposal(self, process_psbt: "ProcessPartiallySignedTransaction",min_feerate_sat_per_vb: "typing.Optional[int]"): @@ -4432,20 +4390,6 @@ def _make_instance_(cls, pointer): return inst - def contribute_non_witness_input(self, tx: "typing.List[int]",outpoint: "OutPoint") -> None: - _UniffiConverterSequenceUInt8.check_lower(tx) - - _UniffiConverterTypeOutPoint.check_lower(outpoint) - - _uniffi_rust_call_with_error(_UniffiConverterTypePayjoinError,_UniffiLib.uniffi_payjoin_ffi_fn_method_v2provisionalproposal_contribute_non_witness_input,self._uniffi_clone_pointer(), - _UniffiConverterSequenceUInt8.lower(tx), - _UniffiConverterTypeOutPoint.lower(outpoint)) - - - - - - def contribute_witness_input(self, txout: "TxOut",outpoint: "OutPoint") -> None: _UniffiConverterTypeTxOut.check_lower(txout) diff --git a/src/receive/v1.rs b/src/receive/v1.rs index 047a5c0..7602ad3 100644 --- a/src/receive/v1.rs +++ b/src/receive/v1.rs @@ -482,12 +482,13 @@ mod test { .check_no_inputs_seen_before(|_| Ok(false)) .expect("No inputs should be seen before") .identify_receiver_outputs(|script| { - let network = payjoin::bitcoin::Network::Bitcoin; - let script = payjoin::bitcoin::ScriptBuf::from_bytes(script.to_vec()); - Ok(payjoin::bitcoin::Address::from_script(&script, network).unwrap() - == payjoin::bitcoin::Address::from_str("3CZZi7aWFugaCdUCS15dgrUUViupmB8bVM") - .map(|x| x.require_network(network).unwrap()).unwrap()) - }) - .expect("Receiver output should be identified"); - } + let network = payjoin::bitcoin::Network::Bitcoin; + let script = payjoin::bitcoin::ScriptBuf::from_bytes(script.to_vec()); + Ok(payjoin::bitcoin::Address::from_script(&script, network).unwrap() + == payjoin::bitcoin::Address::from_str("3CZZi7aWFugaCdUCS15dgrUUViupmB8bVM") + .map(|x| x.require_network(network).unwrap()) + .unwrap()) + }) + .expect("Receiver output should be identified"); + } } diff --git a/src/receive/v2.rs b/src/receive/v2.rs index fe1e3a8..de8ee22 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -536,8 +536,6 @@ impl V2ProvisionalProposal { }) .map_err(|e| e.into()) } - //TODO; create try_substitute_receiver_output for uniffi build - #[cfg(feature = "uniffi")] #[cfg(feature = "uniffi")] pub fn try_substitute_receiver_output( &self, @@ -624,7 +622,7 @@ impl V2PayjoinProposal { >::into(self.clone()) .utxos_to_be_locked() { - outpoints.push((e.to_owned()).into()) + outpoints.push(e.to_owned().into()); } outpoints } diff --git a/src/send/v1.rs b/src/send/v1.rs index c301b74..cc5b392 100644 --- a/src/send/v1.rs +++ b/src/send/v1.rs @@ -22,6 +22,7 @@ impl From> for RequestBuilder { } impl RequestBuilder { + //TODO: Replicate all functions like this & remove duplicate code /// Prepare an HTTP request and request context to process the response /// /// An HTTP client will own the Request data while Context sticks around so @@ -34,7 +35,7 @@ impl RequestBuilder { ) -> Result { let psbt = payjoin::bitcoin::psbt::Psbt::from_str(psbt.as_str())?; #[cfg(feature = "uniffi")] - let uri = (*uri).clone().into(); + let uri: PjUri = (*uri).clone(); pdk::RequestBuilder::from_psbt_and_uri(psbt, uri.into()) .map(|e| e.into()) .map_err(|e| e.into())