Skip to content

Commit

Permalink
Merge pull request #34 from LtbLightning/review-comments-v0.20.0
Browse files Browse the repository at this point in the history
Review comments v0.20.0
  • Loading branch information
BitcoinZavior authored Aug 21, 2024
2 parents 0cd12ba + 0f72d24 commit cc718d3
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 70 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 8 additions & 0 deletions python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"""

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",
include_package_data=True,
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,
)
Binary file modified python/src/payjoin/libpayjoin_ffi.dylib
Binary file not shown.
Binary file modified python/src/payjoin/libpayjoin_ffi.so
Binary file not shown.
Binary file modified python/src/payjoin/payjoin_ffi.dll
Binary file not shown.
56 changes: 0 additions & 56 deletions python/src/payjoin/payjoin_ffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]"):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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]"):
Expand Down Expand Up @@ -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)

Expand Down
17 changes: 9 additions & 8 deletions src/receive/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
4 changes: 1 addition & 3 deletions src/receive/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -624,7 +622,7 @@ impl V2PayjoinProposal {
<V2PayjoinProposal as Into<payjoin::receive::v2::PayjoinProposal>>::into(self.clone())
.utxos_to_be_locked()
{
outpoints.push((e.to_owned()).into())
outpoints.push(e.to_owned().into());
}
outpoints
}
Expand Down
3 changes: 2 additions & 1 deletion src/send/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ impl From<pdk::RequestBuilder<'static>> 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
Expand All @@ -34,7 +35,7 @@ impl RequestBuilder {
) -> Result<Self, PayjoinError> {
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())
Expand Down

0 comments on commit cc718d3

Please sign in to comment.