breez-sdk-spark 0.6.6__cp312-cp312-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of breez-sdk-spark might be problematic. Click here for more details.
- breez_sdk_spark/__init__.py +2 -0
- breez_sdk_spark/breez_sdk_spark.py +18924 -0
- breez_sdk_spark/breez_sdk_spark_bindings.dll +0 -0
- breez_sdk_spark/breez_sdk_spark_bindings.py +885 -0
- breez_sdk_spark/msvcp140.dll +0 -0
- breez_sdk_spark/vcruntime140.dll +0 -0
- breez_sdk_spark-0.6.6.dist-info/METADATA +23 -0
- breez_sdk_spark-0.6.6.dist-info/RECORD +10 -0
- breez_sdk_spark-0.6.6.dist-info/WHEEL +5 -0
- breez_sdk_spark-0.6.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,885 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
# This file was autogenerated by some hot garbage in the `uniffi` crate.
|
|
4
|
+
# Trust me, you don't want to mess with it!
|
|
5
|
+
|
|
6
|
+
# Common helper code.
|
|
7
|
+
#
|
|
8
|
+
# Ideally this would live in a separate .py file where it can be unittested etc
|
|
9
|
+
# in isolation, and perhaps even published as a re-useable package.
|
|
10
|
+
#
|
|
11
|
+
# However, it's important that the details of how this helper code works (e.g. the
|
|
12
|
+
# way that different builtin types are passed across the FFI) exactly match what's
|
|
13
|
+
# expected by the rust code on the other side of the interface. In practice right
|
|
14
|
+
# now that means coming from the exact some version of `uniffi` that was used to
|
|
15
|
+
# compile the rust component. The easiest way to ensure this is to bundle the Python
|
|
16
|
+
# helpers directly inline like we're doing here.
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
import os
|
|
20
|
+
import sys
|
|
21
|
+
import ctypes
|
|
22
|
+
import enum
|
|
23
|
+
import struct
|
|
24
|
+
import contextlib
|
|
25
|
+
import datetime
|
|
26
|
+
import threading
|
|
27
|
+
import itertools
|
|
28
|
+
import traceback
|
|
29
|
+
import typing
|
|
30
|
+
import platform
|
|
31
|
+
|
|
32
|
+
# Used for default argument values
|
|
33
|
+
_DEFAULT = object() # type: typing.Any
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class _UniffiRustBuffer(ctypes.Structure):
|
|
37
|
+
_fields_ = [
|
|
38
|
+
("capacity", ctypes.c_uint64),
|
|
39
|
+
("len", ctypes.c_uint64),
|
|
40
|
+
("data", ctypes.POINTER(ctypes.c_char)),
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
@staticmethod
|
|
44
|
+
def default():
|
|
45
|
+
return _UniffiRustBuffer(0, 0, None)
|
|
46
|
+
|
|
47
|
+
@staticmethod
|
|
48
|
+
def alloc(size):
|
|
49
|
+
return _uniffi_rust_call(_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_alloc, size)
|
|
50
|
+
|
|
51
|
+
@staticmethod
|
|
52
|
+
def reserve(rbuf, additional):
|
|
53
|
+
return _uniffi_rust_call(_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_reserve, rbuf, additional)
|
|
54
|
+
|
|
55
|
+
def free(self):
|
|
56
|
+
return _uniffi_rust_call(_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_free, self)
|
|
57
|
+
|
|
58
|
+
def __str__(self):
|
|
59
|
+
return "_UniffiRustBuffer(capacity={}, len={}, data={})".format(
|
|
60
|
+
self.capacity,
|
|
61
|
+
self.len,
|
|
62
|
+
self.data[0:self.len]
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
@contextlib.contextmanager
|
|
66
|
+
def alloc_with_builder(*args):
|
|
67
|
+
"""Context-manger to allocate a buffer using a _UniffiRustBufferBuilder.
|
|
68
|
+
|
|
69
|
+
The allocated buffer will be automatically freed if an error occurs, ensuring that
|
|
70
|
+
we don't accidentally leak it.
|
|
71
|
+
"""
|
|
72
|
+
builder = _UniffiRustBufferBuilder()
|
|
73
|
+
try:
|
|
74
|
+
yield builder
|
|
75
|
+
except:
|
|
76
|
+
builder.discard()
|
|
77
|
+
raise
|
|
78
|
+
|
|
79
|
+
@contextlib.contextmanager
|
|
80
|
+
def consume_with_stream(self):
|
|
81
|
+
"""Context-manager to consume a buffer using a _UniffiRustBufferStream.
|
|
82
|
+
|
|
83
|
+
The _UniffiRustBuffer will be freed once the context-manager exits, ensuring that we don't
|
|
84
|
+
leak it even if an error occurs.
|
|
85
|
+
"""
|
|
86
|
+
try:
|
|
87
|
+
s = _UniffiRustBufferStream.from_rust_buffer(self)
|
|
88
|
+
yield s
|
|
89
|
+
if s.remaining() != 0:
|
|
90
|
+
raise RuntimeError("junk data left in buffer at end of consume_with_stream")
|
|
91
|
+
finally:
|
|
92
|
+
self.free()
|
|
93
|
+
|
|
94
|
+
@contextlib.contextmanager
|
|
95
|
+
def read_with_stream(self):
|
|
96
|
+
"""Context-manager to read a buffer using a _UniffiRustBufferStream.
|
|
97
|
+
|
|
98
|
+
This is like consume_with_stream, but doesn't free the buffer afterwards.
|
|
99
|
+
It should only be used with borrowed `_UniffiRustBuffer` data.
|
|
100
|
+
"""
|
|
101
|
+
s = _UniffiRustBufferStream.from_rust_buffer(self)
|
|
102
|
+
yield s
|
|
103
|
+
if s.remaining() != 0:
|
|
104
|
+
raise RuntimeError("junk data left in buffer at end of read_with_stream")
|
|
105
|
+
|
|
106
|
+
class _UniffiForeignBytes(ctypes.Structure):
|
|
107
|
+
_fields_ = [
|
|
108
|
+
("len", ctypes.c_int32),
|
|
109
|
+
("data", ctypes.POINTER(ctypes.c_char)),
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
def __str__(self):
|
|
113
|
+
return "_UniffiForeignBytes(len={}, data={})".format(self.len, self.data[0:self.len])
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class _UniffiRustBufferStream:
|
|
117
|
+
"""
|
|
118
|
+
Helper for structured reading of bytes from a _UniffiRustBuffer
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
def __init__(self, data, len):
|
|
122
|
+
self.data = data
|
|
123
|
+
self.len = len
|
|
124
|
+
self.offset = 0
|
|
125
|
+
|
|
126
|
+
@classmethod
|
|
127
|
+
def from_rust_buffer(cls, buf):
|
|
128
|
+
return cls(buf.data, buf.len)
|
|
129
|
+
|
|
130
|
+
def remaining(self):
|
|
131
|
+
return self.len - self.offset
|
|
132
|
+
|
|
133
|
+
def _unpack_from(self, size, format):
|
|
134
|
+
if self.offset + size > self.len:
|
|
135
|
+
raise InternalError("read past end of rust buffer")
|
|
136
|
+
value = struct.unpack(format, self.data[self.offset:self.offset+size])[0]
|
|
137
|
+
self.offset += size
|
|
138
|
+
return value
|
|
139
|
+
|
|
140
|
+
def read(self, size):
|
|
141
|
+
if self.offset + size > self.len:
|
|
142
|
+
raise InternalError("read past end of rust buffer")
|
|
143
|
+
data = self.data[self.offset:self.offset+size]
|
|
144
|
+
self.offset += size
|
|
145
|
+
return data
|
|
146
|
+
|
|
147
|
+
def read_i8(self):
|
|
148
|
+
return self._unpack_from(1, ">b")
|
|
149
|
+
|
|
150
|
+
def read_u8(self):
|
|
151
|
+
return self._unpack_from(1, ">B")
|
|
152
|
+
|
|
153
|
+
def read_i16(self):
|
|
154
|
+
return self._unpack_from(2, ">h")
|
|
155
|
+
|
|
156
|
+
def read_u16(self):
|
|
157
|
+
return self._unpack_from(2, ">H")
|
|
158
|
+
|
|
159
|
+
def read_i32(self):
|
|
160
|
+
return self._unpack_from(4, ">i")
|
|
161
|
+
|
|
162
|
+
def read_u32(self):
|
|
163
|
+
return self._unpack_from(4, ">I")
|
|
164
|
+
|
|
165
|
+
def read_i64(self):
|
|
166
|
+
return self._unpack_from(8, ">q")
|
|
167
|
+
|
|
168
|
+
def read_u64(self):
|
|
169
|
+
return self._unpack_from(8, ">Q")
|
|
170
|
+
|
|
171
|
+
def read_float(self):
|
|
172
|
+
v = self._unpack_from(4, ">f")
|
|
173
|
+
return v
|
|
174
|
+
|
|
175
|
+
def read_double(self):
|
|
176
|
+
return self._unpack_from(8, ">d")
|
|
177
|
+
|
|
178
|
+
class _UniffiRustBufferBuilder:
|
|
179
|
+
"""
|
|
180
|
+
Helper for structured writing of bytes into a _UniffiRustBuffer.
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
def __init__(self):
|
|
184
|
+
self.rbuf = _UniffiRustBuffer.alloc(16)
|
|
185
|
+
self.rbuf.len = 0
|
|
186
|
+
|
|
187
|
+
def finalize(self):
|
|
188
|
+
rbuf = self.rbuf
|
|
189
|
+
self.rbuf = None
|
|
190
|
+
return rbuf
|
|
191
|
+
|
|
192
|
+
def discard(self):
|
|
193
|
+
if self.rbuf is not None:
|
|
194
|
+
rbuf = self.finalize()
|
|
195
|
+
rbuf.free()
|
|
196
|
+
|
|
197
|
+
@contextlib.contextmanager
|
|
198
|
+
def _reserve(self, num_bytes):
|
|
199
|
+
if self.rbuf.len + num_bytes > self.rbuf.capacity:
|
|
200
|
+
self.rbuf = _UniffiRustBuffer.reserve(self.rbuf, num_bytes)
|
|
201
|
+
yield None
|
|
202
|
+
self.rbuf.len += num_bytes
|
|
203
|
+
|
|
204
|
+
def _pack_into(self, size, format, value):
|
|
205
|
+
with self._reserve(size):
|
|
206
|
+
# XXX TODO: I feel like I should be able to use `struct.pack_into` here but can't figure it out.
|
|
207
|
+
for i, byte in enumerate(struct.pack(format, value)):
|
|
208
|
+
self.rbuf.data[self.rbuf.len + i] = byte
|
|
209
|
+
|
|
210
|
+
def write(self, value):
|
|
211
|
+
with self._reserve(len(value)):
|
|
212
|
+
for i, byte in enumerate(value):
|
|
213
|
+
self.rbuf.data[self.rbuf.len + i] = byte
|
|
214
|
+
|
|
215
|
+
def write_i8(self, v):
|
|
216
|
+
self._pack_into(1, ">b", v)
|
|
217
|
+
|
|
218
|
+
def write_u8(self, v):
|
|
219
|
+
self._pack_into(1, ">B", v)
|
|
220
|
+
|
|
221
|
+
def write_i16(self, v):
|
|
222
|
+
self._pack_into(2, ">h", v)
|
|
223
|
+
|
|
224
|
+
def write_u16(self, v):
|
|
225
|
+
self._pack_into(2, ">H", v)
|
|
226
|
+
|
|
227
|
+
def write_i32(self, v):
|
|
228
|
+
self._pack_into(4, ">i", v)
|
|
229
|
+
|
|
230
|
+
def write_u32(self, v):
|
|
231
|
+
self._pack_into(4, ">I", v)
|
|
232
|
+
|
|
233
|
+
def write_i64(self, v):
|
|
234
|
+
self._pack_into(8, ">q", v)
|
|
235
|
+
|
|
236
|
+
def write_u64(self, v):
|
|
237
|
+
self._pack_into(8, ">Q", v)
|
|
238
|
+
|
|
239
|
+
def write_float(self, v):
|
|
240
|
+
self._pack_into(4, ">f", v)
|
|
241
|
+
|
|
242
|
+
def write_double(self, v):
|
|
243
|
+
self._pack_into(8, ">d", v)
|
|
244
|
+
|
|
245
|
+
def write_c_size_t(self, v):
|
|
246
|
+
self._pack_into(ctypes.sizeof(ctypes.c_size_t) , "@N", v)
|
|
247
|
+
# A handful of classes and functions to support the generated data structures.
|
|
248
|
+
# This would be a good candidate for isolating in its own ffi-support lib.
|
|
249
|
+
|
|
250
|
+
class InternalError(Exception):
|
|
251
|
+
pass
|
|
252
|
+
|
|
253
|
+
class _UniffiRustCallStatus(ctypes.Structure):
|
|
254
|
+
"""
|
|
255
|
+
Error runtime.
|
|
256
|
+
"""
|
|
257
|
+
_fields_ = [
|
|
258
|
+
("code", ctypes.c_int8),
|
|
259
|
+
("error_buf", _UniffiRustBuffer),
|
|
260
|
+
]
|
|
261
|
+
|
|
262
|
+
# These match the values from the uniffi::rustcalls module
|
|
263
|
+
CALL_SUCCESS = 0
|
|
264
|
+
CALL_ERROR = 1
|
|
265
|
+
CALL_UNEXPECTED_ERROR = 2
|
|
266
|
+
|
|
267
|
+
@staticmethod
|
|
268
|
+
def default():
|
|
269
|
+
return _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer.default())
|
|
270
|
+
|
|
271
|
+
def __str__(self):
|
|
272
|
+
if self.code == _UniffiRustCallStatus.CALL_SUCCESS:
|
|
273
|
+
return "_UniffiRustCallStatus(CALL_SUCCESS)"
|
|
274
|
+
elif self.code == _UniffiRustCallStatus.CALL_ERROR:
|
|
275
|
+
return "_UniffiRustCallStatus(CALL_ERROR)"
|
|
276
|
+
elif self.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR:
|
|
277
|
+
return "_UniffiRustCallStatus(CALL_UNEXPECTED_ERROR)"
|
|
278
|
+
else:
|
|
279
|
+
return "_UniffiRustCallStatus(<invalid code>)"
|
|
280
|
+
|
|
281
|
+
def _uniffi_rust_call(fn, *args):
|
|
282
|
+
# Call a rust function
|
|
283
|
+
return _uniffi_rust_call_with_error(None, fn, *args)
|
|
284
|
+
|
|
285
|
+
def _uniffi_rust_call_with_error(error_ffi_converter, fn, *args):
|
|
286
|
+
# Call a rust function and handle any errors
|
|
287
|
+
#
|
|
288
|
+
# This function is used for rust calls that return Result<> and therefore can set the CALL_ERROR status code.
|
|
289
|
+
# error_ffi_converter must be set to the _UniffiConverter for the error class that corresponds to the result.
|
|
290
|
+
call_status = _UniffiRustCallStatus.default()
|
|
291
|
+
|
|
292
|
+
args_with_error = args + (ctypes.byref(call_status),)
|
|
293
|
+
result = fn(*args_with_error)
|
|
294
|
+
_uniffi_check_call_status(error_ffi_converter, call_status)
|
|
295
|
+
return result
|
|
296
|
+
|
|
297
|
+
def _uniffi_check_call_status(error_ffi_converter, call_status):
|
|
298
|
+
if call_status.code == _UniffiRustCallStatus.CALL_SUCCESS:
|
|
299
|
+
pass
|
|
300
|
+
elif call_status.code == _UniffiRustCallStatus.CALL_ERROR:
|
|
301
|
+
if error_ffi_converter is None:
|
|
302
|
+
call_status.error_buf.free()
|
|
303
|
+
raise InternalError("_uniffi_rust_call_with_error: CALL_ERROR, but error_ffi_converter is None")
|
|
304
|
+
else:
|
|
305
|
+
raise error_ffi_converter.lift(call_status.error_buf)
|
|
306
|
+
elif call_status.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR:
|
|
307
|
+
# When the rust code sees a panic, it tries to construct a _UniffiRustBuffer
|
|
308
|
+
# with the message. But if that code panics, then it just sends back
|
|
309
|
+
# an empty buffer.
|
|
310
|
+
if call_status.error_buf.len > 0:
|
|
311
|
+
msg = _UniffiConverterString.lift(call_status.error_buf)
|
|
312
|
+
else:
|
|
313
|
+
msg = "Unknown rust panic"
|
|
314
|
+
raise InternalError(msg)
|
|
315
|
+
else:
|
|
316
|
+
raise InternalError("Invalid _UniffiRustCallStatus code: {}".format(
|
|
317
|
+
call_status.code))
|
|
318
|
+
|
|
319
|
+
def _uniffi_trait_interface_call(call_status, make_call, write_return_value):
|
|
320
|
+
try:
|
|
321
|
+
return write_return_value(make_call())
|
|
322
|
+
except Exception as e:
|
|
323
|
+
call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR
|
|
324
|
+
call_status.error_buf = _UniffiConverterString.lower(repr(e))
|
|
325
|
+
|
|
326
|
+
def _uniffi_trait_interface_call_with_error(call_status, make_call, write_return_value, error_type, lower_error):
|
|
327
|
+
try:
|
|
328
|
+
try:
|
|
329
|
+
return write_return_value(make_call())
|
|
330
|
+
except error_type as e:
|
|
331
|
+
call_status.code = _UniffiRustCallStatus.CALL_ERROR
|
|
332
|
+
call_status.error_buf = lower_error(e)
|
|
333
|
+
except Exception as e:
|
|
334
|
+
call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR
|
|
335
|
+
call_status.error_buf = _UniffiConverterString.lower(repr(e))
|
|
336
|
+
class _UniffiHandleMap:
|
|
337
|
+
"""
|
|
338
|
+
A map where inserting, getting and removing data is synchronized with a lock.
|
|
339
|
+
"""
|
|
340
|
+
|
|
341
|
+
def __init__(self):
|
|
342
|
+
# type Handle = int
|
|
343
|
+
self._map = {} # type: Dict[Handle, Any]
|
|
344
|
+
self._lock = threading.Lock()
|
|
345
|
+
self._counter = itertools.count()
|
|
346
|
+
|
|
347
|
+
def insert(self, obj):
|
|
348
|
+
with self._lock:
|
|
349
|
+
handle = next(self._counter)
|
|
350
|
+
self._map[handle] = obj
|
|
351
|
+
return handle
|
|
352
|
+
|
|
353
|
+
def get(self, handle):
|
|
354
|
+
try:
|
|
355
|
+
with self._lock:
|
|
356
|
+
return self._map[handle]
|
|
357
|
+
except KeyError:
|
|
358
|
+
raise InternalError("_UniffiHandleMap.get: Invalid handle")
|
|
359
|
+
|
|
360
|
+
def remove(self, handle):
|
|
361
|
+
try:
|
|
362
|
+
with self._lock:
|
|
363
|
+
return self._map.pop(handle)
|
|
364
|
+
except KeyError:
|
|
365
|
+
raise InternalError("_UniffiHandleMap.remove: Invalid handle")
|
|
366
|
+
|
|
367
|
+
def __len__(self):
|
|
368
|
+
return len(self._map)
|
|
369
|
+
# Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI.
|
|
370
|
+
class _UniffiConverterPrimitive:
|
|
371
|
+
@classmethod
|
|
372
|
+
def lift(cls, value):
|
|
373
|
+
return value
|
|
374
|
+
|
|
375
|
+
@classmethod
|
|
376
|
+
def lower(cls, value):
|
|
377
|
+
return value
|
|
378
|
+
|
|
379
|
+
class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive):
|
|
380
|
+
@classmethod
|
|
381
|
+
def check_lower(cls, value):
|
|
382
|
+
try:
|
|
383
|
+
value = value.__index__()
|
|
384
|
+
except Exception:
|
|
385
|
+
raise TypeError("'{}' object cannot be interpreted as an integer".format(type(value).__name__))
|
|
386
|
+
if not isinstance(value, int):
|
|
387
|
+
raise TypeError("__index__ returned non-int (type {})".format(type(value).__name__))
|
|
388
|
+
if not cls.VALUE_MIN <= value < cls.VALUE_MAX:
|
|
389
|
+
raise ValueError("{} requires {} <= value < {}".format(cls.CLASS_NAME, cls.VALUE_MIN, cls.VALUE_MAX))
|
|
390
|
+
|
|
391
|
+
class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive):
|
|
392
|
+
@classmethod
|
|
393
|
+
def check_lower(cls, value):
|
|
394
|
+
try:
|
|
395
|
+
value = value.__float__()
|
|
396
|
+
except Exception:
|
|
397
|
+
raise TypeError("must be real number, not {}".format(type(value).__name__))
|
|
398
|
+
if not isinstance(value, float):
|
|
399
|
+
raise TypeError("__float__ returned non-float (type {})".format(type(value).__name__))
|
|
400
|
+
|
|
401
|
+
# Helper class for wrapper types that will always go through a _UniffiRustBuffer.
|
|
402
|
+
# Classes should inherit from this and implement the `read` and `write` static methods.
|
|
403
|
+
class _UniffiConverterRustBuffer:
|
|
404
|
+
@classmethod
|
|
405
|
+
def lift(cls, rbuf):
|
|
406
|
+
with rbuf.consume_with_stream() as stream:
|
|
407
|
+
return cls.read(stream)
|
|
408
|
+
|
|
409
|
+
@classmethod
|
|
410
|
+
def lower(cls, value):
|
|
411
|
+
with _UniffiRustBuffer.alloc_with_builder() as builder:
|
|
412
|
+
cls.write(value, builder)
|
|
413
|
+
return builder.finalize()
|
|
414
|
+
|
|
415
|
+
# Contains loading, initialization code, and the FFI Function declarations.
|
|
416
|
+
# Define some ctypes FFI types that we use in the library
|
|
417
|
+
|
|
418
|
+
"""
|
|
419
|
+
Function pointer for a Rust task, which a callback function that takes a opaque pointer
|
|
420
|
+
"""
|
|
421
|
+
_UNIFFI_RUST_TASK = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int8)
|
|
422
|
+
|
|
423
|
+
def _uniffi_future_callback_t(return_type):
|
|
424
|
+
"""
|
|
425
|
+
Factory function to create callback function types for async functions
|
|
426
|
+
"""
|
|
427
|
+
return ctypes.CFUNCTYPE(None, ctypes.c_uint64, return_type, _UniffiRustCallStatus)
|
|
428
|
+
|
|
429
|
+
def _uniffi_load_indirect():
|
|
430
|
+
"""
|
|
431
|
+
This is how we find and load the dynamic library provided by the component.
|
|
432
|
+
For now we just look it up by name.
|
|
433
|
+
"""
|
|
434
|
+
if sys.platform == "darwin":
|
|
435
|
+
libname = "lib{}.dylib"
|
|
436
|
+
elif sys.platform.startswith("win"):
|
|
437
|
+
# As of python3.8, ctypes does not seem to search $PATH when loading DLLs.
|
|
438
|
+
# We could use `os.add_dll_directory` to configure the search path, but
|
|
439
|
+
# it doesn't feel right to mess with application-wide settings. Let's
|
|
440
|
+
# assume that the `.dll` is next to the `.py` file and load by full path.
|
|
441
|
+
libname = os.path.join(
|
|
442
|
+
os.path.dirname(__file__),
|
|
443
|
+
"{}.dll",
|
|
444
|
+
)
|
|
445
|
+
else:
|
|
446
|
+
# Anything else must be an ELF platform - Linux, *BSD, Solaris/illumos
|
|
447
|
+
libname = "lib{}.so"
|
|
448
|
+
|
|
449
|
+
libname = libname.format("breez_sdk_spark_bindings")
|
|
450
|
+
path = os.path.join(os.path.dirname(__file__), libname)
|
|
451
|
+
lib = ctypes.cdll.LoadLibrary(path)
|
|
452
|
+
return lib
|
|
453
|
+
|
|
454
|
+
def _uniffi_check_contract_api_version(lib):
|
|
455
|
+
# Get the bindings contract version from our ComponentInterface
|
|
456
|
+
bindings_contract_version = 26
|
|
457
|
+
# Get the scaffolding contract version by calling the into the dylib
|
|
458
|
+
scaffolding_contract_version = lib.ffi_breez_sdk_spark_bindings_uniffi_contract_version()
|
|
459
|
+
if bindings_contract_version != scaffolding_contract_version:
|
|
460
|
+
raise InternalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
|
|
461
|
+
|
|
462
|
+
def _uniffi_check_api_checksums(lib):
|
|
463
|
+
pass
|
|
464
|
+
|
|
465
|
+
# A ctypes library to expose the extern-C FFI definitions.
|
|
466
|
+
# This is an implementation detail which will be called internally by the public API.
|
|
467
|
+
|
|
468
|
+
_UniffiLib = _uniffi_load_indirect()
|
|
469
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_int8,
|
|
470
|
+
)
|
|
471
|
+
_UNIFFI_FOREIGN_FUTURE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64,
|
|
472
|
+
)
|
|
473
|
+
_UNIFFI_CALLBACK_INTERFACE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64,
|
|
474
|
+
)
|
|
475
|
+
class _UniffiForeignFuture(ctypes.Structure):
|
|
476
|
+
_fields_ = [
|
|
477
|
+
("handle", ctypes.c_uint64),
|
|
478
|
+
("free", _UNIFFI_FOREIGN_FUTURE_FREE),
|
|
479
|
+
]
|
|
480
|
+
class _UniffiForeignFutureStructU8(ctypes.Structure):
|
|
481
|
+
_fields_ = [
|
|
482
|
+
("return_value", ctypes.c_uint8),
|
|
483
|
+
("call_status", _UniffiRustCallStatus),
|
|
484
|
+
]
|
|
485
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_U8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU8,
|
|
486
|
+
)
|
|
487
|
+
class _UniffiForeignFutureStructI8(ctypes.Structure):
|
|
488
|
+
_fields_ = [
|
|
489
|
+
("return_value", ctypes.c_int8),
|
|
490
|
+
("call_status", _UniffiRustCallStatus),
|
|
491
|
+
]
|
|
492
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_I8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI8,
|
|
493
|
+
)
|
|
494
|
+
class _UniffiForeignFutureStructU16(ctypes.Structure):
|
|
495
|
+
_fields_ = [
|
|
496
|
+
("return_value", ctypes.c_uint16),
|
|
497
|
+
("call_status", _UniffiRustCallStatus),
|
|
498
|
+
]
|
|
499
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_U16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU16,
|
|
500
|
+
)
|
|
501
|
+
class _UniffiForeignFutureStructI16(ctypes.Structure):
|
|
502
|
+
_fields_ = [
|
|
503
|
+
("return_value", ctypes.c_int16),
|
|
504
|
+
("call_status", _UniffiRustCallStatus),
|
|
505
|
+
]
|
|
506
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_I16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI16,
|
|
507
|
+
)
|
|
508
|
+
class _UniffiForeignFutureStructU32(ctypes.Structure):
|
|
509
|
+
_fields_ = [
|
|
510
|
+
("return_value", ctypes.c_uint32),
|
|
511
|
+
("call_status", _UniffiRustCallStatus),
|
|
512
|
+
]
|
|
513
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_U32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU32,
|
|
514
|
+
)
|
|
515
|
+
class _UniffiForeignFutureStructI32(ctypes.Structure):
|
|
516
|
+
_fields_ = [
|
|
517
|
+
("return_value", ctypes.c_int32),
|
|
518
|
+
("call_status", _UniffiRustCallStatus),
|
|
519
|
+
]
|
|
520
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_I32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI32,
|
|
521
|
+
)
|
|
522
|
+
class _UniffiForeignFutureStructU64(ctypes.Structure):
|
|
523
|
+
_fields_ = [
|
|
524
|
+
("return_value", ctypes.c_uint64),
|
|
525
|
+
("call_status", _UniffiRustCallStatus),
|
|
526
|
+
]
|
|
527
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_U64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU64,
|
|
528
|
+
)
|
|
529
|
+
class _UniffiForeignFutureStructI64(ctypes.Structure):
|
|
530
|
+
_fields_ = [
|
|
531
|
+
("return_value", ctypes.c_int64),
|
|
532
|
+
("call_status", _UniffiRustCallStatus),
|
|
533
|
+
]
|
|
534
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_I64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI64,
|
|
535
|
+
)
|
|
536
|
+
class _UniffiForeignFutureStructF32(ctypes.Structure):
|
|
537
|
+
_fields_ = [
|
|
538
|
+
("return_value", ctypes.c_float),
|
|
539
|
+
("call_status", _UniffiRustCallStatus),
|
|
540
|
+
]
|
|
541
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_F32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF32,
|
|
542
|
+
)
|
|
543
|
+
class _UniffiForeignFutureStructF64(ctypes.Structure):
|
|
544
|
+
_fields_ = [
|
|
545
|
+
("return_value", ctypes.c_double),
|
|
546
|
+
("call_status", _UniffiRustCallStatus),
|
|
547
|
+
]
|
|
548
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_F64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF64,
|
|
549
|
+
)
|
|
550
|
+
class _UniffiForeignFutureStructPointer(ctypes.Structure):
|
|
551
|
+
_fields_ = [
|
|
552
|
+
("return_value", ctypes.c_void_p),
|
|
553
|
+
("call_status", _UniffiRustCallStatus),
|
|
554
|
+
]
|
|
555
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_POINTER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructPointer,
|
|
556
|
+
)
|
|
557
|
+
class _UniffiForeignFutureStructRustBuffer(ctypes.Structure):
|
|
558
|
+
_fields_ = [
|
|
559
|
+
("return_value", _UniffiRustBuffer),
|
|
560
|
+
("call_status", _UniffiRustCallStatus),
|
|
561
|
+
]
|
|
562
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructRustBuffer,
|
|
563
|
+
)
|
|
564
|
+
class _UniffiForeignFutureStructVoid(ctypes.Structure):
|
|
565
|
+
_fields_ = [
|
|
566
|
+
("call_status", _UniffiRustCallStatus),
|
|
567
|
+
]
|
|
568
|
+
_UNIFFI_FOREIGN_FUTURE_COMPLETE_VOID = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructVoid,
|
|
569
|
+
)
|
|
570
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_alloc.argtypes = (
|
|
571
|
+
ctypes.c_uint64,
|
|
572
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
573
|
+
)
|
|
574
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_alloc.restype = _UniffiRustBuffer
|
|
575
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_from_bytes.argtypes = (
|
|
576
|
+
_UniffiForeignBytes,
|
|
577
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
578
|
+
)
|
|
579
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_from_bytes.restype = _UniffiRustBuffer
|
|
580
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_free.argtypes = (
|
|
581
|
+
_UniffiRustBuffer,
|
|
582
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
583
|
+
)
|
|
584
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_free.restype = None
|
|
585
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_reserve.argtypes = (
|
|
586
|
+
_UniffiRustBuffer,
|
|
587
|
+
ctypes.c_uint64,
|
|
588
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
589
|
+
)
|
|
590
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rustbuffer_reserve.restype = _UniffiRustBuffer
|
|
591
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_u8.argtypes = (
|
|
592
|
+
ctypes.c_uint64,
|
|
593
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
594
|
+
ctypes.c_uint64,
|
|
595
|
+
)
|
|
596
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_u8.restype = None
|
|
597
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_u8.argtypes = (
|
|
598
|
+
ctypes.c_uint64,
|
|
599
|
+
)
|
|
600
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_u8.restype = None
|
|
601
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_u8.argtypes = (
|
|
602
|
+
ctypes.c_uint64,
|
|
603
|
+
)
|
|
604
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_u8.restype = None
|
|
605
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_u8.argtypes = (
|
|
606
|
+
ctypes.c_uint64,
|
|
607
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
608
|
+
)
|
|
609
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_u8.restype = ctypes.c_uint8
|
|
610
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_i8.argtypes = (
|
|
611
|
+
ctypes.c_uint64,
|
|
612
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
613
|
+
ctypes.c_uint64,
|
|
614
|
+
)
|
|
615
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_i8.restype = None
|
|
616
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_i8.argtypes = (
|
|
617
|
+
ctypes.c_uint64,
|
|
618
|
+
)
|
|
619
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_i8.restype = None
|
|
620
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_i8.argtypes = (
|
|
621
|
+
ctypes.c_uint64,
|
|
622
|
+
)
|
|
623
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_i8.restype = None
|
|
624
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_i8.argtypes = (
|
|
625
|
+
ctypes.c_uint64,
|
|
626
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
627
|
+
)
|
|
628
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_i8.restype = ctypes.c_int8
|
|
629
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_u16.argtypes = (
|
|
630
|
+
ctypes.c_uint64,
|
|
631
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
632
|
+
ctypes.c_uint64,
|
|
633
|
+
)
|
|
634
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_u16.restype = None
|
|
635
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_u16.argtypes = (
|
|
636
|
+
ctypes.c_uint64,
|
|
637
|
+
)
|
|
638
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_u16.restype = None
|
|
639
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_u16.argtypes = (
|
|
640
|
+
ctypes.c_uint64,
|
|
641
|
+
)
|
|
642
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_u16.restype = None
|
|
643
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_u16.argtypes = (
|
|
644
|
+
ctypes.c_uint64,
|
|
645
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
646
|
+
)
|
|
647
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_u16.restype = ctypes.c_uint16
|
|
648
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_i16.argtypes = (
|
|
649
|
+
ctypes.c_uint64,
|
|
650
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
651
|
+
ctypes.c_uint64,
|
|
652
|
+
)
|
|
653
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_i16.restype = None
|
|
654
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_i16.argtypes = (
|
|
655
|
+
ctypes.c_uint64,
|
|
656
|
+
)
|
|
657
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_i16.restype = None
|
|
658
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_i16.argtypes = (
|
|
659
|
+
ctypes.c_uint64,
|
|
660
|
+
)
|
|
661
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_i16.restype = None
|
|
662
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_i16.argtypes = (
|
|
663
|
+
ctypes.c_uint64,
|
|
664
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
665
|
+
)
|
|
666
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_i16.restype = ctypes.c_int16
|
|
667
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_u32.argtypes = (
|
|
668
|
+
ctypes.c_uint64,
|
|
669
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
670
|
+
ctypes.c_uint64,
|
|
671
|
+
)
|
|
672
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_u32.restype = None
|
|
673
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_u32.argtypes = (
|
|
674
|
+
ctypes.c_uint64,
|
|
675
|
+
)
|
|
676
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_u32.restype = None
|
|
677
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_u32.argtypes = (
|
|
678
|
+
ctypes.c_uint64,
|
|
679
|
+
)
|
|
680
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_u32.restype = None
|
|
681
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_u32.argtypes = (
|
|
682
|
+
ctypes.c_uint64,
|
|
683
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
684
|
+
)
|
|
685
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_u32.restype = ctypes.c_uint32
|
|
686
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_i32.argtypes = (
|
|
687
|
+
ctypes.c_uint64,
|
|
688
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
689
|
+
ctypes.c_uint64,
|
|
690
|
+
)
|
|
691
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_i32.restype = None
|
|
692
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_i32.argtypes = (
|
|
693
|
+
ctypes.c_uint64,
|
|
694
|
+
)
|
|
695
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_i32.restype = None
|
|
696
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_i32.argtypes = (
|
|
697
|
+
ctypes.c_uint64,
|
|
698
|
+
)
|
|
699
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_i32.restype = None
|
|
700
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_i32.argtypes = (
|
|
701
|
+
ctypes.c_uint64,
|
|
702
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
703
|
+
)
|
|
704
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_i32.restype = ctypes.c_int32
|
|
705
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_u64.argtypes = (
|
|
706
|
+
ctypes.c_uint64,
|
|
707
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
708
|
+
ctypes.c_uint64,
|
|
709
|
+
)
|
|
710
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_u64.restype = None
|
|
711
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_u64.argtypes = (
|
|
712
|
+
ctypes.c_uint64,
|
|
713
|
+
)
|
|
714
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_u64.restype = None
|
|
715
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_u64.argtypes = (
|
|
716
|
+
ctypes.c_uint64,
|
|
717
|
+
)
|
|
718
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_u64.restype = None
|
|
719
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_u64.argtypes = (
|
|
720
|
+
ctypes.c_uint64,
|
|
721
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
722
|
+
)
|
|
723
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_u64.restype = ctypes.c_uint64
|
|
724
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_i64.argtypes = (
|
|
725
|
+
ctypes.c_uint64,
|
|
726
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
727
|
+
ctypes.c_uint64,
|
|
728
|
+
)
|
|
729
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_i64.restype = None
|
|
730
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_i64.argtypes = (
|
|
731
|
+
ctypes.c_uint64,
|
|
732
|
+
)
|
|
733
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_i64.restype = None
|
|
734
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_i64.argtypes = (
|
|
735
|
+
ctypes.c_uint64,
|
|
736
|
+
)
|
|
737
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_i64.restype = None
|
|
738
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_i64.argtypes = (
|
|
739
|
+
ctypes.c_uint64,
|
|
740
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
741
|
+
)
|
|
742
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_i64.restype = ctypes.c_int64
|
|
743
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_f32.argtypes = (
|
|
744
|
+
ctypes.c_uint64,
|
|
745
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
746
|
+
ctypes.c_uint64,
|
|
747
|
+
)
|
|
748
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_f32.restype = None
|
|
749
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_f32.argtypes = (
|
|
750
|
+
ctypes.c_uint64,
|
|
751
|
+
)
|
|
752
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_f32.restype = None
|
|
753
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_f32.argtypes = (
|
|
754
|
+
ctypes.c_uint64,
|
|
755
|
+
)
|
|
756
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_f32.restype = None
|
|
757
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_f32.argtypes = (
|
|
758
|
+
ctypes.c_uint64,
|
|
759
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
760
|
+
)
|
|
761
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_f32.restype = ctypes.c_float
|
|
762
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_f64.argtypes = (
|
|
763
|
+
ctypes.c_uint64,
|
|
764
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
765
|
+
ctypes.c_uint64,
|
|
766
|
+
)
|
|
767
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_f64.restype = None
|
|
768
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_f64.argtypes = (
|
|
769
|
+
ctypes.c_uint64,
|
|
770
|
+
)
|
|
771
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_f64.restype = None
|
|
772
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_f64.argtypes = (
|
|
773
|
+
ctypes.c_uint64,
|
|
774
|
+
)
|
|
775
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_f64.restype = None
|
|
776
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_f64.argtypes = (
|
|
777
|
+
ctypes.c_uint64,
|
|
778
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
779
|
+
)
|
|
780
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_f64.restype = ctypes.c_double
|
|
781
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_pointer.argtypes = (
|
|
782
|
+
ctypes.c_uint64,
|
|
783
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
784
|
+
ctypes.c_uint64,
|
|
785
|
+
)
|
|
786
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_pointer.restype = None
|
|
787
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_pointer.argtypes = (
|
|
788
|
+
ctypes.c_uint64,
|
|
789
|
+
)
|
|
790
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_pointer.restype = None
|
|
791
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_pointer.argtypes = (
|
|
792
|
+
ctypes.c_uint64,
|
|
793
|
+
)
|
|
794
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_pointer.restype = None
|
|
795
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_pointer.argtypes = (
|
|
796
|
+
ctypes.c_uint64,
|
|
797
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
798
|
+
)
|
|
799
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_pointer.restype = ctypes.c_void_p
|
|
800
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_rust_buffer.argtypes = (
|
|
801
|
+
ctypes.c_uint64,
|
|
802
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
803
|
+
ctypes.c_uint64,
|
|
804
|
+
)
|
|
805
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_rust_buffer.restype = None
|
|
806
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_rust_buffer.argtypes = (
|
|
807
|
+
ctypes.c_uint64,
|
|
808
|
+
)
|
|
809
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_rust_buffer.restype = None
|
|
810
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_rust_buffer.argtypes = (
|
|
811
|
+
ctypes.c_uint64,
|
|
812
|
+
)
|
|
813
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_rust_buffer.restype = None
|
|
814
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_rust_buffer.argtypes = (
|
|
815
|
+
ctypes.c_uint64,
|
|
816
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
817
|
+
)
|
|
818
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer
|
|
819
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_void.argtypes = (
|
|
820
|
+
ctypes.c_uint64,
|
|
821
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
822
|
+
ctypes.c_uint64,
|
|
823
|
+
)
|
|
824
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_poll_void.restype = None
|
|
825
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_void.argtypes = (
|
|
826
|
+
ctypes.c_uint64,
|
|
827
|
+
)
|
|
828
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_cancel_void.restype = None
|
|
829
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_void.argtypes = (
|
|
830
|
+
ctypes.c_uint64,
|
|
831
|
+
)
|
|
832
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_free_void.restype = None
|
|
833
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_void.argtypes = (
|
|
834
|
+
ctypes.c_uint64,
|
|
835
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
836
|
+
)
|
|
837
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_rust_future_complete_void.restype = None
|
|
838
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_uniffi_contract_version.argtypes = (
|
|
839
|
+
)
|
|
840
|
+
_UniffiLib.ffi_breez_sdk_spark_bindings_uniffi_contract_version.restype = ctypes.c_uint32
|
|
841
|
+
|
|
842
|
+
_uniffi_check_contract_api_version(_UniffiLib)
|
|
843
|
+
# _uniffi_check_api_checksums(_UniffiLib)
|
|
844
|
+
|
|
845
|
+
# Public interface members begin here.
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
class _UniffiConverterString:
|
|
849
|
+
@staticmethod
|
|
850
|
+
def check_lower(value):
|
|
851
|
+
if not isinstance(value, str):
|
|
852
|
+
raise TypeError("argument must be str, not {}".format(type(value).__name__))
|
|
853
|
+
return value
|
|
854
|
+
|
|
855
|
+
@staticmethod
|
|
856
|
+
def read(buf):
|
|
857
|
+
size = buf.read_i32()
|
|
858
|
+
if size < 0:
|
|
859
|
+
raise InternalError("Unexpected negative string length")
|
|
860
|
+
utf8_bytes = buf.read(size)
|
|
861
|
+
return utf8_bytes.decode("utf-8")
|
|
862
|
+
|
|
863
|
+
@staticmethod
|
|
864
|
+
def write(value, buf):
|
|
865
|
+
utf8_bytes = value.encode("utf-8")
|
|
866
|
+
buf.write_i32(len(utf8_bytes))
|
|
867
|
+
buf.write(utf8_bytes)
|
|
868
|
+
|
|
869
|
+
@staticmethod
|
|
870
|
+
def lift(buf):
|
|
871
|
+
with buf.consume_with_stream() as stream:
|
|
872
|
+
return stream.read(stream.remaining()).decode("utf-8")
|
|
873
|
+
|
|
874
|
+
@staticmethod
|
|
875
|
+
def lower(value):
|
|
876
|
+
with _UniffiRustBuffer.alloc_with_builder() as builder:
|
|
877
|
+
builder.write(value.encode("utf-8"))
|
|
878
|
+
return builder.finalize()
|
|
879
|
+
|
|
880
|
+
# Async support
|
|
881
|
+
|
|
882
|
+
__all__ = [
|
|
883
|
+
"InternalError",
|
|
884
|
+
]
|
|
885
|
+
|