dash-shielded-native 0.0.1
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.
- package/CHANGELOG.md +5 -0
- package/LICENSE +27 -0
- package/README.md +36 -0
- package/android/build.gradle +56 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/app/edge/rndashshielded/RNDashShieldedModule.kt +215 -0
- package/android/src/main/java/app/edge/rndashshielded/RNDashShieldedPackage.kt +16 -0
- package/android/src/main/java/uniffi/dash/dash.kt +1665 -0
- package/android/src/main/jniLibs/arm64-v8a/libdashshielded.so +0 -0
- package/dash-shielded-native.podspec +32 -0
- package/ios/.uniffi-generated +1 -0
- package/ios/EdgeDashClient.swift +88 -0
- package/ios/RNDashShielded.m +83 -0
- package/ios/RNDashShielded.swift +214 -0
- package/ios/dash-shielded-native-Bridging-Header.h +2 -0
- package/ios/dash.swift +1124 -0
- package/ios/libdashshielded.xcframework/Info.plist +47 -0
- package/ios/libdashshielded.xcframework/ios-arm64/Headers/dashFFI.h +696 -0
- package/ios/libdashshielded.xcframework/ios-arm64/Headers/module.modulemap +7 -0
- package/ios/libdashshielded.xcframework/ios-arm64/libdashshielded.a +0 -0
- package/ios/libdashshielded.xcframework/ios-arm64-simulator/Headers/dashFFI.h +696 -0
- package/ios/libdashshielded.xcframework/ios-arm64-simulator/Headers/module.modulemap +7 -0
- package/ios/libdashshielded.xcframework/ios-arm64-simulator/libdashshielded.a +0 -0
- package/lib/load-addon.d.ts +34 -0
- package/lib/node.d.ts +50 -0
- package/lib/react-native.d.ts +31 -0
- package/lib/rndash.rn.js +267 -0
- package/lib/rndash.rn.js.map +1 -0
- package/lib/src/node.js +328 -0
- package/lib/src/node.js.map +1 -0
- package/lib/types.d.ts +73 -0
- package/node.d.ts +1 -0
- package/node.js +2 -0
- package/package.json +105 -0
- package/prebuilds/darwin-arm64/dashshielded.node +0 -0
- package/rust/Cargo.lock +6795 -0
- package/rust/Cargo.toml +63 -0
- package/rust/build.rs +7 -0
- package/rust/rust-toolchain.toml +3 -0
- package/rust/src/dash.udl +90 -0
- package/rust/src/lib.rs +16 -0
- package/rust/src/napi_api.rs +164 -0
- package/rust/src/uniffi_api.rs +116 -0
- package/rust/src/wallet.rs +888 -0
- package/rust/uniffi-bindgen.rs +3 -0
- package/src/load-addon.ts +99 -0
- package/src/node.ts +248 -0
- package/src/react-native.ts +212 -0
- package/src/types.ts +88 -0
|
@@ -0,0 +1,1665 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
|
|
4
|
+
@file:Suppress("NAME_SHADOWING")
|
|
5
|
+
|
|
6
|
+
package uniffi.dash
|
|
7
|
+
|
|
8
|
+
// Common helper code.
|
|
9
|
+
//
|
|
10
|
+
// Ideally this would live in a separate .kt file where it can be unittested etc
|
|
11
|
+
// in isolation, and perhaps even published as a re-useable package.
|
|
12
|
+
//
|
|
13
|
+
// However, it's important that the details of how this helper code works (e.g. the
|
|
14
|
+
// way that different builtin types are passed across the FFI) exactly match what's
|
|
15
|
+
// expected by the Rust code on the other side of the interface. In practice right
|
|
16
|
+
// now that means coming from the exact some version of `uniffi` that was used to
|
|
17
|
+
// compile the Rust component. The easiest way to ensure this is to bundle the Kotlin
|
|
18
|
+
// helpers directly inline like we're doing here.
|
|
19
|
+
|
|
20
|
+
import com.sun.jna.Library
|
|
21
|
+
import com.sun.jna.IntegerType
|
|
22
|
+
import com.sun.jna.Native
|
|
23
|
+
import com.sun.jna.Pointer
|
|
24
|
+
import com.sun.jna.Structure
|
|
25
|
+
import com.sun.jna.Callback
|
|
26
|
+
import com.sun.jna.ptr.*
|
|
27
|
+
import java.nio.ByteBuffer
|
|
28
|
+
import java.nio.ByteOrder
|
|
29
|
+
import java.nio.CharBuffer
|
|
30
|
+
import java.nio.charset.CodingErrorAction
|
|
31
|
+
import java.util.concurrent.atomic.AtomicLong
|
|
32
|
+
import java.util.concurrent.ConcurrentHashMap
|
|
33
|
+
|
|
34
|
+
// This is a helper for safely working with byte buffers returned from the Rust code.
|
|
35
|
+
// A rust-owned buffer is represented by its capacity, its current length, and a
|
|
36
|
+
// pointer to the underlying data.
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @suppress
|
|
40
|
+
*/
|
|
41
|
+
@Structure.FieldOrder("capacity", "len", "data")
|
|
42
|
+
open class RustBuffer : Structure() {
|
|
43
|
+
// Note: `capacity` and `len` are actually `ULong` values, but JVM only supports signed values.
|
|
44
|
+
// When dealing with these fields, make sure to call `toULong()`.
|
|
45
|
+
@JvmField var capacity: Long = 0
|
|
46
|
+
@JvmField var len: Long = 0
|
|
47
|
+
@JvmField var data: Pointer? = null
|
|
48
|
+
|
|
49
|
+
class ByValue: RustBuffer(), Structure.ByValue
|
|
50
|
+
class ByReference: RustBuffer(), Structure.ByReference
|
|
51
|
+
|
|
52
|
+
internal fun setValue(other: RustBuffer) {
|
|
53
|
+
capacity = other.capacity
|
|
54
|
+
len = other.len
|
|
55
|
+
data = other.data
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
companion object {
|
|
59
|
+
internal fun alloc(size: ULong = 0UL) = uniffiRustCall() { status ->
|
|
60
|
+
// Note: need to convert the size to a `Long` value to make this work with JVM.
|
|
61
|
+
UniffiLib.INSTANCE.ffi_dashshielded_rustbuffer_alloc(size.toLong(), status)
|
|
62
|
+
}.also {
|
|
63
|
+
if(it.data == null) {
|
|
64
|
+
throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})")
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
internal fun create(capacity: ULong, len: ULong, data: Pointer?): RustBuffer.ByValue {
|
|
69
|
+
var buf = RustBuffer.ByValue()
|
|
70
|
+
buf.capacity = capacity.toLong()
|
|
71
|
+
buf.len = len.toLong()
|
|
72
|
+
buf.data = data
|
|
73
|
+
return buf
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
internal fun free(buf: RustBuffer.ByValue) = uniffiRustCall() { status ->
|
|
77
|
+
UniffiLib.INSTANCE.ffi_dashshielded_rustbuffer_free(buf, status)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Suppress("TooGenericExceptionThrown")
|
|
82
|
+
fun asByteBuffer() =
|
|
83
|
+
this.data?.getByteBuffer(0, this.len.toLong())?.also {
|
|
84
|
+
it.order(ByteOrder.BIG_ENDIAN)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The equivalent of the `*mut RustBuffer` type.
|
|
90
|
+
* Required for callbacks taking in an out pointer.
|
|
91
|
+
*
|
|
92
|
+
* Size is the sum of all values in the struct.
|
|
93
|
+
*
|
|
94
|
+
* @suppress
|
|
95
|
+
*/
|
|
96
|
+
class RustBufferByReference : ByReference(16) {
|
|
97
|
+
/**
|
|
98
|
+
* Set the pointed-to `RustBuffer` to the given value.
|
|
99
|
+
*/
|
|
100
|
+
fun setValue(value: RustBuffer.ByValue) {
|
|
101
|
+
// NOTE: The offsets are as they are in the C-like struct.
|
|
102
|
+
val pointer = getPointer()
|
|
103
|
+
pointer.setLong(0, value.capacity)
|
|
104
|
+
pointer.setLong(8, value.len)
|
|
105
|
+
pointer.setPointer(16, value.data)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get a `RustBuffer.ByValue` from this reference.
|
|
110
|
+
*/
|
|
111
|
+
fun getValue(): RustBuffer.ByValue {
|
|
112
|
+
val pointer = getPointer()
|
|
113
|
+
val value = RustBuffer.ByValue()
|
|
114
|
+
value.writeField("capacity", pointer.getLong(0))
|
|
115
|
+
value.writeField("len", pointer.getLong(8))
|
|
116
|
+
value.writeField("data", pointer.getLong(16))
|
|
117
|
+
|
|
118
|
+
return value
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// This is a helper for safely passing byte references into the rust code.
|
|
123
|
+
// It's not actually used at the moment, because there aren't many things that you
|
|
124
|
+
// can take a direct pointer to in the JVM, and if we're going to copy something
|
|
125
|
+
// then we might as well copy it into a `RustBuffer`. But it's here for API
|
|
126
|
+
// completeness.
|
|
127
|
+
|
|
128
|
+
@Structure.FieldOrder("len", "data")
|
|
129
|
+
internal open class ForeignBytes : Structure() {
|
|
130
|
+
@JvmField var len: Int = 0
|
|
131
|
+
@JvmField var data: Pointer? = null
|
|
132
|
+
|
|
133
|
+
class ByValue : ForeignBytes(), Structure.ByValue
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The FfiConverter interface handles converter types to and from the FFI
|
|
137
|
+
*
|
|
138
|
+
* All implementing objects should be public to support external types. When a
|
|
139
|
+
* type is external we need to import it's FfiConverter.
|
|
140
|
+
*
|
|
141
|
+
* @suppress
|
|
142
|
+
*/
|
|
143
|
+
public interface FfiConverter<KotlinType, FfiType> {
|
|
144
|
+
// Convert an FFI type to a Kotlin type
|
|
145
|
+
fun lift(value: FfiType): KotlinType
|
|
146
|
+
|
|
147
|
+
// Convert an Kotlin type to an FFI type
|
|
148
|
+
fun lower(value: KotlinType): FfiType
|
|
149
|
+
|
|
150
|
+
// Read a Kotlin type from a `ByteBuffer`
|
|
151
|
+
fun read(buf: ByteBuffer): KotlinType
|
|
152
|
+
|
|
153
|
+
// Calculate bytes to allocate when creating a `RustBuffer`
|
|
154
|
+
//
|
|
155
|
+
// This must return at least as many bytes as the write() function will
|
|
156
|
+
// write. It can return more bytes than needed, for example when writing
|
|
157
|
+
// Strings we can't know the exact bytes needed until we the UTF-8
|
|
158
|
+
// encoding, so we pessimistically allocate the largest size possible (3
|
|
159
|
+
// bytes per codepoint). Allocating extra bytes is not really a big deal
|
|
160
|
+
// because the `RustBuffer` is short-lived.
|
|
161
|
+
fun allocationSize(value: KotlinType): ULong
|
|
162
|
+
|
|
163
|
+
// Write a Kotlin type to a `ByteBuffer`
|
|
164
|
+
fun write(value: KotlinType, buf: ByteBuffer)
|
|
165
|
+
|
|
166
|
+
// Lower a value into a `RustBuffer`
|
|
167
|
+
//
|
|
168
|
+
// This method lowers a value into a `RustBuffer` rather than the normal
|
|
169
|
+
// FfiType. It's used by the callback interface code. Callback interface
|
|
170
|
+
// returns are always serialized into a `RustBuffer` regardless of their
|
|
171
|
+
// normal FFI type.
|
|
172
|
+
fun lowerIntoRustBuffer(value: KotlinType): RustBuffer.ByValue {
|
|
173
|
+
val rbuf = RustBuffer.alloc(allocationSize(value))
|
|
174
|
+
try {
|
|
175
|
+
val bbuf = rbuf.data!!.getByteBuffer(0, rbuf.capacity).also {
|
|
176
|
+
it.order(ByteOrder.BIG_ENDIAN)
|
|
177
|
+
}
|
|
178
|
+
write(value, bbuf)
|
|
179
|
+
rbuf.writeField("len", bbuf.position().toLong())
|
|
180
|
+
return rbuf
|
|
181
|
+
} catch (e: Throwable) {
|
|
182
|
+
RustBuffer.free(rbuf)
|
|
183
|
+
throw e
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Lift a value from a `RustBuffer`.
|
|
188
|
+
//
|
|
189
|
+
// This here mostly because of the symmetry with `lowerIntoRustBuffer()`.
|
|
190
|
+
// It's currently only used by the `FfiConverterRustBuffer` class below.
|
|
191
|
+
fun liftFromRustBuffer(rbuf: RustBuffer.ByValue): KotlinType {
|
|
192
|
+
val byteBuf = rbuf.asByteBuffer()!!
|
|
193
|
+
try {
|
|
194
|
+
val item = read(byteBuf)
|
|
195
|
+
if (byteBuf.hasRemaining()) {
|
|
196
|
+
throw RuntimeException("junk remaining in buffer after lifting, something is very wrong!!")
|
|
197
|
+
}
|
|
198
|
+
return item
|
|
199
|
+
} finally {
|
|
200
|
+
RustBuffer.free(rbuf)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* FfiConverter that uses `RustBuffer` as the FfiType
|
|
207
|
+
*
|
|
208
|
+
* @suppress
|
|
209
|
+
*/
|
|
210
|
+
public interface FfiConverterRustBuffer<KotlinType>: FfiConverter<KotlinType, RustBuffer.ByValue> {
|
|
211
|
+
override fun lift(value: RustBuffer.ByValue) = liftFromRustBuffer(value)
|
|
212
|
+
override fun lower(value: KotlinType) = lowerIntoRustBuffer(value)
|
|
213
|
+
}
|
|
214
|
+
// A handful of classes and functions to support the generated data structures.
|
|
215
|
+
// This would be a good candidate for isolating in its own ffi-support lib.
|
|
216
|
+
|
|
217
|
+
internal const val UNIFFI_CALL_SUCCESS = 0.toByte()
|
|
218
|
+
internal const val UNIFFI_CALL_ERROR = 1.toByte()
|
|
219
|
+
internal const val UNIFFI_CALL_UNEXPECTED_ERROR = 2.toByte()
|
|
220
|
+
|
|
221
|
+
@Structure.FieldOrder("code", "error_buf")
|
|
222
|
+
internal open class UniffiRustCallStatus : Structure() {
|
|
223
|
+
@JvmField var code: Byte = 0
|
|
224
|
+
@JvmField var error_buf: RustBuffer.ByValue = RustBuffer.ByValue()
|
|
225
|
+
|
|
226
|
+
class ByValue: UniffiRustCallStatus(), Structure.ByValue
|
|
227
|
+
|
|
228
|
+
fun isSuccess(): Boolean {
|
|
229
|
+
return code == UNIFFI_CALL_SUCCESS
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
fun isError(): Boolean {
|
|
233
|
+
return code == UNIFFI_CALL_ERROR
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
fun isPanic(): Boolean {
|
|
237
|
+
return code == UNIFFI_CALL_UNEXPECTED_ERROR
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
companion object {
|
|
241
|
+
fun create(code: Byte, errorBuf: RustBuffer.ByValue): UniffiRustCallStatus.ByValue {
|
|
242
|
+
val callStatus = UniffiRustCallStatus.ByValue()
|
|
243
|
+
callStatus.code = code
|
|
244
|
+
callStatus.error_buf = errorBuf
|
|
245
|
+
return callStatus
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
class InternalException(message: String) : kotlin.Exception(message)
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Each top-level error class has a companion object that can lift the error from the call status's rust buffer
|
|
254
|
+
*
|
|
255
|
+
* @suppress
|
|
256
|
+
*/
|
|
257
|
+
interface UniffiRustCallStatusErrorHandler<E> {
|
|
258
|
+
fun lift(error_buf: RustBuffer.ByValue): E;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Helpers for calling Rust
|
|
262
|
+
// In practice we usually need to be synchronized to call this safely, so it doesn't
|
|
263
|
+
// synchronize itself
|
|
264
|
+
|
|
265
|
+
// Call a rust function that returns a Result<>. Pass in the Error class companion that corresponds to the Err
|
|
266
|
+
private inline fun <U, E: kotlin.Exception> uniffiRustCallWithError(errorHandler: UniffiRustCallStatusErrorHandler<E>, callback: (UniffiRustCallStatus) -> U): U {
|
|
267
|
+
var status = UniffiRustCallStatus()
|
|
268
|
+
val return_value = callback(status)
|
|
269
|
+
uniffiCheckCallStatus(errorHandler, status)
|
|
270
|
+
return return_value
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Check UniffiRustCallStatus and throw an error if the call wasn't successful
|
|
274
|
+
private fun<E: kotlin.Exception> uniffiCheckCallStatus(errorHandler: UniffiRustCallStatusErrorHandler<E>, status: UniffiRustCallStatus) {
|
|
275
|
+
if (status.isSuccess()) {
|
|
276
|
+
return
|
|
277
|
+
} else if (status.isError()) {
|
|
278
|
+
throw errorHandler.lift(status.error_buf)
|
|
279
|
+
} else if (status.isPanic()) {
|
|
280
|
+
// when the rust code sees a panic, it tries to construct a rustbuffer
|
|
281
|
+
// with the message. but if that code panics, then it just sends back
|
|
282
|
+
// an empty buffer.
|
|
283
|
+
if (status.error_buf.len > 0) {
|
|
284
|
+
throw InternalException(FfiConverterString.lift(status.error_buf))
|
|
285
|
+
} else {
|
|
286
|
+
throw InternalException("Rust panic")
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
throw InternalException("Unknown rust call status: $status.code")
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* UniffiRustCallStatusErrorHandler implementation for times when we don't expect a CALL_ERROR
|
|
295
|
+
*
|
|
296
|
+
* @suppress
|
|
297
|
+
*/
|
|
298
|
+
object UniffiNullRustCallStatusErrorHandler: UniffiRustCallStatusErrorHandler<InternalException> {
|
|
299
|
+
override fun lift(error_buf: RustBuffer.ByValue): InternalException {
|
|
300
|
+
RustBuffer.free(error_buf)
|
|
301
|
+
return InternalException("Unexpected CALL_ERROR")
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Call a rust function that returns a plain value
|
|
306
|
+
private inline fun <U> uniffiRustCall(callback: (UniffiRustCallStatus) -> U): U {
|
|
307
|
+
return uniffiRustCallWithError(UniffiNullRustCallStatusErrorHandler, callback)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
internal inline fun<T> uniffiTraitInterfaceCall(
|
|
311
|
+
callStatus: UniffiRustCallStatus,
|
|
312
|
+
makeCall: () -> T,
|
|
313
|
+
writeReturn: (T) -> Unit,
|
|
314
|
+
) {
|
|
315
|
+
try {
|
|
316
|
+
writeReturn(makeCall())
|
|
317
|
+
} catch(e: kotlin.Exception) {
|
|
318
|
+
callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
|
|
319
|
+
callStatus.error_buf = FfiConverterString.lower(e.toString())
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
internal inline fun<T, reified E: Throwable> uniffiTraitInterfaceCallWithError(
|
|
324
|
+
callStatus: UniffiRustCallStatus,
|
|
325
|
+
makeCall: () -> T,
|
|
326
|
+
writeReturn: (T) -> Unit,
|
|
327
|
+
lowerError: (E) -> RustBuffer.ByValue
|
|
328
|
+
) {
|
|
329
|
+
try {
|
|
330
|
+
writeReturn(makeCall())
|
|
331
|
+
} catch(e: kotlin.Exception) {
|
|
332
|
+
if (e is E) {
|
|
333
|
+
callStatus.code = UNIFFI_CALL_ERROR
|
|
334
|
+
callStatus.error_buf = lowerError(e)
|
|
335
|
+
} else {
|
|
336
|
+
callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
|
|
337
|
+
callStatus.error_buf = FfiConverterString.lower(e.toString())
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// Map handles to objects
|
|
342
|
+
//
|
|
343
|
+
// This is used pass an opaque 64-bit handle representing a foreign object to the Rust code.
|
|
344
|
+
internal class UniffiHandleMap<T: Any> {
|
|
345
|
+
private val map = ConcurrentHashMap<Long, T>()
|
|
346
|
+
private val counter = java.util.concurrent.atomic.AtomicLong(0)
|
|
347
|
+
|
|
348
|
+
val size: Int
|
|
349
|
+
get() = map.size
|
|
350
|
+
|
|
351
|
+
// Insert a new object into the handle map and get a handle for it
|
|
352
|
+
fun insert(obj: T): Long {
|
|
353
|
+
val handle = counter.getAndAdd(1)
|
|
354
|
+
map.put(handle, obj)
|
|
355
|
+
return handle
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Get an object from the handle map
|
|
359
|
+
fun get(handle: Long): T {
|
|
360
|
+
return map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle")
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// Remove an entry from the handlemap and get the Kotlin object back
|
|
364
|
+
fun remove(handle: Long): T {
|
|
365
|
+
return map.remove(handle) ?: throw InternalException("UniffiHandleMap: Invalid handle")
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Contains loading, initialization code,
|
|
370
|
+
// and the FFI Function declarations in a com.sun.jna.Library.
|
|
371
|
+
@Synchronized
|
|
372
|
+
private fun findLibraryName(componentName: String): String {
|
|
373
|
+
val libOverride = System.getProperty("uniffi.component.$componentName.libraryOverride")
|
|
374
|
+
if (libOverride != null) {
|
|
375
|
+
return libOverride
|
|
376
|
+
}
|
|
377
|
+
return "uniffi_dash"
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
private inline fun <reified Lib : Library> loadIndirect(
|
|
381
|
+
componentName: String
|
|
382
|
+
): Lib {
|
|
383
|
+
return Native.load<Lib>(findLibraryName(componentName), Lib::class.java)
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Define FFI callback types
|
|
387
|
+
internal interface UniffiRustFutureContinuationCallback : com.sun.jna.Callback {
|
|
388
|
+
fun callback(`data`: Long,`pollResult`: Byte,)
|
|
389
|
+
}
|
|
390
|
+
internal interface UniffiForeignFutureFree : com.sun.jna.Callback {
|
|
391
|
+
fun callback(`handle`: Long,)
|
|
392
|
+
}
|
|
393
|
+
internal interface UniffiCallbackInterfaceFree : com.sun.jna.Callback {
|
|
394
|
+
fun callback(`handle`: Long,)
|
|
395
|
+
}
|
|
396
|
+
@Structure.FieldOrder("handle", "free")
|
|
397
|
+
internal open class UniffiForeignFuture(
|
|
398
|
+
@JvmField internal var `handle`: Long = 0.toLong(),
|
|
399
|
+
@JvmField internal var `free`: UniffiForeignFutureFree? = null,
|
|
400
|
+
) : Structure() {
|
|
401
|
+
class UniffiByValue(
|
|
402
|
+
`handle`: Long = 0.toLong(),
|
|
403
|
+
`free`: UniffiForeignFutureFree? = null,
|
|
404
|
+
): UniffiForeignFuture(`handle`,`free`,), Structure.ByValue
|
|
405
|
+
|
|
406
|
+
internal fun uniffiSetValue(other: UniffiForeignFuture) {
|
|
407
|
+
`handle` = other.`handle`
|
|
408
|
+
`free` = other.`free`
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
413
|
+
internal open class UniffiForeignFutureStructU8(
|
|
414
|
+
@JvmField internal var `returnValue`: Byte = 0.toByte(),
|
|
415
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
416
|
+
) : Structure() {
|
|
417
|
+
class UniffiByValue(
|
|
418
|
+
`returnValue`: Byte = 0.toByte(),
|
|
419
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
420
|
+
): UniffiForeignFutureStructU8(`returnValue`,`callStatus`,), Structure.ByValue
|
|
421
|
+
|
|
422
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) {
|
|
423
|
+
`returnValue` = other.`returnValue`
|
|
424
|
+
`callStatus` = other.`callStatus`
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
internal interface UniffiForeignFutureCompleteU8 : com.sun.jna.Callback {
|
|
429
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU8.UniffiByValue,)
|
|
430
|
+
}
|
|
431
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
432
|
+
internal open class UniffiForeignFutureStructI8(
|
|
433
|
+
@JvmField internal var `returnValue`: Byte = 0.toByte(),
|
|
434
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
435
|
+
) : Structure() {
|
|
436
|
+
class UniffiByValue(
|
|
437
|
+
`returnValue`: Byte = 0.toByte(),
|
|
438
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
439
|
+
): UniffiForeignFutureStructI8(`returnValue`,`callStatus`,), Structure.ByValue
|
|
440
|
+
|
|
441
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) {
|
|
442
|
+
`returnValue` = other.`returnValue`
|
|
443
|
+
`callStatus` = other.`callStatus`
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
}
|
|
447
|
+
internal interface UniffiForeignFutureCompleteI8 : com.sun.jna.Callback {
|
|
448
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI8.UniffiByValue,)
|
|
449
|
+
}
|
|
450
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
451
|
+
internal open class UniffiForeignFutureStructU16(
|
|
452
|
+
@JvmField internal var `returnValue`: Short = 0.toShort(),
|
|
453
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
454
|
+
) : Structure() {
|
|
455
|
+
class UniffiByValue(
|
|
456
|
+
`returnValue`: Short = 0.toShort(),
|
|
457
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
458
|
+
): UniffiForeignFutureStructU16(`returnValue`,`callStatus`,), Structure.ByValue
|
|
459
|
+
|
|
460
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) {
|
|
461
|
+
`returnValue` = other.`returnValue`
|
|
462
|
+
`callStatus` = other.`callStatus`
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
}
|
|
466
|
+
internal interface UniffiForeignFutureCompleteU16 : com.sun.jna.Callback {
|
|
467
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU16.UniffiByValue,)
|
|
468
|
+
}
|
|
469
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
470
|
+
internal open class UniffiForeignFutureStructI16(
|
|
471
|
+
@JvmField internal var `returnValue`: Short = 0.toShort(),
|
|
472
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
473
|
+
) : Structure() {
|
|
474
|
+
class UniffiByValue(
|
|
475
|
+
`returnValue`: Short = 0.toShort(),
|
|
476
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
477
|
+
): UniffiForeignFutureStructI16(`returnValue`,`callStatus`,), Structure.ByValue
|
|
478
|
+
|
|
479
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) {
|
|
480
|
+
`returnValue` = other.`returnValue`
|
|
481
|
+
`callStatus` = other.`callStatus`
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
}
|
|
485
|
+
internal interface UniffiForeignFutureCompleteI16 : com.sun.jna.Callback {
|
|
486
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI16.UniffiByValue,)
|
|
487
|
+
}
|
|
488
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
489
|
+
internal open class UniffiForeignFutureStructU32(
|
|
490
|
+
@JvmField internal var `returnValue`: Int = 0,
|
|
491
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
492
|
+
) : Structure() {
|
|
493
|
+
class UniffiByValue(
|
|
494
|
+
`returnValue`: Int = 0,
|
|
495
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
496
|
+
): UniffiForeignFutureStructU32(`returnValue`,`callStatus`,), Structure.ByValue
|
|
497
|
+
|
|
498
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) {
|
|
499
|
+
`returnValue` = other.`returnValue`
|
|
500
|
+
`callStatus` = other.`callStatus`
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
}
|
|
504
|
+
internal interface UniffiForeignFutureCompleteU32 : com.sun.jna.Callback {
|
|
505
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU32.UniffiByValue,)
|
|
506
|
+
}
|
|
507
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
508
|
+
internal open class UniffiForeignFutureStructI32(
|
|
509
|
+
@JvmField internal var `returnValue`: Int = 0,
|
|
510
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
511
|
+
) : Structure() {
|
|
512
|
+
class UniffiByValue(
|
|
513
|
+
`returnValue`: Int = 0,
|
|
514
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
515
|
+
): UniffiForeignFutureStructI32(`returnValue`,`callStatus`,), Structure.ByValue
|
|
516
|
+
|
|
517
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) {
|
|
518
|
+
`returnValue` = other.`returnValue`
|
|
519
|
+
`callStatus` = other.`callStatus`
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
}
|
|
523
|
+
internal interface UniffiForeignFutureCompleteI32 : com.sun.jna.Callback {
|
|
524
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI32.UniffiByValue,)
|
|
525
|
+
}
|
|
526
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
527
|
+
internal open class UniffiForeignFutureStructU64(
|
|
528
|
+
@JvmField internal var `returnValue`: Long = 0.toLong(),
|
|
529
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
530
|
+
) : Structure() {
|
|
531
|
+
class UniffiByValue(
|
|
532
|
+
`returnValue`: Long = 0.toLong(),
|
|
533
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
534
|
+
): UniffiForeignFutureStructU64(`returnValue`,`callStatus`,), Structure.ByValue
|
|
535
|
+
|
|
536
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) {
|
|
537
|
+
`returnValue` = other.`returnValue`
|
|
538
|
+
`callStatus` = other.`callStatus`
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
}
|
|
542
|
+
internal interface UniffiForeignFutureCompleteU64 : com.sun.jna.Callback {
|
|
543
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU64.UniffiByValue,)
|
|
544
|
+
}
|
|
545
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
546
|
+
internal open class UniffiForeignFutureStructI64(
|
|
547
|
+
@JvmField internal var `returnValue`: Long = 0.toLong(),
|
|
548
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
549
|
+
) : Structure() {
|
|
550
|
+
class UniffiByValue(
|
|
551
|
+
`returnValue`: Long = 0.toLong(),
|
|
552
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
553
|
+
): UniffiForeignFutureStructI64(`returnValue`,`callStatus`,), Structure.ByValue
|
|
554
|
+
|
|
555
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) {
|
|
556
|
+
`returnValue` = other.`returnValue`
|
|
557
|
+
`callStatus` = other.`callStatus`
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
}
|
|
561
|
+
internal interface UniffiForeignFutureCompleteI64 : com.sun.jna.Callback {
|
|
562
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI64.UniffiByValue,)
|
|
563
|
+
}
|
|
564
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
565
|
+
internal open class UniffiForeignFutureStructF32(
|
|
566
|
+
@JvmField internal var `returnValue`: Float = 0.0f,
|
|
567
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
568
|
+
) : Structure() {
|
|
569
|
+
class UniffiByValue(
|
|
570
|
+
`returnValue`: Float = 0.0f,
|
|
571
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
572
|
+
): UniffiForeignFutureStructF32(`returnValue`,`callStatus`,), Structure.ByValue
|
|
573
|
+
|
|
574
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) {
|
|
575
|
+
`returnValue` = other.`returnValue`
|
|
576
|
+
`callStatus` = other.`callStatus`
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
}
|
|
580
|
+
internal interface UniffiForeignFutureCompleteF32 : com.sun.jna.Callback {
|
|
581
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF32.UniffiByValue,)
|
|
582
|
+
}
|
|
583
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
584
|
+
internal open class UniffiForeignFutureStructF64(
|
|
585
|
+
@JvmField internal var `returnValue`: Double = 0.0,
|
|
586
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
587
|
+
) : Structure() {
|
|
588
|
+
class UniffiByValue(
|
|
589
|
+
`returnValue`: Double = 0.0,
|
|
590
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
591
|
+
): UniffiForeignFutureStructF64(`returnValue`,`callStatus`,), Structure.ByValue
|
|
592
|
+
|
|
593
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) {
|
|
594
|
+
`returnValue` = other.`returnValue`
|
|
595
|
+
`callStatus` = other.`callStatus`
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
}
|
|
599
|
+
internal interface UniffiForeignFutureCompleteF64 : com.sun.jna.Callback {
|
|
600
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF64.UniffiByValue,)
|
|
601
|
+
}
|
|
602
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
603
|
+
internal open class UniffiForeignFutureStructPointer(
|
|
604
|
+
@JvmField internal var `returnValue`: Pointer = Pointer.NULL,
|
|
605
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
606
|
+
) : Structure() {
|
|
607
|
+
class UniffiByValue(
|
|
608
|
+
`returnValue`: Pointer = Pointer.NULL,
|
|
609
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
610
|
+
): UniffiForeignFutureStructPointer(`returnValue`,`callStatus`,), Structure.ByValue
|
|
611
|
+
|
|
612
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) {
|
|
613
|
+
`returnValue` = other.`returnValue`
|
|
614
|
+
`callStatus` = other.`callStatus`
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
}
|
|
618
|
+
internal interface UniffiForeignFutureCompletePointer : com.sun.jna.Callback {
|
|
619
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructPointer.UniffiByValue,)
|
|
620
|
+
}
|
|
621
|
+
@Structure.FieldOrder("returnValue", "callStatus")
|
|
622
|
+
internal open class UniffiForeignFutureStructRustBuffer(
|
|
623
|
+
@JvmField internal var `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
|
|
624
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
625
|
+
) : Structure() {
|
|
626
|
+
class UniffiByValue(
|
|
627
|
+
`returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
|
|
628
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
629
|
+
): UniffiForeignFutureStructRustBuffer(`returnValue`,`callStatus`,), Structure.ByValue
|
|
630
|
+
|
|
631
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) {
|
|
632
|
+
`returnValue` = other.`returnValue`
|
|
633
|
+
`callStatus` = other.`callStatus`
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
}
|
|
637
|
+
internal interface UniffiForeignFutureCompleteRustBuffer : com.sun.jna.Callback {
|
|
638
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructRustBuffer.UniffiByValue,)
|
|
639
|
+
}
|
|
640
|
+
@Structure.FieldOrder("callStatus")
|
|
641
|
+
internal open class UniffiForeignFutureStructVoid(
|
|
642
|
+
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
643
|
+
) : Structure() {
|
|
644
|
+
class UniffiByValue(
|
|
645
|
+
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
646
|
+
): UniffiForeignFutureStructVoid(`callStatus`,), Structure.ByValue
|
|
647
|
+
|
|
648
|
+
internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) {
|
|
649
|
+
`callStatus` = other.`callStatus`
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
}
|
|
653
|
+
internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback {
|
|
654
|
+
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructVoid.UniffiByValue,)
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
// For large crates we prevent `MethodTooLargeException` (see #2340)
|
|
743
|
+
// N.B. the name of the extension is very misleading, since it is
|
|
744
|
+
// rather `InterfaceTooLargeException`, caused by too many methods
|
|
745
|
+
// in the interface for large crates.
|
|
746
|
+
//
|
|
747
|
+
// By splitting the otherwise huge interface into two parts
|
|
748
|
+
// * UniffiLib
|
|
749
|
+
// * IntegrityCheckingUniffiLib (this)
|
|
750
|
+
// we allow for ~2x as many methods in the UniffiLib interface.
|
|
751
|
+
//
|
|
752
|
+
// The `ffi_uniffi_contract_version` method and all checksum methods are put
|
|
753
|
+
// into `IntegrityCheckingUniffiLib` and these methods are called only once,
|
|
754
|
+
// when the library is loaded.
|
|
755
|
+
internal interface IntegrityCheckingUniffiLib : Library {
|
|
756
|
+
// Integrity check functions only
|
|
757
|
+
fun uniffi_dashshielded_checksum_func_create_transfer(
|
|
758
|
+
): Short
|
|
759
|
+
fun uniffi_dashshielded_checksum_func_derive_shielded_address(
|
|
760
|
+
): Short
|
|
761
|
+
fun uniffi_dashshielded_checksum_func_derive_shielded_address_from_seed(
|
|
762
|
+
): Short
|
|
763
|
+
fun uniffi_dashshielded_checksum_func_derive_viewing_key(
|
|
764
|
+
): Short
|
|
765
|
+
fun uniffi_dashshielded_checksum_func_initialize(
|
|
766
|
+
): Short
|
|
767
|
+
fun uniffi_dashshielded_checksum_func_is_prover_ready(
|
|
768
|
+
): Short
|
|
769
|
+
fun uniffi_dashshielded_checksum_func_is_valid_address(
|
|
770
|
+
): Short
|
|
771
|
+
fun uniffi_dashshielded_checksum_func_poll(
|
|
772
|
+
): Short
|
|
773
|
+
fun uniffi_dashshielded_checksum_func_propose_transfer(
|
|
774
|
+
): Short
|
|
775
|
+
fun uniffi_dashshielded_checksum_func_set_document_directory(
|
|
776
|
+
): Short
|
|
777
|
+
fun uniffi_dashshielded_checksum_func_start_sync(
|
|
778
|
+
): Short
|
|
779
|
+
fun uniffi_dashshielded_checksum_func_stop(
|
|
780
|
+
): Short
|
|
781
|
+
fun uniffi_dashshielded_checksum_func_stop_sync(
|
|
782
|
+
): Short
|
|
783
|
+
fun uniffi_dashshielded_checksum_func_warm_up_prover(
|
|
784
|
+
): Short
|
|
785
|
+
fun ffi_dashshielded_uniffi_contract_version(
|
|
786
|
+
): Int
|
|
787
|
+
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
// A JNA Library to expose the extern-C FFI definitions.
|
|
791
|
+
// This is an implementation detail which will be called internally by the public API.
|
|
792
|
+
internal interface UniffiLib : Library {
|
|
793
|
+
companion object {
|
|
794
|
+
internal val INSTANCE: UniffiLib by lazy {
|
|
795
|
+
val componentName = "dash"
|
|
796
|
+
// For large crates we prevent `MethodTooLargeException` (see #2340)
|
|
797
|
+
// N.B. the name of the extension is very misleading, since it is
|
|
798
|
+
// rather `InterfaceTooLargeException`, caused by too many methods
|
|
799
|
+
// in the interface for large crates.
|
|
800
|
+
//
|
|
801
|
+
// By splitting the otherwise huge interface into two parts
|
|
802
|
+
// * UniffiLib (this)
|
|
803
|
+
// * IntegrityCheckingUniffiLib
|
|
804
|
+
// And all checksum methods are put into `IntegrityCheckingUniffiLib`
|
|
805
|
+
// we allow for ~2x as many methods in the UniffiLib interface.
|
|
806
|
+
//
|
|
807
|
+
// Thus we first load the library with `loadIndirect` as `IntegrityCheckingUniffiLib`
|
|
808
|
+
// so that we can (optionally!) call `uniffiCheckApiChecksums`...
|
|
809
|
+
loadIndirect<IntegrityCheckingUniffiLib>(componentName)
|
|
810
|
+
.also { lib: IntegrityCheckingUniffiLib ->
|
|
811
|
+
uniffiCheckContractApiVersion(lib)
|
|
812
|
+
uniffiCheckApiChecksums(lib)
|
|
813
|
+
}
|
|
814
|
+
// ... and then we load the library as `UniffiLib`
|
|
815
|
+
// N.B. we cannot use `loadIndirect` once and then try to cast it to `UniffiLib`
|
|
816
|
+
// => results in `java.lang.ClassCastException: com.sun.proxy.$Proxy cannot be cast to ...`
|
|
817
|
+
// error. So we must call `loadIndirect` twice. For crates large enough
|
|
818
|
+
// to trigger this issue, the performance impact is negligible, running on
|
|
819
|
+
// a macOS M1 machine the `loadIndirect` call takes ~50ms.
|
|
820
|
+
val lib = loadIndirect<UniffiLib>(componentName)
|
|
821
|
+
// No need to check the contract version and checksums, since
|
|
822
|
+
// we already did that with `IntegrityCheckingUniffiLib` above.
|
|
823
|
+
// Loading of library with integrity check done.
|
|
824
|
+
lib
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// FFI functions
|
|
830
|
+
fun uniffi_dashshielded_fn_func_create_transfer(`alias`: RustBuffer.ByValue,`proposalId`: RustBuffer.ByValue,`mnemonicSeed`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
831
|
+
): RustBuffer.ByValue
|
|
832
|
+
fun uniffi_dashshielded_fn_func_derive_shielded_address(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
833
|
+
): RustBuffer.ByValue
|
|
834
|
+
fun uniffi_dashshielded_fn_func_derive_shielded_address_from_seed(`mnemonicSeed`: RustBuffer.ByValue,`network`: RustBuffer.ByValue,`account`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
835
|
+
): RustBuffer.ByValue
|
|
836
|
+
fun uniffi_dashshielded_fn_func_derive_viewing_key(`mnemonicSeed`: RustBuffer.ByValue,`network`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
837
|
+
): RustBuffer.ByValue
|
|
838
|
+
fun uniffi_dashshielded_fn_func_initialize(`mnemonicSeed`: RustBuffer.ByValue,`account`: Int,`alias`: RustBuffer.ByValue,`networkName`: RustBuffer.ByValue,`defaultHost`: RustBuffer.ByValue,`defaultPort`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
839
|
+
): Unit
|
|
840
|
+
fun uniffi_dashshielded_fn_func_is_prover_ready(uniffi_out_err: UniffiRustCallStatus,
|
|
841
|
+
): Byte
|
|
842
|
+
fun uniffi_dashshielded_fn_func_is_valid_address(`address`: RustBuffer.ByValue,`network`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
843
|
+
): Byte
|
|
844
|
+
fun uniffi_dashshielded_fn_func_poll(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
845
|
+
): RustBuffer.ByValue
|
|
846
|
+
fun uniffi_dashshielded_fn_func_propose_transfer(`alias`: RustBuffer.ByValue,`amountCredits`: RustBuffer.ByValue,`toAddress`: RustBuffer.ByValue,`memo`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
847
|
+
): RustBuffer.ByValue
|
|
848
|
+
fun uniffi_dashshielded_fn_func_set_document_directory(`path`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
849
|
+
): Unit
|
|
850
|
+
fun uniffi_dashshielded_fn_func_start_sync(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
851
|
+
): Unit
|
|
852
|
+
fun uniffi_dashshielded_fn_func_stop(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
853
|
+
): RustBuffer.ByValue
|
|
854
|
+
fun uniffi_dashshielded_fn_func_stop_sync(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
855
|
+
): Unit
|
|
856
|
+
fun uniffi_dashshielded_fn_func_warm_up_prover(uniffi_out_err: UniffiRustCallStatus,
|
|
857
|
+
): Unit
|
|
858
|
+
fun ffi_dashshielded_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
859
|
+
): RustBuffer.ByValue
|
|
860
|
+
fun ffi_dashshielded_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
861
|
+
): RustBuffer.ByValue
|
|
862
|
+
fun ffi_dashshielded_rustbuffer_free(`buf`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
863
|
+
): Unit
|
|
864
|
+
fun ffi_dashshielded_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
865
|
+
): RustBuffer.ByValue
|
|
866
|
+
fun ffi_dashshielded_rust_future_poll_u8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
867
|
+
): Unit
|
|
868
|
+
fun ffi_dashshielded_rust_future_cancel_u8(`handle`: Long,
|
|
869
|
+
): Unit
|
|
870
|
+
fun ffi_dashshielded_rust_future_free_u8(`handle`: Long,
|
|
871
|
+
): Unit
|
|
872
|
+
fun ffi_dashshielded_rust_future_complete_u8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
873
|
+
): Byte
|
|
874
|
+
fun ffi_dashshielded_rust_future_poll_i8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
875
|
+
): Unit
|
|
876
|
+
fun ffi_dashshielded_rust_future_cancel_i8(`handle`: Long,
|
|
877
|
+
): Unit
|
|
878
|
+
fun ffi_dashshielded_rust_future_free_i8(`handle`: Long,
|
|
879
|
+
): Unit
|
|
880
|
+
fun ffi_dashshielded_rust_future_complete_i8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
881
|
+
): Byte
|
|
882
|
+
fun ffi_dashshielded_rust_future_poll_u16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
883
|
+
): Unit
|
|
884
|
+
fun ffi_dashshielded_rust_future_cancel_u16(`handle`: Long,
|
|
885
|
+
): Unit
|
|
886
|
+
fun ffi_dashshielded_rust_future_free_u16(`handle`: Long,
|
|
887
|
+
): Unit
|
|
888
|
+
fun ffi_dashshielded_rust_future_complete_u16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
889
|
+
): Short
|
|
890
|
+
fun ffi_dashshielded_rust_future_poll_i16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
891
|
+
): Unit
|
|
892
|
+
fun ffi_dashshielded_rust_future_cancel_i16(`handle`: Long,
|
|
893
|
+
): Unit
|
|
894
|
+
fun ffi_dashshielded_rust_future_free_i16(`handle`: Long,
|
|
895
|
+
): Unit
|
|
896
|
+
fun ffi_dashshielded_rust_future_complete_i16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
897
|
+
): Short
|
|
898
|
+
fun ffi_dashshielded_rust_future_poll_u32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
899
|
+
): Unit
|
|
900
|
+
fun ffi_dashshielded_rust_future_cancel_u32(`handle`: Long,
|
|
901
|
+
): Unit
|
|
902
|
+
fun ffi_dashshielded_rust_future_free_u32(`handle`: Long,
|
|
903
|
+
): Unit
|
|
904
|
+
fun ffi_dashshielded_rust_future_complete_u32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
905
|
+
): Int
|
|
906
|
+
fun ffi_dashshielded_rust_future_poll_i32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
907
|
+
): Unit
|
|
908
|
+
fun ffi_dashshielded_rust_future_cancel_i32(`handle`: Long,
|
|
909
|
+
): Unit
|
|
910
|
+
fun ffi_dashshielded_rust_future_free_i32(`handle`: Long,
|
|
911
|
+
): Unit
|
|
912
|
+
fun ffi_dashshielded_rust_future_complete_i32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
913
|
+
): Int
|
|
914
|
+
fun ffi_dashshielded_rust_future_poll_u64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
915
|
+
): Unit
|
|
916
|
+
fun ffi_dashshielded_rust_future_cancel_u64(`handle`: Long,
|
|
917
|
+
): Unit
|
|
918
|
+
fun ffi_dashshielded_rust_future_free_u64(`handle`: Long,
|
|
919
|
+
): Unit
|
|
920
|
+
fun ffi_dashshielded_rust_future_complete_u64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
921
|
+
): Long
|
|
922
|
+
fun ffi_dashshielded_rust_future_poll_i64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
923
|
+
): Unit
|
|
924
|
+
fun ffi_dashshielded_rust_future_cancel_i64(`handle`: Long,
|
|
925
|
+
): Unit
|
|
926
|
+
fun ffi_dashshielded_rust_future_free_i64(`handle`: Long,
|
|
927
|
+
): Unit
|
|
928
|
+
fun ffi_dashshielded_rust_future_complete_i64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
929
|
+
): Long
|
|
930
|
+
fun ffi_dashshielded_rust_future_poll_f32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
931
|
+
): Unit
|
|
932
|
+
fun ffi_dashshielded_rust_future_cancel_f32(`handle`: Long,
|
|
933
|
+
): Unit
|
|
934
|
+
fun ffi_dashshielded_rust_future_free_f32(`handle`: Long,
|
|
935
|
+
): Unit
|
|
936
|
+
fun ffi_dashshielded_rust_future_complete_f32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
937
|
+
): Float
|
|
938
|
+
fun ffi_dashshielded_rust_future_poll_f64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
939
|
+
): Unit
|
|
940
|
+
fun ffi_dashshielded_rust_future_cancel_f64(`handle`: Long,
|
|
941
|
+
): Unit
|
|
942
|
+
fun ffi_dashshielded_rust_future_free_f64(`handle`: Long,
|
|
943
|
+
): Unit
|
|
944
|
+
fun ffi_dashshielded_rust_future_complete_f64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
945
|
+
): Double
|
|
946
|
+
fun ffi_dashshielded_rust_future_poll_pointer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
947
|
+
): Unit
|
|
948
|
+
fun ffi_dashshielded_rust_future_cancel_pointer(`handle`: Long,
|
|
949
|
+
): Unit
|
|
950
|
+
fun ffi_dashshielded_rust_future_free_pointer(`handle`: Long,
|
|
951
|
+
): Unit
|
|
952
|
+
fun ffi_dashshielded_rust_future_complete_pointer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
953
|
+
): Pointer
|
|
954
|
+
fun ffi_dashshielded_rust_future_poll_rust_buffer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
955
|
+
): Unit
|
|
956
|
+
fun ffi_dashshielded_rust_future_cancel_rust_buffer(`handle`: Long,
|
|
957
|
+
): Unit
|
|
958
|
+
fun ffi_dashshielded_rust_future_free_rust_buffer(`handle`: Long,
|
|
959
|
+
): Unit
|
|
960
|
+
fun ffi_dashshielded_rust_future_complete_rust_buffer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
961
|
+
): RustBuffer.ByValue
|
|
962
|
+
fun ffi_dashshielded_rust_future_poll_void(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
963
|
+
): Unit
|
|
964
|
+
fun ffi_dashshielded_rust_future_cancel_void(`handle`: Long,
|
|
965
|
+
): Unit
|
|
966
|
+
fun ffi_dashshielded_rust_future_free_void(`handle`: Long,
|
|
967
|
+
): Unit
|
|
968
|
+
fun ffi_dashshielded_rust_future_complete_void(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
969
|
+
): Unit
|
|
970
|
+
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
private fun uniffiCheckContractApiVersion(lib: IntegrityCheckingUniffiLib) {
|
|
974
|
+
// Get the bindings contract version from our ComponentInterface
|
|
975
|
+
val bindings_contract_version = 29
|
|
976
|
+
// Get the scaffolding contract version by calling the into the dylib
|
|
977
|
+
val scaffolding_contract_version = lib.ffi_dashshielded_uniffi_contract_version()
|
|
978
|
+
if (bindings_contract_version != scaffolding_contract_version) {
|
|
979
|
+
throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
@Suppress("UNUSED_PARAMETER")
|
|
983
|
+
private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
|
|
984
|
+
if (lib.uniffi_dashshielded_checksum_func_create_transfer() != 10651.toShort()) {
|
|
985
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
986
|
+
}
|
|
987
|
+
if (lib.uniffi_dashshielded_checksum_func_derive_shielded_address() != 17735.toShort()) {
|
|
988
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
989
|
+
}
|
|
990
|
+
if (lib.uniffi_dashshielded_checksum_func_derive_shielded_address_from_seed() != 20809.toShort()) {
|
|
991
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
992
|
+
}
|
|
993
|
+
if (lib.uniffi_dashshielded_checksum_func_derive_viewing_key() != 35588.toShort()) {
|
|
994
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
995
|
+
}
|
|
996
|
+
if (lib.uniffi_dashshielded_checksum_func_initialize() != 3174.toShort()) {
|
|
997
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
998
|
+
}
|
|
999
|
+
if (lib.uniffi_dashshielded_checksum_func_is_prover_ready() != 38748.toShort()) {
|
|
1000
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1001
|
+
}
|
|
1002
|
+
if (lib.uniffi_dashshielded_checksum_func_is_valid_address() != 228.toShort()) {
|
|
1003
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1004
|
+
}
|
|
1005
|
+
if (lib.uniffi_dashshielded_checksum_func_poll() != 4874.toShort()) {
|
|
1006
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1007
|
+
}
|
|
1008
|
+
if (lib.uniffi_dashshielded_checksum_func_propose_transfer() != 1851.toShort()) {
|
|
1009
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1010
|
+
}
|
|
1011
|
+
if (lib.uniffi_dashshielded_checksum_func_set_document_directory() != 41116.toShort()) {
|
|
1012
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1013
|
+
}
|
|
1014
|
+
if (lib.uniffi_dashshielded_checksum_func_start_sync() != 56361.toShort()) {
|
|
1015
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1016
|
+
}
|
|
1017
|
+
if (lib.uniffi_dashshielded_checksum_func_stop() != 11070.toShort()) {
|
|
1018
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1019
|
+
}
|
|
1020
|
+
if (lib.uniffi_dashshielded_checksum_func_stop_sync() != 6076.toShort()) {
|
|
1021
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1022
|
+
}
|
|
1023
|
+
if (lib.uniffi_dashshielded_checksum_func_warm_up_prover() != 10994.toShort()) {
|
|
1024
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* @suppress
|
|
1030
|
+
*/
|
|
1031
|
+
public fun uniffiEnsureInitialized() {
|
|
1032
|
+
UniffiLib.INSTANCE
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// Async support
|
|
1036
|
+
|
|
1037
|
+
// Public interface members begin here.
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
// Interface implemented by anything that can contain an object reference.
|
|
1041
|
+
//
|
|
1042
|
+
// Such types expose a `destroy()` method that must be called to cleanly
|
|
1043
|
+
// dispose of the contained objects. Failure to call this method may result
|
|
1044
|
+
// in memory leaks.
|
|
1045
|
+
//
|
|
1046
|
+
// The easiest way to ensure this method is called is to use the `.use`
|
|
1047
|
+
// helper method to execute a block and destroy the object at the end.
|
|
1048
|
+
interface Disposable {
|
|
1049
|
+
fun destroy()
|
|
1050
|
+
companion object {
|
|
1051
|
+
fun destroy(vararg args: Any?) {
|
|
1052
|
+
for (arg in args) {
|
|
1053
|
+
when (arg) {
|
|
1054
|
+
is Disposable -> arg.destroy()
|
|
1055
|
+
is ArrayList<*> -> {
|
|
1056
|
+
for (idx in arg.indices) {
|
|
1057
|
+
val element = arg[idx]
|
|
1058
|
+
if (element is Disposable) {
|
|
1059
|
+
element.destroy()
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
is Map<*, *> -> {
|
|
1064
|
+
for (element in arg.values) {
|
|
1065
|
+
if (element is Disposable) {
|
|
1066
|
+
element.destroy()
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
is Iterable<*> -> {
|
|
1071
|
+
for (element in arg) {
|
|
1072
|
+
if (element is Disposable) {
|
|
1073
|
+
element.destroy()
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* @suppress
|
|
1085
|
+
*/
|
|
1086
|
+
inline fun <T : Disposable?, R> T.use(block: (T) -> R) =
|
|
1087
|
+
try {
|
|
1088
|
+
block(this)
|
|
1089
|
+
} finally {
|
|
1090
|
+
try {
|
|
1091
|
+
// N.B. our implementation is on the nullable type `Disposable?`.
|
|
1092
|
+
this?.destroy()
|
|
1093
|
+
} catch (e: Throwable) {
|
|
1094
|
+
// swallow
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Used to instantiate an interface without an actual pointer, for fakes in tests, mostly.
|
|
1100
|
+
*
|
|
1101
|
+
* @suppress
|
|
1102
|
+
* */
|
|
1103
|
+
object NoPointer
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* @suppress
|
|
1107
|
+
*/
|
|
1108
|
+
public object FfiConverterUInt: FfiConverter<UInt, Int> {
|
|
1109
|
+
override fun lift(value: Int): UInt {
|
|
1110
|
+
return value.toUInt()
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
override fun read(buf: ByteBuffer): UInt {
|
|
1114
|
+
return lift(buf.getInt())
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
override fun lower(value: UInt): Int {
|
|
1118
|
+
return value.toInt()
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
override fun allocationSize(value: UInt) = 4UL
|
|
1122
|
+
|
|
1123
|
+
override fun write(value: UInt, buf: ByteBuffer) {
|
|
1124
|
+
buf.putInt(value.toInt())
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* @suppress
|
|
1130
|
+
*/
|
|
1131
|
+
public object FfiConverterLong: FfiConverter<Long, Long> {
|
|
1132
|
+
override fun lift(value: Long): Long {
|
|
1133
|
+
return value
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
override fun read(buf: ByteBuffer): Long {
|
|
1137
|
+
return buf.getLong()
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
override fun lower(value: Long): Long {
|
|
1141
|
+
return value
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
override fun allocationSize(value: Long) = 8UL
|
|
1145
|
+
|
|
1146
|
+
override fun write(value: Long, buf: ByteBuffer) {
|
|
1147
|
+
buf.putLong(value)
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* @suppress
|
|
1153
|
+
*/
|
|
1154
|
+
public object FfiConverterDouble: FfiConverter<Double, Double> {
|
|
1155
|
+
override fun lift(value: Double): Double {
|
|
1156
|
+
return value
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
override fun read(buf: ByteBuffer): Double {
|
|
1160
|
+
return buf.getDouble()
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
override fun lower(value: Double): Double {
|
|
1164
|
+
return value
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
override fun allocationSize(value: Double) = 8UL
|
|
1168
|
+
|
|
1169
|
+
override fun write(value: Double, buf: ByteBuffer) {
|
|
1170
|
+
buf.putDouble(value)
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* @suppress
|
|
1176
|
+
*/
|
|
1177
|
+
public object FfiConverterBoolean: FfiConverter<Boolean, Byte> {
|
|
1178
|
+
override fun lift(value: Byte): Boolean {
|
|
1179
|
+
return value.toInt() != 0
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
override fun read(buf: ByteBuffer): Boolean {
|
|
1183
|
+
return lift(buf.get())
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
override fun lower(value: Boolean): Byte {
|
|
1187
|
+
return if (value) 1.toByte() else 0.toByte()
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
override fun allocationSize(value: Boolean) = 1UL
|
|
1191
|
+
|
|
1192
|
+
override fun write(value: Boolean, buf: ByteBuffer) {
|
|
1193
|
+
buf.put(lower(value))
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* @suppress
|
|
1199
|
+
*/
|
|
1200
|
+
public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
1201
|
+
// Note: we don't inherit from FfiConverterRustBuffer, because we use a
|
|
1202
|
+
// special encoding when lowering/lifting. We can use `RustBuffer.len` to
|
|
1203
|
+
// store our length and avoid writing it out to the buffer.
|
|
1204
|
+
override fun lift(value: RustBuffer.ByValue): String {
|
|
1205
|
+
try {
|
|
1206
|
+
val byteArr = ByteArray(value.len.toInt())
|
|
1207
|
+
value.asByteBuffer()!!.get(byteArr)
|
|
1208
|
+
return byteArr.toString(Charsets.UTF_8)
|
|
1209
|
+
} finally {
|
|
1210
|
+
RustBuffer.free(value)
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
override fun read(buf: ByteBuffer): String {
|
|
1215
|
+
val len = buf.getInt()
|
|
1216
|
+
val byteArr = ByteArray(len)
|
|
1217
|
+
buf.get(byteArr)
|
|
1218
|
+
return byteArr.toString(Charsets.UTF_8)
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
fun toUtf8(value: String): ByteBuffer {
|
|
1222
|
+
// Make sure we don't have invalid UTF-16, check for lone surrogates.
|
|
1223
|
+
return Charsets.UTF_8.newEncoder().run {
|
|
1224
|
+
onMalformedInput(CodingErrorAction.REPORT)
|
|
1225
|
+
encode(CharBuffer.wrap(value))
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
override fun lower(value: String): RustBuffer.ByValue {
|
|
1230
|
+
val byteBuf = toUtf8(value)
|
|
1231
|
+
// Ideally we'd pass these bytes to `ffi_bytebuffer_from_bytes`, but doing so would require us
|
|
1232
|
+
// to copy them into a JNA `Memory`. So we might as well directly copy them into a `RustBuffer`.
|
|
1233
|
+
val rbuf = RustBuffer.alloc(byteBuf.limit().toULong())
|
|
1234
|
+
rbuf.asByteBuffer()!!.put(byteBuf)
|
|
1235
|
+
return rbuf
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// We aren't sure exactly how many bytes our string will be once it's UTF-8
|
|
1239
|
+
// encoded. Allocate 3 bytes per UTF-16 code unit which will always be
|
|
1240
|
+
// enough.
|
|
1241
|
+
override fun allocationSize(value: String): ULong {
|
|
1242
|
+
val sizeForLength = 4UL
|
|
1243
|
+
val sizeForString = value.length.toULong() * 3UL
|
|
1244
|
+
return sizeForLength + sizeForString
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
override fun write(value: String, buf: ByteBuffer) {
|
|
1248
|
+
val byteBuf = toUtf8(value)
|
|
1249
|
+
buf.putInt(byteBuf.limit())
|
|
1250
|
+
buf.put(byteBuf)
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
data class Addresses (
|
|
1257
|
+
var `shieldedAddress`: kotlin.String
|
|
1258
|
+
) {
|
|
1259
|
+
|
|
1260
|
+
companion object
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* @suppress
|
|
1265
|
+
*/
|
|
1266
|
+
public object FfiConverterTypeAddresses: FfiConverterRustBuffer<Addresses> {
|
|
1267
|
+
override fun read(buf: ByteBuffer): Addresses {
|
|
1268
|
+
return Addresses(
|
|
1269
|
+
FfiConverterString.read(buf),
|
|
1270
|
+
)
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
override fun allocationSize(value: Addresses) = (
|
|
1274
|
+
FfiConverterString.allocationSize(value.`shieldedAddress`)
|
|
1275
|
+
)
|
|
1276
|
+
|
|
1277
|
+
override fun write(value: Addresses, buf: ByteBuffer) {
|
|
1278
|
+
FfiConverterString.write(value.`shieldedAddress`, buf)
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
data class Poll (
|
|
1285
|
+
var `alias`: kotlin.String,
|
|
1286
|
+
var `status`: kotlin.String,
|
|
1287
|
+
var `scanProgress`: kotlin.Double,
|
|
1288
|
+
var `networkBlockHeight`: kotlin.UInt,
|
|
1289
|
+
var `availableCredits`: kotlin.String,
|
|
1290
|
+
var `totalCredits`: kotlin.String,
|
|
1291
|
+
var `transactions`: List<Transaction>
|
|
1292
|
+
) {
|
|
1293
|
+
|
|
1294
|
+
companion object
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* @suppress
|
|
1299
|
+
*/
|
|
1300
|
+
public object FfiConverterTypePoll: FfiConverterRustBuffer<Poll> {
|
|
1301
|
+
override fun read(buf: ByteBuffer): Poll {
|
|
1302
|
+
return Poll(
|
|
1303
|
+
FfiConverterString.read(buf),
|
|
1304
|
+
FfiConverterString.read(buf),
|
|
1305
|
+
FfiConverterDouble.read(buf),
|
|
1306
|
+
FfiConverterUInt.read(buf),
|
|
1307
|
+
FfiConverterString.read(buf),
|
|
1308
|
+
FfiConverterString.read(buf),
|
|
1309
|
+
FfiConverterSequenceTypeTransaction.read(buf),
|
|
1310
|
+
)
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
override fun allocationSize(value: Poll) = (
|
|
1314
|
+
FfiConverterString.allocationSize(value.`alias`) +
|
|
1315
|
+
FfiConverterString.allocationSize(value.`status`) +
|
|
1316
|
+
FfiConverterDouble.allocationSize(value.`scanProgress`) +
|
|
1317
|
+
FfiConverterUInt.allocationSize(value.`networkBlockHeight`) +
|
|
1318
|
+
FfiConverterString.allocationSize(value.`availableCredits`) +
|
|
1319
|
+
FfiConverterString.allocationSize(value.`totalCredits`) +
|
|
1320
|
+
FfiConverterSequenceTypeTransaction.allocationSize(value.`transactions`)
|
|
1321
|
+
)
|
|
1322
|
+
|
|
1323
|
+
override fun write(value: Poll, buf: ByteBuffer) {
|
|
1324
|
+
FfiConverterString.write(value.`alias`, buf)
|
|
1325
|
+
FfiConverterString.write(value.`status`, buf)
|
|
1326
|
+
FfiConverterDouble.write(value.`scanProgress`, buf)
|
|
1327
|
+
FfiConverterUInt.write(value.`networkBlockHeight`, buf)
|
|
1328
|
+
FfiConverterString.write(value.`availableCredits`, buf)
|
|
1329
|
+
FfiConverterString.write(value.`totalCredits`, buf)
|
|
1330
|
+
FfiConverterSequenceTypeTransaction.write(value.`transactions`, buf)
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
data class Transaction (
|
|
1337
|
+
var `txid`: kotlin.String,
|
|
1338
|
+
var `blockTimeInSeconds`: kotlin.Long,
|
|
1339
|
+
var `minedHeight`: kotlin.Long,
|
|
1340
|
+
var `value`: kotlin.String,
|
|
1341
|
+
var `fee`: kotlin.String?,
|
|
1342
|
+
var `toAddress`: kotlin.String?,
|
|
1343
|
+
var `memos`: List<kotlin.String>
|
|
1344
|
+
) {
|
|
1345
|
+
|
|
1346
|
+
companion object
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* @suppress
|
|
1351
|
+
*/
|
|
1352
|
+
public object FfiConverterTypeTransaction: FfiConverterRustBuffer<Transaction> {
|
|
1353
|
+
override fun read(buf: ByteBuffer): Transaction {
|
|
1354
|
+
return Transaction(
|
|
1355
|
+
FfiConverterString.read(buf),
|
|
1356
|
+
FfiConverterLong.read(buf),
|
|
1357
|
+
FfiConverterLong.read(buf),
|
|
1358
|
+
FfiConverterString.read(buf),
|
|
1359
|
+
FfiConverterOptionalString.read(buf),
|
|
1360
|
+
FfiConverterOptionalString.read(buf),
|
|
1361
|
+
FfiConverterSequenceString.read(buf),
|
|
1362
|
+
)
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
override fun allocationSize(value: Transaction) = (
|
|
1366
|
+
FfiConverterString.allocationSize(value.`txid`) +
|
|
1367
|
+
FfiConverterLong.allocationSize(value.`blockTimeInSeconds`) +
|
|
1368
|
+
FfiConverterLong.allocationSize(value.`minedHeight`) +
|
|
1369
|
+
FfiConverterString.allocationSize(value.`value`) +
|
|
1370
|
+
FfiConverterOptionalString.allocationSize(value.`fee`) +
|
|
1371
|
+
FfiConverterOptionalString.allocationSize(value.`toAddress`) +
|
|
1372
|
+
FfiConverterSequenceString.allocationSize(value.`memos`)
|
|
1373
|
+
)
|
|
1374
|
+
|
|
1375
|
+
override fun write(value: Transaction, buf: ByteBuffer) {
|
|
1376
|
+
FfiConverterString.write(value.`txid`, buf)
|
|
1377
|
+
FfiConverterLong.write(value.`blockTimeInSeconds`, buf)
|
|
1378
|
+
FfiConverterLong.write(value.`minedHeight`, buf)
|
|
1379
|
+
FfiConverterString.write(value.`value`, buf)
|
|
1380
|
+
FfiConverterOptionalString.write(value.`fee`, buf)
|
|
1381
|
+
FfiConverterOptionalString.write(value.`toAddress`, buf)
|
|
1382
|
+
FfiConverterSequenceString.write(value.`memos`, buf)
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
|
|
1390
|
+
sealed class DashException: kotlin.Exception() {
|
|
1391
|
+
|
|
1392
|
+
class Internal(
|
|
1393
|
+
|
|
1394
|
+
val errorMessage: kotlin.String
|
|
1395
|
+
) : DashException() {
|
|
1396
|
+
override val message
|
|
1397
|
+
get() = errorMessage
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
companion object ErrorHandler : UniffiRustCallStatusErrorHandler<DashException> {
|
|
1402
|
+
override fun lift(error_buf: RustBuffer.ByValue): DashException = FfiConverterTypeDashError.lift(error_buf)
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* @suppress
|
|
1410
|
+
*/
|
|
1411
|
+
public object FfiConverterTypeDashError : FfiConverterRustBuffer<DashException> {
|
|
1412
|
+
override fun read(buf: ByteBuffer): DashException {
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
return when(buf.getInt()) {
|
|
1416
|
+
1 -> DashException.Internal(
|
|
1417
|
+
FfiConverterString.read(buf),
|
|
1418
|
+
)
|
|
1419
|
+
else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
override fun allocationSize(value: DashException): ULong {
|
|
1424
|
+
return when(value) {
|
|
1425
|
+
is DashException.Internal -> (
|
|
1426
|
+
// Add the size for the Int that specifies the variant plus the size needed for all fields
|
|
1427
|
+
4UL
|
|
1428
|
+
+ FfiConverterString.allocationSize(value.errorMessage)
|
|
1429
|
+
)
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
override fun write(value: DashException, buf: ByteBuffer) {
|
|
1434
|
+
when(value) {
|
|
1435
|
+
is DashException.Internal -> {
|
|
1436
|
+
buf.putInt(1)
|
|
1437
|
+
FfiConverterString.write(value.errorMessage, buf)
|
|
1438
|
+
Unit
|
|
1439
|
+
}
|
|
1440
|
+
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1449
|
+
* @suppress
|
|
1450
|
+
*/
|
|
1451
|
+
public object FfiConverterOptionalString: FfiConverterRustBuffer<kotlin.String?> {
|
|
1452
|
+
override fun read(buf: ByteBuffer): kotlin.String? {
|
|
1453
|
+
if (buf.get().toInt() == 0) {
|
|
1454
|
+
return null
|
|
1455
|
+
}
|
|
1456
|
+
return FfiConverterString.read(buf)
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
override fun allocationSize(value: kotlin.String?): ULong {
|
|
1460
|
+
if (value == null) {
|
|
1461
|
+
return 1UL
|
|
1462
|
+
} else {
|
|
1463
|
+
return 1UL + FfiConverterString.allocationSize(value)
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
override fun write(value: kotlin.String?, buf: ByteBuffer) {
|
|
1468
|
+
if (value == null) {
|
|
1469
|
+
buf.put(0)
|
|
1470
|
+
} else {
|
|
1471
|
+
buf.put(1)
|
|
1472
|
+
FfiConverterString.write(value, buf)
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
/**
|
|
1481
|
+
* @suppress
|
|
1482
|
+
*/
|
|
1483
|
+
public object FfiConverterSequenceString: FfiConverterRustBuffer<List<kotlin.String>> {
|
|
1484
|
+
override fun read(buf: ByteBuffer): List<kotlin.String> {
|
|
1485
|
+
val len = buf.getInt()
|
|
1486
|
+
return List<kotlin.String>(len) {
|
|
1487
|
+
FfiConverterString.read(buf)
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
override fun allocationSize(value: List<kotlin.String>): ULong {
|
|
1492
|
+
val sizeForLength = 4UL
|
|
1493
|
+
val sizeForItems = value.map { FfiConverterString.allocationSize(it) }.sum()
|
|
1494
|
+
return sizeForLength + sizeForItems
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
override fun write(value: List<kotlin.String>, buf: ByteBuffer) {
|
|
1498
|
+
buf.putInt(value.size)
|
|
1499
|
+
value.iterator().forEach {
|
|
1500
|
+
FfiConverterString.write(it, buf)
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
/**
|
|
1509
|
+
* @suppress
|
|
1510
|
+
*/
|
|
1511
|
+
public object FfiConverterSequenceTypeTransaction: FfiConverterRustBuffer<List<Transaction>> {
|
|
1512
|
+
override fun read(buf: ByteBuffer): List<Transaction> {
|
|
1513
|
+
val len = buf.getInt()
|
|
1514
|
+
return List<Transaction>(len) {
|
|
1515
|
+
FfiConverterTypeTransaction.read(buf)
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
override fun allocationSize(value: List<Transaction>): ULong {
|
|
1520
|
+
val sizeForLength = 4UL
|
|
1521
|
+
val sizeForItems = value.map { FfiConverterTypeTransaction.allocationSize(it) }.sum()
|
|
1522
|
+
return sizeForLength + sizeForItems
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
override fun write(value: List<Transaction>, buf: ByteBuffer) {
|
|
1526
|
+
buf.putInt(value.size)
|
|
1527
|
+
value.iterator().forEach {
|
|
1528
|
+
FfiConverterTypeTransaction.write(it, buf)
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
@Throws(DashException::class) fun `createTransfer`(`alias`: kotlin.String, `proposalId`: kotlin.String, `mnemonicSeed`: kotlin.String): kotlin.String {
|
|
1533
|
+
return FfiConverterString.lift(
|
|
1534
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1535
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_create_transfer(
|
|
1536
|
+
FfiConverterString.lower(`alias`),FfiConverterString.lower(`proposalId`),FfiConverterString.lower(`mnemonicSeed`),_status)
|
|
1537
|
+
}
|
|
1538
|
+
)
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
|
|
1542
|
+
@Throws(DashException::class) fun `deriveShieldedAddress`(`alias`: kotlin.String): Addresses {
|
|
1543
|
+
return FfiConverterTypeAddresses.lift(
|
|
1544
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1545
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_derive_shielded_address(
|
|
1546
|
+
FfiConverterString.lower(`alias`),_status)
|
|
1547
|
+
}
|
|
1548
|
+
)
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
@Throws(DashException::class) fun `deriveShieldedAddressFromSeed`(`mnemonicSeed`: kotlin.String, `network`: kotlin.String, `account`: kotlin.UInt): kotlin.String {
|
|
1553
|
+
return FfiConverterString.lift(
|
|
1554
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1555
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_derive_shielded_address_from_seed(
|
|
1556
|
+
FfiConverterString.lower(`mnemonicSeed`),FfiConverterString.lower(`network`),FfiConverterUInt.lower(`account`),_status)
|
|
1557
|
+
}
|
|
1558
|
+
)
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
|
|
1562
|
+
@Throws(DashException::class) fun `deriveViewingKey`(`mnemonicSeed`: kotlin.String, `network`: kotlin.String): kotlin.String {
|
|
1563
|
+
return FfiConverterString.lift(
|
|
1564
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1565
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_derive_viewing_key(
|
|
1566
|
+
FfiConverterString.lower(`mnemonicSeed`),FfiConverterString.lower(`network`),_status)
|
|
1567
|
+
}
|
|
1568
|
+
)
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
@Throws(DashException::class) fun `initialize`(`mnemonicSeed`: kotlin.String, `account`: kotlin.UInt, `alias`: kotlin.String, `networkName`: kotlin.String, `defaultHost`: kotlin.String, `defaultPort`: kotlin.UInt)
|
|
1573
|
+
=
|
|
1574
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1575
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_initialize(
|
|
1576
|
+
FfiConverterString.lower(`mnemonicSeed`),FfiConverterUInt.lower(`account`),FfiConverterString.lower(`alias`),FfiConverterString.lower(`networkName`),FfiConverterString.lower(`defaultHost`),FfiConverterUInt.lower(`defaultPort`),_status)
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
fun `isProverReady`(): kotlin.Boolean {
|
|
1581
|
+
return FfiConverterBoolean.lift(
|
|
1582
|
+
uniffiRustCall() { _status ->
|
|
1583
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_is_prover_ready(
|
|
1584
|
+
_status)
|
|
1585
|
+
}
|
|
1586
|
+
)
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
fun `isValidAddress`(`address`: kotlin.String, `network`: kotlin.String): kotlin.Boolean {
|
|
1590
|
+
return FfiConverterBoolean.lift(
|
|
1591
|
+
uniffiRustCall() { _status ->
|
|
1592
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_is_valid_address(
|
|
1593
|
+
FfiConverterString.lower(`address`),FfiConverterString.lower(`network`),_status)
|
|
1594
|
+
}
|
|
1595
|
+
)
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
|
|
1599
|
+
@Throws(DashException::class) fun `poll`(`alias`: kotlin.String): Poll {
|
|
1600
|
+
return FfiConverterTypePoll.lift(
|
|
1601
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1602
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_poll(
|
|
1603
|
+
FfiConverterString.lower(`alias`),_status)
|
|
1604
|
+
}
|
|
1605
|
+
)
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
@Throws(DashException::class) fun `proposeTransfer`(`alias`: kotlin.String, `amountCredits`: kotlin.String, `toAddress`: kotlin.String, `memo`: kotlin.String?): kotlin.String {
|
|
1610
|
+
return FfiConverterString.lift(
|
|
1611
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1612
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_propose_transfer(
|
|
1613
|
+
FfiConverterString.lower(`alias`),FfiConverterString.lower(`amountCredits`),FfiConverterString.lower(`toAddress`),FfiConverterOptionalString.lower(`memo`),_status)
|
|
1614
|
+
}
|
|
1615
|
+
)
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
@Throws(DashException::class) fun `setDocumentDirectory`(`path`: kotlin.String)
|
|
1620
|
+
=
|
|
1621
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1622
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_set_document_directory(
|
|
1623
|
+
FfiConverterString.lower(`path`),_status)
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
@Throws(DashException::class) fun `startSync`(`alias`: kotlin.String)
|
|
1629
|
+
=
|
|
1630
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1631
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_start_sync(
|
|
1632
|
+
FfiConverterString.lower(`alias`),_status)
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
@Throws(DashException::class) fun `stop`(`alias`: kotlin.String): kotlin.String {
|
|
1638
|
+
return FfiConverterString.lift(
|
|
1639
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1640
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_stop(
|
|
1641
|
+
FfiConverterString.lower(`alias`),_status)
|
|
1642
|
+
}
|
|
1643
|
+
)
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
@Throws(DashException::class) fun `stopSync`(`alias`: kotlin.String)
|
|
1648
|
+
=
|
|
1649
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1650
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_stop_sync(
|
|
1651
|
+
FfiConverterString.lower(`alias`),_status)
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
@Throws(DashException::class) fun `warmUpProver`()
|
|
1657
|
+
=
|
|
1658
|
+
uniffiRustCallWithError(DashException) { _status ->
|
|
1659
|
+
UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_warm_up_prover(
|
|
1660
|
+
_status)
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
|