@buildonspark/spark-sdk 0.3.8 → 0.4.0

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/uniffi/uniffi/spark_frost/spark_frost.kt +1361 -1367
  4. package/android/src/main/jniLibs/arm64-v8a/libuniffi_spark_frost.so +0 -0
  5. package/android/src/main/jniLibs/armeabi-v7a/libuniffi_spark_frost.so +0 -0
  6. package/android/src/main/jniLibs/x86/libuniffi_spark_frost.so +0 -0
  7. package/android/src/main/jniLibs/x86_64/libuniffi_spark_frost.so +0 -0
  8. package/dist/bare/index.cjs +1342 -1346
  9. package/dist/bare/index.d.cts +114 -68
  10. package/dist/bare/index.d.ts +114 -68
  11. package/dist/bare/index.js +1266 -1279
  12. package/dist/{chunk-FXIESWE6.js → chunk-27ILUWDJ.js} +1 -1
  13. package/dist/{chunk-5ASXVNTM.js → chunk-4YFT7DAE.js} +1 -1
  14. package/dist/{chunk-FP2CRVQH.js → chunk-G3LHXHF3.js} +1045 -1308
  15. package/dist/{chunk-XI6FCNYG.js → chunk-JLF6WJ7K.js} +1 -1
  16. package/dist/{chunk-3LPEQGVJ.js → chunk-LOXWCMZL.js} +1 -1
  17. package/dist/{chunk-5HU5W56H.js → chunk-WICAF6BS.js} +2 -2
  18. package/dist/{chunk-VFN34EOX.js → chunk-YEBEN7XD.js} +258 -0
  19. package/dist/{client-pNpGP15j.d.cts → client-BIqiUNy4.d.cts} +1 -1
  20. package/dist/{client-By-N7oJS.d.ts → client-BaQf-5gD.d.ts} +1 -1
  21. package/dist/debug.cjs +1330 -1336
  22. package/dist/debug.d.cts +20 -16
  23. package/dist/debug.d.ts +20 -16
  24. package/dist/debug.js +5 -5
  25. package/dist/graphql/objects/index.d.cts +3 -3
  26. package/dist/graphql/objects/index.d.ts +3 -3
  27. package/dist/index.cjs +1363 -1365
  28. package/dist/index.d.cts +7 -7
  29. package/dist/index.d.ts +7 -7
  30. package/dist/index.js +32 -24
  31. package/dist/index.node.cjs +1363 -1365
  32. package/dist/index.node.d.cts +7 -7
  33. package/dist/index.node.d.ts +7 -7
  34. package/dist/index.node.js +31 -23
  35. package/dist/{logging-DMFVY384.d.ts → logging-BNGm6dBp.d.ts} +42 -37
  36. package/dist/{logging-DxLp34Xm.d.cts → logging-D3IfXfHG.d.cts} +42 -37
  37. package/dist/native/index.react-native.cjs +1505 -1366
  38. package/dist/native/index.react-native.d.cts +112 -58
  39. package/dist/native/index.react-native.d.ts +112 -58
  40. package/dist/native/index.react-native.js +1415 -1289
  41. package/dist/proto/spark.cjs +258 -0
  42. package/dist/proto/spark.d.cts +1 -1
  43. package/dist/proto/spark.d.ts +1 -1
  44. package/dist/proto/spark.js +5 -1
  45. package/dist/proto/spark_token.d.cts +1 -1
  46. package/dist/proto/spark_token.d.ts +1 -1
  47. package/dist/proto/spark_token.js +2 -2
  48. package/dist/{spark-By6yHsrk.d.cts → spark-DOpheE8_.d.cts} +39 -2
  49. package/dist/{spark-By6yHsrk.d.ts → spark-DOpheE8_.d.ts} +39 -2
  50. package/dist/{spark-wallet.browser-C1dQknVj.d.ts → spark-wallet.browser-B2rGwjuM.d.ts} +2 -2
  51. package/dist/{spark-wallet.browser-CNMo3IvO.d.cts → spark-wallet.browser-Ck9No4Ks.d.cts} +2 -2
  52. package/dist/{spark-wallet.node-Og6__NMh.d.ts → spark-wallet.node-BqmKsGPs.d.ts} +2 -2
  53. package/dist/{spark-wallet.node-BZJhJZKq.d.cts → spark-wallet.node-C2TIkyt4.d.cts} +2 -2
  54. package/dist/tests/test-utils.cjs +1304 -1236
  55. package/dist/tests/test-utils.d.cts +18 -4
  56. package/dist/tests/test-utils.d.ts +18 -4
  57. package/dist/tests/test-utils.js +7 -7
  58. package/dist/{token-transactions-CLR3rnYi.d.cts → token-transactions-Db8mkjnU.d.cts} +2 -2
  59. package/dist/{token-transactions-C7yefB2S.d.ts → token-transactions-DoMcrxXQ.d.ts} +2 -2
  60. package/dist/types/index.cjs +256 -0
  61. package/dist/types/index.d.cts +2 -2
  62. package/dist/types/index.d.ts +2 -2
  63. package/dist/types/index.js +2 -2
  64. package/dist/{wallet-config-BoyMVa6n.d.ts → wallet-config-Bg3kWltL.d.ts} +42 -35
  65. package/dist/{wallet-config-xom-9UFF.d.cts → wallet-config-CuZKNo9S.d.cts} +42 -35
  66. package/ios/spark_frostFFI.xcframework/ios-arm64/SparkFrost +0 -0
  67. package/ios/spark_frostFFI.xcframework/ios-arm64/spark_frostFFI.framework/spark_frostFFI +0 -0
  68. package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/SparkFrost +0 -0
  69. package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/spark_frostFFI.framework/spark_frostFFI +0 -0
  70. package/ios/spark_frostFFI.xcframework/macos-arm64_x86_64/spark_frostFFI.framework/spark_frostFFI +0 -0
  71. package/package.json +1 -1
  72. package/src/index.react-native.ts +8 -2
  73. package/src/proto/spark.ts +348 -4
  74. package/src/services/config.ts +5 -0
  75. package/src/services/coop-exit.ts +26 -107
  76. package/src/services/deposit.ts +12 -48
  77. package/src/services/signing.ts +62 -49
  78. package/src/services/transfer.ts +437 -722
  79. package/src/services/wallet-config.ts +10 -0
  80. package/src/services/xhr-transport.ts +13 -3
  81. package/src/signer/signer.react-native.ts +73 -1
  82. package/src/spark-wallet/proto-descriptors.ts +1 -1
  83. package/src/spark-wallet/spark-wallet.ts +162 -315
  84. package/src/spark-wallet/types.ts +2 -2
  85. package/src/spark_descriptors.pb +0 -0
  86. package/src/tests/integration/lightning.test.ts +1 -27
  87. package/src/tests/integration/static_deposit.test.ts +6 -9
  88. package/src/tests/integration/unilateral-exit.test.ts +117 -0
  89. package/src/tests/optimize.test.ts +31 -1
  90. package/src/tests/utils/signing.ts +33 -0
  91. package/src/tests/utils/test-faucet.ts +61 -0
  92. package/src/utils/optimize.ts +42 -0
  93. package/src/utils/transaction.ts +250 -249
  94. package/src/utils/unilateral-exit.ts +1 -40
@@ -39,62 +39,62 @@ import java.util.concurrent.atomic.AtomicLong
39
39
  */
40
40
  @Structure.FieldOrder("capacity", "len", "data")
41
41
  open class RustBuffer : Structure() {
42
- // Note: `capacity` and `len` are actually `ULong` values, but JVM only supports signed values.
43
- // When dealing with these fields, make sure to call `toULong()`.
44
- @JvmField var capacity: Long = 0
45
-
46
- @JvmField var len: Long = 0
47
-
48
- @JvmField var data: Pointer? = null
49
-
50
- class ByValue :
51
- RustBuffer(),
52
- Structure.ByValue
53
-
54
- class ByReference :
55
- RustBuffer(),
56
- Structure.ByReference
42
+ // Note: `capacity` and `len` are actually `ULong` values, but JVM only supports signed values.
43
+ // When dealing with these fields, make sure to call `toULong()`.
44
+ @JvmField var capacity: Long = 0
45
+
46
+ @JvmField var len: Long = 0
47
+
48
+ @JvmField var data: Pointer? = null
49
+
50
+ class ByValue :
51
+ RustBuffer(),
52
+ Structure.ByValue
53
+
54
+ class ByReference :
55
+ RustBuffer(),
56
+ Structure.ByReference
57
+
58
+ internal fun setValue(other: RustBuffer) {
59
+ capacity = other.capacity
60
+ len = other.len
61
+ data = other.data
62
+ }
63
+
64
+ companion object {
65
+ internal fun alloc(size: ULong = 0UL) =
66
+ uniffiRustCall { status ->
67
+ // Note: need to convert the size to a `Long` value to make this work with JVM.
68
+ UniffiLib.INSTANCE.ffi_spark_frost_rustbuffer_alloc(size.toLong(), status)
69
+ }.also {
70
+ if (it.data == null) {
71
+ throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=$size)")
72
+ }
73
+ }
57
74
 
58
- internal fun setValue(other: RustBuffer) {
59
- capacity = other.capacity
60
- len = other.len
61
- data = other.data
75
+ internal fun create(
76
+ capacity: ULong,
77
+ len: ULong,
78
+ data: Pointer?,
79
+ ): RustBuffer.ByValue {
80
+ var buf = RustBuffer.ByValue()
81
+ buf.capacity = capacity.toLong()
82
+ buf.len = len.toLong()
83
+ buf.data = data
84
+ return buf
62
85
  }
63
86
 
64
- companion object {
65
- internal fun alloc(size: ULong = 0UL) =
66
- uniffiRustCall { status ->
67
- // Note: need to convert the size to a `Long` value to make this work with JVM.
68
- UniffiLib.INSTANCE.ffi_spark_frost_rustbuffer_alloc(size.toLong(), status)
69
- }.also {
70
- if (it.data == null) {
71
- throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=$size)")
72
- }
73
- }
74
-
75
- internal fun create(
76
- capacity: ULong,
77
- len: ULong,
78
- data: Pointer?,
79
- ): RustBuffer.ByValue {
80
- var buf = RustBuffer.ByValue()
81
- buf.capacity = capacity.toLong()
82
- buf.len = len.toLong()
83
- buf.data = data
84
- return buf
85
- }
87
+ internal fun free(buf: RustBuffer.ByValue) =
88
+ uniffiRustCall { status ->
89
+ UniffiLib.INSTANCE.ffi_spark_frost_rustbuffer_free(buf, status)
90
+ }
91
+ }
86
92
 
87
- internal fun free(buf: RustBuffer.ByValue) =
88
- uniffiRustCall { status ->
89
- UniffiLib.INSTANCE.ffi_spark_frost_rustbuffer_free(buf, status)
90
- }
93
+ @Suppress("TooGenericExceptionThrown")
94
+ fun asByteBuffer() =
95
+ this.data?.getByteBuffer(0, this.len.toLong())?.also {
96
+ it.order(ByteOrder.BIG_ENDIAN)
91
97
  }
92
-
93
- @Suppress("TooGenericExceptionThrown")
94
- fun asByteBuffer() =
95
- this.data?.getByteBuffer(0, this.len.toLong())?.also {
96
- it.order(ByteOrder.BIG_ENDIAN)
97
- }
98
98
  }
99
99
 
100
100
  /**
@@ -106,29 +106,29 @@ open class RustBuffer : Structure() {
106
106
  * @suppress
107
107
  */
108
108
  class RustBufferByReference : ByReference(16) {
109
- /**
110
- * Set the pointed-to `RustBuffer` to the given value.
111
- */
112
- fun setValue(value: RustBuffer.ByValue) {
113
- // NOTE: The offsets are as they are in the C-like struct.
114
- val pointer = getPointer()
115
- pointer.setLong(0, value.capacity)
116
- pointer.setLong(8, value.len)
117
- pointer.setPointer(16, value.data)
118
- }
119
-
120
- /**
121
- * Get a `RustBuffer.ByValue` from this reference.
122
- */
123
- fun getValue(): RustBuffer.ByValue {
124
- val pointer = getPointer()
125
- val value = RustBuffer.ByValue()
126
- value.writeField("capacity", pointer.getLong(0))
127
- value.writeField("len", pointer.getLong(8))
128
- value.writeField("data", pointer.getLong(16))
129
-
130
- return value
131
- }
109
+ /**
110
+ * Set the pointed-to `RustBuffer` to the given value.
111
+ */
112
+ fun setValue(value: RustBuffer.ByValue) {
113
+ // NOTE: The offsets are as they are in the C-like struct.
114
+ val pointer = getPointer()
115
+ pointer.setLong(0, value.capacity)
116
+ pointer.setLong(8, value.len)
117
+ pointer.setPointer(16, value.data)
118
+ }
119
+
120
+ /**
121
+ * Get a `RustBuffer.ByValue` from this reference.
122
+ */
123
+ fun getValue(): RustBuffer.ByValue {
124
+ val pointer = getPointer()
125
+ val value = RustBuffer.ByValue()
126
+ value.writeField("capacity", pointer.getLong(0))
127
+ value.writeField("len", pointer.getLong(8))
128
+ value.writeField("data", pointer.getLong(16))
129
+
130
+ return value
131
+ }
132
132
  }
133
133
 
134
134
  // This is a helper for safely passing byte references into the rust code.
@@ -139,13 +139,13 @@ class RustBufferByReference : ByReference(16) {
139
139
 
140
140
  @Structure.FieldOrder("len", "data")
141
141
  internal open class ForeignBytes : Structure() {
142
- @JvmField var len: Int = 0
142
+ @JvmField var len: Int = 0
143
143
 
144
- @JvmField var data: Pointer? = null
144
+ @JvmField var data: Pointer? = null
145
145
 
146
- class ByValue :
147
- ForeignBytes(),
148
- Structure.ByValue
146
+ class ByValue :
147
+ ForeignBytes(),
148
+ Structure.ByValue
149
149
  }
150
150
 
151
151
  /**
@@ -157,69 +157,69 @@ internal open class ForeignBytes : Structure() {
157
157
  * @suppress
158
158
  */
159
159
  public interface FfiConverter<KotlinType, FfiType> {
160
- // Convert an FFI type to a Kotlin type
161
- fun lift(value: FfiType): KotlinType
162
-
163
- // Convert an Kotlin type to an FFI type
164
- fun lower(value: KotlinType): FfiType
165
-
166
- // Read a Kotlin type from a `ByteBuffer`
167
- fun read(buf: ByteBuffer): KotlinType
168
-
169
- // Calculate bytes to allocate when creating a `RustBuffer`
170
- //
171
- // This must return at least as many bytes as the write() function will
172
- // write. It can return more bytes than needed, for example when writing
173
- // Strings we can't know the exact bytes needed until we the UTF-8
174
- // encoding, so we pessimistically allocate the largest size possible (3
175
- // bytes per codepoint). Allocating extra bytes is not really a big deal
176
- // because the `RustBuffer` is short-lived.
177
- fun allocationSize(value: KotlinType): ULong
178
-
179
- // Write a Kotlin type to a `ByteBuffer`
180
- fun write(
181
- value: KotlinType,
182
- buf: ByteBuffer,
183
- )
184
-
185
- // Lower a value into a `RustBuffer`
186
- //
187
- // This method lowers a value into a `RustBuffer` rather than the normal
188
- // FfiType. It's used by the callback interface code. Callback interface
189
- // returns are always serialized into a `RustBuffer` regardless of their
190
- // normal FFI type.
191
- fun lowerIntoRustBuffer(value: KotlinType): RustBuffer.ByValue {
192
- val rbuf = RustBuffer.alloc(allocationSize(value))
193
- try {
194
- val bbuf =
195
- rbuf.data!!.getByteBuffer(0, rbuf.capacity).also {
196
- it.order(ByteOrder.BIG_ENDIAN)
197
- }
198
- write(value, bbuf)
199
- rbuf.writeField("len", bbuf.position().toLong())
200
- return rbuf
201
- } catch (e: Throwable) {
202
- RustBuffer.free(rbuf)
203
- throw e
204
- }
205
- }
206
-
207
- // Lift a value from a `RustBuffer`.
208
- //
209
- // This here mostly because of the symmetry with `lowerIntoRustBuffer()`.
210
- // It's currently only used by the `FfiConverterRustBuffer` class below.
211
- fun liftFromRustBuffer(rbuf: RustBuffer.ByValue): KotlinType {
212
- val byteBuf = rbuf.asByteBuffer()!!
213
- try {
214
- val item = read(byteBuf)
215
- if (byteBuf.hasRemaining()) {
216
- throw RuntimeException("junk remaining in buffer after lifting, something is very wrong!!")
217
- }
218
- return item
219
- } finally {
220
- RustBuffer.free(rbuf)
160
+ // Convert an FFI type to a Kotlin type
161
+ fun lift(value: FfiType): KotlinType
162
+
163
+ // Convert an Kotlin type to an FFI type
164
+ fun lower(value: KotlinType): FfiType
165
+
166
+ // Read a Kotlin type from a `ByteBuffer`
167
+ fun read(buf: ByteBuffer): KotlinType
168
+
169
+ // Calculate bytes to allocate when creating a `RustBuffer`
170
+ //
171
+ // This must return at least as many bytes as the write() function will
172
+ // write. It can return more bytes than needed, for example when writing
173
+ // Strings we can't know the exact bytes needed until we the UTF-8
174
+ // encoding, so we pessimistically allocate the largest size possible (3
175
+ // bytes per codepoint). Allocating extra bytes is not really a big deal
176
+ // because the `RustBuffer` is short-lived.
177
+ fun allocationSize(value: KotlinType): ULong
178
+
179
+ // Write a Kotlin type to a `ByteBuffer`
180
+ fun write(
181
+ value: KotlinType,
182
+ buf: ByteBuffer,
183
+ )
184
+
185
+ // Lower a value into a `RustBuffer`
186
+ //
187
+ // This method lowers a value into a `RustBuffer` rather than the normal
188
+ // FfiType. It's used by the callback interface code. Callback interface
189
+ // returns are always serialized into a `RustBuffer` regardless of their
190
+ // normal FFI type.
191
+ fun lowerIntoRustBuffer(value: KotlinType): RustBuffer.ByValue {
192
+ val rbuf = RustBuffer.alloc(allocationSize(value))
193
+ try {
194
+ val bbuf =
195
+ rbuf.data!!.getByteBuffer(0, rbuf.capacity).also {
196
+ it.order(ByteOrder.BIG_ENDIAN)
221
197
  }
198
+ write(value, bbuf)
199
+ rbuf.writeField("len", bbuf.position().toLong())
200
+ return rbuf
201
+ } catch (e: Throwable) {
202
+ RustBuffer.free(rbuf)
203
+ throw e
204
+ }
205
+ }
206
+
207
+ // Lift a value from a `RustBuffer`.
208
+ //
209
+ // This here mostly because of the symmetry with `lowerIntoRustBuffer()`.
210
+ // It's currently only used by the `FfiConverterRustBuffer` class below.
211
+ fun liftFromRustBuffer(rbuf: RustBuffer.ByValue): KotlinType {
212
+ val byteBuf = rbuf.asByteBuffer()!!
213
+ try {
214
+ val item = read(byteBuf)
215
+ if (byteBuf.hasRemaining()) {
216
+ throw RuntimeException("junk remaining in buffer after lifting, something is very wrong!!")
217
+ }
218
+ return item
219
+ } finally {
220
+ RustBuffer.free(rbuf)
222
221
  }
222
+ }
223
223
  }
224
224
 
225
225
  /**
@@ -228,9 +228,9 @@ public interface FfiConverter<KotlinType, FfiType> {
228
228
  * @suppress
229
229
  */
230
230
  public interface FfiConverterRustBuffer<KotlinType> : FfiConverter<KotlinType, RustBuffer.ByValue> {
231
- override fun lift(value: RustBuffer.ByValue) = liftFromRustBuffer(value)
231
+ override fun lift(value: RustBuffer.ByValue) = liftFromRustBuffer(value)
232
232
 
233
- override fun lower(value: KotlinType) = lowerIntoRustBuffer(value)
233
+ override fun lower(value: KotlinType) = lowerIntoRustBuffer(value)
234
234
  }
235
235
  // A handful of classes and functions to support the generated data structures.
236
236
  // This would be a good candidate for isolating in its own ffi-support lib.
@@ -241,35 +241,35 @@ internal const val UNIFFI_CALL_UNEXPECTED_ERROR = 2.toByte()
241
241
 
242
242
  @Structure.FieldOrder("code", "error_buf")
243
243
  internal open class UniffiRustCallStatus : Structure() {
244
- @JvmField var code: Byte = 0
244
+ @JvmField var code: Byte = 0
245
245
 
246
- @JvmField var error_buf: RustBuffer.ByValue = RustBuffer.ByValue()
246
+ @JvmField var error_buf: RustBuffer.ByValue = RustBuffer.ByValue()
247
247
 
248
- class ByValue :
249
- UniffiRustCallStatus(),
250
- Structure.ByValue
248
+ class ByValue :
249
+ UniffiRustCallStatus(),
250
+ Structure.ByValue
251
251
 
252
- fun isSuccess(): Boolean = code == UNIFFI_CALL_SUCCESS
252
+ fun isSuccess(): Boolean = code == UNIFFI_CALL_SUCCESS
253
253
 
254
- fun isError(): Boolean = code == UNIFFI_CALL_ERROR
254
+ fun isError(): Boolean = code == UNIFFI_CALL_ERROR
255
255
 
256
- fun isPanic(): Boolean = code == UNIFFI_CALL_UNEXPECTED_ERROR
256
+ fun isPanic(): Boolean = code == UNIFFI_CALL_UNEXPECTED_ERROR
257
257
 
258
- companion object {
259
- fun create(
260
- code: Byte,
261
- errorBuf: RustBuffer.ByValue,
262
- ): UniffiRustCallStatus.ByValue {
263
- val callStatus = UniffiRustCallStatus.ByValue()
264
- callStatus.code = code
265
- callStatus.error_buf = errorBuf
266
- return callStatus
267
- }
258
+ companion object {
259
+ fun create(
260
+ code: Byte,
261
+ errorBuf: RustBuffer.ByValue,
262
+ ): UniffiRustCallStatus.ByValue {
263
+ val callStatus = UniffiRustCallStatus.ByValue()
264
+ callStatus.code = code
265
+ callStatus.error_buf = errorBuf
266
+ return callStatus
268
267
  }
268
+ }
269
269
  }
270
270
 
271
271
  class InternalException(
272
- message: String,
272
+ message: String,
273
273
  ) : kotlin.Exception(message)
274
274
 
275
275
  /**
@@ -278,7 +278,7 @@ class InternalException(
278
278
  * @suppress
279
279
  */
280
280
  interface UniffiRustCallStatusErrorHandler<E> {
281
- fun lift(error_buf: RustBuffer.ByValue): E
281
+ fun lift(error_buf: RustBuffer.ByValue): E
282
282
  }
283
283
 
284
284
  // Helpers for calling Rust
@@ -287,36 +287,36 @@ interface UniffiRustCallStatusErrorHandler<E> {
287
287
 
288
288
  // Call a rust function that returns a Result<>. Pass in the Error class companion that corresponds to the Err
289
289
  private inline fun <U, E : kotlin.Exception> uniffiRustCallWithError(
290
- errorHandler: UniffiRustCallStatusErrorHandler<E>,
291
- callback: (UniffiRustCallStatus) -> U,
290
+ errorHandler: UniffiRustCallStatusErrorHandler<E>,
291
+ callback: (UniffiRustCallStatus) -> U,
292
292
  ): U {
293
- var status = UniffiRustCallStatus()
294
- val return_value = callback(status)
295
- uniffiCheckCallStatus(errorHandler, status)
296
- return return_value
293
+ var status = UniffiRustCallStatus()
294
+ val return_value = callback(status)
295
+ uniffiCheckCallStatus(errorHandler, status)
296
+ return return_value
297
297
  }
298
298
 
299
299
  // Check UniffiRustCallStatus and throw an error if the call wasn't successful
300
300
  private fun <E : kotlin.Exception> uniffiCheckCallStatus(
301
- errorHandler: UniffiRustCallStatusErrorHandler<E>,
302
- status: UniffiRustCallStatus,
301
+ errorHandler: UniffiRustCallStatusErrorHandler<E>,
302
+ status: UniffiRustCallStatus,
303
303
  ) {
304
- if (status.isSuccess()) {
305
- return
306
- } else if (status.isError()) {
307
- throw errorHandler.lift(status.error_buf)
308
- } else if (status.isPanic()) {
309
- // when the rust code sees a panic, it tries to construct a rustbuffer
310
- // with the message. but if that code panics, then it just sends back
311
- // an empty buffer.
312
- if (status.error_buf.len > 0) {
313
- throw InternalException(FfiConverterString.lift(status.error_buf))
314
- } else {
315
- throw InternalException("Rust panic")
316
- }
304
+ if (status.isSuccess()) {
305
+ return
306
+ } else if (status.isError()) {
307
+ throw errorHandler.lift(status.error_buf)
308
+ } else if (status.isPanic()) {
309
+ // when the rust code sees a panic, it tries to construct a rustbuffer
310
+ // with the message. but if that code panics, then it just sends back
311
+ // an empty buffer.
312
+ if (status.error_buf.len > 0) {
313
+ throw InternalException(FfiConverterString.lift(status.error_buf))
317
314
  } else {
318
- throw InternalException("Unknown rust call status: $status.code")
315
+ throw InternalException("Rust panic")
319
316
  }
317
+ } else {
318
+ throw InternalException("Unknown rust call status: $status.code")
319
+ }
320
320
  }
321
321
 
322
322
  /**
@@ -325,830 +325,830 @@ private fun <E : kotlin.Exception> uniffiCheckCallStatus(
325
325
  * @suppress
326
326
  */
327
327
  object UniffiNullRustCallStatusErrorHandler : UniffiRustCallStatusErrorHandler<InternalException> {
328
- override fun lift(error_buf: RustBuffer.ByValue): InternalException {
329
- RustBuffer.free(error_buf)
330
- return InternalException("Unexpected CALL_ERROR")
331
- }
328
+ override fun lift(error_buf: RustBuffer.ByValue): InternalException {
329
+ RustBuffer.free(error_buf)
330
+ return InternalException("Unexpected CALL_ERROR")
331
+ }
332
332
  }
333
333
 
334
334
  // Call a rust function that returns a plain value
335
335
  private inline fun <U> uniffiRustCall(callback: (UniffiRustCallStatus) -> U): U =
336
- uniffiRustCallWithError(UniffiNullRustCallStatusErrorHandler, callback)
336
+ uniffiRustCallWithError(UniffiNullRustCallStatusErrorHandler, callback)
337
337
 
338
338
  internal inline fun <T> uniffiTraitInterfaceCall(
339
- callStatus: UniffiRustCallStatus,
340
- makeCall: () -> T,
341
- writeReturn: (T) -> Unit,
339
+ callStatus: UniffiRustCallStatus,
340
+ makeCall: () -> T,
341
+ writeReturn: (T) -> Unit,
342
342
  ) {
343
- try {
344
- writeReturn(makeCall())
345
- } catch (e: kotlin.Exception) {
346
- callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
347
- callStatus.error_buf = FfiConverterString.lower(e.toString())
348
- }
343
+ try {
344
+ writeReturn(makeCall())
345
+ } catch (e: kotlin.Exception) {
346
+ callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
347
+ callStatus.error_buf = FfiConverterString.lower(e.toString())
348
+ }
349
349
  }
350
350
 
351
351
  internal inline fun <T, reified E : Throwable> uniffiTraitInterfaceCallWithError(
352
- callStatus: UniffiRustCallStatus,
353
- makeCall: () -> T,
354
- writeReturn: (T) -> Unit,
355
- lowerError: (E) -> RustBuffer.ByValue,
352
+ callStatus: UniffiRustCallStatus,
353
+ makeCall: () -> T,
354
+ writeReturn: (T) -> Unit,
355
+ lowerError: (E) -> RustBuffer.ByValue,
356
356
  ) {
357
- try {
358
- writeReturn(makeCall())
359
- } catch (e: kotlin.Exception) {
360
- if (e is E) {
361
- callStatus.code = UNIFFI_CALL_ERROR
362
- callStatus.error_buf = lowerError(e)
363
- } else {
364
- callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
365
- callStatus.error_buf = FfiConverterString.lower(e.toString())
366
- }
357
+ try {
358
+ writeReturn(makeCall())
359
+ } catch (e: kotlin.Exception) {
360
+ if (e is E) {
361
+ callStatus.code = UNIFFI_CALL_ERROR
362
+ callStatus.error_buf = lowerError(e)
363
+ } else {
364
+ callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
365
+ callStatus.error_buf = FfiConverterString.lower(e.toString())
367
366
  }
367
+ }
368
368
  }
369
369
 
370
370
  // Map handles to objects
371
371
  //
372
372
  // This is used pass an opaque 64-bit handle representing a foreign object to the Rust code.
373
373
  internal class UniffiHandleMap<T : Any> {
374
- private val map = ConcurrentHashMap<Long, T>()
375
- private val counter =
376
- java.util.concurrent.atomic
377
- .AtomicLong(0)
378
-
379
- val size: Int
380
- get() = map.size
381
-
382
- // Insert a new object into the handle map and get a handle for it
383
- fun insert(obj: T): Long {
384
- val handle = counter.getAndAdd(1)
385
- map.put(handle, obj)
386
- return handle
387
- }
374
+ private val map = ConcurrentHashMap<Long, T>()
375
+ private val counter =
376
+ java.util.concurrent.atomic
377
+ .AtomicLong(0)
388
378
 
389
- // Get an object from the handle map
390
- fun get(handle: Long): T = map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle")
379
+ val size: Int
380
+ get() = map.size
391
381
 
392
- // Remove an entry from the handlemap and get the Kotlin object back
393
- fun remove(handle: Long): T = map.remove(handle) ?: throw InternalException("UniffiHandleMap: Invalid handle")
382
+ // Insert a new object into the handle map and get a handle for it
383
+ fun insert(obj: T): Long {
384
+ val handle = counter.getAndAdd(1)
385
+ map.put(handle, obj)
386
+ return handle
387
+ }
388
+
389
+ // Get an object from the handle map
390
+ fun get(handle: Long): T = map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle")
391
+
392
+ // Remove an entry from the handlemap and get the Kotlin object back
393
+ fun remove(handle: Long): T = map.remove(handle) ?: throw InternalException("UniffiHandleMap: Invalid handle")
394
394
  }
395
395
 
396
396
  // Contains loading, initialization code,
397
397
  // and the FFI Function declarations in a com.sun.jna.Library.
398
398
  @Synchronized
399
399
  private fun findLibraryName(componentName: String): String {
400
- val libOverride = System.getProperty("uniffi.component.$componentName.libraryOverride")
401
- if (libOverride != null) {
402
- return libOverride
403
- }
404
- return "uniffi_spark_frost"
400
+ val libOverride = System.getProperty("uniffi.component.$componentName.libraryOverride")
401
+ if (libOverride != null) {
402
+ return libOverride
403
+ }
404
+ return "uniffi_spark_frost"
405
405
  }
406
406
 
407
407
  private inline fun <reified Lib : Library> loadIndirect(componentName: String): Lib =
408
- Native.load<Lib>(findLibraryName(componentName), Lib::class.java)
408
+ Native.load<Lib>(findLibraryName(componentName), Lib::class.java)
409
409
 
410
410
  // Define FFI callback types
411
411
  internal interface UniffiRustFutureContinuationCallback : com.sun.jna.Callback {
412
- fun callback(
413
- `data`: Long,
414
- `pollResult`: Byte,
415
- )
412
+ fun callback(
413
+ `data`: Long,
414
+ `pollResult`: Byte,
415
+ )
416
416
  }
417
417
 
418
418
  internal interface UniffiForeignFutureFree : com.sun.jna.Callback {
419
- fun callback(`handle`: Long)
419
+ fun callback(`handle`: Long)
420
420
  }
421
421
 
422
422
  internal interface UniffiCallbackInterfaceFree : com.sun.jna.Callback {
423
- fun callback(`handle`: Long)
423
+ fun callback(`handle`: Long)
424
424
  }
425
425
 
426
426
  @Structure.FieldOrder("handle", "free")
427
427
  internal open class UniffiForeignFuture(
428
- @JvmField internal var `handle`: Long = 0.toLong(),
429
- @JvmField internal var `free`: UniffiForeignFutureFree? = null,
428
+ @JvmField internal var `handle`: Long = 0.toLong(),
429
+ @JvmField internal var `free`: UniffiForeignFutureFree? = null,
430
430
  ) : Structure() {
431
- class UniffiByValue(
432
- `handle`: Long = 0.toLong(),
433
- `free`: UniffiForeignFutureFree? = null,
434
- ) : UniffiForeignFuture(`handle`, `free`),
435
- Structure.ByValue
436
-
437
- internal fun uniffiSetValue(other: UniffiForeignFuture) {
438
- `handle` = other.`handle`
439
- `free` = other.`free`
440
- }
431
+ class UniffiByValue(
432
+ `handle`: Long = 0.toLong(),
433
+ `free`: UniffiForeignFutureFree? = null,
434
+ ) : UniffiForeignFuture(`handle`, `free`),
435
+ Structure.ByValue
436
+
437
+ internal fun uniffiSetValue(other: UniffiForeignFuture) {
438
+ `handle` = other.`handle`
439
+ `free` = other.`free`
440
+ }
441
441
  }
442
442
 
443
443
  @Structure.FieldOrder("returnValue", "callStatus")
444
444
  internal open class UniffiForeignFutureStructU8(
445
- @JvmField internal var `returnValue`: Byte = 0.toByte(),
446
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
445
+ @JvmField internal var `returnValue`: Byte = 0.toByte(),
446
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
447
447
  ) : Structure() {
448
- class UniffiByValue(
449
- `returnValue`: Byte = 0.toByte(),
450
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
451
- ) : UniffiForeignFutureStructU8(`returnValue`, `callStatus`),
452
- Structure.ByValue
453
-
454
- internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) {
455
- `returnValue` = other.`returnValue`
456
- `callStatus` = other.`callStatus`
457
- }
448
+ class UniffiByValue(
449
+ `returnValue`: Byte = 0.toByte(),
450
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
451
+ ) : UniffiForeignFutureStructU8(`returnValue`, `callStatus`),
452
+ Structure.ByValue
453
+
454
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) {
455
+ `returnValue` = other.`returnValue`
456
+ `callStatus` = other.`callStatus`
457
+ }
458
458
  }
459
459
 
460
460
  internal interface UniffiForeignFutureCompleteU8 : com.sun.jna.Callback {
461
- fun callback(
462
- `callbackData`: Long,
463
- `result`: UniffiForeignFutureStructU8.UniffiByValue,
464
- )
461
+ fun callback(
462
+ `callbackData`: Long,
463
+ `result`: UniffiForeignFutureStructU8.UniffiByValue,
464
+ )
465
465
  }
466
466
 
467
467
  @Structure.FieldOrder("returnValue", "callStatus")
468
468
  internal open class UniffiForeignFutureStructI8(
469
- @JvmField internal var `returnValue`: Byte = 0.toByte(),
470
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
469
+ @JvmField internal var `returnValue`: Byte = 0.toByte(),
470
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
471
471
  ) : Structure() {
472
- class UniffiByValue(
473
- `returnValue`: Byte = 0.toByte(),
474
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
475
- ) : UniffiForeignFutureStructI8(`returnValue`, `callStatus`),
476
- Structure.ByValue
477
-
478
- internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) {
479
- `returnValue` = other.`returnValue`
480
- `callStatus` = other.`callStatus`
481
- }
472
+ class UniffiByValue(
473
+ `returnValue`: Byte = 0.toByte(),
474
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
475
+ ) : UniffiForeignFutureStructI8(`returnValue`, `callStatus`),
476
+ Structure.ByValue
477
+
478
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) {
479
+ `returnValue` = other.`returnValue`
480
+ `callStatus` = other.`callStatus`
481
+ }
482
482
  }
483
483
 
484
484
  internal interface UniffiForeignFutureCompleteI8 : com.sun.jna.Callback {
485
- fun callback(
486
- `callbackData`: Long,
487
- `result`: UniffiForeignFutureStructI8.UniffiByValue,
488
- )
485
+ fun callback(
486
+ `callbackData`: Long,
487
+ `result`: UniffiForeignFutureStructI8.UniffiByValue,
488
+ )
489
489
  }
490
490
 
491
491
  @Structure.FieldOrder("returnValue", "callStatus")
492
492
  internal open class UniffiForeignFutureStructU16(
493
- @JvmField internal var `returnValue`: Short = 0.toShort(),
494
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
493
+ @JvmField internal var `returnValue`: Short = 0.toShort(),
494
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
495
495
  ) : Structure() {
496
- class UniffiByValue(
497
- `returnValue`: Short = 0.toShort(),
498
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
499
- ) : UniffiForeignFutureStructU16(`returnValue`, `callStatus`),
500
- Structure.ByValue
501
-
502
- internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) {
503
- `returnValue` = other.`returnValue`
504
- `callStatus` = other.`callStatus`
505
- }
496
+ class UniffiByValue(
497
+ `returnValue`: Short = 0.toShort(),
498
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
499
+ ) : UniffiForeignFutureStructU16(`returnValue`, `callStatus`),
500
+ Structure.ByValue
501
+
502
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) {
503
+ `returnValue` = other.`returnValue`
504
+ `callStatus` = other.`callStatus`
505
+ }
506
506
  }
507
507
 
508
508
  internal interface UniffiForeignFutureCompleteU16 : com.sun.jna.Callback {
509
- fun callback(
510
- `callbackData`: Long,
511
- `result`: UniffiForeignFutureStructU16.UniffiByValue,
512
- )
509
+ fun callback(
510
+ `callbackData`: Long,
511
+ `result`: UniffiForeignFutureStructU16.UniffiByValue,
512
+ )
513
513
  }
514
514
 
515
515
  @Structure.FieldOrder("returnValue", "callStatus")
516
516
  internal open class UniffiForeignFutureStructI16(
517
- @JvmField internal var `returnValue`: Short = 0.toShort(),
518
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
517
+ @JvmField internal var `returnValue`: Short = 0.toShort(),
518
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
519
519
  ) : Structure() {
520
- class UniffiByValue(
521
- `returnValue`: Short = 0.toShort(),
522
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
523
- ) : UniffiForeignFutureStructI16(`returnValue`, `callStatus`),
524
- Structure.ByValue
525
-
526
- internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) {
527
- `returnValue` = other.`returnValue`
528
- `callStatus` = other.`callStatus`
529
- }
520
+ class UniffiByValue(
521
+ `returnValue`: Short = 0.toShort(),
522
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
523
+ ) : UniffiForeignFutureStructI16(`returnValue`, `callStatus`),
524
+ Structure.ByValue
525
+
526
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) {
527
+ `returnValue` = other.`returnValue`
528
+ `callStatus` = other.`callStatus`
529
+ }
530
530
  }
531
531
 
532
532
  internal interface UniffiForeignFutureCompleteI16 : com.sun.jna.Callback {
533
- fun callback(
534
- `callbackData`: Long,
535
- `result`: UniffiForeignFutureStructI16.UniffiByValue,
536
- )
533
+ fun callback(
534
+ `callbackData`: Long,
535
+ `result`: UniffiForeignFutureStructI16.UniffiByValue,
536
+ )
537
537
  }
538
538
 
539
539
  @Structure.FieldOrder("returnValue", "callStatus")
540
540
  internal open class UniffiForeignFutureStructU32(
541
- @JvmField internal var `returnValue`: Int = 0,
542
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
541
+ @JvmField internal var `returnValue`: Int = 0,
542
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
543
543
  ) : Structure() {
544
- class UniffiByValue(
545
- `returnValue`: Int = 0,
546
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
547
- ) : UniffiForeignFutureStructU32(`returnValue`, `callStatus`),
548
- Structure.ByValue
549
-
550
- internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) {
551
- `returnValue` = other.`returnValue`
552
- `callStatus` = other.`callStatus`
553
- }
544
+ class UniffiByValue(
545
+ `returnValue`: Int = 0,
546
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
547
+ ) : UniffiForeignFutureStructU32(`returnValue`, `callStatus`),
548
+ Structure.ByValue
549
+
550
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) {
551
+ `returnValue` = other.`returnValue`
552
+ `callStatus` = other.`callStatus`
553
+ }
554
554
  }
555
555
 
556
556
  internal interface UniffiForeignFutureCompleteU32 : com.sun.jna.Callback {
557
- fun callback(
558
- `callbackData`: Long,
559
- `result`: UniffiForeignFutureStructU32.UniffiByValue,
560
- )
557
+ fun callback(
558
+ `callbackData`: Long,
559
+ `result`: UniffiForeignFutureStructU32.UniffiByValue,
560
+ )
561
561
  }
562
562
 
563
563
  @Structure.FieldOrder("returnValue", "callStatus")
564
564
  internal open class UniffiForeignFutureStructI32(
565
- @JvmField internal var `returnValue`: Int = 0,
566
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
565
+ @JvmField internal var `returnValue`: Int = 0,
566
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
567
567
  ) : Structure() {
568
- class UniffiByValue(
569
- `returnValue`: Int = 0,
570
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
571
- ) : UniffiForeignFutureStructI32(`returnValue`, `callStatus`),
572
- Structure.ByValue
573
-
574
- internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) {
575
- `returnValue` = other.`returnValue`
576
- `callStatus` = other.`callStatus`
577
- }
568
+ class UniffiByValue(
569
+ `returnValue`: Int = 0,
570
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
571
+ ) : UniffiForeignFutureStructI32(`returnValue`, `callStatus`),
572
+ Structure.ByValue
573
+
574
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) {
575
+ `returnValue` = other.`returnValue`
576
+ `callStatus` = other.`callStatus`
577
+ }
578
578
  }
579
579
 
580
580
  internal interface UniffiForeignFutureCompleteI32 : com.sun.jna.Callback {
581
- fun callback(
582
- `callbackData`: Long,
583
- `result`: UniffiForeignFutureStructI32.UniffiByValue,
584
- )
581
+ fun callback(
582
+ `callbackData`: Long,
583
+ `result`: UniffiForeignFutureStructI32.UniffiByValue,
584
+ )
585
585
  }
586
586
 
587
587
  @Structure.FieldOrder("returnValue", "callStatus")
588
588
  internal open class UniffiForeignFutureStructU64(
589
- @JvmField internal var `returnValue`: Long = 0.toLong(),
590
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
589
+ @JvmField internal var `returnValue`: Long = 0.toLong(),
590
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
591
591
  ) : Structure() {
592
- class UniffiByValue(
593
- `returnValue`: Long = 0.toLong(),
594
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
595
- ) : UniffiForeignFutureStructU64(`returnValue`, `callStatus`),
596
- Structure.ByValue
597
-
598
- internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) {
599
- `returnValue` = other.`returnValue`
600
- `callStatus` = other.`callStatus`
601
- }
592
+ class UniffiByValue(
593
+ `returnValue`: Long = 0.toLong(),
594
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
595
+ ) : UniffiForeignFutureStructU64(`returnValue`, `callStatus`),
596
+ Structure.ByValue
597
+
598
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) {
599
+ `returnValue` = other.`returnValue`
600
+ `callStatus` = other.`callStatus`
601
+ }
602
602
  }
603
603
 
604
604
  internal interface UniffiForeignFutureCompleteU64 : com.sun.jna.Callback {
605
- fun callback(
606
- `callbackData`: Long,
607
- `result`: UniffiForeignFutureStructU64.UniffiByValue,
608
- )
605
+ fun callback(
606
+ `callbackData`: Long,
607
+ `result`: UniffiForeignFutureStructU64.UniffiByValue,
608
+ )
609
609
  }
610
610
 
611
611
  @Structure.FieldOrder("returnValue", "callStatus")
612
612
  internal open class UniffiForeignFutureStructI64(
613
- @JvmField internal var `returnValue`: Long = 0.toLong(),
614
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
613
+ @JvmField internal var `returnValue`: Long = 0.toLong(),
614
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
615
615
  ) : Structure() {
616
- class UniffiByValue(
617
- `returnValue`: Long = 0.toLong(),
618
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
619
- ) : UniffiForeignFutureStructI64(`returnValue`, `callStatus`),
620
- Structure.ByValue
621
-
622
- internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) {
623
- `returnValue` = other.`returnValue`
624
- `callStatus` = other.`callStatus`
625
- }
616
+ class UniffiByValue(
617
+ `returnValue`: Long = 0.toLong(),
618
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
619
+ ) : UniffiForeignFutureStructI64(`returnValue`, `callStatus`),
620
+ Structure.ByValue
621
+
622
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) {
623
+ `returnValue` = other.`returnValue`
624
+ `callStatus` = other.`callStatus`
625
+ }
626
626
  }
627
627
 
628
628
  internal interface UniffiForeignFutureCompleteI64 : com.sun.jna.Callback {
629
- fun callback(
630
- `callbackData`: Long,
631
- `result`: UniffiForeignFutureStructI64.UniffiByValue,
632
- )
629
+ fun callback(
630
+ `callbackData`: Long,
631
+ `result`: UniffiForeignFutureStructI64.UniffiByValue,
632
+ )
633
633
  }
634
634
 
635
635
  @Structure.FieldOrder("returnValue", "callStatus")
636
636
  internal open class UniffiForeignFutureStructF32(
637
- @JvmField internal var `returnValue`: Float = 0.0f,
638
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
637
+ @JvmField internal var `returnValue`: Float = 0.0f,
638
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
639
639
  ) : Structure() {
640
- class UniffiByValue(
641
- `returnValue`: Float = 0.0f,
642
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
643
- ) : UniffiForeignFutureStructF32(`returnValue`, `callStatus`),
644
- Structure.ByValue
645
-
646
- internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) {
647
- `returnValue` = other.`returnValue`
648
- `callStatus` = other.`callStatus`
649
- }
640
+ class UniffiByValue(
641
+ `returnValue`: Float = 0.0f,
642
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
643
+ ) : UniffiForeignFutureStructF32(`returnValue`, `callStatus`),
644
+ Structure.ByValue
645
+
646
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) {
647
+ `returnValue` = other.`returnValue`
648
+ `callStatus` = other.`callStatus`
649
+ }
650
650
  }
651
651
 
652
652
  internal interface UniffiForeignFutureCompleteF32 : com.sun.jna.Callback {
653
- fun callback(
654
- `callbackData`: Long,
655
- `result`: UniffiForeignFutureStructF32.UniffiByValue,
656
- )
653
+ fun callback(
654
+ `callbackData`: Long,
655
+ `result`: UniffiForeignFutureStructF32.UniffiByValue,
656
+ )
657
657
  }
658
658
 
659
659
  @Structure.FieldOrder("returnValue", "callStatus")
660
660
  internal open class UniffiForeignFutureStructF64(
661
- @JvmField internal var `returnValue`: Double = 0.0,
662
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
661
+ @JvmField internal var `returnValue`: Double = 0.0,
662
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
663
663
  ) : Structure() {
664
- class UniffiByValue(
665
- `returnValue`: Double = 0.0,
666
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
667
- ) : UniffiForeignFutureStructF64(`returnValue`, `callStatus`),
668
- Structure.ByValue
669
-
670
- internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) {
671
- `returnValue` = other.`returnValue`
672
- `callStatus` = other.`callStatus`
673
- }
664
+ class UniffiByValue(
665
+ `returnValue`: Double = 0.0,
666
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
667
+ ) : UniffiForeignFutureStructF64(`returnValue`, `callStatus`),
668
+ Structure.ByValue
669
+
670
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) {
671
+ `returnValue` = other.`returnValue`
672
+ `callStatus` = other.`callStatus`
673
+ }
674
674
  }
675
675
 
676
676
  internal interface UniffiForeignFutureCompleteF64 : com.sun.jna.Callback {
677
- fun callback(
678
- `callbackData`: Long,
679
- `result`: UniffiForeignFutureStructF64.UniffiByValue,
680
- )
677
+ fun callback(
678
+ `callbackData`: Long,
679
+ `result`: UniffiForeignFutureStructF64.UniffiByValue,
680
+ )
681
681
  }
682
682
 
683
683
  @Structure.FieldOrder("returnValue", "callStatus")
684
684
  internal open class UniffiForeignFutureStructPointer(
685
- @JvmField internal var `returnValue`: Pointer = Pointer.NULL,
686
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
685
+ @JvmField internal var `returnValue`: Pointer = Pointer.NULL,
686
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
687
687
  ) : Structure() {
688
- class UniffiByValue(
689
- `returnValue`: Pointer = Pointer.NULL,
690
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
691
- ) : UniffiForeignFutureStructPointer(`returnValue`, `callStatus`),
692
- Structure.ByValue
693
-
694
- internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) {
695
- `returnValue` = other.`returnValue`
696
- `callStatus` = other.`callStatus`
697
- }
688
+ class UniffiByValue(
689
+ `returnValue`: Pointer = Pointer.NULL,
690
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
691
+ ) : UniffiForeignFutureStructPointer(`returnValue`, `callStatus`),
692
+ Structure.ByValue
693
+
694
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) {
695
+ `returnValue` = other.`returnValue`
696
+ `callStatus` = other.`callStatus`
697
+ }
698
698
  }
699
699
 
700
700
  internal interface UniffiForeignFutureCompletePointer : com.sun.jna.Callback {
701
- fun callback(
702
- `callbackData`: Long,
703
- `result`: UniffiForeignFutureStructPointer.UniffiByValue,
704
- )
701
+ fun callback(
702
+ `callbackData`: Long,
703
+ `result`: UniffiForeignFutureStructPointer.UniffiByValue,
704
+ )
705
705
  }
706
706
 
707
707
  @Structure.FieldOrder("returnValue", "callStatus")
708
708
  internal open class UniffiForeignFutureStructRustBuffer(
709
- @JvmField internal var `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
710
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
709
+ @JvmField internal var `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
710
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
711
711
  ) : Structure() {
712
- class UniffiByValue(
713
- `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
714
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
715
- ) : UniffiForeignFutureStructRustBuffer(`returnValue`, `callStatus`),
716
- Structure.ByValue
717
-
718
- internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) {
719
- `returnValue` = other.`returnValue`
720
- `callStatus` = other.`callStatus`
721
- }
712
+ class UniffiByValue(
713
+ `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
714
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
715
+ ) : UniffiForeignFutureStructRustBuffer(`returnValue`, `callStatus`),
716
+ Structure.ByValue
717
+
718
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) {
719
+ `returnValue` = other.`returnValue`
720
+ `callStatus` = other.`callStatus`
721
+ }
722
722
  }
723
723
 
724
724
  internal interface UniffiForeignFutureCompleteRustBuffer : com.sun.jna.Callback {
725
- fun callback(
726
- `callbackData`: Long,
727
- `result`: UniffiForeignFutureStructRustBuffer.UniffiByValue,
728
- )
725
+ fun callback(
726
+ `callbackData`: Long,
727
+ `result`: UniffiForeignFutureStructRustBuffer.UniffiByValue,
728
+ )
729
729
  }
730
730
 
731
731
  @Structure.FieldOrder("callStatus")
732
732
  internal open class UniffiForeignFutureStructVoid(
733
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
733
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
734
734
  ) : Structure() {
735
- class UniffiByValue(
736
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
737
- ) : UniffiForeignFutureStructVoid(`callStatus`),
738
- Structure.ByValue
735
+ class UniffiByValue(
736
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
737
+ ) : UniffiForeignFutureStructVoid(`callStatus`),
738
+ Structure.ByValue
739
739
 
740
- internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) {
741
- `callStatus` = other.`callStatus`
742
- }
740
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) {
741
+ `callStatus` = other.`callStatus`
742
+ }
743
743
  }
744
744
 
745
745
  internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback {
746
- fun callback(
747
- `callbackData`: Long,
748
- `result`: UniffiForeignFutureStructVoid.UniffiByValue,
749
- )
746
+ fun callback(
747
+ `callbackData`: Long,
748
+ `result`: UniffiForeignFutureStructVoid.UniffiByValue,
749
+ )
750
750
  }
751
751
 
752
752
  // A JNA Library to expose the extern-C FFI definitions.
753
753
  // This is an implementation detail which will be called internally by the public API.
754
754
 
755
755
  internal interface UniffiLib : Library {
756
- companion object {
757
- internal val INSTANCE: UniffiLib by lazy {
758
- loadIndirect<UniffiLib>(componentName = "spark_frost")
759
- .also { lib: UniffiLib ->
760
- uniffiCheckContractApiVersion(lib)
761
- uniffiCheckApiChecksums(lib)
762
- }
756
+ companion object {
757
+ internal val INSTANCE: UniffiLib by lazy {
758
+ loadIndirect<UniffiLib>(componentName = "spark_frost")
759
+ .also { lib: UniffiLib ->
760
+ uniffiCheckContractApiVersion(lib)
761
+ uniffiCheckApiChecksums(lib)
763
762
  }
764
763
  }
764
+ }
765
+
766
+ fun uniffi_spark_frost_fn_func_aggregate_frost(
767
+ `msg`: RustBuffer.ByValue,
768
+ `statechainCommitments`: RustBuffer.ByValue,
769
+ `selfCommitment`: RustBuffer.ByValue,
770
+ `statechainSignatures`: RustBuffer.ByValue,
771
+ `selfSignature`: RustBuffer.ByValue,
772
+ `statechainPublicKeys`: RustBuffer.ByValue,
773
+ `selfPublicKey`: RustBuffer.ByValue,
774
+ `verifyingKey`: RustBuffer.ByValue,
775
+ `adaptorPublicKey`: RustBuffer.ByValue,
776
+ uniffi_out_err: UniffiRustCallStatus,
777
+ ): RustBuffer.ByValue
778
+
779
+ fun uniffi_spark_frost_fn_func_construct_direct_refund_tx(
780
+ `tx`: RustBuffer.ByValue,
781
+ `vout`: Int,
782
+ `pubkey`: RustBuffer.ByValue,
783
+ `network`: RustBuffer.ByValue,
784
+ `locktime`: Short,
785
+ uniffi_out_err: UniffiRustCallStatus,
786
+ ): RustBuffer.ByValue
787
+
788
+ fun uniffi_spark_frost_fn_func_construct_node_tx(
789
+ `tx`: RustBuffer.ByValue,
790
+ `vout`: Int,
791
+ `address`: RustBuffer.ByValue,
792
+ `locktime`: Short,
793
+ uniffi_out_err: UniffiRustCallStatus,
794
+ ): RustBuffer.ByValue
795
+
796
+ fun uniffi_spark_frost_fn_func_construct_refund_tx(
797
+ `tx`: RustBuffer.ByValue,
798
+ `vout`: Int,
799
+ `pubkey`: RustBuffer.ByValue,
800
+ `network`: RustBuffer.ByValue,
801
+ `locktime`: Short,
802
+ uniffi_out_err: UniffiRustCallStatus,
803
+ ): RustBuffer.ByValue
804
+
805
+ fun uniffi_spark_frost_fn_func_construct_split_tx(
806
+ `tx`: RustBuffer.ByValue,
807
+ `vout`: Int,
808
+ `addresses`: RustBuffer.ByValue,
809
+ `locktime`: Short,
810
+ uniffi_out_err: UniffiRustCallStatus,
811
+ ): RustBuffer.ByValue
812
+
813
+ fun uniffi_spark_frost_fn_func_create_dummy_tx(
814
+ `address`: RustBuffer.ByValue,
815
+ `amountSats`: Long,
816
+ uniffi_out_err: UniffiRustCallStatus,
817
+ ): RustBuffer.ByValue
818
+
819
+ fun uniffi_spark_frost_fn_func_decrypt_ecies(
820
+ `encryptedMsg`: RustBuffer.ByValue,
821
+ `privateKey`: RustBuffer.ByValue,
822
+ uniffi_out_err: UniffiRustCallStatus,
823
+ ): RustBuffer.ByValue
824
+
825
+ fun uniffi_spark_frost_fn_func_encrypt_ecies(
826
+ `msg`: RustBuffer.ByValue,
827
+ `publicKey`: RustBuffer.ByValue,
828
+ uniffi_out_err: UniffiRustCallStatus,
829
+ ): RustBuffer.ByValue
830
+
831
+ fun uniffi_spark_frost_fn_func_frost_nonce(
832
+ `keyPackage`: RustBuffer.ByValue,
833
+ uniffi_out_err: UniffiRustCallStatus,
834
+ ): RustBuffer.ByValue
835
+
836
+ fun uniffi_spark_frost_fn_func_get_taproot_pubkey(
837
+ `verifyingPubkey`: RustBuffer.ByValue,
838
+ uniffi_out_err: UniffiRustCallStatus,
839
+ ): RustBuffer.ByValue
840
+
841
+ fun uniffi_spark_frost_fn_func_sign_frost(
842
+ `msg`: RustBuffer.ByValue,
843
+ `keyPackage`: RustBuffer.ByValue,
844
+ `nonce`: RustBuffer.ByValue,
845
+ `selfCommitment`: RustBuffer.ByValue,
846
+ `statechainCommitments`: RustBuffer.ByValue,
847
+ `adaptorPublicKey`: RustBuffer.ByValue,
848
+ uniffi_out_err: UniffiRustCallStatus,
849
+ ): RustBuffer.ByValue
850
+
851
+ fun uniffi_spark_frost_fn_func_validate_signature_share(
852
+ `msg`: RustBuffer.ByValue,
853
+ `statechainCommitments`: RustBuffer.ByValue,
854
+ `selfCommitment`: RustBuffer.ByValue,
855
+ `signatureShare`: RustBuffer.ByValue,
856
+ `publicShare`: RustBuffer.ByValue,
857
+ `verifyingKey`: RustBuffer.ByValue,
858
+ uniffi_out_err: UniffiRustCallStatus,
859
+ ): Byte
860
+
861
+ fun ffi_spark_frost_rustbuffer_alloc(
862
+ `size`: Long,
863
+ uniffi_out_err: UniffiRustCallStatus,
864
+ ): RustBuffer.ByValue
865
+
866
+ fun ffi_spark_frost_rustbuffer_from_bytes(
867
+ `bytes`: ForeignBytes.ByValue,
868
+ uniffi_out_err: UniffiRustCallStatus,
869
+ ): RustBuffer.ByValue
870
+
871
+ fun ffi_spark_frost_rustbuffer_free(
872
+ `buf`: RustBuffer.ByValue,
873
+ uniffi_out_err: UniffiRustCallStatus,
874
+ ): Unit
875
+
876
+ fun ffi_spark_frost_rustbuffer_reserve(
877
+ `buf`: RustBuffer.ByValue,
878
+ `additional`: Long,
879
+ uniffi_out_err: UniffiRustCallStatus,
880
+ ): RustBuffer.ByValue
881
+
882
+ fun ffi_spark_frost_rust_future_poll_u8(
883
+ `handle`: Long,
884
+ `callback`: UniffiRustFutureContinuationCallback,
885
+ `callbackData`: Long,
886
+ ): Unit
887
+
888
+ fun ffi_spark_frost_rust_future_cancel_u8(`handle`: Long): Unit
889
+
890
+ fun ffi_spark_frost_rust_future_free_u8(`handle`: Long): Unit
891
+
892
+ fun ffi_spark_frost_rust_future_complete_u8(
893
+ `handle`: Long,
894
+ uniffi_out_err: UniffiRustCallStatus,
895
+ ): Byte
896
+
897
+ fun ffi_spark_frost_rust_future_poll_i8(
898
+ `handle`: Long,
899
+ `callback`: UniffiRustFutureContinuationCallback,
900
+ `callbackData`: Long,
901
+ ): Unit
902
+
903
+ fun ffi_spark_frost_rust_future_cancel_i8(`handle`: Long): Unit
904
+
905
+ fun ffi_spark_frost_rust_future_free_i8(`handle`: Long): Unit
906
+
907
+ fun ffi_spark_frost_rust_future_complete_i8(
908
+ `handle`: Long,
909
+ uniffi_out_err: UniffiRustCallStatus,
910
+ ): Byte
911
+
912
+ fun ffi_spark_frost_rust_future_poll_u16(
913
+ `handle`: Long,
914
+ `callback`: UniffiRustFutureContinuationCallback,
915
+ `callbackData`: Long,
916
+ ): Unit
917
+
918
+ fun ffi_spark_frost_rust_future_cancel_u16(`handle`: Long): Unit
919
+
920
+ fun ffi_spark_frost_rust_future_free_u16(`handle`: Long): Unit
921
+
922
+ fun ffi_spark_frost_rust_future_complete_u16(
923
+ `handle`: Long,
924
+ uniffi_out_err: UniffiRustCallStatus,
925
+ ): Short
926
+
927
+ fun ffi_spark_frost_rust_future_poll_i16(
928
+ `handle`: Long,
929
+ `callback`: UniffiRustFutureContinuationCallback,
930
+ `callbackData`: Long,
931
+ ): Unit
932
+
933
+ fun ffi_spark_frost_rust_future_cancel_i16(`handle`: Long): Unit
934
+
935
+ fun ffi_spark_frost_rust_future_free_i16(`handle`: Long): Unit
936
+
937
+ fun ffi_spark_frost_rust_future_complete_i16(
938
+ `handle`: Long,
939
+ uniffi_out_err: UniffiRustCallStatus,
940
+ ): Short
941
+
942
+ fun ffi_spark_frost_rust_future_poll_u32(
943
+ `handle`: Long,
944
+ `callback`: UniffiRustFutureContinuationCallback,
945
+ `callbackData`: Long,
946
+ ): Unit
765
947
 
766
- fun uniffi_spark_frost_fn_func_aggregate_frost(
767
- `msg`: RustBuffer.ByValue,
768
- `statechainCommitments`: RustBuffer.ByValue,
769
- `selfCommitment`: RustBuffer.ByValue,
770
- `statechainSignatures`: RustBuffer.ByValue,
771
- `selfSignature`: RustBuffer.ByValue,
772
- `statechainPublicKeys`: RustBuffer.ByValue,
773
- `selfPublicKey`: RustBuffer.ByValue,
774
- `verifyingKey`: RustBuffer.ByValue,
775
- `adaptorPublicKey`: RustBuffer.ByValue,
776
- uniffi_out_err: UniffiRustCallStatus,
777
- ): RustBuffer.ByValue
778
-
779
- fun uniffi_spark_frost_fn_func_construct_direct_refund_tx(
780
- `tx`: RustBuffer.ByValue,
781
- `vout`: Int,
782
- `pubkey`: RustBuffer.ByValue,
783
- `network`: RustBuffer.ByValue,
784
- `locktime`: Short,
785
- uniffi_out_err: UniffiRustCallStatus,
786
- ): RustBuffer.ByValue
787
-
788
- fun uniffi_spark_frost_fn_func_construct_node_tx(
789
- `tx`: RustBuffer.ByValue,
790
- `vout`: Int,
791
- `address`: RustBuffer.ByValue,
792
- `locktime`: Short,
793
- uniffi_out_err: UniffiRustCallStatus,
794
- ): RustBuffer.ByValue
795
-
796
- fun uniffi_spark_frost_fn_func_construct_refund_tx(
797
- `tx`: RustBuffer.ByValue,
798
- `vout`: Int,
799
- `pubkey`: RustBuffer.ByValue,
800
- `network`: RustBuffer.ByValue,
801
- `locktime`: Short,
802
- uniffi_out_err: UniffiRustCallStatus,
803
- ): RustBuffer.ByValue
804
-
805
- fun uniffi_spark_frost_fn_func_construct_split_tx(
806
- `tx`: RustBuffer.ByValue,
807
- `vout`: Int,
808
- `addresses`: RustBuffer.ByValue,
809
- `locktime`: Short,
810
- uniffi_out_err: UniffiRustCallStatus,
811
- ): RustBuffer.ByValue
812
-
813
- fun uniffi_spark_frost_fn_func_create_dummy_tx(
814
- `address`: RustBuffer.ByValue,
815
- `amountSats`: Long,
816
- uniffi_out_err: UniffiRustCallStatus,
817
- ): RustBuffer.ByValue
818
-
819
- fun uniffi_spark_frost_fn_func_decrypt_ecies(
820
- `encryptedMsg`: RustBuffer.ByValue,
821
- `privateKey`: RustBuffer.ByValue,
822
- uniffi_out_err: UniffiRustCallStatus,
823
- ): RustBuffer.ByValue
824
-
825
- fun uniffi_spark_frost_fn_func_encrypt_ecies(
826
- `msg`: RustBuffer.ByValue,
827
- `publicKey`: RustBuffer.ByValue,
828
- uniffi_out_err: UniffiRustCallStatus,
829
- ): RustBuffer.ByValue
830
-
831
- fun uniffi_spark_frost_fn_func_frost_nonce(
832
- `keyPackage`: RustBuffer.ByValue,
833
- uniffi_out_err: UniffiRustCallStatus,
834
- ): RustBuffer.ByValue
835
-
836
- fun uniffi_spark_frost_fn_func_get_taproot_pubkey(
837
- `verifyingPubkey`: RustBuffer.ByValue,
838
- uniffi_out_err: UniffiRustCallStatus,
839
- ): RustBuffer.ByValue
840
-
841
- fun uniffi_spark_frost_fn_func_sign_frost(
842
- `msg`: RustBuffer.ByValue,
843
- `keyPackage`: RustBuffer.ByValue,
844
- `nonce`: RustBuffer.ByValue,
845
- `selfCommitment`: RustBuffer.ByValue,
846
- `statechainCommitments`: RustBuffer.ByValue,
847
- `adaptorPublicKey`: RustBuffer.ByValue,
848
- uniffi_out_err: UniffiRustCallStatus,
849
- ): RustBuffer.ByValue
850
-
851
- fun uniffi_spark_frost_fn_func_validate_signature_share(
852
- `msg`: RustBuffer.ByValue,
853
- `statechainCommitments`: RustBuffer.ByValue,
854
- `selfCommitment`: RustBuffer.ByValue,
855
- `signatureShare`: RustBuffer.ByValue,
856
- `publicShare`: RustBuffer.ByValue,
857
- `verifyingKey`: RustBuffer.ByValue,
858
- uniffi_out_err: UniffiRustCallStatus,
859
- ): Byte
860
-
861
- fun ffi_spark_frost_rustbuffer_alloc(
862
- `size`: Long,
863
- uniffi_out_err: UniffiRustCallStatus,
864
- ): RustBuffer.ByValue
865
-
866
- fun ffi_spark_frost_rustbuffer_from_bytes(
867
- `bytes`: ForeignBytes.ByValue,
868
- uniffi_out_err: UniffiRustCallStatus,
869
- ): RustBuffer.ByValue
870
-
871
- fun ffi_spark_frost_rustbuffer_free(
872
- `buf`: RustBuffer.ByValue,
873
- uniffi_out_err: UniffiRustCallStatus,
874
- ): Unit
875
-
876
- fun ffi_spark_frost_rustbuffer_reserve(
877
- `buf`: RustBuffer.ByValue,
878
- `additional`: Long,
879
- uniffi_out_err: UniffiRustCallStatus,
880
- ): RustBuffer.ByValue
881
-
882
- fun ffi_spark_frost_rust_future_poll_u8(
883
- `handle`: Long,
884
- `callback`: UniffiRustFutureContinuationCallback,
885
- `callbackData`: Long,
886
- ): Unit
887
-
888
- fun ffi_spark_frost_rust_future_cancel_u8(`handle`: Long): Unit
889
-
890
- fun ffi_spark_frost_rust_future_free_u8(`handle`: Long): Unit
891
-
892
- fun ffi_spark_frost_rust_future_complete_u8(
893
- `handle`: Long,
894
- uniffi_out_err: UniffiRustCallStatus,
895
- ): Byte
896
-
897
- fun ffi_spark_frost_rust_future_poll_i8(
898
- `handle`: Long,
899
- `callback`: UniffiRustFutureContinuationCallback,
900
- `callbackData`: Long,
901
- ): Unit
902
-
903
- fun ffi_spark_frost_rust_future_cancel_i8(`handle`: Long): Unit
904
-
905
- fun ffi_spark_frost_rust_future_free_i8(`handle`: Long): Unit
906
-
907
- fun ffi_spark_frost_rust_future_complete_i8(
908
- `handle`: Long,
909
- uniffi_out_err: UniffiRustCallStatus,
910
- ): Byte
911
-
912
- fun ffi_spark_frost_rust_future_poll_u16(
913
- `handle`: Long,
914
- `callback`: UniffiRustFutureContinuationCallback,
915
- `callbackData`: Long,
916
- ): Unit
917
-
918
- fun ffi_spark_frost_rust_future_cancel_u16(`handle`: Long): Unit
919
-
920
- fun ffi_spark_frost_rust_future_free_u16(`handle`: Long): Unit
921
-
922
- fun ffi_spark_frost_rust_future_complete_u16(
923
- `handle`: Long,
924
- uniffi_out_err: UniffiRustCallStatus,
925
- ): Short
926
-
927
- fun ffi_spark_frost_rust_future_poll_i16(
928
- `handle`: Long,
929
- `callback`: UniffiRustFutureContinuationCallback,
930
- `callbackData`: Long,
931
- ): Unit
932
-
933
- fun ffi_spark_frost_rust_future_cancel_i16(`handle`: Long): Unit
934
-
935
- fun ffi_spark_frost_rust_future_free_i16(`handle`: Long): Unit
936
-
937
- fun ffi_spark_frost_rust_future_complete_i16(
938
- `handle`: Long,
939
- uniffi_out_err: UniffiRustCallStatus,
940
- ): Short
941
-
942
- fun ffi_spark_frost_rust_future_poll_u32(
943
- `handle`: Long,
944
- `callback`: UniffiRustFutureContinuationCallback,
945
- `callbackData`: Long,
946
- ): Unit
947
-
948
- fun ffi_spark_frost_rust_future_cancel_u32(`handle`: Long): Unit
948
+ fun ffi_spark_frost_rust_future_cancel_u32(`handle`: Long): Unit
949
949
 
950
- fun ffi_spark_frost_rust_future_free_u32(`handle`: Long): Unit
951
-
952
- fun ffi_spark_frost_rust_future_complete_u32(
953
- `handle`: Long,
954
- uniffi_out_err: UniffiRustCallStatus,
955
- ): Int
950
+ fun ffi_spark_frost_rust_future_free_u32(`handle`: Long): Unit
951
+
952
+ fun ffi_spark_frost_rust_future_complete_u32(
953
+ `handle`: Long,
954
+ uniffi_out_err: UniffiRustCallStatus,
955
+ ): Int
956
956
 
957
- fun ffi_spark_frost_rust_future_poll_i32(
958
- `handle`: Long,
959
- `callback`: UniffiRustFutureContinuationCallback,
960
- `callbackData`: Long,
961
- ): Unit
957
+ fun ffi_spark_frost_rust_future_poll_i32(
958
+ `handle`: Long,
959
+ `callback`: UniffiRustFutureContinuationCallback,
960
+ `callbackData`: Long,
961
+ ): Unit
962
962
 
963
- fun ffi_spark_frost_rust_future_cancel_i32(`handle`: Long): Unit
963
+ fun ffi_spark_frost_rust_future_cancel_i32(`handle`: Long): Unit
964
964
 
965
- fun ffi_spark_frost_rust_future_free_i32(`handle`: Long): Unit
965
+ fun ffi_spark_frost_rust_future_free_i32(`handle`: Long): Unit
966
966
 
967
- fun ffi_spark_frost_rust_future_complete_i32(
968
- `handle`: Long,
969
- uniffi_out_err: UniffiRustCallStatus,
970
- ): Int
967
+ fun ffi_spark_frost_rust_future_complete_i32(
968
+ `handle`: Long,
969
+ uniffi_out_err: UniffiRustCallStatus,
970
+ ): Int
971
971
 
972
- fun ffi_spark_frost_rust_future_poll_u64(
973
- `handle`: Long,
974
- `callback`: UniffiRustFutureContinuationCallback,
975
- `callbackData`: Long,
976
- ): Unit
972
+ fun ffi_spark_frost_rust_future_poll_u64(
973
+ `handle`: Long,
974
+ `callback`: UniffiRustFutureContinuationCallback,
975
+ `callbackData`: Long,
976
+ ): Unit
977
977
 
978
- fun ffi_spark_frost_rust_future_cancel_u64(`handle`: Long): Unit
978
+ fun ffi_spark_frost_rust_future_cancel_u64(`handle`: Long): Unit
979
979
 
980
- fun ffi_spark_frost_rust_future_free_u64(`handle`: Long): Unit
980
+ fun ffi_spark_frost_rust_future_free_u64(`handle`: Long): Unit
981
981
 
982
- fun ffi_spark_frost_rust_future_complete_u64(
983
- `handle`: Long,
984
- uniffi_out_err: UniffiRustCallStatus,
985
- ): Long
982
+ fun ffi_spark_frost_rust_future_complete_u64(
983
+ `handle`: Long,
984
+ uniffi_out_err: UniffiRustCallStatus,
985
+ ): Long
986
986
 
987
- fun ffi_spark_frost_rust_future_poll_i64(
988
- `handle`: Long,
989
- `callback`: UniffiRustFutureContinuationCallback,
990
- `callbackData`: Long,
991
- ): Unit
987
+ fun ffi_spark_frost_rust_future_poll_i64(
988
+ `handle`: Long,
989
+ `callback`: UniffiRustFutureContinuationCallback,
990
+ `callbackData`: Long,
991
+ ): Unit
992
992
 
993
- fun ffi_spark_frost_rust_future_cancel_i64(`handle`: Long): Unit
993
+ fun ffi_spark_frost_rust_future_cancel_i64(`handle`: Long): Unit
994
994
 
995
- fun ffi_spark_frost_rust_future_free_i64(`handle`: Long): Unit
995
+ fun ffi_spark_frost_rust_future_free_i64(`handle`: Long): Unit
996
996
 
997
- fun ffi_spark_frost_rust_future_complete_i64(
998
- `handle`: Long,
999
- uniffi_out_err: UniffiRustCallStatus,
1000
- ): Long
997
+ fun ffi_spark_frost_rust_future_complete_i64(
998
+ `handle`: Long,
999
+ uniffi_out_err: UniffiRustCallStatus,
1000
+ ): Long
1001
1001
 
1002
- fun ffi_spark_frost_rust_future_poll_f32(
1003
- `handle`: Long,
1004
- `callback`: UniffiRustFutureContinuationCallback,
1005
- `callbackData`: Long,
1006
- ): Unit
1002
+ fun ffi_spark_frost_rust_future_poll_f32(
1003
+ `handle`: Long,
1004
+ `callback`: UniffiRustFutureContinuationCallback,
1005
+ `callbackData`: Long,
1006
+ ): Unit
1007
1007
 
1008
- fun ffi_spark_frost_rust_future_cancel_f32(`handle`: Long): Unit
1008
+ fun ffi_spark_frost_rust_future_cancel_f32(`handle`: Long): Unit
1009
1009
 
1010
- fun ffi_spark_frost_rust_future_free_f32(`handle`: Long): Unit
1010
+ fun ffi_spark_frost_rust_future_free_f32(`handle`: Long): Unit
1011
1011
 
1012
- fun ffi_spark_frost_rust_future_complete_f32(
1013
- `handle`: Long,
1014
- uniffi_out_err: UniffiRustCallStatus,
1015
- ): Float
1012
+ fun ffi_spark_frost_rust_future_complete_f32(
1013
+ `handle`: Long,
1014
+ uniffi_out_err: UniffiRustCallStatus,
1015
+ ): Float
1016
1016
 
1017
- fun ffi_spark_frost_rust_future_poll_f64(
1018
- `handle`: Long,
1019
- `callback`: UniffiRustFutureContinuationCallback,
1020
- `callbackData`: Long,
1021
- ): Unit
1017
+ fun ffi_spark_frost_rust_future_poll_f64(
1018
+ `handle`: Long,
1019
+ `callback`: UniffiRustFutureContinuationCallback,
1020
+ `callbackData`: Long,
1021
+ ): Unit
1022
1022
 
1023
- fun ffi_spark_frost_rust_future_cancel_f64(`handle`: Long): Unit
1023
+ fun ffi_spark_frost_rust_future_cancel_f64(`handle`: Long): Unit
1024
1024
 
1025
- fun ffi_spark_frost_rust_future_free_f64(`handle`: Long): Unit
1025
+ fun ffi_spark_frost_rust_future_free_f64(`handle`: Long): Unit
1026
1026
 
1027
- fun ffi_spark_frost_rust_future_complete_f64(
1028
- `handle`: Long,
1029
- uniffi_out_err: UniffiRustCallStatus,
1030
- ): Double
1027
+ fun ffi_spark_frost_rust_future_complete_f64(
1028
+ `handle`: Long,
1029
+ uniffi_out_err: UniffiRustCallStatus,
1030
+ ): Double
1031
1031
 
1032
- fun ffi_spark_frost_rust_future_poll_pointer(
1033
- `handle`: Long,
1034
- `callback`: UniffiRustFutureContinuationCallback,
1035
- `callbackData`: Long,
1036
- ): Unit
1032
+ fun ffi_spark_frost_rust_future_poll_pointer(
1033
+ `handle`: Long,
1034
+ `callback`: UniffiRustFutureContinuationCallback,
1035
+ `callbackData`: Long,
1036
+ ): Unit
1037
1037
 
1038
- fun ffi_spark_frost_rust_future_cancel_pointer(`handle`: Long): Unit
1038
+ fun ffi_spark_frost_rust_future_cancel_pointer(`handle`: Long): Unit
1039
1039
 
1040
- fun ffi_spark_frost_rust_future_free_pointer(`handle`: Long): Unit
1040
+ fun ffi_spark_frost_rust_future_free_pointer(`handle`: Long): Unit
1041
1041
 
1042
- fun ffi_spark_frost_rust_future_complete_pointer(
1043
- `handle`: Long,
1044
- uniffi_out_err: UniffiRustCallStatus,
1045
- ): Pointer
1042
+ fun ffi_spark_frost_rust_future_complete_pointer(
1043
+ `handle`: Long,
1044
+ uniffi_out_err: UniffiRustCallStatus,
1045
+ ): Pointer
1046
1046
 
1047
- fun ffi_spark_frost_rust_future_poll_rust_buffer(
1048
- `handle`: Long,
1049
- `callback`: UniffiRustFutureContinuationCallback,
1050
- `callbackData`: Long,
1051
- ): Unit
1047
+ fun ffi_spark_frost_rust_future_poll_rust_buffer(
1048
+ `handle`: Long,
1049
+ `callback`: UniffiRustFutureContinuationCallback,
1050
+ `callbackData`: Long,
1051
+ ): Unit
1052
1052
 
1053
- fun ffi_spark_frost_rust_future_cancel_rust_buffer(`handle`: Long): Unit
1053
+ fun ffi_spark_frost_rust_future_cancel_rust_buffer(`handle`: Long): Unit
1054
1054
 
1055
- fun ffi_spark_frost_rust_future_free_rust_buffer(`handle`: Long): Unit
1055
+ fun ffi_spark_frost_rust_future_free_rust_buffer(`handle`: Long): Unit
1056
1056
 
1057
- fun ffi_spark_frost_rust_future_complete_rust_buffer(
1058
- `handle`: Long,
1059
- uniffi_out_err: UniffiRustCallStatus,
1060
- ): RustBuffer.ByValue
1057
+ fun ffi_spark_frost_rust_future_complete_rust_buffer(
1058
+ `handle`: Long,
1059
+ uniffi_out_err: UniffiRustCallStatus,
1060
+ ): RustBuffer.ByValue
1061
1061
 
1062
- fun ffi_spark_frost_rust_future_poll_void(
1063
- `handle`: Long,
1064
- `callback`: UniffiRustFutureContinuationCallback,
1065
- `callbackData`: Long,
1066
- ): Unit
1062
+ fun ffi_spark_frost_rust_future_poll_void(
1063
+ `handle`: Long,
1064
+ `callback`: UniffiRustFutureContinuationCallback,
1065
+ `callbackData`: Long,
1066
+ ): Unit
1067
1067
 
1068
- fun ffi_spark_frost_rust_future_cancel_void(`handle`: Long): Unit
1068
+ fun ffi_spark_frost_rust_future_cancel_void(`handle`: Long): Unit
1069
1069
 
1070
- fun ffi_spark_frost_rust_future_free_void(`handle`: Long): Unit
1070
+ fun ffi_spark_frost_rust_future_free_void(`handle`: Long): Unit
1071
1071
 
1072
- fun ffi_spark_frost_rust_future_complete_void(
1073
- `handle`: Long,
1074
- uniffi_out_err: UniffiRustCallStatus,
1075
- ): Unit
1072
+ fun ffi_spark_frost_rust_future_complete_void(
1073
+ `handle`: Long,
1074
+ uniffi_out_err: UniffiRustCallStatus,
1075
+ ): Unit
1076
1076
 
1077
- fun uniffi_spark_frost_checksum_func_aggregate_frost(): Short
1077
+ fun uniffi_spark_frost_checksum_func_aggregate_frost(): Short
1078
1078
 
1079
- fun uniffi_spark_frost_checksum_func_construct_direct_refund_tx(): Short
1079
+ fun uniffi_spark_frost_checksum_func_construct_direct_refund_tx(): Short
1080
1080
 
1081
- fun uniffi_spark_frost_checksum_func_construct_node_tx(): Short
1081
+ fun uniffi_spark_frost_checksum_func_construct_node_tx(): Short
1082
1082
 
1083
- fun uniffi_spark_frost_checksum_func_construct_refund_tx(): Short
1083
+ fun uniffi_spark_frost_checksum_func_construct_refund_tx(): Short
1084
1084
 
1085
- fun uniffi_spark_frost_checksum_func_construct_split_tx(): Short
1085
+ fun uniffi_spark_frost_checksum_func_construct_split_tx(): Short
1086
1086
 
1087
- fun uniffi_spark_frost_checksum_func_create_dummy_tx(): Short
1087
+ fun uniffi_spark_frost_checksum_func_create_dummy_tx(): Short
1088
1088
 
1089
- fun uniffi_spark_frost_checksum_func_decrypt_ecies(): Short
1089
+ fun uniffi_spark_frost_checksum_func_decrypt_ecies(): Short
1090
1090
 
1091
- fun uniffi_spark_frost_checksum_func_encrypt_ecies(): Short
1091
+ fun uniffi_spark_frost_checksum_func_encrypt_ecies(): Short
1092
1092
 
1093
- fun uniffi_spark_frost_checksum_func_frost_nonce(): Short
1093
+ fun uniffi_spark_frost_checksum_func_frost_nonce(): Short
1094
1094
 
1095
- fun uniffi_spark_frost_checksum_func_get_taproot_pubkey(): Short
1095
+ fun uniffi_spark_frost_checksum_func_get_taproot_pubkey(): Short
1096
1096
 
1097
- fun uniffi_spark_frost_checksum_func_sign_frost(): Short
1097
+ fun uniffi_spark_frost_checksum_func_sign_frost(): Short
1098
1098
 
1099
- fun uniffi_spark_frost_checksum_func_validate_signature_share(): Short
1099
+ fun uniffi_spark_frost_checksum_func_validate_signature_share(): Short
1100
1100
 
1101
- fun ffi_spark_frost_uniffi_contract_version(): Int
1101
+ fun ffi_spark_frost_uniffi_contract_version(): Int
1102
1102
  }
1103
1103
 
1104
1104
  private fun uniffiCheckContractApiVersion(lib: UniffiLib) {
1105
- // Get the bindings contract version from our ComponentInterface
1106
- val bindings_contract_version = 26
1107
- // Get the scaffolding contract version by calling the into the dylib
1108
- val scaffolding_contract_version = lib.ffi_spark_frost_uniffi_contract_version()
1109
- if (bindings_contract_version != scaffolding_contract_version) {
1110
- throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
1111
- }
1105
+ // Get the bindings contract version from our ComponentInterface
1106
+ val bindings_contract_version = 26
1107
+ // Get the scaffolding contract version by calling the into the dylib
1108
+ val scaffolding_contract_version = lib.ffi_spark_frost_uniffi_contract_version()
1109
+ if (bindings_contract_version != scaffolding_contract_version) {
1110
+ throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
1111
+ }
1112
1112
  }
1113
1113
 
1114
1114
  @Suppress("UNUSED_PARAMETER")
1115
1115
  private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1116
- if (lib.uniffi_spark_frost_checksum_func_aggregate_frost() != 50841.toShort()) {
1117
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1118
- }
1119
- if (lib.uniffi_spark_frost_checksum_func_construct_direct_refund_tx() != 21321.toShort()) {
1120
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1121
- }
1122
- if (lib.uniffi_spark_frost_checksum_func_construct_node_tx() != 50549.toShort()) {
1123
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1124
- }
1125
- if (lib.uniffi_spark_frost_checksum_func_construct_refund_tx() != 47425.toShort()) {
1126
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1127
- }
1128
- if (lib.uniffi_spark_frost_checksum_func_construct_split_tx() != 55511.toShort()) {
1129
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1130
- }
1131
- if (lib.uniffi_spark_frost_checksum_func_create_dummy_tx() != 14929.toShort()) {
1132
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1133
- }
1134
- if (lib.uniffi_spark_frost_checksum_func_decrypt_ecies() != 30948.toShort()) {
1135
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1136
- }
1137
- if (lib.uniffi_spark_frost_checksum_func_encrypt_ecies() != 55565.toShort()) {
1138
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1139
- }
1140
- if (lib.uniffi_spark_frost_checksum_func_frost_nonce() != 5111.toShort()) {
1141
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1142
- }
1143
- if (lib.uniffi_spark_frost_checksum_func_get_taproot_pubkey() != 13153.toShort()) {
1144
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1145
- }
1146
- if (lib.uniffi_spark_frost_checksum_func_sign_frost() != 4845.toShort()) {
1147
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1148
- }
1149
- if (lib.uniffi_spark_frost_checksum_func_validate_signature_share() != 64132.toShort()) {
1150
- throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1151
- }
1116
+ if (lib.uniffi_spark_frost_checksum_func_aggregate_frost() != 50841.toShort()) {
1117
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1118
+ }
1119
+ if (lib.uniffi_spark_frost_checksum_func_construct_direct_refund_tx() != 21321.toShort()) {
1120
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1121
+ }
1122
+ if (lib.uniffi_spark_frost_checksum_func_construct_node_tx() != 50549.toShort()) {
1123
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1124
+ }
1125
+ if (lib.uniffi_spark_frost_checksum_func_construct_refund_tx() != 47425.toShort()) {
1126
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1127
+ }
1128
+ if (lib.uniffi_spark_frost_checksum_func_construct_split_tx() != 55511.toShort()) {
1129
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1130
+ }
1131
+ if (lib.uniffi_spark_frost_checksum_func_create_dummy_tx() != 14929.toShort()) {
1132
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1133
+ }
1134
+ if (lib.uniffi_spark_frost_checksum_func_decrypt_ecies() != 30948.toShort()) {
1135
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1136
+ }
1137
+ if (lib.uniffi_spark_frost_checksum_func_encrypt_ecies() != 55565.toShort()) {
1138
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1139
+ }
1140
+ if (lib.uniffi_spark_frost_checksum_func_frost_nonce() != 5111.toShort()) {
1141
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1142
+ }
1143
+ if (lib.uniffi_spark_frost_checksum_func_get_taproot_pubkey() != 13153.toShort()) {
1144
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1145
+ }
1146
+ if (lib.uniffi_spark_frost_checksum_func_sign_frost() != 4845.toShort()) {
1147
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1148
+ }
1149
+ if (lib.uniffi_spark_frost_checksum_func_validate_signature_share() != 64132.toShort()) {
1150
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1151
+ }
1152
1152
  }
1153
1153
 
1154
1154
  // Async support
@@ -1164,31 +1164,31 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1164
1164
  // The easiest way to ensure this method is called is to use the `.use`
1165
1165
  // helper method to execute a block and destroy the object at the end.
1166
1166
  interface Disposable {
1167
- fun destroy()
1167
+ fun destroy()
1168
1168
 
1169
- companion object {
1170
- fun destroy(vararg args: Any?) {
1171
- args
1172
- .filterIsInstance<Disposable>()
1173
- .forEach(Disposable::destroy)
1174
- }
1169
+ companion object {
1170
+ fun destroy(vararg args: Any?) {
1171
+ args
1172
+ .filterIsInstance<Disposable>()
1173
+ .forEach(Disposable::destroy)
1175
1174
  }
1175
+ }
1176
1176
  }
1177
1177
 
1178
1178
  /**
1179
1179
  * @suppress
1180
1180
  */
1181
1181
  inline fun <T : Disposable?, R> T.use(block: (T) -> R) =
1182
+ try {
1183
+ block(this)
1184
+ } finally {
1182
1185
  try {
1183
- block(this)
1184
- } finally {
1185
- try {
1186
- // N.B. our implementation is on the nullable type `Disposable?`.
1187
- this?.destroy()
1188
- } catch (e: Throwable) {
1189
- // swallow
1190
- }
1186
+ // N.B. our implementation is on the nullable type `Disposable?`.
1187
+ this?.destroy()
1188
+ } catch (e: Throwable) {
1189
+ // swallow
1191
1190
  }
1191
+ }
1192
1192
 
1193
1193
  /**
1194
1194
  * Used to instantiate an interface without an actual pointer, for fakes in tests, mostly.
@@ -1201,756 +1201,750 @@ object NoPointer
1201
1201
  * @suppress
1202
1202
  */
1203
1203
  public object FfiConverterUShort : FfiConverter<UShort, Short> {
1204
- override fun lift(value: Short): UShort = value.toUShort()
1204
+ override fun lift(value: Short): UShort = value.toUShort()
1205
1205
 
1206
- override fun read(buf: ByteBuffer): UShort = lift(buf.getShort())
1206
+ override fun read(buf: ByteBuffer): UShort = lift(buf.getShort())
1207
1207
 
1208
- override fun lower(value: UShort): Short = value.toShort()
1208
+ override fun lower(value: UShort): Short = value.toShort()
1209
1209
 
1210
- override fun allocationSize(value: UShort) = 2UL
1210
+ override fun allocationSize(value: UShort) = 2UL
1211
1211
 
1212
- override fun write(
1213
- value: UShort,
1214
- buf: ByteBuffer,
1215
- ) {
1216
- buf.putShort(value.toShort())
1217
- }
1212
+ override fun write(
1213
+ value: UShort,
1214
+ buf: ByteBuffer,
1215
+ ) {
1216
+ buf.putShort(value.toShort())
1217
+ }
1218
1218
  }
1219
1219
 
1220
1220
  /**
1221
1221
  * @suppress
1222
1222
  */
1223
1223
  public object FfiConverterUInt : FfiConverter<UInt, Int> {
1224
- override fun lift(value: Int): UInt = value.toUInt()
1224
+ override fun lift(value: Int): UInt = value.toUInt()
1225
1225
 
1226
- override fun read(buf: ByteBuffer): UInt = lift(buf.getInt())
1226
+ override fun read(buf: ByteBuffer): UInt = lift(buf.getInt())
1227
1227
 
1228
- override fun lower(value: UInt): Int = value.toInt()
1228
+ override fun lower(value: UInt): Int = value.toInt()
1229
1229
 
1230
- override fun allocationSize(value: UInt) = 4UL
1230
+ override fun allocationSize(value: UInt) = 4UL
1231
1231
 
1232
- override fun write(
1233
- value: UInt,
1234
- buf: ByteBuffer,
1235
- ) {
1236
- buf.putInt(value.toInt())
1237
- }
1232
+ override fun write(
1233
+ value: UInt,
1234
+ buf: ByteBuffer,
1235
+ ) {
1236
+ buf.putInt(value.toInt())
1237
+ }
1238
1238
  }
1239
1239
 
1240
1240
  /**
1241
1241
  * @suppress
1242
1242
  */
1243
1243
  public object FfiConverterULong : FfiConverter<ULong, Long> {
1244
- override fun lift(value: Long): ULong = value.toULong()
1244
+ override fun lift(value: Long): ULong = value.toULong()
1245
1245
 
1246
- override fun read(buf: ByteBuffer): ULong = lift(buf.getLong())
1246
+ override fun read(buf: ByteBuffer): ULong = lift(buf.getLong())
1247
1247
 
1248
- override fun lower(value: ULong): Long = value.toLong()
1248
+ override fun lower(value: ULong): Long = value.toLong()
1249
1249
 
1250
- override fun allocationSize(value: ULong) = 8UL
1250
+ override fun allocationSize(value: ULong) = 8UL
1251
1251
 
1252
- override fun write(
1253
- value: ULong,
1254
- buf: ByteBuffer,
1255
- ) {
1256
- buf.putLong(value.toLong())
1257
- }
1252
+ override fun write(
1253
+ value: ULong,
1254
+ buf: ByteBuffer,
1255
+ ) {
1256
+ buf.putLong(value.toLong())
1257
+ }
1258
1258
  }
1259
1259
 
1260
1260
  /**
1261
1261
  * @suppress
1262
1262
  */
1263
1263
  public object FfiConverterBoolean : FfiConverter<Boolean, Byte> {
1264
- override fun lift(value: Byte): Boolean = value.toInt() != 0
1264
+ override fun lift(value: Byte): Boolean = value.toInt() != 0
1265
1265
 
1266
- override fun read(buf: ByteBuffer): Boolean = lift(buf.get())
1266
+ override fun read(buf: ByteBuffer): Boolean = lift(buf.get())
1267
1267
 
1268
- override fun lower(value: Boolean): Byte = if (value) 1.toByte() else 0.toByte()
1268
+ override fun lower(value: Boolean): Byte = if (value) 1.toByte() else 0.toByte()
1269
1269
 
1270
- override fun allocationSize(value: Boolean) = 1UL
1270
+ override fun allocationSize(value: Boolean) = 1UL
1271
1271
 
1272
- override fun write(
1273
- value: Boolean,
1274
- buf: ByteBuffer,
1275
- ) {
1276
- buf.put(lower(value))
1277
- }
1272
+ override fun write(
1273
+ value: Boolean,
1274
+ buf: ByteBuffer,
1275
+ ) {
1276
+ buf.put(lower(value))
1277
+ }
1278
1278
  }
1279
1279
 
1280
1280
  /**
1281
1281
  * @suppress
1282
1282
  */
1283
1283
  public object FfiConverterString : FfiConverter<String, RustBuffer.ByValue> {
1284
- // Note: we don't inherit from FfiConverterRustBuffer, because we use a
1285
- // special encoding when lowering/lifting. We can use `RustBuffer.len` to
1286
- // store our length and avoid writing it out to the buffer.
1287
- override fun lift(value: RustBuffer.ByValue): String {
1288
- try {
1289
- val byteArr = ByteArray(value.len.toInt())
1290
- value.asByteBuffer()!!.get(byteArr)
1291
- return byteArr.toString(Charsets.UTF_8)
1292
- } finally {
1293
- RustBuffer.free(value)
1294
- }
1295
- }
1296
-
1297
- override fun read(buf: ByteBuffer): String {
1298
- val len = buf.getInt()
1299
- val byteArr = ByteArray(len)
1300
- buf.get(byteArr)
1301
- return byteArr.toString(Charsets.UTF_8)
1302
- }
1303
-
1304
- fun toUtf8(value: String): ByteBuffer {
1305
- // Make sure we don't have invalid UTF-16, check for lone surrogates.
1306
- return Charsets.UTF_8.newEncoder().run {
1307
- onMalformedInput(CodingErrorAction.REPORT)
1308
- encode(CharBuffer.wrap(value))
1309
- }
1310
- }
1311
-
1312
- override fun lower(value: String): RustBuffer.ByValue {
1313
- val byteBuf = toUtf8(value)
1314
- // Ideally we'd pass these bytes to `ffi_bytebuffer_from_bytes`, but doing so would require us
1315
- // to copy them into a JNA `Memory`. So we might as well directly copy them into a `RustBuffer`.
1316
- val rbuf = RustBuffer.alloc(byteBuf.limit().toULong())
1317
- rbuf.asByteBuffer()!!.put(byteBuf)
1318
- return rbuf
1319
- }
1320
-
1321
- // We aren't sure exactly how many bytes our string will be once it's UTF-8
1322
- // encoded. Allocate 3 bytes per UTF-16 code unit which will always be
1323
- // enough.
1324
- override fun allocationSize(value: String): ULong {
1325
- val sizeForLength = 4UL
1326
- val sizeForString = value.length.toULong() * 3UL
1327
- return sizeForLength + sizeForString
1328
- }
1329
-
1330
- override fun write(
1331
- value: String,
1332
- buf: ByteBuffer,
1333
- ) {
1334
- val byteBuf = toUtf8(value)
1335
- buf.putInt(byteBuf.limit())
1336
- buf.put(byteBuf)
1337
- }
1284
+ // Note: we don't inherit from FfiConverterRustBuffer, because we use a
1285
+ // special encoding when lowering/lifting. We can use `RustBuffer.len` to
1286
+ // store our length and avoid writing it out to the buffer.
1287
+ override fun lift(value: RustBuffer.ByValue): String {
1288
+ try {
1289
+ val byteArr = ByteArray(value.len.toInt())
1290
+ value.asByteBuffer()!!.get(byteArr)
1291
+ return byteArr.toString(Charsets.UTF_8)
1292
+ } finally {
1293
+ RustBuffer.free(value)
1294
+ }
1295
+ }
1296
+
1297
+ override fun read(buf: ByteBuffer): String {
1298
+ val len = buf.getInt()
1299
+ val byteArr = ByteArray(len)
1300
+ buf.get(byteArr)
1301
+ return byteArr.toString(Charsets.UTF_8)
1302
+ }
1303
+
1304
+ fun toUtf8(value: String): ByteBuffer {
1305
+ // Make sure we don't have invalid UTF-16, check for lone surrogates.
1306
+ return Charsets.UTF_8.newEncoder().run {
1307
+ onMalformedInput(CodingErrorAction.REPORT)
1308
+ encode(CharBuffer.wrap(value))
1309
+ }
1310
+ }
1311
+
1312
+ override fun lower(value: String): RustBuffer.ByValue {
1313
+ val byteBuf = toUtf8(value)
1314
+ // Ideally we'd pass these bytes to `ffi_bytebuffer_from_bytes`, but doing so would require us
1315
+ // to copy them into a JNA `Memory`. So we might as well directly copy them into a `RustBuffer`.
1316
+ val rbuf = RustBuffer.alloc(byteBuf.limit().toULong())
1317
+ rbuf.asByteBuffer()!!.put(byteBuf)
1318
+ return rbuf
1319
+ }
1320
+
1321
+ // We aren't sure exactly how many bytes our string will be once it's UTF-8
1322
+ // encoded. Allocate 3 bytes per UTF-16 code unit which will always be
1323
+ // enough.
1324
+ override fun allocationSize(value: String): ULong {
1325
+ val sizeForLength = 4UL
1326
+ val sizeForString = value.length.toULong() * 3UL
1327
+ return sizeForLength + sizeForString
1328
+ }
1329
+
1330
+ override fun write(
1331
+ value: String,
1332
+ buf: ByteBuffer,
1333
+ ) {
1334
+ val byteBuf = toUtf8(value)
1335
+ buf.putInt(byteBuf.limit())
1336
+ buf.put(byteBuf)
1337
+ }
1338
1338
  }
1339
1339
 
1340
1340
  /**
1341
1341
  * @suppress
1342
1342
  */
1343
1343
  public object FfiConverterByteArray : FfiConverterRustBuffer<ByteArray> {
1344
- override fun read(buf: ByteBuffer): ByteArray {
1345
- val len = buf.getInt()
1346
- val byteArr = ByteArray(len)
1347
- buf.get(byteArr)
1348
- return byteArr
1349
- }
1344
+ override fun read(buf: ByteBuffer): ByteArray {
1345
+ val len = buf.getInt()
1346
+ val byteArr = ByteArray(len)
1347
+ buf.get(byteArr)
1348
+ return byteArr
1349
+ }
1350
1350
 
1351
- override fun allocationSize(value: ByteArray): ULong = 4UL + value.size.toULong()
1351
+ override fun allocationSize(value: ByteArray): ULong = 4UL + value.size.toULong()
1352
1352
 
1353
- override fun write(
1354
- value: ByteArray,
1355
- buf: ByteBuffer,
1356
- ) {
1357
- buf.putInt(value.size)
1358
- buf.put(value)
1359
- }
1353
+ override fun write(
1354
+ value: ByteArray,
1355
+ buf: ByteBuffer,
1356
+ ) {
1357
+ buf.putInt(value.size)
1358
+ buf.put(value)
1359
+ }
1360
1360
  }
1361
1361
 
1362
1362
  data class DummyTx(
1363
- var `tx`: kotlin.ByteArray,
1364
- var `txid`: kotlin.String,
1363
+ var `tx`: kotlin.ByteArray,
1364
+ var `txid`: kotlin.String,
1365
1365
  ) {
1366
- companion object
1366
+ companion object
1367
1367
  }
1368
1368
 
1369
1369
  /**
1370
1370
  * @suppress
1371
1371
  */
1372
1372
  public object FfiConverterTypeDummyTx : FfiConverterRustBuffer<DummyTx> {
1373
- override fun read(buf: ByteBuffer): DummyTx =
1374
- DummyTx(
1375
- FfiConverterByteArray.read(buf),
1376
- FfiConverterString.read(buf),
1377
- )
1378
-
1379
- override fun allocationSize(value: DummyTx) =
1380
- (
1381
- FfiConverterByteArray.allocationSize(value.`tx`) +
1382
- FfiConverterString.allocationSize(value.`txid`)
1383
- )
1384
-
1385
- override fun write(
1386
- value: DummyTx,
1387
- buf: ByteBuffer,
1388
- ) {
1389
- FfiConverterByteArray.write(value.`tx`, buf)
1390
- FfiConverterString.write(value.`txid`, buf)
1391
- }
1373
+ override fun read(buf: ByteBuffer): DummyTx =
1374
+ DummyTx(
1375
+ FfiConverterByteArray.read(buf),
1376
+ FfiConverterString.read(buf),
1377
+ )
1378
+
1379
+ override fun allocationSize(value: DummyTx) =
1380
+ (
1381
+ FfiConverterByteArray.allocationSize(value.`tx`) +
1382
+ FfiConverterString.allocationSize(value.`txid`)
1383
+ )
1384
+
1385
+ override fun write(
1386
+ value: DummyTx,
1387
+ buf: ByteBuffer,
1388
+ ) {
1389
+ FfiConverterByteArray.write(value.`tx`, buf)
1390
+ FfiConverterString.write(value.`txid`, buf)
1391
+ }
1392
1392
  }
1393
1393
 
1394
1394
  data class KeyPackage(
1395
- var `secretKey`: kotlin.ByteArray,
1396
- var `publicKey`: kotlin.ByteArray,
1397
- var `verifyingKey`: kotlin.ByteArray,
1395
+ var `secretKey`: kotlin.ByteArray,
1396
+ var `publicKey`: kotlin.ByteArray,
1397
+ var `verifyingKey`: kotlin.ByteArray,
1398
1398
  ) {
1399
- companion object
1399
+ companion object
1400
1400
  }
1401
1401
 
1402
1402
  /**
1403
1403
  * @suppress
1404
1404
  */
1405
1405
  public object FfiConverterTypeKeyPackage : FfiConverterRustBuffer<KeyPackage> {
1406
- override fun read(buf: ByteBuffer): KeyPackage =
1407
- KeyPackage(
1408
- FfiConverterByteArray.read(buf),
1409
- FfiConverterByteArray.read(buf),
1410
- FfiConverterByteArray.read(buf),
1411
- )
1412
-
1413
- override fun allocationSize(value: KeyPackage) =
1414
- (
1415
- FfiConverterByteArray.allocationSize(value.`secretKey`) +
1416
- FfiConverterByteArray.allocationSize(value.`publicKey`) +
1417
- FfiConverterByteArray.allocationSize(value.`verifyingKey`)
1418
- )
1419
-
1420
- override fun write(
1421
- value: KeyPackage,
1422
- buf: ByteBuffer,
1423
- ) {
1424
- FfiConverterByteArray.write(value.`secretKey`, buf)
1425
- FfiConverterByteArray.write(value.`publicKey`, buf)
1426
- FfiConverterByteArray.write(value.`verifyingKey`, buf)
1427
- }
1406
+ override fun read(buf: ByteBuffer): KeyPackage =
1407
+ KeyPackage(
1408
+ FfiConverterByteArray.read(buf),
1409
+ FfiConverterByteArray.read(buf),
1410
+ FfiConverterByteArray.read(buf),
1411
+ )
1412
+
1413
+ override fun allocationSize(value: KeyPackage) =
1414
+ (
1415
+ FfiConverterByteArray.allocationSize(value.`secretKey`) +
1416
+ FfiConverterByteArray.allocationSize(value.`publicKey`) +
1417
+ FfiConverterByteArray.allocationSize(value.`verifyingKey`)
1418
+ )
1419
+
1420
+ override fun write(
1421
+ value: KeyPackage,
1422
+ buf: ByteBuffer,
1423
+ ) {
1424
+ FfiConverterByteArray.write(value.`secretKey`, buf)
1425
+ FfiConverterByteArray.write(value.`publicKey`, buf)
1426
+ FfiConverterByteArray.write(value.`verifyingKey`, buf)
1427
+ }
1428
1428
  }
1429
1429
 
1430
1430
  data class NonceResult(
1431
- var `nonce`: SigningNonce,
1432
- var `commitment`: SigningCommitment,
1431
+ var `nonce`: SigningNonce,
1432
+ var `commitment`: SigningCommitment,
1433
1433
  ) {
1434
- companion object
1434
+ companion object
1435
1435
  }
1436
1436
 
1437
1437
  /**
1438
1438
  * @suppress
1439
1439
  */
1440
1440
  public object FfiConverterTypeNonceResult : FfiConverterRustBuffer<NonceResult> {
1441
- override fun read(buf: ByteBuffer): NonceResult =
1442
- NonceResult(
1443
- FfiConverterTypeSigningNonce.read(buf),
1444
- FfiConverterTypeSigningCommitment.read(buf),
1445
- )
1446
-
1447
- override fun allocationSize(value: NonceResult) =
1448
- (
1449
- FfiConverterTypeSigningNonce.allocationSize(value.`nonce`) +
1450
- FfiConverterTypeSigningCommitment.allocationSize(value.`commitment`)
1451
- )
1452
-
1453
- override fun write(
1454
- value: NonceResult,
1455
- buf: ByteBuffer,
1456
- ) {
1457
- FfiConverterTypeSigningNonce.write(value.`nonce`, buf)
1458
- FfiConverterTypeSigningCommitment.write(value.`commitment`, buf)
1459
- }
1441
+ override fun read(buf: ByteBuffer): NonceResult =
1442
+ NonceResult(
1443
+ FfiConverterTypeSigningNonce.read(buf),
1444
+ FfiConverterTypeSigningCommitment.read(buf),
1445
+ )
1446
+
1447
+ override fun allocationSize(value: NonceResult) =
1448
+ (
1449
+ FfiConverterTypeSigningNonce.allocationSize(value.`nonce`) +
1450
+ FfiConverterTypeSigningCommitment.allocationSize(value.`commitment`)
1451
+ )
1452
+
1453
+ override fun write(
1454
+ value: NonceResult,
1455
+ buf: ByteBuffer,
1456
+ ) {
1457
+ FfiConverterTypeSigningNonce.write(value.`nonce`, buf)
1458
+ FfiConverterTypeSigningCommitment.write(value.`commitment`, buf)
1459
+ }
1460
1460
  }
1461
1461
 
1462
1462
  data class SigningCommitment(
1463
- var `hiding`: kotlin.ByteArray,
1464
- var `binding`: kotlin.ByteArray,
1463
+ var `hiding`: kotlin.ByteArray,
1464
+ var `binding`: kotlin.ByteArray,
1465
1465
  ) {
1466
- companion object
1466
+ companion object
1467
1467
  }
1468
1468
 
1469
1469
  /**
1470
1470
  * @suppress
1471
1471
  */
1472
1472
  public object FfiConverterTypeSigningCommitment : FfiConverterRustBuffer<SigningCommitment> {
1473
- override fun read(buf: ByteBuffer): SigningCommitment =
1474
- SigningCommitment(
1475
- FfiConverterByteArray.read(buf),
1476
- FfiConverterByteArray.read(buf),
1477
- )
1478
-
1479
- override fun allocationSize(value: SigningCommitment) =
1480
- (
1481
- FfiConverterByteArray.allocationSize(value.`hiding`) +
1482
- FfiConverterByteArray.allocationSize(value.`binding`)
1483
- )
1484
-
1485
- override fun write(
1486
- value: SigningCommitment,
1487
- buf: ByteBuffer,
1488
- ) {
1489
- FfiConverterByteArray.write(value.`hiding`, buf)
1490
- FfiConverterByteArray.write(value.`binding`, buf)
1491
- }
1473
+ override fun read(buf: ByteBuffer): SigningCommitment =
1474
+ SigningCommitment(
1475
+ FfiConverterByteArray.read(buf),
1476
+ FfiConverterByteArray.read(buf),
1477
+ )
1478
+
1479
+ override fun allocationSize(value: SigningCommitment) =
1480
+ (
1481
+ FfiConverterByteArray.allocationSize(value.`hiding`) +
1482
+ FfiConverterByteArray.allocationSize(value.`binding`)
1483
+ )
1484
+
1485
+ override fun write(
1486
+ value: SigningCommitment,
1487
+ buf: ByteBuffer,
1488
+ ) {
1489
+ FfiConverterByteArray.write(value.`hiding`, buf)
1490
+ FfiConverterByteArray.write(value.`binding`, buf)
1491
+ }
1492
1492
  }
1493
1493
 
1494
1494
  data class SigningNonce(
1495
- var `hiding`: kotlin.ByteArray,
1496
- var `binding`: kotlin.ByteArray,
1495
+ var `hiding`: kotlin.ByteArray,
1496
+ var `binding`: kotlin.ByteArray,
1497
1497
  ) {
1498
- companion object
1498
+ companion object
1499
1499
  }
1500
1500
 
1501
1501
  /**
1502
1502
  * @suppress
1503
1503
  */
1504
1504
  public object FfiConverterTypeSigningNonce : FfiConverterRustBuffer<SigningNonce> {
1505
- override fun read(buf: ByteBuffer): SigningNonce =
1506
- SigningNonce(
1507
- FfiConverterByteArray.read(buf),
1508
- FfiConverterByteArray.read(buf),
1509
- )
1510
-
1511
- override fun allocationSize(value: SigningNonce) =
1512
- (
1513
- FfiConverterByteArray.allocationSize(value.`hiding`) +
1514
- FfiConverterByteArray.allocationSize(value.`binding`)
1515
- )
1516
-
1517
- override fun write(
1518
- value: SigningNonce,
1519
- buf: ByteBuffer,
1520
- ) {
1521
- FfiConverterByteArray.write(value.`hiding`, buf)
1522
- FfiConverterByteArray.write(value.`binding`, buf)
1523
- }
1505
+ override fun read(buf: ByteBuffer): SigningNonce =
1506
+ SigningNonce(
1507
+ FfiConverterByteArray.read(buf),
1508
+ FfiConverterByteArray.read(buf),
1509
+ )
1510
+
1511
+ override fun allocationSize(value: SigningNonce) =
1512
+ (
1513
+ FfiConverterByteArray.allocationSize(value.`hiding`) +
1514
+ FfiConverterByteArray.allocationSize(value.`binding`)
1515
+ )
1516
+
1517
+ override fun write(
1518
+ value: SigningNonce,
1519
+ buf: ByteBuffer,
1520
+ ) {
1521
+ FfiConverterByteArray.write(value.`hiding`, buf)
1522
+ FfiConverterByteArray.write(value.`binding`, buf)
1523
+ }
1524
1524
  }
1525
1525
 
1526
1526
  data class TransactionResult(
1527
- var `tx`: kotlin.ByteArray,
1528
- var `sighash`: kotlin.ByteArray,
1527
+ var `tx`: kotlin.ByteArray,
1528
+ var `sighash`: kotlin.ByteArray,
1529
1529
  ) {
1530
- companion object
1530
+ companion object
1531
1531
  }
1532
1532
 
1533
1533
  /**
1534
1534
  * @suppress
1535
1535
  */
1536
1536
  public object FfiConverterTypeTransactionResult : FfiConverterRustBuffer<TransactionResult> {
1537
- override fun read(buf: ByteBuffer): TransactionResult =
1538
- TransactionResult(
1539
- FfiConverterByteArray.read(buf),
1540
- FfiConverterByteArray.read(buf),
1541
- )
1542
-
1543
- override fun allocationSize(value: TransactionResult) =
1544
- (
1545
- FfiConverterByteArray.allocationSize(value.`tx`) +
1546
- FfiConverterByteArray.allocationSize(value.`sighash`)
1547
- )
1548
-
1549
- override fun write(
1550
- value: TransactionResult,
1551
- buf: ByteBuffer,
1552
- ) {
1553
- FfiConverterByteArray.write(value.`tx`, buf)
1554
- FfiConverterByteArray.write(value.`sighash`, buf)
1555
- }
1537
+ override fun read(buf: ByteBuffer): TransactionResult =
1538
+ TransactionResult(
1539
+ FfiConverterByteArray.read(buf),
1540
+ FfiConverterByteArray.read(buf),
1541
+ )
1542
+
1543
+ override fun allocationSize(value: TransactionResult) =
1544
+ (
1545
+ FfiConverterByteArray.allocationSize(value.`tx`) +
1546
+ FfiConverterByteArray.allocationSize(value.`sighash`)
1547
+ )
1548
+
1549
+ override fun write(
1550
+ value: TransactionResult,
1551
+ buf: ByteBuffer,
1552
+ ) {
1553
+ FfiConverterByteArray.write(value.`tx`, buf)
1554
+ FfiConverterByteArray.write(value.`sighash`, buf)
1555
+ }
1556
1556
  }
1557
1557
 
1558
1558
  sealed class Exception(
1559
- message: String,
1559
+ message: String,
1560
1560
  ) : kotlin.Exception(message) {
1561
- class Spark(
1562
- message: String,
1563
- ) : Exception(message)
1561
+ class Spark(
1562
+ message: String,
1563
+ ) : Exception(message)
1564
1564
 
1565
- companion object ErrorHandler : UniffiRustCallStatusErrorHandler<Exception> {
1566
- override fun lift(error_buf: RustBuffer.ByValue): Exception = FfiConverterTypeError.lift(error_buf)
1567
- }
1565
+ companion object ErrorHandler : UniffiRustCallStatusErrorHandler<Exception> {
1566
+ override fun lift(error_buf: RustBuffer.ByValue): Exception = FfiConverterTypeError.lift(error_buf)
1567
+ }
1568
1568
  }
1569
1569
 
1570
1570
  /**
1571
1571
  * @suppress
1572
1572
  */
1573
1573
  public object FfiConverterTypeError : FfiConverterRustBuffer<Exception> {
1574
- override fun read(buf: ByteBuffer): Exception =
1575
- when (buf.getInt()) {
1576
- 1 -> Exception.Spark(FfiConverterString.read(buf))
1577
- else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
1578
- }
1579
-
1580
- override fun allocationSize(value: Exception): ULong = 4UL
1581
-
1582
- override fun write(
1583
- value: Exception,
1584
- buf: ByteBuffer,
1585
- ) {
1586
- when (value) {
1587
- is Exception.Spark -> {
1588
- buf.putInt(1)
1589
- Unit
1590
- }
1591
- }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
1574
+ override fun read(buf: ByteBuffer): Exception =
1575
+ when (buf.getInt()) {
1576
+ 1 -> Exception.Spark(FfiConverterString.read(buf))
1577
+ else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
1592
1578
  }
1579
+
1580
+ override fun allocationSize(value: Exception): ULong = 4UL
1581
+
1582
+ override fun write(
1583
+ value: Exception,
1584
+ buf: ByteBuffer,
1585
+ ) {
1586
+ when (value) {
1587
+ is Exception.Spark -> {
1588
+ buf.putInt(1)
1589
+ Unit
1590
+ }
1591
+ }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
1592
+ }
1593
1593
  }
1594
1594
 
1595
1595
  /**
1596
1596
  * @suppress
1597
1597
  */
1598
1598
  public object FfiConverterOptionalByteArray : FfiConverterRustBuffer<kotlin.ByteArray?> {
1599
- override fun read(buf: ByteBuffer): kotlin.ByteArray? {
1600
- if (buf.get().toInt() == 0) {
1601
- return null
1602
- }
1603
- return FfiConverterByteArray.read(buf)
1599
+ override fun read(buf: ByteBuffer): kotlin.ByteArray? {
1600
+ if (buf.get().toInt() == 0) {
1601
+ return null
1604
1602
  }
1603
+ return FfiConverterByteArray.read(buf)
1604
+ }
1605
1605
 
1606
- override fun allocationSize(value: kotlin.ByteArray?): ULong {
1607
- if (value == null) {
1608
- return 1UL
1609
- } else {
1610
- return 1UL + FfiConverterByteArray.allocationSize(value)
1611
- }
1606
+ override fun allocationSize(value: kotlin.ByteArray?): ULong {
1607
+ if (value == null) {
1608
+ return 1UL
1609
+ } else {
1610
+ return 1UL + FfiConverterByteArray.allocationSize(value)
1612
1611
  }
1612
+ }
1613
1613
 
1614
- override fun write(
1615
- value: kotlin.ByteArray?,
1616
- buf: ByteBuffer,
1617
- ) {
1618
- if (value == null) {
1619
- buf.put(0)
1620
- } else {
1621
- buf.put(1)
1622
- FfiConverterByteArray.write(value, buf)
1623
- }
1614
+ override fun write(
1615
+ value: kotlin.ByteArray?,
1616
+ buf: ByteBuffer,
1617
+ ) {
1618
+ if (value == null) {
1619
+ buf.put(0)
1620
+ } else {
1621
+ buf.put(1)
1622
+ FfiConverterByteArray.write(value, buf)
1624
1623
  }
1624
+ }
1625
1625
  }
1626
1626
 
1627
1627
  /**
1628
1628
  * @suppress
1629
1629
  */
1630
1630
  public object FfiConverterSequenceString : FfiConverterRustBuffer<List<kotlin.String>> {
1631
- override fun read(buf: ByteBuffer): List<kotlin.String> {
1632
- val len = buf.getInt()
1633
- return List<kotlin.String>(len) {
1634
- FfiConverterString.read(buf)
1635
- }
1631
+ override fun read(buf: ByteBuffer): List<kotlin.String> {
1632
+ val len = buf.getInt()
1633
+ return List<kotlin.String>(len) {
1634
+ FfiConverterString.read(buf)
1636
1635
  }
1636
+ }
1637
1637
 
1638
- override fun allocationSize(value: List<kotlin.String>): ULong {
1639
- val sizeForLength = 4UL
1640
- val sizeForItems = value.map { FfiConverterString.allocationSize(it) }.sum()
1641
- return sizeForLength + sizeForItems
1642
- }
1638
+ override fun allocationSize(value: List<kotlin.String>): ULong {
1639
+ val sizeForLength = 4UL
1640
+ val sizeForItems = value.map { FfiConverterString.allocationSize(it) }.sum()
1641
+ return sizeForLength + sizeForItems
1642
+ }
1643
1643
 
1644
- override fun write(
1645
- value: List<kotlin.String>,
1646
- buf: ByteBuffer,
1647
- ) {
1648
- buf.putInt(value.size)
1649
- value.iterator().forEach {
1650
- FfiConverterString.write(it, buf)
1651
- }
1644
+ override fun write(
1645
+ value: List<kotlin.String>,
1646
+ buf: ByteBuffer,
1647
+ ) {
1648
+ buf.putInt(value.size)
1649
+ value.iterator().forEach {
1650
+ FfiConverterString.write(it, buf)
1652
1651
  }
1652
+ }
1653
1653
  }
1654
1654
 
1655
1655
  /**
1656
1656
  * @suppress
1657
1657
  */
1658
1658
  public object FfiConverterMapStringByteArray : FfiConverterRustBuffer<Map<kotlin.String, kotlin.ByteArray>> {
1659
- override fun read(buf: ByteBuffer): Map<kotlin.String, kotlin.ByteArray> {
1660
- val len = buf.getInt()
1661
- return buildMap<kotlin.String, kotlin.ByteArray>(len) {
1662
- repeat(len) {
1663
- val k = FfiConverterString.read(buf)
1664
- val v = FfiConverterByteArray.read(buf)
1665
- this[k] = v
1666
- }
1667
- }
1668
- }
1669
-
1670
- override fun allocationSize(value: Map<kotlin.String, kotlin.ByteArray>): ULong {
1671
- val spaceForMapSize = 4UL
1672
- val spaceForChildren =
1673
- value
1674
- .map { (k, v) ->
1675
- FfiConverterString.allocationSize(k) +
1676
- FfiConverterByteArray.allocationSize(v)
1677
- }.sum()
1678
- return spaceForMapSize + spaceForChildren
1679
- }
1680
-
1681
- override fun write(
1682
- value: Map<kotlin.String, kotlin.ByteArray>,
1683
- buf: ByteBuffer,
1684
- ) {
1685
- buf.putInt(value.size)
1686
- // The parens on `(k, v)` here ensure we're calling the right method,
1687
- // which is important for compatibility with older android devices.
1688
- // Ref https://blog.danlew.net/2017/03/16/kotlin-puzzler-whose-line-is-it-anyways/
1689
- value.forEach { (k, v) ->
1690
- FfiConverterString.write(k, buf)
1691
- FfiConverterByteArray.write(v, buf)
1692
- }
1693
- }
1659
+ override fun read(buf: ByteBuffer): Map<kotlin.String, kotlin.ByteArray> {
1660
+ val len = buf.getInt()
1661
+ return buildMap<kotlin.String, kotlin.ByteArray>(len) {
1662
+ repeat(len) {
1663
+ val k = FfiConverterString.read(buf)
1664
+ val v = FfiConverterByteArray.read(buf)
1665
+ this[k] = v
1666
+ }
1667
+ }
1668
+ }
1669
+
1670
+ override fun allocationSize(value: Map<kotlin.String, kotlin.ByteArray>): ULong {
1671
+ val spaceForMapSize = 4UL
1672
+ val spaceForChildren =
1673
+ value
1674
+ .map { (k, v) ->
1675
+ FfiConverterString.allocationSize(k) +
1676
+ FfiConverterByteArray.allocationSize(v)
1677
+ }.sum()
1678
+ return spaceForMapSize + spaceForChildren
1679
+ }
1680
+
1681
+ override fun write(
1682
+ value: Map<kotlin.String, kotlin.ByteArray>,
1683
+ buf: ByteBuffer,
1684
+ ) {
1685
+ buf.putInt(value.size)
1686
+ // The parens on `(k, v)` here ensure we're calling the right method,
1687
+ // which is important for compatibility with older android devices.
1688
+ // Ref https://blog.danlew.net/2017/03/16/kotlin-puzzler-whose-line-is-it-anyways/
1689
+ value.forEach { (k, v) ->
1690
+ FfiConverterString.write(k, buf)
1691
+ FfiConverterByteArray.write(v, buf)
1692
+ }
1693
+ }
1694
1694
  }
1695
1695
 
1696
1696
  /**
1697
1697
  * @suppress
1698
1698
  */
1699
1699
  public object FfiConverterMapStringTypeSigningCommitment : FfiConverterRustBuffer<Map<kotlin.String, SigningCommitment>> {
1700
- override fun read(buf: ByteBuffer): Map<kotlin.String, SigningCommitment> {
1701
- val len = buf.getInt()
1702
- return buildMap<kotlin.String, SigningCommitment>(len) {
1703
- repeat(len) {
1704
- val k = FfiConverterString.read(buf)
1705
- val v = FfiConverterTypeSigningCommitment.read(buf)
1706
- this[k] = v
1707
- }
1708
- }
1709
- }
1710
-
1711
- override fun allocationSize(value: Map<kotlin.String, SigningCommitment>): ULong {
1712
- val spaceForMapSize = 4UL
1713
- val spaceForChildren =
1714
- value
1715
- .map { (k, v) ->
1716
- FfiConverterString.allocationSize(k) +
1717
- FfiConverterTypeSigningCommitment.allocationSize(v)
1718
- }.sum()
1719
- return spaceForMapSize + spaceForChildren
1720
- }
1721
-
1722
- override fun write(
1723
- value: Map<kotlin.String, SigningCommitment>,
1724
- buf: ByteBuffer,
1725
- ) {
1726
- buf.putInt(value.size)
1727
- // The parens on `(k, v)` here ensure we're calling the right method,
1728
- // which is important for compatibility with older android devices.
1729
- // Ref https://blog.danlew.net/2017/03/16/kotlin-puzzler-whose-line-is-it-anyways/
1730
- value.forEach { (k, v) ->
1731
- FfiConverterString.write(k, buf)
1732
- FfiConverterTypeSigningCommitment.write(v, buf)
1733
- }
1734
- }
1700
+ override fun read(buf: ByteBuffer): Map<kotlin.String, SigningCommitment> {
1701
+ val len = buf.getInt()
1702
+ return buildMap<kotlin.String, SigningCommitment>(len) {
1703
+ repeat(len) {
1704
+ val k = FfiConverterString.read(buf)
1705
+ val v = FfiConverterTypeSigningCommitment.read(buf)
1706
+ this[k] = v
1707
+ }
1708
+ }
1709
+ }
1710
+
1711
+ override fun allocationSize(value: Map<kotlin.String, SigningCommitment>): ULong {
1712
+ val spaceForMapSize = 4UL
1713
+ val spaceForChildren =
1714
+ value
1715
+ .map { (k, v) ->
1716
+ FfiConverterString.allocationSize(k) +
1717
+ FfiConverterTypeSigningCommitment.allocationSize(v)
1718
+ }.sum()
1719
+ return spaceForMapSize + spaceForChildren
1720
+ }
1721
+
1722
+ override fun write(
1723
+ value: Map<kotlin.String, SigningCommitment>,
1724
+ buf: ByteBuffer,
1725
+ ) {
1726
+ buf.putInt(value.size)
1727
+ // The parens on `(k, v)` here ensure we're calling the right method,
1728
+ // which is important for compatibility with older android devices.
1729
+ // Ref https://blog.danlew.net/2017/03/16/kotlin-puzzler-whose-line-is-it-anyways/
1730
+ value.forEach { (k, v) ->
1731
+ FfiConverterString.write(k, buf)
1732
+ FfiConverterTypeSigningCommitment.write(v, buf)
1733
+ }
1734
+ }
1735
1735
  }
1736
1736
 
1737
1737
  @Throws(Exception::class)
1738
1738
  fun `aggregateFrost`(
1739
- `msg`: kotlin.ByteArray,
1740
- `statechainCommitments`: Map<kotlin.String, SigningCommitment>,
1741
- `selfCommitment`: SigningCommitment,
1742
- `statechainSignatures`: Map<kotlin.String, kotlin.ByteArray>,
1743
- `selfSignature`: kotlin.ByteArray,
1744
- `statechainPublicKeys`: Map<kotlin.String, kotlin.ByteArray>,
1745
- `selfPublicKey`: kotlin.ByteArray,
1746
- `verifyingKey`: kotlin.ByteArray,
1747
- `adaptorPublicKey`: kotlin.ByteArray?,
1739
+ `msg`: kotlin.ByteArray,
1740
+ `statechainCommitments`: Map<kotlin.String, SigningCommitment>,
1741
+ `selfCommitment`: SigningCommitment,
1742
+ `statechainSignatures`: Map<kotlin.String, kotlin.ByteArray>,
1743
+ `selfSignature`: kotlin.ByteArray,
1744
+ `statechainPublicKeys`: Map<kotlin.String, kotlin.ByteArray>,
1745
+ `selfPublicKey`: kotlin.ByteArray,
1746
+ `verifyingKey`: kotlin.ByteArray,
1747
+ `adaptorPublicKey`: kotlin.ByteArray?,
1748
1748
  ): kotlin.ByteArray =
1749
- FfiConverterByteArray.lift(
1750
- uniffiRustCallWithError(Exception) { _status ->
1751
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_aggregate_frost(
1752
- FfiConverterByteArray.lower(`msg`),
1753
- FfiConverterMapStringTypeSigningCommitment.lower(`statechainCommitments`),
1754
- FfiConverterTypeSigningCommitment.lower(`selfCommitment`),
1755
- FfiConverterMapStringByteArray.lower(`statechainSignatures`),
1756
- FfiConverterByteArray.lower(`selfSignature`),
1757
- FfiConverterMapStringByteArray.lower(`statechainPublicKeys`),
1758
- FfiConverterByteArray.lower(`selfPublicKey`),
1759
- FfiConverterByteArray.lower(`verifyingKey`),
1760
- FfiConverterOptionalByteArray.lower(`adaptorPublicKey`),
1761
- _status,
1762
- )
1763
- },
1764
- )
1749
+ FfiConverterByteArray.lift(
1750
+ uniffiRustCallWithError(Exception) { _status ->
1751
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_aggregate_frost(
1752
+ FfiConverterByteArray.lower(`msg`),
1753
+ FfiConverterMapStringTypeSigningCommitment.lower(`statechainCommitments`),
1754
+ FfiConverterTypeSigningCommitment.lower(`selfCommitment`),
1755
+ FfiConverterMapStringByteArray.lower(`statechainSignatures`),
1756
+ FfiConverterByteArray.lower(`selfSignature`),
1757
+ FfiConverterMapStringByteArray.lower(`statechainPublicKeys`),
1758
+ FfiConverterByteArray.lower(`selfPublicKey`),
1759
+ FfiConverterByteArray.lower(`verifyingKey`),
1760
+ FfiConverterOptionalByteArray.lower(`adaptorPublicKey`),
1761
+ _status,
1762
+ )
1763
+ },
1764
+ )
1765
1765
 
1766
1766
  @Throws(Exception::class)
1767
1767
  fun `constructDirectRefundTx`(
1768
- `tx`: kotlin.ByteArray,
1769
- `vout`: kotlin.UInt,
1770
- `pubkey`: kotlin.ByteArray,
1771
- `network`: kotlin.String,
1772
- `locktime`: kotlin.UShort,
1768
+ `tx`: kotlin.ByteArray,
1769
+ `vout`: kotlin.UInt,
1770
+ `pubkey`: kotlin.ByteArray,
1771
+ `network`: kotlin.String,
1772
+ `locktime`: kotlin.UShort,
1773
1773
  ): TransactionResult =
1774
- FfiConverterTypeTransactionResult.lift(
1775
- uniffiRustCallWithError(Exception) { _status ->
1776
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_construct_direct_refund_tx(
1777
- FfiConverterByteArray.lower(`tx`),
1778
- FfiConverterUInt.lower(`vout`),
1779
- FfiConverterByteArray.lower(`pubkey`),
1780
- FfiConverterString.lower(`network`),
1781
- FfiConverterUShort.lower(`locktime`),
1782
- _status,
1783
- )
1784
- },
1785
- )
1774
+ FfiConverterTypeTransactionResult.lift(
1775
+ uniffiRustCallWithError(Exception) { _status ->
1776
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_construct_direct_refund_tx(
1777
+ FfiConverterByteArray.lower(`tx`),
1778
+ FfiConverterUInt.lower(`vout`),
1779
+ FfiConverterByteArray.lower(`pubkey`),
1780
+ FfiConverterString.lower(`network`),
1781
+ FfiConverterUShort.lower(`locktime`),
1782
+ _status,
1783
+ )
1784
+ },
1785
+ )
1786
1786
 
1787
1787
  @Throws(Exception::class)
1788
1788
  fun `constructNodeTx`(
1789
- `tx`: kotlin.ByteArray,
1790
- `vout`: kotlin.UInt,
1791
- `address`: kotlin.String,
1792
- `locktime`: kotlin.UShort,
1789
+ `tx`: kotlin.ByteArray,
1790
+ `vout`: kotlin.UInt,
1791
+ `address`: kotlin.String,
1792
+ `locktime`: kotlin.UShort,
1793
1793
  ): TransactionResult =
1794
- FfiConverterTypeTransactionResult.lift(
1795
- uniffiRustCallWithError(Exception) { _status ->
1796
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_construct_node_tx(
1797
- FfiConverterByteArray.lower(`tx`),
1798
- FfiConverterUInt.lower(`vout`),
1799
- FfiConverterString.lower(`address`),
1800
- FfiConverterUShort.lower(`locktime`),
1801
- _status,
1802
- )
1803
- },
1804
- )
1794
+ FfiConverterTypeTransactionResult.lift(
1795
+ uniffiRustCallWithError(Exception) { _status ->
1796
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_construct_node_tx(
1797
+ FfiConverterByteArray.lower(`tx`),
1798
+ FfiConverterUInt.lower(`vout`),
1799
+ FfiConverterString.lower(`address`),
1800
+ FfiConverterUShort.lower(`locktime`),
1801
+ _status,
1802
+ )
1803
+ },
1804
+ )
1805
1805
 
1806
1806
  @Throws(Exception::class)
1807
1807
  fun `constructRefundTx`(
1808
- `tx`: kotlin.ByteArray,
1809
- `vout`: kotlin.UInt,
1810
- `pubkey`: kotlin.ByteArray,
1811
- `network`: kotlin.String,
1812
- `locktime`: kotlin.UShort,
1808
+ `tx`: kotlin.ByteArray,
1809
+ `vout`: kotlin.UInt,
1810
+ `pubkey`: kotlin.ByteArray,
1811
+ `network`: kotlin.String,
1812
+ `locktime`: kotlin.UShort,
1813
1813
  ): TransactionResult =
1814
- FfiConverterTypeTransactionResult.lift(
1815
- uniffiRustCallWithError(Exception) { _status ->
1816
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_construct_refund_tx(
1817
- FfiConverterByteArray.lower(`tx`),
1818
- FfiConverterUInt.lower(`vout`),
1819
- FfiConverterByteArray.lower(`pubkey`),
1820
- FfiConverterString.lower(`network`),
1821
- FfiConverterUShort.lower(`locktime`),
1822
- _status,
1823
- )
1824
- },
1825
- )
1814
+ FfiConverterTypeTransactionResult.lift(
1815
+ uniffiRustCallWithError(Exception) { _status ->
1816
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_construct_refund_tx(
1817
+ FfiConverterByteArray.lower(`tx`),
1818
+ FfiConverterUInt.lower(`vout`),
1819
+ FfiConverterByteArray.lower(`pubkey`),
1820
+ FfiConverterString.lower(`network`),
1821
+ FfiConverterUShort.lower(`locktime`),
1822
+ _status,
1823
+ )
1824
+ },
1825
+ )
1826
1826
 
1827
1827
  @Throws(Exception::class)
1828
1828
  fun `constructSplitTx`(
1829
- `tx`: kotlin.ByteArray,
1830
- `vout`: kotlin.UInt,
1831
- `addresses`: List<kotlin.String>,
1832
- `locktime`: kotlin.UShort,
1829
+ `tx`: kotlin.ByteArray,
1830
+ `vout`: kotlin.UInt,
1831
+ `addresses`: List<kotlin.String>,
1832
+ `locktime`: kotlin.UShort,
1833
1833
  ): TransactionResult =
1834
- FfiConverterTypeTransactionResult.lift(
1835
- uniffiRustCallWithError(Exception) { _status ->
1836
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_construct_split_tx(
1837
- FfiConverterByteArray.lower(`tx`),
1838
- FfiConverterUInt.lower(`vout`),
1839
- FfiConverterSequenceString.lower(`addresses`),
1840
- FfiConverterUShort.lower(`locktime`),
1841
- _status,
1842
- )
1843
- },
1844
- )
1834
+ FfiConverterTypeTransactionResult.lift(
1835
+ uniffiRustCallWithError(Exception) { _status ->
1836
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_construct_split_tx(
1837
+ FfiConverterByteArray.lower(`tx`),
1838
+ FfiConverterUInt.lower(`vout`),
1839
+ FfiConverterSequenceString.lower(`addresses`),
1840
+ FfiConverterUShort.lower(`locktime`),
1841
+ _status,
1842
+ )
1843
+ },
1844
+ )
1845
1845
 
1846
1846
  @Throws(Exception::class)
1847
1847
  fun `createDummyTx`(
1848
- `address`: kotlin.String,
1849
- `amountSats`: kotlin.ULong,
1848
+ `address`: kotlin.String,
1849
+ `amountSats`: kotlin.ULong,
1850
1850
  ): DummyTx =
1851
- FfiConverterTypeDummyTx.lift(
1852
- uniffiRustCallWithError(Exception) { _status ->
1853
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_create_dummy_tx(
1854
- FfiConverterString.lower(`address`),
1855
- FfiConverterULong.lower(`amountSats`),
1856
- _status,
1857
- )
1858
- },
1859
- )
1851
+ FfiConverterTypeDummyTx.lift(
1852
+ uniffiRustCallWithError(Exception) { _status ->
1853
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_create_dummy_tx(
1854
+ FfiConverterString.lower(`address`),
1855
+ FfiConverterULong.lower(`amountSats`),
1856
+ _status,
1857
+ )
1858
+ },
1859
+ )
1860
1860
 
1861
1861
  @Throws(Exception::class)
1862
1862
  fun `decryptEcies`(
1863
- `encryptedMsg`: kotlin.ByteArray,
1864
- `privateKey`: kotlin.ByteArray,
1863
+ `encryptedMsg`: kotlin.ByteArray,
1864
+ `privateKey`: kotlin.ByteArray,
1865
1865
  ): kotlin.ByteArray =
1866
- FfiConverterByteArray.lift(
1867
- uniffiRustCallWithError(Exception) { _status ->
1868
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_decrypt_ecies(
1869
- FfiConverterByteArray.lower(`encryptedMsg`),
1870
- FfiConverterByteArray.lower(`privateKey`),
1871
- _status,
1872
- )
1873
- },
1874
- )
1866
+ FfiConverterByteArray.lift(
1867
+ uniffiRustCallWithError(Exception) { _status ->
1868
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_decrypt_ecies(
1869
+ FfiConverterByteArray.lower(`encryptedMsg`),
1870
+ FfiConverterByteArray.lower(`privateKey`),
1871
+ _status,
1872
+ )
1873
+ },
1874
+ )
1875
1875
 
1876
1876
  @Throws(Exception::class)
1877
1877
  fun `encryptEcies`(
1878
- `msg`: kotlin.ByteArray,
1879
- `publicKey`: kotlin.ByteArray,
1878
+ `msg`: kotlin.ByteArray,
1879
+ `publicKey`: kotlin.ByteArray,
1880
1880
  ): kotlin.ByteArray =
1881
- FfiConverterByteArray.lift(
1882
- uniffiRustCallWithError(Exception) { _status ->
1883
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_encrypt_ecies(
1884
- FfiConverterByteArray.lower(`msg`),
1885
- FfiConverterByteArray.lower(`publicKey`),
1886
- _status,
1887
- )
1888
- },
1889
- )
1881
+ FfiConverterByteArray.lift(
1882
+ uniffiRustCallWithError(Exception) { _status ->
1883
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_encrypt_ecies(
1884
+ FfiConverterByteArray.lower(`msg`),
1885
+ FfiConverterByteArray.lower(`publicKey`),
1886
+ _status,
1887
+ )
1888
+ },
1889
+ )
1890
1890
 
1891
1891
  @Throws(Exception::class)
1892
1892
  fun `frostNonce`(`keyPackage`: KeyPackage): NonceResult =
1893
- FfiConverterTypeNonceResult.lift(
1894
- uniffiRustCallWithError(Exception) { _status ->
1895
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_frost_nonce(
1896
- FfiConverterTypeKeyPackage.lower(`keyPackage`),
1897
- _status,
1898
- )
1899
- },
1900
- )
1893
+ FfiConverterTypeNonceResult.lift(
1894
+ uniffiRustCallWithError(Exception) { _status ->
1895
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_frost_nonce(FfiConverterTypeKeyPackage.lower(`keyPackage`), _status)
1896
+ },
1897
+ )
1901
1898
 
1902
1899
  @Throws(Exception::class)
1903
1900
  fun `getTaprootPubkey`(`verifyingPubkey`: kotlin.ByteArray): kotlin.ByteArray =
1904
- FfiConverterByteArray.lift(
1905
- uniffiRustCallWithError(Exception) { _status ->
1906
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_get_taproot_pubkey(
1907
- FfiConverterByteArray.lower(`verifyingPubkey`),
1908
- _status,
1909
- )
1910
- },
1911
- )
1901
+ FfiConverterByteArray.lift(
1902
+ uniffiRustCallWithError(Exception) { _status ->
1903
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_get_taproot_pubkey(FfiConverterByteArray.lower(`verifyingPubkey`), _status)
1904
+ },
1905
+ )
1912
1906
 
1913
1907
  @Throws(Exception::class)
1914
1908
  fun `signFrost`(
1915
- `msg`: kotlin.ByteArray,
1916
- `keyPackage`: KeyPackage,
1917
- `nonce`: SigningNonce,
1918
- `selfCommitment`: SigningCommitment,
1919
- `statechainCommitments`: Map<kotlin.String, SigningCommitment>,
1920
- `adaptorPublicKey`: kotlin.ByteArray?,
1909
+ `msg`: kotlin.ByteArray,
1910
+ `keyPackage`: KeyPackage,
1911
+ `nonce`: SigningNonce,
1912
+ `selfCommitment`: SigningCommitment,
1913
+ `statechainCommitments`: Map<kotlin.String, SigningCommitment>,
1914
+ `adaptorPublicKey`: kotlin.ByteArray?,
1921
1915
  ): kotlin.ByteArray =
1922
- FfiConverterByteArray.lift(
1923
- uniffiRustCallWithError(Exception) { _status ->
1924
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_sign_frost(
1925
- FfiConverterByteArray.lower(`msg`),
1926
- FfiConverterTypeKeyPackage.lower(`keyPackage`),
1927
- FfiConverterTypeSigningNonce.lower(`nonce`),
1928
- FfiConverterTypeSigningCommitment.lower(`selfCommitment`),
1929
- FfiConverterMapStringTypeSigningCommitment.lower(`statechainCommitments`),
1930
- FfiConverterOptionalByteArray.lower(`adaptorPublicKey`),
1931
- _status,
1932
- )
1933
- },
1934
- )
1916
+ FfiConverterByteArray.lift(
1917
+ uniffiRustCallWithError(Exception) { _status ->
1918
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_sign_frost(
1919
+ FfiConverterByteArray.lower(`msg`),
1920
+ FfiConverterTypeKeyPackage.lower(`keyPackage`),
1921
+ FfiConverterTypeSigningNonce.lower(`nonce`),
1922
+ FfiConverterTypeSigningCommitment.lower(`selfCommitment`),
1923
+ FfiConverterMapStringTypeSigningCommitment.lower(`statechainCommitments`),
1924
+ FfiConverterOptionalByteArray.lower(`adaptorPublicKey`),
1925
+ _status,
1926
+ )
1927
+ },
1928
+ )
1935
1929
 
1936
1930
  fun `validateSignatureShare`(
1937
- `msg`: kotlin.ByteArray,
1938
- `statechainCommitments`: Map<kotlin.String, SigningCommitment>,
1939
- `selfCommitment`: SigningCommitment,
1940
- `signatureShare`: kotlin.ByteArray,
1941
- `publicShare`: kotlin.ByteArray,
1942
- `verifyingKey`: kotlin.ByteArray,
1931
+ `msg`: kotlin.ByteArray,
1932
+ `statechainCommitments`: Map<kotlin.String, SigningCommitment>,
1933
+ `selfCommitment`: SigningCommitment,
1934
+ `signatureShare`: kotlin.ByteArray,
1935
+ `publicShare`: kotlin.ByteArray,
1936
+ `verifyingKey`: kotlin.ByteArray,
1943
1937
  ): kotlin.Boolean =
1944
- FfiConverterBoolean.lift(
1945
- uniffiRustCall { _status ->
1946
- UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_validate_signature_share(
1947
- FfiConverterByteArray.lower(`msg`),
1948
- FfiConverterMapStringTypeSigningCommitment.lower(`statechainCommitments`),
1949
- FfiConverterTypeSigningCommitment.lower(`selfCommitment`),
1950
- FfiConverterByteArray.lower(`signatureShare`),
1951
- FfiConverterByteArray.lower(`publicShare`),
1952
- FfiConverterByteArray.lower(`verifyingKey`),
1953
- _status,
1954
- )
1955
- },
1956
- )
1938
+ FfiConverterBoolean.lift(
1939
+ uniffiRustCall { _status ->
1940
+ UniffiLib.INSTANCE.uniffi_spark_frost_fn_func_validate_signature_share(
1941
+ FfiConverterByteArray.lower(`msg`),
1942
+ FfiConverterMapStringTypeSigningCommitment.lower(`statechainCommitments`),
1943
+ FfiConverterTypeSigningCommitment.lower(`selfCommitment`),
1944
+ FfiConverterByteArray.lower(`signatureShare`),
1945
+ FfiConverterByteArray.lower(`publicShare`),
1946
+ FfiConverterByteArray.lower(`verifyingKey`),
1947
+ _status,
1948
+ )
1949
+ },
1950
+ )