bdkpython
Advanced tools
+36
-3
| Metadata-Version: 2.1 | ||
| Name: bdkpython | ||
| Version: 1.0.0b5 | ||
| Version: 0.32.0 | ||
| Summary: The Python language bindings for the Bitcoin Development Kit | ||
| Home-page: https://github.com/bitcoindevkit/bdk-ffi | ||
| Author: Bitcoin Dev Kit Developers <dev@bitcoindevkit.org> | ||
| Author: Alekos Filini <alekos.filini@gmail.com>, Steve Myers <steve@notmandatory.org> | ||
| License: MIT or Apache 2.0 | ||
@@ -21,2 +21,35 @@ Description-Content-Type: text/markdown | ||
| import bdkpython as bdk | ||
| ``` | ||
| descriptor = bdk.Descriptor("wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/0h/0h/0/*)", bdk.Network.TESTNET) | ||
| db_config = bdk.DatabaseConfig.MEMORY() | ||
| blockchain_config = bdk.BlockchainConfig.ELECTRUM( | ||
| bdk.ElectrumConfig( | ||
| url = "ssl://electrum.blockstream.info:60002", | ||
| socks5 = None, | ||
| retry = 5, | ||
| timeout = None, | ||
| stop_gap = 100, | ||
| validate_domain = True, | ||
| ) | ||
| ) | ||
| blockchain = bdk.Blockchain(blockchain_config) | ||
| wallet = bdk.Wallet( | ||
| descriptor=descriptor, | ||
| change_descriptor=None, | ||
| network=bdk.Network.TESTNET, | ||
| database_config=db_config, | ||
| ) | ||
| # print new receive address | ||
| address_info = wallet.get_address(bdk.AddressIndex.LAST_UNUSED()) | ||
| address = address_info.address | ||
| index = address_info.index | ||
| print(f"New BIP84 testnet address: {address} at index {index}") | ||
| # print wallet balance | ||
| wallet.sync(blockchain, None) | ||
| balance = wallet.get_balance() | ||
| print(f"Wallet balance is: {balance.total}") |
+6
-7
| bdkpython/__init__.py,sha256=ATeFkCbwx3hWmg2HKvxY6LX-KzEK4cnYyA-yjmX_jRw,27 | ||
| bdkpython/bdk.py,sha256=B3c-aNbzYuRqRYs8BLVuynMfdd9vjkr-V0Mur9z35HA,386956 | ||
| bdkpython/bitcoin.py,sha256=q0w9iuODAM7BZ8nIUPGUmfTr3pLjAj1s-B78y5s1y_U,58357 | ||
| bdkpython/libbdkffi.dylib,sha256=dri8cS5ocIUSztNXCS5izrgcuQMGeuwBFWM6LQq5WiI,8616144 | ||
| bdkpython-1.0.0b5.dist-info/METADATA,sha256=j92doceWyvh9YgoQS5L0rawBZ5jVMAIrqcbHDN55YP0,522 | ||
| bdkpython-1.0.0b5.dist-info/WHEEL,sha256=oMFc9-KjvMLKiqM40kAaafsHJktZGp0eIX_k197YDRk,110 | ||
| bdkpython-1.0.0b5.dist-info/top_level.txt,sha256=BpjT6locJ4WJz-wFZu6kSG9cKeH8E64dUJlPeL425OY,10 | ||
| bdkpython-1.0.0b5.dist-info/RECORD,, | ||
| bdkpython/bdk.py,sha256=YseFeVCmhprVnaIfpZQhrC4P5HQEnQmD8oHpXJINqSg,260894 | ||
| bdkpython/libbdkffi.dylib,sha256=0EWsurPqjQl5nVQw_M7fblX-5tBN01fYjtupn1w4zso,9675072 | ||
| bdkpython-0.32.0.dist-info/METADATA,sha256=a8ddeBaYRC2XEDSAXxliIeQjI-sl1Qv4DUikNS6-UcM,1614 | ||
| bdkpython-0.32.0.dist-info/WHEEL,sha256=oMFc9-KjvMLKiqM40kAaafsHJktZGp0eIX_k197YDRk,110 | ||
| bdkpython-0.32.0.dist-info/top_level.txt,sha256=BpjT6locJ4WJz-wFZu6kSG9cKeH8E64dUJlPeL425OY,10 | ||
| bdkpython-0.32.0.dist-info/RECORD,, |
-1666
| # This file was autogenerated by some hot garbage in the `uniffi` crate. | ||
| # Trust me, you don't want to mess with it! | ||
| # Common helper code. | ||
| # | ||
| # Ideally this would live in a separate .py file where it can be unittested etc | ||
| # in isolation, and perhaps even published as a re-useable package. | ||
| # | ||
| # However, it's important that the details of how this helper code works (e.g. the | ||
| # way that different builtin types are passed across the FFI) exactly match what's | ||
| # expected by the rust code on the other side of the interface. In practice right | ||
| # now that means coming from the exact some version of `uniffi` that was used to | ||
| # compile the rust component. The easiest way to ensure this is to bundle the Python | ||
| # helpers directly inline like we're doing here. | ||
| from __future__ import annotations | ||
| import os | ||
| import sys | ||
| import ctypes | ||
| import enum | ||
| import struct | ||
| import contextlib | ||
| import datetime | ||
| import threading | ||
| import itertools | ||
| import traceback | ||
| import typing | ||
| import platform | ||
| # Used for default argument values | ||
| _DEFAULT = object() # type: typing.Any | ||
| class _UniffiRustBuffer(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("capacity", ctypes.c_uint64), | ||
| ("len", ctypes.c_uint64), | ||
| ("data", ctypes.POINTER(ctypes.c_char)), | ||
| ] | ||
| @staticmethod | ||
| def default(): | ||
| return _UniffiRustBuffer(0, 0, None) | ||
| @staticmethod | ||
| def alloc(size): | ||
| return _uniffi_rust_call(_UniffiLib.ffi_bitcoin_ffi_rustbuffer_alloc, size) | ||
| @staticmethod | ||
| def reserve(rbuf, additional): | ||
| return _uniffi_rust_call(_UniffiLib.ffi_bitcoin_ffi_rustbuffer_reserve, rbuf, additional) | ||
| def free(self): | ||
| return _uniffi_rust_call(_UniffiLib.ffi_bitcoin_ffi_rustbuffer_free, self) | ||
| def __str__(self): | ||
| return "_UniffiRustBuffer(capacity={}, len={}, data={})".format( | ||
| self.capacity, | ||
| self.len, | ||
| self.data[0:self.len] | ||
| ) | ||
| @contextlib.contextmanager | ||
| def alloc_with_builder(*args): | ||
| """Context-manger to allocate a buffer using a _UniffiRustBufferBuilder. | ||
| The allocated buffer will be automatically freed if an error occurs, ensuring that | ||
| we don't accidentally leak it. | ||
| """ | ||
| builder = _UniffiRustBufferBuilder() | ||
| try: | ||
| yield builder | ||
| except: | ||
| builder.discard() | ||
| raise | ||
| @contextlib.contextmanager | ||
| def consume_with_stream(self): | ||
| """Context-manager to consume a buffer using a _UniffiRustBufferStream. | ||
| The _UniffiRustBuffer will be freed once the context-manager exits, ensuring that we don't | ||
| leak it even if an error occurs. | ||
| """ | ||
| try: | ||
| s = _UniffiRustBufferStream.from_rust_buffer(self) | ||
| yield s | ||
| if s.remaining() != 0: | ||
| raise RuntimeError("junk data left in buffer at end of consume_with_stream") | ||
| finally: | ||
| self.free() | ||
| @contextlib.contextmanager | ||
| def read_with_stream(self): | ||
| """Context-manager to read a buffer using a _UniffiRustBufferStream. | ||
| This is like consume_with_stream, but doesn't free the buffer afterwards. | ||
| It should only be used with borrowed `_UniffiRustBuffer` data. | ||
| """ | ||
| s = _UniffiRustBufferStream.from_rust_buffer(self) | ||
| yield s | ||
| if s.remaining() != 0: | ||
| raise RuntimeError("junk data left in buffer at end of read_with_stream") | ||
| class _UniffiForeignBytes(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("len", ctypes.c_int32), | ||
| ("data", ctypes.POINTER(ctypes.c_char)), | ||
| ] | ||
| def __str__(self): | ||
| return "_UniffiForeignBytes(len={}, data={})".format(self.len, self.data[0:self.len]) | ||
| class _UniffiRustBufferStream: | ||
| """ | ||
| Helper for structured reading of bytes from a _UniffiRustBuffer | ||
| """ | ||
| def __init__(self, data, len): | ||
| self.data = data | ||
| self.len = len | ||
| self.offset = 0 | ||
| @classmethod | ||
| def from_rust_buffer(cls, buf): | ||
| return cls(buf.data, buf.len) | ||
| def remaining(self): | ||
| return self.len - self.offset | ||
| def _unpack_from(self, size, format): | ||
| if self.offset + size > self.len: | ||
| raise InternalError("read past end of rust buffer") | ||
| value = struct.unpack(format, self.data[self.offset:self.offset+size])[0] | ||
| self.offset += size | ||
| return value | ||
| def read(self, size): | ||
| if self.offset + size > self.len: | ||
| raise InternalError("read past end of rust buffer") | ||
| data = self.data[self.offset:self.offset+size] | ||
| self.offset += size | ||
| return data | ||
| def read_i8(self): | ||
| return self._unpack_from(1, ">b") | ||
| def read_u8(self): | ||
| return self._unpack_from(1, ">B") | ||
| def read_i16(self): | ||
| return self._unpack_from(2, ">h") | ||
| def read_u16(self): | ||
| return self._unpack_from(2, ">H") | ||
| def read_i32(self): | ||
| return self._unpack_from(4, ">i") | ||
| def read_u32(self): | ||
| return self._unpack_from(4, ">I") | ||
| def read_i64(self): | ||
| return self._unpack_from(8, ">q") | ||
| def read_u64(self): | ||
| return self._unpack_from(8, ">Q") | ||
| def read_float(self): | ||
| v = self._unpack_from(4, ">f") | ||
| return v | ||
| def read_double(self): | ||
| return self._unpack_from(8, ">d") | ||
| class _UniffiRustBufferBuilder: | ||
| """ | ||
| Helper for structured writing of bytes into a _UniffiRustBuffer. | ||
| """ | ||
| def __init__(self): | ||
| self.rbuf = _UniffiRustBuffer.alloc(16) | ||
| self.rbuf.len = 0 | ||
| def finalize(self): | ||
| rbuf = self.rbuf | ||
| self.rbuf = None | ||
| return rbuf | ||
| def discard(self): | ||
| if self.rbuf is not None: | ||
| rbuf = self.finalize() | ||
| rbuf.free() | ||
| @contextlib.contextmanager | ||
| def _reserve(self, num_bytes): | ||
| if self.rbuf.len + num_bytes > self.rbuf.capacity: | ||
| self.rbuf = _UniffiRustBuffer.reserve(self.rbuf, num_bytes) | ||
| yield None | ||
| self.rbuf.len += num_bytes | ||
| def _pack_into(self, size, format, value): | ||
| with self._reserve(size): | ||
| # XXX TODO: I feel like I should be able to use `struct.pack_into` here but can't figure it out. | ||
| for i, byte in enumerate(struct.pack(format, value)): | ||
| self.rbuf.data[self.rbuf.len + i] = byte | ||
| def write(self, value): | ||
| with self._reserve(len(value)): | ||
| for i, byte in enumerate(value): | ||
| self.rbuf.data[self.rbuf.len + i] = byte | ||
| def write_i8(self, v): | ||
| self._pack_into(1, ">b", v) | ||
| def write_u8(self, v): | ||
| self._pack_into(1, ">B", v) | ||
| def write_i16(self, v): | ||
| self._pack_into(2, ">h", v) | ||
| def write_u16(self, v): | ||
| self._pack_into(2, ">H", v) | ||
| def write_i32(self, v): | ||
| self._pack_into(4, ">i", v) | ||
| def write_u32(self, v): | ||
| self._pack_into(4, ">I", v) | ||
| def write_i64(self, v): | ||
| self._pack_into(8, ">q", v) | ||
| def write_u64(self, v): | ||
| self._pack_into(8, ">Q", v) | ||
| def write_float(self, v): | ||
| self._pack_into(4, ">f", v) | ||
| def write_double(self, v): | ||
| self._pack_into(8, ">d", v) | ||
| def write_c_size_t(self, v): | ||
| self._pack_into(ctypes.sizeof(ctypes.c_size_t) , "@N", v) | ||
| # A handful of classes and functions to support the generated data structures. | ||
| # This would be a good candidate for isolating in its own ffi-support lib. | ||
| class InternalError(Exception): | ||
| pass | ||
| class _UniffiRustCallStatus(ctypes.Structure): | ||
| """ | ||
| Error runtime. | ||
| """ | ||
| _fields_ = [ | ||
| ("code", ctypes.c_int8), | ||
| ("error_buf", _UniffiRustBuffer), | ||
| ] | ||
| # These match the values from the uniffi::rustcalls module | ||
| CALL_SUCCESS = 0 | ||
| CALL_ERROR = 1 | ||
| CALL_UNEXPECTED_ERROR = 2 | ||
| @staticmethod | ||
| def default(): | ||
| return _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer.default()) | ||
| def __str__(self): | ||
| if self.code == _UniffiRustCallStatus.CALL_SUCCESS: | ||
| return "_UniffiRustCallStatus(CALL_SUCCESS)" | ||
| elif self.code == _UniffiRustCallStatus.CALL_ERROR: | ||
| return "_UniffiRustCallStatus(CALL_ERROR)" | ||
| elif self.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR: | ||
| return "_UniffiRustCallStatus(CALL_UNEXPECTED_ERROR)" | ||
| else: | ||
| return "_UniffiRustCallStatus(<invalid code>)" | ||
| def _uniffi_rust_call(fn, *args): | ||
| # Call a rust function | ||
| return _uniffi_rust_call_with_error(None, fn, *args) | ||
| def _uniffi_rust_call_with_error(error_ffi_converter, fn, *args): | ||
| # Call a rust function and handle any errors | ||
| # | ||
| # This function is used for rust calls that return Result<> and therefore can set the CALL_ERROR status code. | ||
| # error_ffi_converter must be set to the _UniffiConverter for the error class that corresponds to the result. | ||
| call_status = _UniffiRustCallStatus.default() | ||
| args_with_error = args + (ctypes.byref(call_status),) | ||
| result = fn(*args_with_error) | ||
| _uniffi_check_call_status(error_ffi_converter, call_status) | ||
| return result | ||
| def _uniffi_check_call_status(error_ffi_converter, call_status): | ||
| if call_status.code == _UniffiRustCallStatus.CALL_SUCCESS: | ||
| pass | ||
| elif call_status.code == _UniffiRustCallStatus.CALL_ERROR: | ||
| if error_ffi_converter is None: | ||
| call_status.error_buf.free() | ||
| raise InternalError("_uniffi_rust_call_with_error: CALL_ERROR, but error_ffi_converter is None") | ||
| else: | ||
| raise error_ffi_converter.lift(call_status.error_buf) | ||
| elif call_status.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR: | ||
| # When the rust code sees a panic, it tries to construct a _UniffiRustBuffer | ||
| # with the message. But if that code panics, then it just sends back | ||
| # an empty buffer. | ||
| if call_status.error_buf.len > 0: | ||
| msg = _UniffiConverterString.lift(call_status.error_buf) | ||
| else: | ||
| msg = "Unknown rust panic" | ||
| raise InternalError(msg) | ||
| else: | ||
| raise InternalError("Invalid _UniffiRustCallStatus code: {}".format( | ||
| call_status.code)) | ||
| def _uniffi_trait_interface_call(call_status, make_call, write_return_value): | ||
| try: | ||
| return write_return_value(make_call()) | ||
| except Exception as e: | ||
| call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR | ||
| call_status.error_buf = _UniffiConverterString.lower(repr(e)) | ||
| def _uniffi_trait_interface_call_with_error(call_status, make_call, write_return_value, error_type, lower_error): | ||
| try: | ||
| try: | ||
| return write_return_value(make_call()) | ||
| except error_type as e: | ||
| call_status.code = _UniffiRustCallStatus.CALL_ERROR | ||
| call_status.error_buf = lower_error(e) | ||
| except Exception as e: | ||
| call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR | ||
| call_status.error_buf = _UniffiConverterString.lower(repr(e)) | ||
| class _UniffiHandleMap: | ||
| """ | ||
| A map where inserting, getting and removing data is synchronized with a lock. | ||
| """ | ||
| def __init__(self): | ||
| # type Handle = int | ||
| self._map = {} # type: Dict[Handle, Any] | ||
| self._lock = threading.Lock() | ||
| self._counter = itertools.count() | ||
| def insert(self, obj): | ||
| with self._lock: | ||
| handle = next(self._counter) | ||
| self._map[handle] = obj | ||
| return handle | ||
| def get(self, handle): | ||
| try: | ||
| with self._lock: | ||
| return self._map[handle] | ||
| except KeyError: | ||
| raise InternalError("_UniffiHandleMap.get: Invalid handle") | ||
| def remove(self, handle): | ||
| try: | ||
| with self._lock: | ||
| return self._map.pop(handle) | ||
| except KeyError: | ||
| raise InternalError("_UniffiHandleMap.remove: Invalid handle") | ||
| def __len__(self): | ||
| return len(self._map) | ||
| # Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI. | ||
| class _UniffiConverterPrimitive: | ||
| @classmethod | ||
| def lift(cls, value): | ||
| return value | ||
| @classmethod | ||
| def lower(cls, value): | ||
| return value | ||
| class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive): | ||
| @classmethod | ||
| def check_lower(cls, value): | ||
| try: | ||
| value = value.__index__() | ||
| except Exception: | ||
| raise TypeError("'{}' object cannot be interpreted as an integer".format(type(value).__name__)) | ||
| if not isinstance(value, int): | ||
| raise TypeError("__index__ returned non-int (type {})".format(type(value).__name__)) | ||
| if not cls.VALUE_MIN <= value < cls.VALUE_MAX: | ||
| raise ValueError("{} requires {} <= value < {}".format(cls.CLASS_NAME, cls.VALUE_MIN, cls.VALUE_MAX)) | ||
| class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive): | ||
| @classmethod | ||
| def check_lower(cls, value): | ||
| try: | ||
| value = value.__float__() | ||
| except Exception: | ||
| raise TypeError("must be real number, not {}".format(type(value).__name__)) | ||
| if not isinstance(value, float): | ||
| raise TypeError("__float__ returned non-float (type {})".format(type(value).__name__)) | ||
| # Helper class for wrapper types that will always go through a _UniffiRustBuffer. | ||
| # Classes should inherit from this and implement the `read` and `write` static methods. | ||
| class _UniffiConverterRustBuffer: | ||
| @classmethod | ||
| def lift(cls, rbuf): | ||
| with rbuf.consume_with_stream() as stream: | ||
| return cls.read(stream) | ||
| @classmethod | ||
| def lower(cls, value): | ||
| with _UniffiRustBuffer.alloc_with_builder() as builder: | ||
| cls.write(value, builder) | ||
| return builder.finalize() | ||
| # Contains loading, initialization code, and the FFI Function declarations. | ||
| # Define some ctypes FFI types that we use in the library | ||
| """ | ||
| Function pointer for a Rust task, which a callback function that takes a opaque pointer | ||
| """ | ||
| _UNIFFI_RUST_TASK = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int8) | ||
| def _uniffi_future_callback_t(return_type): | ||
| """ | ||
| Factory function to create callback function types for async functions | ||
| """ | ||
| return ctypes.CFUNCTYPE(None, ctypes.c_uint64, return_type, _UniffiRustCallStatus) | ||
| def _uniffi_load_indirect(): | ||
| """ | ||
| This is how we find and load the dynamic library provided by the component. | ||
| For now we just look it up by name. | ||
| """ | ||
| if sys.platform == "darwin": | ||
| libname = "lib{}.dylib" | ||
| elif sys.platform.startswith("win"): | ||
| # As of python3.8, ctypes does not seem to search $PATH when loading DLLs. | ||
| # We could use `os.add_dll_directory` to configure the search path, but | ||
| # it doesn't feel right to mess with application-wide settings. Let's | ||
| # assume that the `.dll` is next to the `.py` file and load by full path. | ||
| libname = os.path.join( | ||
| os.path.dirname(__file__), | ||
| "{}.dll", | ||
| ) | ||
| else: | ||
| # Anything else must be an ELF platform - Linux, *BSD, Solaris/illumos | ||
| libname = "lib{}.so" | ||
| libname = libname.format("bdkffi") | ||
| path = os.path.join(os.path.dirname(__file__), libname) | ||
| lib = ctypes.cdll.LoadLibrary(path) | ||
| return lib | ||
| def _uniffi_check_contract_api_version(lib): | ||
| # Get the bindings contract version from our ComponentInterface | ||
| bindings_contract_version = 26 | ||
| # Get the scaffolding contract version by calling the into the dylib | ||
| scaffolding_contract_version = lib.ffi_bitcoin_ffi_uniffi_contract_version() | ||
| if bindings_contract_version != scaffolding_contract_version: | ||
| raise InternalError("UniFFI contract version mismatch: try cleaning and rebuilding your project") | ||
| def _uniffi_check_api_checksums(lib): | ||
| if lib.uniffi_bitcoin_ffi_checksum_method_amount_to_btc() != 6538: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_method_amount_to_sat() != 9947: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_kwu() != 34871: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_vb_ceil() != 36445: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_vb_floor() != 14258: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_method_script_to_bytes() != 2169: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_constructor_amount_from_btc() != 58031: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_constructor_amount_from_sat() != 19356: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_constructor_feerate_from_sat_per_kwu() != 37445: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_constructor_feerate_from_sat_per_vb() != 13015: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| if lib.uniffi_bitcoin_ffi_checksum_constructor_script_new() != 5408: | ||
| raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") | ||
| # A ctypes library to expose the extern-C FFI definitions. | ||
| # This is an implementation detail which will be called internally by the public API. | ||
| _UniffiLib = _uniffi_load_indirect() | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_int8, | ||
| ) | ||
| _UNIFFI_FOREIGN_FUTURE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64, | ||
| ) | ||
| _UNIFFI_CALLBACK_INTERFACE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64, | ||
| ) | ||
| class _UniffiForeignFuture(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("handle", ctypes.c_uint64), | ||
| ("free", _UNIFFI_FOREIGN_FUTURE_FREE), | ||
| ] | ||
| class _UniffiForeignFutureStructU8(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_uint8), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_U8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU8, | ||
| ) | ||
| class _UniffiForeignFutureStructI8(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_int8), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_I8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI8, | ||
| ) | ||
| class _UniffiForeignFutureStructU16(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_uint16), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_U16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU16, | ||
| ) | ||
| class _UniffiForeignFutureStructI16(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_int16), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_I16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI16, | ||
| ) | ||
| class _UniffiForeignFutureStructU32(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_uint32), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_U32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU32, | ||
| ) | ||
| class _UniffiForeignFutureStructI32(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_int32), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_I32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI32, | ||
| ) | ||
| class _UniffiForeignFutureStructU64(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_uint64), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_U64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU64, | ||
| ) | ||
| class _UniffiForeignFutureStructI64(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_int64), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_I64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI64, | ||
| ) | ||
| class _UniffiForeignFutureStructF32(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_float), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_F32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF32, | ||
| ) | ||
| class _UniffiForeignFutureStructF64(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_double), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_F64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF64, | ||
| ) | ||
| class _UniffiForeignFutureStructPointer(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", ctypes.c_void_p), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_POINTER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructPointer, | ||
| ) | ||
| class _UniffiForeignFutureStructRustBuffer(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("return_value", _UniffiRustBuffer), | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructRustBuffer, | ||
| ) | ||
| class _UniffiForeignFutureStructVoid(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("call_status", _UniffiRustCallStatus), | ||
| ] | ||
| _UNIFFI_FOREIGN_FUTURE_COMPLETE_VOID = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructVoid, | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_clone_amount.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_clone_amount.restype = ctypes.c_void_p | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_free_amount.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_free_amount.restype = None | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_amount_from_btc.argtypes = ( | ||
| ctypes.c_double, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_amount_from_btc.restype = ctypes.c_void_p | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_amount_from_sat.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_amount_from_sat.restype = ctypes.c_void_p | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_amount_to_btc.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_amount_to_btc.restype = ctypes.c_double | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_amount_to_sat.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_amount_to_sat.restype = ctypes.c_uint64 | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_clone_feerate.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_clone_feerate.restype = ctypes.c_void_p | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_free_feerate.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_free_feerate.restype = None | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_feerate_from_sat_per_kwu.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_feerate_from_sat_per_kwu.restype = ctypes.c_void_p | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_feerate_from_sat_per_vb.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_feerate_from_sat_per_vb.restype = ctypes.c_void_p | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_kwu.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_kwu.restype = ctypes.c_uint64 | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_vb_ceil.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_vb_ceil.restype = ctypes.c_uint64 | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_vb_floor.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_vb_floor.restype = ctypes.c_uint64 | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_clone_script.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_clone_script.restype = ctypes.c_void_p | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_free_script.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_free_script.restype = None | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_script_new.argtypes = ( | ||
| _UniffiRustBuffer, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_constructor_script_new.restype = ctypes.c_void_p | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_script_to_bytes.argtypes = ( | ||
| ctypes.c_void_p, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_fn_method_script_to_bytes.restype = _UniffiRustBuffer | ||
| _UniffiLib.ffi_bitcoin_ffi_rustbuffer_alloc.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rustbuffer_alloc.restype = _UniffiRustBuffer | ||
| _UniffiLib.ffi_bitcoin_ffi_rustbuffer_from_bytes.argtypes = ( | ||
| _UniffiForeignBytes, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rustbuffer_from_bytes.restype = _UniffiRustBuffer | ||
| _UniffiLib.ffi_bitcoin_ffi_rustbuffer_free.argtypes = ( | ||
| _UniffiRustBuffer, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rustbuffer_free.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rustbuffer_reserve.argtypes = ( | ||
| _UniffiRustBuffer, | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rustbuffer_reserve.restype = _UniffiRustBuffer | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_u8.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_u8.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_u8.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_u8.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_u8.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_u8.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_u8.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_u8.restype = ctypes.c_uint8 | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_i8.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_i8.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_i8.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_i8.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_i8.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_i8.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_i8.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_i8.restype = ctypes.c_int8 | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_u16.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_u16.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_u16.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_u16.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_u16.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_u16.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_u16.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_u16.restype = ctypes.c_uint16 | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_i16.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_i16.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_i16.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_i16.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_i16.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_i16.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_i16.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_i16.restype = ctypes.c_int16 | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_u32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_u32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_u32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_u32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_u32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_u32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_u32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_u32.restype = ctypes.c_uint32 | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_i32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_i32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_i32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_i32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_i32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_i32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_i32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_i32.restype = ctypes.c_int32 | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_u64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_u64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_u64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_u64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_u64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_u64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_u64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_u64.restype = ctypes.c_uint64 | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_i64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_i64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_i64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_i64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_i64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_i64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_i64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_i64.restype = ctypes.c_int64 | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_f32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_f32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_f32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_f32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_f32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_f32.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_f32.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_f32.restype = ctypes.c_float | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_f64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_f64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_f64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_f64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_f64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_f64.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_f64.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_f64.restype = ctypes.c_double | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_pointer.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_pointer.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_pointer.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_pointer.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_pointer.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_pointer.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_pointer.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_pointer.restype = ctypes.c_void_p | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_rust_buffer.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_rust_buffer.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_rust_buffer.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_rust_buffer.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_rust_buffer.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_rust_buffer.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_rust_buffer.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_void.argtypes = ( | ||
| ctypes.c_uint64, | ||
| _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_poll_void.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_void.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_cancel_void.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_void.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_free_void.restype = None | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_void.argtypes = ( | ||
| ctypes.c_uint64, | ||
| ctypes.POINTER(_UniffiRustCallStatus), | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_rust_future_complete_void.restype = None | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_amount_to_btc.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_amount_to_btc.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_amount_to_sat.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_amount_to_sat.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_kwu.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_kwu.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_vb_ceil.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_vb_ceil.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_vb_floor.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_feerate_to_sat_per_vb_floor.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_script_to_bytes.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_method_script_to_bytes.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_amount_from_btc.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_amount_from_btc.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_amount_from_sat.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_amount_from_sat.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_feerate_from_sat_per_kwu.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_feerate_from_sat_per_kwu.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_feerate_from_sat_per_vb.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_feerate_from_sat_per_vb.restype = ctypes.c_uint16 | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_script_new.argtypes = ( | ||
| ) | ||
| _UniffiLib.uniffi_bitcoin_ffi_checksum_constructor_script_new.restype = ctypes.c_uint16 | ||
| _UniffiLib.ffi_bitcoin_ffi_uniffi_contract_version.argtypes = ( | ||
| ) | ||
| _UniffiLib.ffi_bitcoin_ffi_uniffi_contract_version.restype = ctypes.c_uint32 | ||
| _uniffi_check_contract_api_version(_UniffiLib) | ||
| _uniffi_check_api_checksums(_UniffiLib) | ||
| # Public interface members begin here. | ||
| class _UniffiConverterUInt8(_UniffiConverterPrimitiveInt): | ||
| CLASS_NAME = "u8" | ||
| VALUE_MIN = 0 | ||
| VALUE_MAX = 2**8 | ||
| @staticmethod | ||
| def read(buf): | ||
| return buf.read_u8() | ||
| @staticmethod | ||
| def write(value, buf): | ||
| buf.write_u8(value) | ||
| class _UniffiConverterUInt32(_UniffiConverterPrimitiveInt): | ||
| CLASS_NAME = "u32" | ||
| VALUE_MIN = 0 | ||
| VALUE_MAX = 2**32 | ||
| @staticmethod | ||
| def read(buf): | ||
| return buf.read_u32() | ||
| @staticmethod | ||
| def write(value, buf): | ||
| buf.write_u32(value) | ||
| class _UniffiConverterUInt64(_UniffiConverterPrimitiveInt): | ||
| CLASS_NAME = "u64" | ||
| VALUE_MIN = 0 | ||
| VALUE_MAX = 2**64 | ||
| @staticmethod | ||
| def read(buf): | ||
| return buf.read_u64() | ||
| @staticmethod | ||
| def write(value, buf): | ||
| buf.write_u64(value) | ||
| class _UniffiConverterDouble(_UniffiConverterPrimitiveFloat): | ||
| @staticmethod | ||
| def read(buf): | ||
| return buf.read_double() | ||
| @staticmethod | ||
| def write(value, buf): | ||
| buf.write_double(value) | ||
| class _UniffiConverterString: | ||
| @staticmethod | ||
| def check_lower(value): | ||
| if not isinstance(value, str): | ||
| raise TypeError("argument must be str, not {}".format(type(value).__name__)) | ||
| return value | ||
| @staticmethod | ||
| def read(buf): | ||
| size = buf.read_i32() | ||
| if size < 0: | ||
| raise InternalError("Unexpected negative string length") | ||
| utf8_bytes = buf.read(size) | ||
| return utf8_bytes.decode("utf-8") | ||
| @staticmethod | ||
| def write(value, buf): | ||
| utf8_bytes = value.encode("utf-8") | ||
| buf.write_i32(len(utf8_bytes)) | ||
| buf.write(utf8_bytes) | ||
| @staticmethod | ||
| def lift(buf): | ||
| with buf.consume_with_stream() as stream: | ||
| return stream.read(stream.remaining()).decode("utf-8") | ||
| @staticmethod | ||
| def lower(value): | ||
| with _UniffiRustBuffer.alloc_with_builder() as builder: | ||
| builder.write(value.encode("utf-8")) | ||
| return builder.finalize() | ||
| class AmountProtocol(typing.Protocol): | ||
| def to_btc(self, ): | ||
| raise NotImplementedError | ||
| def to_sat(self, ): | ||
| raise NotImplementedError | ||
| class Amount: | ||
| _pointer: ctypes.c_void_p | ||
| def __init__(self, *args, **kwargs): | ||
| raise ValueError("This class has no default constructor") | ||
| def __del__(self): | ||
| # In case of partial initialization of instances. | ||
| pointer = getattr(self, "_pointer", None) | ||
| if pointer is not None: | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_free_amount, pointer) | ||
| def _uniffi_clone_pointer(self): | ||
| return _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_clone_amount, self._pointer) | ||
| # Used by alternative constructors or any methods which return this type. | ||
| @classmethod | ||
| def _make_instance_(cls, pointer): | ||
| # Lightly yucky way to bypass the usual __init__ logic | ||
| # and just create a new instance with the required pointer. | ||
| inst = cls.__new__(cls) | ||
| inst._pointer = pointer | ||
| return inst | ||
| @classmethod | ||
| def from_btc(cls, from_btc: "float"): | ||
| _UniffiConverterDouble.check_lower(from_btc) | ||
| # Call the (fallible) function before creating any half-baked object instances. | ||
| pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeParseAmountError,_UniffiLib.uniffi_bitcoin_ffi_fn_constructor_amount_from_btc, | ||
| _UniffiConverterDouble.lower(from_btc)) | ||
| return cls._make_instance_(pointer) | ||
| @classmethod | ||
| def from_sat(cls, from_sat: "int"): | ||
| _UniffiConverterUInt64.check_lower(from_sat) | ||
| # Call the (fallible) function before creating any half-baked object instances. | ||
| pointer = _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_constructor_amount_from_sat, | ||
| _UniffiConverterUInt64.lower(from_sat)) | ||
| return cls._make_instance_(pointer) | ||
| def to_btc(self, ) -> "float": | ||
| return _UniffiConverterDouble.lift( | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_method_amount_to_btc,self._uniffi_clone_pointer(),) | ||
| ) | ||
| def to_sat(self, ) -> "int": | ||
| return _UniffiConverterUInt64.lift( | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_method_amount_to_sat,self._uniffi_clone_pointer(),) | ||
| ) | ||
| class _UniffiConverterTypeAmount: | ||
| @staticmethod | ||
| def lift(value: int): | ||
| return Amount._make_instance_(value) | ||
| @staticmethod | ||
| def check_lower(value: Amount): | ||
| if not isinstance(value, Amount): | ||
| raise TypeError("Expected Amount instance, {} found".format(type(value).__name__)) | ||
| @staticmethod | ||
| def lower(value: AmountProtocol): | ||
| if not isinstance(value, Amount): | ||
| raise TypeError("Expected Amount instance, {} found".format(type(value).__name__)) | ||
| return value._uniffi_clone_pointer() | ||
| @classmethod | ||
| def read(cls, buf: _UniffiRustBuffer): | ||
| ptr = buf.read_u64() | ||
| if ptr == 0: | ||
| raise InternalError("Raw pointer value was null") | ||
| return cls.lift(ptr) | ||
| @classmethod | ||
| def write(cls, value: AmountProtocol, buf: _UniffiRustBuffer): | ||
| buf.write_u64(cls.lower(value)) | ||
| class FeeRateProtocol(typing.Protocol): | ||
| def to_sat_per_kwu(self, ): | ||
| raise NotImplementedError | ||
| def to_sat_per_vb_ceil(self, ): | ||
| raise NotImplementedError | ||
| def to_sat_per_vb_floor(self, ): | ||
| raise NotImplementedError | ||
| class FeeRate: | ||
| _pointer: ctypes.c_void_p | ||
| def __init__(self, *args, **kwargs): | ||
| raise ValueError("This class has no default constructor") | ||
| def __del__(self): | ||
| # In case of partial initialization of instances. | ||
| pointer = getattr(self, "_pointer", None) | ||
| if pointer is not None: | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_free_feerate, pointer) | ||
| def _uniffi_clone_pointer(self): | ||
| return _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_clone_feerate, self._pointer) | ||
| # Used by alternative constructors or any methods which return this type. | ||
| @classmethod | ||
| def _make_instance_(cls, pointer): | ||
| # Lightly yucky way to bypass the usual __init__ logic | ||
| # and just create a new instance with the required pointer. | ||
| inst = cls.__new__(cls) | ||
| inst._pointer = pointer | ||
| return inst | ||
| @classmethod | ||
| def from_sat_per_kwu(cls, sat_per_kwu: "int"): | ||
| _UniffiConverterUInt64.check_lower(sat_per_kwu) | ||
| # Call the (fallible) function before creating any half-baked object instances. | ||
| pointer = _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_constructor_feerate_from_sat_per_kwu, | ||
| _UniffiConverterUInt64.lower(sat_per_kwu)) | ||
| return cls._make_instance_(pointer) | ||
| @classmethod | ||
| def from_sat_per_vb(cls, sat_per_vb: "int"): | ||
| _UniffiConverterUInt64.check_lower(sat_per_vb) | ||
| # Call the (fallible) function before creating any half-baked object instances. | ||
| pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeFeeRateError,_UniffiLib.uniffi_bitcoin_ffi_fn_constructor_feerate_from_sat_per_vb, | ||
| _UniffiConverterUInt64.lower(sat_per_vb)) | ||
| return cls._make_instance_(pointer) | ||
| def to_sat_per_kwu(self, ) -> "int": | ||
| return _UniffiConverterUInt64.lift( | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_kwu,self._uniffi_clone_pointer(),) | ||
| ) | ||
| def to_sat_per_vb_ceil(self, ) -> "int": | ||
| return _UniffiConverterUInt64.lift( | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_vb_ceil,self._uniffi_clone_pointer(),) | ||
| ) | ||
| def to_sat_per_vb_floor(self, ) -> "int": | ||
| return _UniffiConverterUInt64.lift( | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_method_feerate_to_sat_per_vb_floor,self._uniffi_clone_pointer(),) | ||
| ) | ||
| class _UniffiConverterTypeFeeRate: | ||
| @staticmethod | ||
| def lift(value: int): | ||
| return FeeRate._make_instance_(value) | ||
| @staticmethod | ||
| def check_lower(value: FeeRate): | ||
| if not isinstance(value, FeeRate): | ||
| raise TypeError("Expected FeeRate instance, {} found".format(type(value).__name__)) | ||
| @staticmethod | ||
| def lower(value: FeeRateProtocol): | ||
| if not isinstance(value, FeeRate): | ||
| raise TypeError("Expected FeeRate instance, {} found".format(type(value).__name__)) | ||
| return value._uniffi_clone_pointer() | ||
| @classmethod | ||
| def read(cls, buf: _UniffiRustBuffer): | ||
| ptr = buf.read_u64() | ||
| if ptr == 0: | ||
| raise InternalError("Raw pointer value was null") | ||
| return cls.lift(ptr) | ||
| @classmethod | ||
| def write(cls, value: FeeRateProtocol, buf: _UniffiRustBuffer): | ||
| buf.write_u64(cls.lower(value)) | ||
| class ScriptProtocol(typing.Protocol): | ||
| def to_bytes(self, ): | ||
| raise NotImplementedError | ||
| class Script: | ||
| _pointer: ctypes.c_void_p | ||
| def __init__(self, raw_output_script: "typing.List[int]"): | ||
| _UniffiConverterSequenceUInt8.check_lower(raw_output_script) | ||
| self._pointer = _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_constructor_script_new, | ||
| _UniffiConverterSequenceUInt8.lower(raw_output_script)) | ||
| def __del__(self): | ||
| # In case of partial initialization of instances. | ||
| pointer = getattr(self, "_pointer", None) | ||
| if pointer is not None: | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_free_script, pointer) | ||
| def _uniffi_clone_pointer(self): | ||
| return _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_clone_script, self._pointer) | ||
| # Used by alternative constructors or any methods which return this type. | ||
| @classmethod | ||
| def _make_instance_(cls, pointer): | ||
| # Lightly yucky way to bypass the usual __init__ logic | ||
| # and just create a new instance with the required pointer. | ||
| inst = cls.__new__(cls) | ||
| inst._pointer = pointer | ||
| return inst | ||
| def to_bytes(self, ) -> "typing.List[int]": | ||
| return _UniffiConverterSequenceUInt8.lift( | ||
| _uniffi_rust_call(_UniffiLib.uniffi_bitcoin_ffi_fn_method_script_to_bytes,self._uniffi_clone_pointer(),) | ||
| ) | ||
| class _UniffiConverterTypeScript: | ||
| @staticmethod | ||
| def lift(value: int): | ||
| return Script._make_instance_(value) | ||
| @staticmethod | ||
| def check_lower(value: Script): | ||
| if not isinstance(value, Script): | ||
| raise TypeError("Expected Script instance, {} found".format(type(value).__name__)) | ||
| @staticmethod | ||
| def lower(value: ScriptProtocol): | ||
| if not isinstance(value, Script): | ||
| raise TypeError("Expected Script instance, {} found".format(type(value).__name__)) | ||
| return value._uniffi_clone_pointer() | ||
| @classmethod | ||
| def read(cls, buf: _UniffiRustBuffer): | ||
| ptr = buf.read_u64() | ||
| if ptr == 0: | ||
| raise InternalError("Raw pointer value was null") | ||
| return cls.lift(ptr) | ||
| @classmethod | ||
| def write(cls, value: ScriptProtocol, buf: _UniffiRustBuffer): | ||
| buf.write_u64(cls.lower(value)) | ||
| class OutPoint: | ||
| txid: "Txid" | ||
| vout: "int" | ||
| def __init__(self, *, txid: "Txid", vout: "int"): | ||
| self.txid = txid | ||
| self.vout = vout | ||
| def __str__(self): | ||
| return "OutPoint(txid={}, vout={})".format(self.txid, self.vout) | ||
| def __eq__(self, other): | ||
| if self.txid != other.txid: | ||
| return False | ||
| if self.vout != other.vout: | ||
| return False | ||
| return True | ||
| class _UniffiConverterTypeOutPoint(_UniffiConverterRustBuffer): | ||
| @staticmethod | ||
| def read(buf): | ||
| return OutPoint( | ||
| txid=_UniffiConverterTypeTxid.read(buf), | ||
| vout=_UniffiConverterUInt32.read(buf), | ||
| ) | ||
| @staticmethod | ||
| def check_lower(value): | ||
| _UniffiConverterTypeTxid.check_lower(value.txid) | ||
| _UniffiConverterUInt32.check_lower(value.vout) | ||
| @staticmethod | ||
| def write(value, buf): | ||
| _UniffiConverterTypeTxid.write(value.txid, buf) | ||
| _UniffiConverterUInt32.write(value.vout, buf) | ||
| # FeeRateError | ||
| # We want to define each variant as a nested class that's also a subclass, | ||
| # which is tricky in Python. To accomplish this we're going to create each | ||
| # class separately, then manually add the child classes to the base class's | ||
| # __dict__. All of this happens in dummy class to avoid polluting the module | ||
| # namespace. | ||
| class FeeRateError(Exception): | ||
| pass | ||
| _UniffiTempFeeRateError = FeeRateError | ||
| class FeeRateError: # type: ignore | ||
| class ArithmeticOverflow(_UniffiTempFeeRateError): | ||
| def __init__(self): | ||
| pass | ||
| def __repr__(self): | ||
| return "FeeRateError.ArithmeticOverflow({})".format(str(self)) | ||
| _UniffiTempFeeRateError.ArithmeticOverflow = ArithmeticOverflow # type: ignore | ||
| FeeRateError = _UniffiTempFeeRateError # type: ignore | ||
| del _UniffiTempFeeRateError | ||
| class _UniffiConverterTypeFeeRateError(_UniffiConverterRustBuffer): | ||
| @staticmethod | ||
| def read(buf): | ||
| variant = buf.read_i32() | ||
| if variant == 1: | ||
| return FeeRateError.ArithmeticOverflow( | ||
| ) | ||
| raise InternalError("Raw enum value doesn't match any cases") | ||
| @staticmethod | ||
| def check_lower(value): | ||
| if isinstance(value, FeeRateError.ArithmeticOverflow): | ||
| return | ||
| @staticmethod | ||
| def write(value, buf): | ||
| if isinstance(value, FeeRateError.ArithmeticOverflow): | ||
| buf.write_i32(1) | ||
| class Network(enum.Enum): | ||
| BITCOIN = 0 | ||
| TESTNET = 1 | ||
| SIGNET = 2 | ||
| REGTEST = 3 | ||
| class _UniffiConverterTypeNetwork(_UniffiConverterRustBuffer): | ||
| @staticmethod | ||
| def read(buf): | ||
| variant = buf.read_i32() | ||
| if variant == 1: | ||
| return Network.BITCOIN | ||
| if variant == 2: | ||
| return Network.TESTNET | ||
| if variant == 3: | ||
| return Network.SIGNET | ||
| if variant == 4: | ||
| return Network.REGTEST | ||
| raise InternalError("Raw enum value doesn't match any cases") | ||
| @staticmethod | ||
| def check_lower(value): | ||
| if value == Network.BITCOIN: | ||
| return | ||
| if value == Network.TESTNET: | ||
| return | ||
| if value == Network.SIGNET: | ||
| return | ||
| if value == Network.REGTEST: | ||
| return | ||
| raise ValueError(value) | ||
| @staticmethod | ||
| def write(value, buf): | ||
| if value == Network.BITCOIN: | ||
| buf.write_i32(1) | ||
| if value == Network.TESTNET: | ||
| buf.write_i32(2) | ||
| if value == Network.SIGNET: | ||
| buf.write_i32(3) | ||
| if value == Network.REGTEST: | ||
| buf.write_i32(4) | ||
| # ParseAmountError | ||
| # We want to define each variant as a nested class that's also a subclass, | ||
| # which is tricky in Python. To accomplish this we're going to create each | ||
| # class separately, then manually add the child classes to the base class's | ||
| # __dict__. All of this happens in dummy class to avoid polluting the module | ||
| # namespace. | ||
| class ParseAmountError(Exception): | ||
| pass | ||
| _UniffiTempParseAmountError = ParseAmountError | ||
| class ParseAmountError: # type: ignore | ||
| class OutOfRange(_UniffiTempParseAmountError): | ||
| def __init__(self): | ||
| pass | ||
| def __repr__(self): | ||
| return "ParseAmountError.OutOfRange({})".format(str(self)) | ||
| _UniffiTempParseAmountError.OutOfRange = OutOfRange # type: ignore | ||
| class TooPrecise(_UniffiTempParseAmountError): | ||
| def __init__(self): | ||
| pass | ||
| def __repr__(self): | ||
| return "ParseAmountError.TooPrecise({})".format(str(self)) | ||
| _UniffiTempParseAmountError.TooPrecise = TooPrecise # type: ignore | ||
| class MissingDigits(_UniffiTempParseAmountError): | ||
| def __init__(self): | ||
| pass | ||
| def __repr__(self): | ||
| return "ParseAmountError.MissingDigits({})".format(str(self)) | ||
| _UniffiTempParseAmountError.MissingDigits = MissingDigits # type: ignore | ||
| class InputTooLarge(_UniffiTempParseAmountError): | ||
| def __init__(self): | ||
| pass | ||
| def __repr__(self): | ||
| return "ParseAmountError.InputTooLarge({})".format(str(self)) | ||
| _UniffiTempParseAmountError.InputTooLarge = InputTooLarge # type: ignore | ||
| class InvalidCharacter(_UniffiTempParseAmountError): | ||
| def __init__(self, error_message): | ||
| super().__init__(", ".join([ | ||
| "error_message={!r}".format(error_message), | ||
| ])) | ||
| self.error_message = error_message | ||
| def __repr__(self): | ||
| return "ParseAmountError.InvalidCharacter({})".format(str(self)) | ||
| _UniffiTempParseAmountError.InvalidCharacter = InvalidCharacter # type: ignore | ||
| class OtherParseAmountErr(_UniffiTempParseAmountError): | ||
| def __init__(self): | ||
| pass | ||
| def __repr__(self): | ||
| return "ParseAmountError.OtherParseAmountErr({})".format(str(self)) | ||
| _UniffiTempParseAmountError.OtherParseAmountErr = OtherParseAmountErr # type: ignore | ||
| ParseAmountError = _UniffiTempParseAmountError # type: ignore | ||
| del _UniffiTempParseAmountError | ||
| class _UniffiConverterTypeParseAmountError(_UniffiConverterRustBuffer): | ||
| @staticmethod | ||
| def read(buf): | ||
| variant = buf.read_i32() | ||
| if variant == 1: | ||
| return ParseAmountError.OutOfRange( | ||
| ) | ||
| if variant == 2: | ||
| return ParseAmountError.TooPrecise( | ||
| ) | ||
| if variant == 3: | ||
| return ParseAmountError.MissingDigits( | ||
| ) | ||
| if variant == 4: | ||
| return ParseAmountError.InputTooLarge( | ||
| ) | ||
| if variant == 5: | ||
| return ParseAmountError.InvalidCharacter( | ||
| _UniffiConverterString.read(buf), | ||
| ) | ||
| if variant == 6: | ||
| return ParseAmountError.OtherParseAmountErr( | ||
| ) | ||
| raise InternalError("Raw enum value doesn't match any cases") | ||
| @staticmethod | ||
| def check_lower(value): | ||
| if isinstance(value, ParseAmountError.OutOfRange): | ||
| return | ||
| if isinstance(value, ParseAmountError.TooPrecise): | ||
| return | ||
| if isinstance(value, ParseAmountError.MissingDigits): | ||
| return | ||
| if isinstance(value, ParseAmountError.InputTooLarge): | ||
| return | ||
| if isinstance(value, ParseAmountError.InvalidCharacter): | ||
| _UniffiConverterString.check_lower(value.error_message) | ||
| return | ||
| if isinstance(value, ParseAmountError.OtherParseAmountErr): | ||
| return | ||
| @staticmethod | ||
| def write(value, buf): | ||
| if isinstance(value, ParseAmountError.OutOfRange): | ||
| buf.write_i32(1) | ||
| if isinstance(value, ParseAmountError.TooPrecise): | ||
| buf.write_i32(2) | ||
| if isinstance(value, ParseAmountError.MissingDigits): | ||
| buf.write_i32(3) | ||
| if isinstance(value, ParseAmountError.InputTooLarge): | ||
| buf.write_i32(4) | ||
| if isinstance(value, ParseAmountError.InvalidCharacter): | ||
| buf.write_i32(5) | ||
| _UniffiConverterString.write(value.error_message, buf) | ||
| if isinstance(value, ParseAmountError.OtherParseAmountErr): | ||
| buf.write_i32(6) | ||
| class _UniffiConverterSequenceUInt8(_UniffiConverterRustBuffer): | ||
| @classmethod | ||
| def check_lower(cls, value): | ||
| for item in value: | ||
| _UniffiConverterUInt8.check_lower(item) | ||
| @classmethod | ||
| def write(cls, value, buf): | ||
| items = len(value) | ||
| buf.write_i32(items) | ||
| for item in value: | ||
| _UniffiConverterUInt8.write(item, buf) | ||
| @classmethod | ||
| def read(cls, buf): | ||
| count = buf.read_i32() | ||
| if count < 0: | ||
| raise InternalError("Unexpected negative sequence length") | ||
| return [ | ||
| _UniffiConverterUInt8.read(buf) for i in range(count) | ||
| ] | ||
| class _UniffiConverterTypeTxid: | ||
| @staticmethod | ||
| def write(value, buf): | ||
| _UniffiConverterString.write(value, buf) | ||
| @staticmethod | ||
| def read(buf): | ||
| return _UniffiConverterString.read(buf) | ||
| @staticmethod | ||
| def lift(value): | ||
| return _UniffiConverterString.lift(value) | ||
| @staticmethod | ||
| def check_lower(value): | ||
| return _UniffiConverterString.check_lower(value) | ||
| @staticmethod | ||
| def lower(value): | ||
| return _UniffiConverterString.lower(value) | ||
| Txid = str | ||
| # Async support | ||
| __all__ = [ | ||
| "InternalError", | ||
| "FeeRateError", | ||
| "Network", | ||
| "ParseAmountError", | ||
| "OutPoint", | ||
| "Amount", | ||
| "FeeRate", | ||
| "Script", | ||
| ] | ||
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.