@runflame/wallet-rn 0.0.1-rc.0 → 0.0.1-rc.10

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.
@@ -691,18 +691,28 @@ internal object IntegrityCheckingUniffiLib {
691
691
  ): Int
692
692
  external fun uniffi_flamewallet_ffi_checksum_method_wallet_build_transfer(
693
693
  ): Int
694
+ external fun uniffi_flamewallet_ffi_checksum_method_wallet_kind(
695
+ ): Int
694
696
  external fun uniffi_flamewallet_ffi_checksum_method_wallet_network(
695
697
  ): Int
696
698
  external fun uniffi_flamewallet_ffi_checksum_method_wallet_next_address(
697
699
  ): Int
698
700
  external fun uniffi_flamewallet_ffi_checksum_method_wallet_next_index(
699
701
  ): Int
702
+ external fun uniffi_flamewallet_ffi_checksum_method_wallet_open_note(
703
+ ): Int
700
704
  external fun uniffi_flamewallet_ffi_checksum_method_wallet_owns(
701
705
  ): Int
702
706
  external fun uniffi_flamewallet_ffi_checksum_method_wallet_receiving_key(
703
707
  ): Int
708
+ external fun uniffi_flamewallet_ffi_checksum_method_wallet_view_key(
709
+ ): Int
704
710
  external fun uniffi_flamewallet_ffi_checksum_constructor_wallet_from_mnemonic(
705
711
  ): Int
712
+ external fun uniffi_flamewallet_ffi_checksum_constructor_wallet_from_receiving_key(
713
+ ): Int
714
+ external fun uniffi_flamewallet_ffi_checksum_constructor_wallet_from_view_key(
715
+ ): Int
706
716
  external fun uniffi_flamewallet_ffi_checksum_constructor_wallet_new(
707
717
  ): Int
708
718
  external fun ffi_flamewallet_ffi_uniffi_contract_version(
@@ -731,22 +741,32 @@ internal object UniffiLib {
731
741
  ): Unit
732
742
  external fun uniffi_flamewallet_ffi_fn_constructor_wallet_from_mnemonic(`phrase`: RustBuffer.ByValue,`passphrase`: RustBuffer.ByValue,`network`: RustBuffer.ByValue,`nextIndex`: Int,uniffi_out_err: UniffiRustCallStatus,
733
743
  ): Long
744
+ external fun uniffi_flamewallet_ffi_fn_constructor_wallet_from_receiving_key(`receivingKey`: RustBuffer.ByValue,`network`: RustBuffer.ByValue,`nextIndex`: Int,uniffi_out_err: UniffiRustCallStatus,
745
+ ): Long
746
+ external fun uniffi_flamewallet_ffi_fn_constructor_wallet_from_view_key(`viewKey`: RustBuffer.ByValue,`network`: RustBuffer.ByValue,`nextIndex`: Int,uniffi_out_err: UniffiRustCallStatus,
747
+ ): Long
734
748
  external fun uniffi_flamewallet_ffi_fn_constructor_wallet_new(`seed`: RustBuffer.ByValue,`network`: RustBuffer.ByValue,`nextIndex`: Int,uniffi_out_err: UniffiRustCallStatus,
735
749
  ): Long
736
750
  external fun uniffi_flamewallet_ffi_fn_method_wallet_address(`ptr`: Long,`path`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
737
751
  ): RustBuffer.ByValue
738
752
  external fun uniffi_flamewallet_ffi_fn_method_wallet_build_transfer(`ptr`: Long,`request`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
739
753
  ): RustBuffer.ByValue
754
+ external fun uniffi_flamewallet_ffi_fn_method_wallet_kind(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
755
+ ): RustBuffer.ByValue
740
756
  external fun uniffi_flamewallet_ffi_fn_method_wallet_network(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
741
757
  ): RustBuffer.ByValue
742
758
  external fun uniffi_flamewallet_ffi_fn_method_wallet_next_address(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
743
759
  ): RustBuffer.ByValue
744
760
  external fun uniffi_flamewallet_ffi_fn_method_wallet_next_index(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
745
761
  ): Int
762
+ external fun uniffi_flamewallet_ffi_fn_method_wallet_open_note(`ptr`: Long,`contract`: RustBuffer.ByValue,`note`: RustBuffer.ByValue,`path`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
763
+ ): RustBuffer.ByValue
746
764
  external fun uniffi_flamewallet_ffi_fn_method_wallet_owns(`ptr`: Long,`predicate`: RustBuffer.ByValue,`gap`: Int,uniffi_out_err: UniffiRustCallStatus,
747
765
  ): RustBuffer.ByValue
748
766
  external fun uniffi_flamewallet_ffi_fn_method_wallet_receiving_key(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
749
767
  ): RustBuffer.ByValue
768
+ external fun uniffi_flamewallet_ffi_fn_method_wallet_view_key(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
769
+ ): RustBuffer.ByValue
750
770
  external fun uniffi_flamewallet_ffi_fn_func_decode_contract(`bytes`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
751
771
  ): RustBuffer.ByValue
752
772
  external fun uniffi_flamewallet_ffi_fn_func_opening_matches(`contract`: RustBuffer.ByValue,`opening`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
@@ -899,7 +919,10 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
899
919
  if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_address() and 0xFFFF) != 24772) {
900
920
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
901
921
  }
902
- if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_build_transfer() and 0xFFFF) != 41970) {
922
+ if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_build_transfer() and 0xFFFF) != 38498) {
923
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
924
+ }
925
+ if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_kind() and 0xFFFF) != 48257) {
903
926
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
904
927
  }
905
928
  if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_network() and 0xFFFF) != 6461) {
@@ -911,15 +934,27 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
911
934
  if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_next_index() and 0xFFFF) != 50043) {
912
935
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
913
936
  }
937
+ if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_open_note() and 0xFFFF) != 63642) {
938
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
939
+ }
914
940
  if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_owns() and 0xFFFF) != 34274) {
915
941
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
916
942
  }
917
943
  if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_receiving_key() and 0xFFFF) != 41950) {
918
944
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
919
945
  }
946
+ if ((lib.uniffi_flamewallet_ffi_checksum_method_wallet_view_key() and 0xFFFF) != 51879) {
947
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
948
+ }
920
949
  if ((lib.uniffi_flamewallet_ffi_checksum_constructor_wallet_from_mnemonic() and 0xFFFF) != 19125) {
921
950
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
922
951
  }
952
+ if ((lib.uniffi_flamewallet_ffi_checksum_constructor_wallet_from_receiving_key() and 0xFFFF) != 30262) {
953
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
954
+ }
955
+ if ((lib.uniffi_flamewallet_ffi_checksum_constructor_wallet_from_view_key() and 0xFFFF) != 5669) {
956
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
957
+ }
923
958
  if ((lib.uniffi_flamewallet_ffi_checksum_constructor_wallet_new() and 0xFFFF) != 9773) {
924
959
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
925
960
  }
@@ -1351,8 +1386,11 @@ public object FfiConverterByteArray: FfiConverterRustBuffer<ByteArray> {
1351
1386
  /**
1352
1387
  * One account, `m/35263'/network'/0'`, behind an opaque handle.
1353
1388
  *
1354
- * The handle is the only thing that ever holds key material: every
1355
- * spending key is derived inside a call and dropped before it returns. It
1389
+ * The handle holds the account key, and every child key is derived inside
1390
+ * a call and dropped before it returns. Two calls hand key material out,
1391
+ * and the caller must keep what they return as secret as the wallet
1392
+ * itself: [`Wallet::view_key`] reads every amount and memo, and
1393
+ * [`Wallet::receiving_key`] links every address. Neither can spend. It
1356
1394
  * is safe to share across threads. Calls that read or advance the counter
1357
1395
  * are serialized; [`Wallet::build_transfer`] works on a copy and holds no
1358
1396
  * lock while it proves.
@@ -1372,9 +1410,17 @@ public interface WalletInterface {
1372
1410
  * account with the lock released: other calls on this handle, from a
1373
1411
  * UI thread say, do not wait for it. The build never touches the
1374
1412
  * counter, so nothing the copy does needs writing back.
1413
+ *
1414
+ * Only a spend wallet builds; the others refuse with
1415
+ * [`FlameError::NotPermitted`] before reading the request.
1375
1416
  */
1376
1417
  fun `buildTransfer`(`request`: TransferRequest): Transfer
1377
1418
 
1419
+ /**
1420
+ * What this wallet was built from, and so what it can do.
1421
+ */
1422
+ fun `kind`(): WalletKind
1423
+
1378
1424
  /**
1379
1425
  * The network this wallet's addresses are encoded for.
1380
1426
  */
@@ -1390,6 +1436,15 @@ public interface WalletInterface {
1390
1436
  */
1391
1437
  fun `nextIndex`(): kotlin.UInt
1392
1438
 
1439
+ /**
1440
+ * Opens the note that followed `contract` in its log, as a scan serves
1441
+ * the pair; `note` is `None` when the scan served none. `path` is what
1442
+ * [`Wallet::owns`] found for the contract's predicate. The opening it
1443
+ * gives is what a later [`crate::TransferInput`] spends the output with.
1444
+ * A receive wallet cannot open notes.
1445
+ */
1446
+ fun `openNote`(`contract`: kotlin.ByteArray, `note`: kotlin.ByteArray?, `path`: KeyPath): ReceivedNote
1447
+
1393
1448
  /**
1394
1449
  * Which path below `next_index + gap`, on either branch, owns
1395
1450
  * `predicate`; `None` if none does. The scan re-derives every address
@@ -1405,14 +1460,25 @@ public interface WalletInterface {
1405
1460
  */
1406
1461
  fun `receivingKey`(): kotlin.String
1407
1462
 
1463
+ /**
1464
+ * The account's view key in bech32f (`view1…` / `testview1…`): what a
1465
+ * view wallet is built from. It derives every address and opens every
1466
+ * note, so it reads every amount and memo, but it cannot spend. Store
1467
+ * it as a secret. A receive wallet has none to give.
1468
+ */
1469
+ fun `viewKey`(): kotlin.String
1470
+
1408
1471
  companion object
1409
1472
  }
1410
1473
 
1411
1474
  /**
1412
1475
  * One account, `m/35263'/network'/0'`, behind an opaque handle.
1413
1476
  *
1414
- * The handle is the only thing that ever holds key material: every
1415
- * spending key is derived inside a call and dropped before it returns. It
1477
+ * The handle holds the account key, and every child key is derived inside
1478
+ * a call and dropped before it returns. Two calls hand key material out,
1479
+ * and the caller must keep what they return as secret as the wallet
1480
+ * itself: [`Wallet::view_key`] reads every amount and memo, and
1481
+ * [`Wallet::receiving_key`] links every address. Neither can spend. It
1416
1482
  * is safe to share across threads. Calls that read or advance the counter
1417
1483
  * are serialized; [`Wallet::build_transfer`] works on a copy and holds no
1418
1484
  * lock while it proves.
@@ -1563,6 +1629,9 @@ open class Wallet: Disposable, AutoCloseable, WalletInterface
1563
1629
  * account with the lock released: other calls on this handle, from a
1564
1630
  * UI thread say, do not wait for it. The build never touches the
1565
1631
  * counter, so nothing the copy does needs writing back.
1632
+ *
1633
+ * Only a spend wallet builds; the others refuse with
1634
+ * [`FlameError::NotPermitted`] before reading the request.
1566
1635
  */
1567
1636
  @Throws(FlameException::class)override fun `buildTransfer`(`request`: TransferRequest): Transfer {
1568
1637
  return FfiConverterTypeTransfer.lift(
@@ -1579,6 +1648,22 @@ open class Wallet: Disposable, AutoCloseable, WalletInterface
1579
1648
 
1580
1649
 
1581
1650
 
1651
+ /**
1652
+ * What this wallet was built from, and so what it can do.
1653
+ */override fun `kind`(): WalletKind {
1654
+ return FfiConverterTypeWalletKind.lift(
1655
+ callWithHandle {
1656
+ uniffiRustCall() { _status ->
1657
+ UniffiLib.uniffi_flamewallet_ffi_fn_method_wallet_kind(
1658
+ it,
1659
+ _status)
1660
+ }
1661
+ }
1662
+ )
1663
+ }
1664
+
1665
+
1666
+
1582
1667
  /**
1583
1668
  * The network this wallet's addresses are encoded for.
1584
1669
  */override fun `network`(): Network {
@@ -1628,6 +1713,30 @@ open class Wallet: Disposable, AutoCloseable, WalletInterface
1628
1713
 
1629
1714
 
1630
1715
 
1716
+ /**
1717
+ * Opens the note that followed `contract` in its log, as a scan serves
1718
+ * the pair; `note` is `None` when the scan served none. `path` is what
1719
+ * [`Wallet::owns`] found for the contract's predicate. The opening it
1720
+ * gives is what a later [`crate::TransferInput`] spends the output with.
1721
+ * A receive wallet cannot open notes.
1722
+ */
1723
+ @Throws(FlameException::class)override fun `openNote`(`contract`: kotlin.ByteArray, `note`: kotlin.ByteArray?, `path`: KeyPath): ReceivedNote {
1724
+ return FfiConverterTypeReceivedNote.lift(
1725
+ callWithHandle {
1726
+ uniffiRustCallWithError(FlameException) { _status ->
1727
+ UniffiLib.uniffi_flamewallet_ffi_fn_method_wallet_open_note(
1728
+ it,
1729
+
1730
+ FfiConverterByteArray.lower(`contract`),
1731
+ FfiConverterOptionalByteArray.lower(`note`),
1732
+ FfiConverterTypeKeyPath.lower(`path`),_status)
1733
+ }
1734
+ }
1735
+ )
1736
+ }
1737
+
1738
+
1739
+
1631
1740
  /**
1632
1741
  * Which path below `next_index + gap`, on either branch, owns
1633
1742
  * `predicate`; `None` if none does. The scan re-derives every address
@@ -1668,6 +1777,26 @@ open class Wallet: Disposable, AutoCloseable, WalletInterface
1668
1777
 
1669
1778
 
1670
1779
 
1780
+ /**
1781
+ * The account's view key in bech32f (`view1…` / `testview1…`): what a
1782
+ * view wallet is built from. It derives every address and opens every
1783
+ * note, so it reads every amount and memo, but it cannot spend. Store
1784
+ * it as a secret. A receive wallet has none to give.
1785
+ */
1786
+ @Throws(FlameException::class)override fun `viewKey`(): kotlin.String {
1787
+ return FfiConverterString.lift(
1788
+ callWithHandle {
1789
+ uniffiRustCallWithError(FlameException) { _status ->
1790
+ UniffiLib.uniffi_flamewallet_ffi_fn_method_wallet_view_key(
1791
+ it,
1792
+ _status)
1793
+ }
1794
+ }
1795
+ )
1796
+ }
1797
+
1798
+
1799
+
1671
1800
 
1672
1801
 
1673
1802
 
@@ -1695,6 +1824,58 @@ open class Wallet: Disposable, AutoCloseable, WalletInterface
1695
1824
 
1696
1825
 
1697
1826
 
1827
+ /**
1828
+ * A receive wallet from the account's receiving key in bech32f, as
1829
+ * [`Wallet::receiving_key`] gives it, for `network`; `next_index` as
1830
+ * in [`Wallet::new`]. It issues addresses and finds payments;
1831
+ * [`Wallet::view_key`], [`Wallet::open_note`] and
1832
+ * [`Wallet::build_transfer`] refuse with [`FlameError::NotPermitted`].
1833
+ *
1834
+ * As with [`Wallet::from_view_key`], it must be the account node's
1835
+ * key: one from any other node is accepted and silently owns nothing.
1836
+ */
1837
+ @Throws(FlameException::class) fun `fromReceivingKey`(`receivingKey`: kotlin.String, `network`: Network, `nextIndex`: kotlin.UInt): Wallet {
1838
+ return FfiConverterTypeWallet.lift(
1839
+ uniffiRustCallWithError(FlameException) { _status ->
1840
+ UniffiLib.uniffi_flamewallet_ffi_fn_constructor_wallet_from_receiving_key(
1841
+
1842
+
1843
+ FfiConverterString.lower(`receivingKey`),
1844
+ FfiConverterTypeNetwork.lower(`network`),
1845
+ FfiConverterUInt.lower(`nextIndex`),_status)
1846
+ }
1847
+ )
1848
+ }
1849
+
1850
+
1851
+
1852
+ /**
1853
+ * A view wallet from the account's view key in bech32f, as
1854
+ * [`Wallet::view_key`] gives it, for `network`; `next_index` as in
1855
+ * [`Wallet::new`]. Every call works except
1856
+ * [`Wallet::build_transfer`], which refuses with
1857
+ * [`FlameError::NotPermitted`].
1858
+ *
1859
+ * It must be the key of the account node, `m/35263'/network'/0'`,
1860
+ * exactly as [`Wallet::view_key`] exports it. The encoding carries no
1861
+ * depth, so a key from any other node is accepted too, and that
1862
+ * wallet silently owns nothing: every `owns` is `None`.
1863
+ */
1864
+ @Throws(FlameException::class) fun `fromViewKey`(`viewKey`: kotlin.String, `network`: Network, `nextIndex`: kotlin.UInt): Wallet {
1865
+ return FfiConverterTypeWallet.lift(
1866
+ uniffiRustCallWithError(FlameException) { _status ->
1867
+ UniffiLib.uniffi_flamewallet_ffi_fn_constructor_wallet_from_view_key(
1868
+
1869
+
1870
+ FfiConverterString.lower(`viewKey`),
1871
+ FfiConverterTypeNetwork.lower(`network`),
1872
+ FfiConverterUInt.lower(`nextIndex`),_status)
1873
+ }
1874
+ )
1875
+ }
1876
+
1877
+
1878
+
1698
1879
  }
1699
1880
 
1700
1881
  }
@@ -1779,7 +1960,7 @@ public object FfiConverterTypeContractInfo: FfiConverterRustBuffer<ContractInfo>
1779
1960
 
1780
1961
 
1781
1962
  /**
1782
- * One contract the transfer creates, in request order.
1963
+ * One contract the transfer creates.
1783
1964
  */
1784
1965
  data class CreatedOutput (
1785
1966
  var `contractId`: kotlin.ByteArray
@@ -1790,10 +1971,11 @@ data class CreatedOutput (
1790
1971
  var `contract`: kotlin.ByteArray
1791
1972
  ,
1792
1973
  /**
1793
- * Delivered to the recipient out of band, or kept for change: the
1794
- * output can be spent from this record and nothing else.
1974
+ * The encrypted note that follows it on chain, as an indexer's scan
1975
+ * serves it. Its recipient opens it with [`crate::Wallet::open_note`];
1976
+ * so does this wallet, for its change.
1795
1977
  */
1796
- var `opening`: Opening
1978
+ var `note`: kotlin.ByteArray
1797
1979
 
1798
1980
  ){
1799
1981
 
@@ -1812,20 +1994,20 @@ public object FfiConverterTypeCreatedOutput: FfiConverterRustBuffer<CreatedOutpu
1812
1994
  return CreatedOutput(
1813
1995
  FfiConverterByteArray.read(buf),
1814
1996
  FfiConverterByteArray.read(buf),
1815
- FfiConverterTypeOpening.read(buf),
1997
+ FfiConverterByteArray.read(buf),
1816
1998
  )
1817
1999
  }
1818
2000
 
1819
2001
  override fun allocationSize(value: CreatedOutput) = (
1820
2002
  FfiConverterByteArray.allocationSize(value.`contractId`) +
1821
2003
  FfiConverterByteArray.allocationSize(value.`contract`) +
1822
- FfiConverterTypeOpening.allocationSize(value.`opening`)
2004
+ FfiConverterByteArray.allocationSize(value.`note`)
1823
2005
  )
1824
2006
 
1825
2007
  override fun write(value: CreatedOutput, buf: ByteBuffer) {
1826
2008
  FfiConverterByteArray.write(value.`contractId`, buf)
1827
2009
  FfiConverterByteArray.write(value.`contract`, buf)
1828
- FfiConverterTypeOpening.write(value.`opening`, buf)
2010
+ FfiConverterByteArray.write(value.`note`, buf)
1829
2011
  }
1830
2012
  }
1831
2013
 
@@ -1978,6 +2160,53 @@ public object FfiConverterTypeOpening: FfiConverterRustBuffer<Opening> {
1978
2160
 
1979
2161
 
1980
2162
 
2163
+ /**
2164
+ * What an opened note gives its recipient.
2165
+ */
2166
+ data class ReceivedNote (
2167
+ /**
2168
+ * What a [`crate::TransferInput`] spends the output with.
2169
+ */
2170
+ var `opening`: Opening
2171
+ ,
2172
+ /**
2173
+ * The memo, as the sender wrote it.
2174
+ */
2175
+ var `memo`: kotlin.ByteArray
2176
+
2177
+ ){
2178
+
2179
+
2180
+
2181
+
2182
+
2183
+ companion object
2184
+ }
2185
+
2186
+ /**
2187
+ * @suppress
2188
+ */
2189
+ public object FfiConverterTypeReceivedNote: FfiConverterRustBuffer<ReceivedNote> {
2190
+ override fun read(buf: ByteBuffer): ReceivedNote {
2191
+ return ReceivedNote(
2192
+ FfiConverterTypeOpening.read(buf),
2193
+ FfiConverterByteArray.read(buf),
2194
+ )
2195
+ }
2196
+
2197
+ override fun allocationSize(value: ReceivedNote) = (
2198
+ FfiConverterTypeOpening.allocationSize(value.`opening`) +
2199
+ FfiConverterByteArray.allocationSize(value.`memo`)
2200
+ )
2201
+
2202
+ override fun write(value: ReceivedNote, buf: ByteBuffer) {
2203
+ FfiConverterTypeOpening.write(value.`opening`, buf)
2204
+ FfiConverterByteArray.write(value.`memo`, buf)
2205
+ }
2206
+ }
2207
+
2208
+
2209
+
1981
2210
  /**
1982
2211
  * A signed transfer, ready to publish.
1983
2212
  */
@@ -1992,6 +2221,11 @@ data class Transfer (
1992
2221
  */
1993
2222
  var `blockTx`: kotlin.ByteArray
1994
2223
  ,
2224
+ /**
2225
+ * In the order they are published, which is not request order: the
2226
+ * builder sorts them so that position says nothing about which one is
2227
+ * the change. Match one to its request by its predicate.
2228
+ */
1995
2229
  var `outputs`: List<CreatedOutput>
1996
2230
 
1997
2231
  ){
@@ -2098,10 +2332,10 @@ public object FfiConverterTypeTransferInput: FfiConverterRustBuffer<TransferInpu
2098
2332
  */
2099
2333
  data class TransferOutput (
2100
2334
  /**
2101
- * The recipient's predicate: [`crate::address_to_predicate`], or
2102
- * [`crate::Wallet::address`] on the change branch.
2335
+ * The recipient's bech32f address, for the wallet's network; for
2336
+ * change, [`crate::Wallet::address`] on the change branch.
2103
2337
  */
2104
- var `predicate`: kotlin.ByteArray
2338
+ var `address`: kotlin.String
2105
2339
  ,
2106
2340
  var `qty`: kotlin.ULong
2107
2341
  ,
@@ -2109,6 +2343,12 @@ data class TransferOutput (
2109
2343
  * `None` for flames.
2110
2344
  */
2111
2345
  var `flavor`: kotlin.ByteArray?
2346
+ ,
2347
+ /**
2348
+ * Sealed into the output's note with the amount; only the recipient
2349
+ * reads it. At most 4006 bytes; empty for none.
2350
+ */
2351
+ var `memo`: kotlin.ByteArray
2112
2352
 
2113
2353
  ){
2114
2354
 
@@ -2125,22 +2365,25 @@ data class TransferOutput (
2125
2365
  public object FfiConverterTypeTransferOutput: FfiConverterRustBuffer<TransferOutput> {
2126
2366
  override fun read(buf: ByteBuffer): TransferOutput {
2127
2367
  return TransferOutput(
2128
- FfiConverterByteArray.read(buf),
2368
+ FfiConverterString.read(buf),
2129
2369
  FfiConverterULong.read(buf),
2130
2370
  FfiConverterOptionalByteArray.read(buf),
2371
+ FfiConverterByteArray.read(buf),
2131
2372
  )
2132
2373
  }
2133
2374
 
2134
2375
  override fun allocationSize(value: TransferOutput) = (
2135
- FfiConverterByteArray.allocationSize(value.`predicate`) +
2376
+ FfiConverterString.allocationSize(value.`address`) +
2136
2377
  FfiConverterULong.allocationSize(value.`qty`) +
2137
- FfiConverterOptionalByteArray.allocationSize(value.`flavor`)
2378
+ FfiConverterOptionalByteArray.allocationSize(value.`flavor`) +
2379
+ FfiConverterByteArray.allocationSize(value.`memo`)
2138
2380
  )
2139
2381
 
2140
2382
  override fun write(value: TransferOutput, buf: ByteBuffer) {
2141
- FfiConverterByteArray.write(value.`predicate`, buf)
2383
+ FfiConverterString.write(value.`address`, buf)
2142
2384
  FfiConverterULong.write(value.`qty`, buf)
2143
2385
  FfiConverterOptionalByteArray.write(value.`flavor`, buf)
2386
+ FfiConverterByteArray.write(value.`memo`, buf)
2144
2387
  }
2145
2388
  }
2146
2389
 
@@ -2342,6 +2585,33 @@ sealed class FlameException: kotlin.Exception() {
2342
2585
  get() = "reason=${ `reason` }"
2343
2586
  }
2344
2587
 
2588
+ /**
2589
+ * A view or receiving key does not parse for the wallet's network, or
2590
+ * flamekd refused to derive from the key a wallet holds.
2591
+ */
2592
+ class InvalidKey(
2593
+
2594
+ val `reason`: kotlin.String
2595
+ ) : FlameException() {
2596
+ override val message
2597
+ get() = "reason=${ `reason` }"
2598
+ }
2599
+
2600
+ /**
2601
+ * The wallet's key does not allow the call: a view wallet cannot
2602
+ * spend, and a receive wallet can neither spend nor open notes.
2603
+ * `wallet` is this wallet's kind, `needs` the least kind that could.
2604
+ */
2605
+ class NotPermitted(
2606
+
2607
+ val `wallet`: WalletKind,
2608
+
2609
+ val `needs`: WalletKind
2610
+ ) : FlameException() {
2611
+ override val message
2612
+ get() = "wallet=${ `wallet` }, needs=${ `needs` }"
2613
+ }
2614
+
2345
2615
  /**
2346
2616
  * An address does not parse for the wallet's network.
2347
2617
  */
@@ -2390,6 +2660,20 @@ sealed class FlameException: kotlin.Exception() {
2390
2660
  get() = "input=${ `input` }"
2391
2661
  }
2392
2662
 
2663
+ /**
2664
+ * A note did not open; `failure` says how, and so what the wallet does
2665
+ * with the output.
2666
+ */
2667
+ class Note(
2668
+
2669
+ val `failure`: NoteFailure,
2670
+
2671
+ val `reason`: kotlin.String
2672
+ ) : FlameException() {
2673
+ override val message
2674
+ get() = "failure=${ `failure` }, reason=${ `reason` }"
2675
+ }
2676
+
2393
2677
  /**
2394
2678
  * The transfer could not be built or signed.
2395
2679
  */
@@ -2426,20 +2710,31 @@ public object FfiConverterTypeFlameError : FfiConverterRustBuffer<FlameException
2426
2710
  2 -> FlameException.InvalidSeed(
2427
2711
  FfiConverterString.read(buf),
2428
2712
  )
2429
- 3 -> FlameException.InvalidAddress(
2713
+ 3 -> FlameException.InvalidKey(
2430
2714
  FfiConverterString.read(buf),
2431
2715
  )
2432
- 4 -> FlameException.InvalidKeyPath(
2716
+ 4 -> FlameException.NotPermitted(
2717
+ FfiConverterTypeWalletKind.read(buf),
2718
+ FfiConverterTypeWalletKind.read(buf),
2719
+ )
2720
+ 5 -> FlameException.InvalidAddress(
2433
2721
  FfiConverterString.read(buf),
2434
2722
  )
2435
- 5 -> FlameException.InvalidBytes(
2723
+ 6 -> FlameException.InvalidKeyPath(
2724
+ FfiConverterString.read(buf),
2725
+ )
2726
+ 7 -> FlameException.InvalidBytes(
2436
2727
  FfiConverterString.read(buf),
2437
2728
  FfiConverterString.read(buf),
2438
2729
  )
2439
- 6 -> FlameException.KeyMismatch(
2730
+ 8 -> FlameException.KeyMismatch(
2440
2731
  FfiConverterUInt.read(buf),
2441
2732
  )
2442
- 7 -> FlameException.Transfer(
2733
+ 9 -> FlameException.Note(
2734
+ FfiConverterTypeNoteFailure.read(buf),
2735
+ FfiConverterString.read(buf),
2736
+ )
2737
+ 10 -> FlameException.Transfer(
2443
2738
  FfiConverterString.read(buf),
2444
2739
  )
2445
2740
  else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
@@ -2458,6 +2753,17 @@ public object FfiConverterTypeFlameError : FfiConverterRustBuffer<FlameException
2458
2753
  4UL
2459
2754
  + FfiConverterString.allocationSize(value.`reason`)
2460
2755
  )
2756
+ is FlameException.InvalidKey -> (
2757
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
2758
+ 4UL
2759
+ + FfiConverterString.allocationSize(value.`reason`)
2760
+ )
2761
+ is FlameException.NotPermitted -> (
2762
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
2763
+ 4UL
2764
+ + FfiConverterTypeWalletKind.allocationSize(value.`wallet`)
2765
+ + FfiConverterTypeWalletKind.allocationSize(value.`needs`)
2766
+ )
2461
2767
  is FlameException.InvalidAddress -> (
2462
2768
  // Add the size for the Int that specifies the variant plus the size needed for all fields
2463
2769
  4UL
@@ -2479,6 +2785,12 @@ public object FfiConverterTypeFlameError : FfiConverterRustBuffer<FlameException
2479
2785
  4UL
2480
2786
  + FfiConverterUInt.allocationSize(value.`input`)
2481
2787
  )
2788
+ is FlameException.Note -> (
2789
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
2790
+ 4UL
2791
+ + FfiConverterTypeNoteFailure.allocationSize(value.`failure`)
2792
+ + FfiConverterString.allocationSize(value.`reason`)
2793
+ )
2482
2794
  is FlameException.Transfer -> (
2483
2795
  // Add the size for the Int that specifies the variant plus the size needed for all fields
2484
2796
  4UL
@@ -2499,29 +2811,46 @@ public object FfiConverterTypeFlameError : FfiConverterRustBuffer<FlameException
2499
2811
  FfiConverterString.write(value.`reason`, buf)
2500
2812
  Unit
2501
2813
  }
2502
- is FlameException.InvalidAddress -> {
2814
+ is FlameException.InvalidKey -> {
2503
2815
  buf.putInt(3)
2504
2816
  FfiConverterString.write(value.`reason`, buf)
2505
2817
  Unit
2506
2818
  }
2507
- is FlameException.InvalidKeyPath -> {
2819
+ is FlameException.NotPermitted -> {
2508
2820
  buf.putInt(4)
2821
+ FfiConverterTypeWalletKind.write(value.`wallet`, buf)
2822
+ FfiConverterTypeWalletKind.write(value.`needs`, buf)
2823
+ Unit
2824
+ }
2825
+ is FlameException.InvalidAddress -> {
2826
+ buf.putInt(5)
2827
+ FfiConverterString.write(value.`reason`, buf)
2828
+ Unit
2829
+ }
2830
+ is FlameException.InvalidKeyPath -> {
2831
+ buf.putInt(6)
2509
2832
  FfiConverterString.write(value.`reason`, buf)
2510
2833
  Unit
2511
2834
  }
2512
2835
  is FlameException.InvalidBytes -> {
2513
- buf.putInt(5)
2836
+ buf.putInt(7)
2514
2837
  FfiConverterString.write(value.`what`, buf)
2515
2838
  FfiConverterString.write(value.`reason`, buf)
2516
2839
  Unit
2517
2840
  }
2518
2841
  is FlameException.KeyMismatch -> {
2519
- buf.putInt(6)
2842
+ buf.putInt(8)
2520
2843
  FfiConverterUInt.write(value.`input`, buf)
2521
2844
  Unit
2522
2845
  }
2846
+ is FlameException.Note -> {
2847
+ buf.putInt(9)
2848
+ FfiConverterTypeNoteFailure.write(value.`failure`, buf)
2849
+ FfiConverterString.write(value.`reason`, buf)
2850
+ Unit
2851
+ }
2523
2852
  is FlameException.Transfer -> {
2524
- buf.putInt(7)
2853
+ buf.putInt(10)
2525
2854
  FfiConverterString.write(value.`reason`, buf)
2526
2855
  Unit
2527
2856
  }
@@ -2569,6 +2898,118 @@ public object FfiConverterTypeNetwork: FfiConverterRustBuffer<Network> {
2569
2898
 
2570
2899
 
2571
2900
 
2901
+ /**
2902
+ * Why a note did not open: the outcomes of `docs/payments.md`
2903
+ * "Receiving", which a wallet treats differently.
2904
+ */
2905
+
2906
+ enum class NoteFailure {
2907
+
2908
+ /**
2909
+ * No note followed the output. The output is ours but unreadable: keep
2910
+ * and list it, and leave it out of the balance.
2911
+ */
2912
+ MISSING,
2913
+ /**
2914
+ * The note is malformed. Treated as [`NoteFailure::Missing`].
2915
+ */
2916
+ MALFORMED,
2917
+ /**
2918
+ * A note version this library does not know; a later one may open it.
2919
+ */
2920
+ UNKNOWN_VERSION,
2921
+ /**
2922
+ * The note does not decrypt under this address. Treated as
2923
+ * [`NoteFailure::Missing`].
2924
+ */
2925
+ UNDECRYPTABLE,
2926
+ /**
2927
+ * The note decrypts but misstates its output: the sender erred or lied.
2928
+ * Keep and flag it; never count it.
2929
+ */
2930
+ OPENING_MISMATCH,
2931
+ /**
2932
+ * The contract is a cleartext token, or not a token: there is no note
2933
+ * to open, and [`crate::decode_contract`] reads its amount.
2934
+ */
2935
+ NOT_CONFIDENTIAL;
2936
+
2937
+
2938
+
2939
+
2940
+ companion object
2941
+ }
2942
+
2943
+
2944
+ /**
2945
+ * @suppress
2946
+ */
2947
+ public object FfiConverterTypeNoteFailure: FfiConverterRustBuffer<NoteFailure> {
2948
+ override fun read(buf: ByteBuffer) = try {
2949
+ NoteFailure.values()[buf.getInt() - 1]
2950
+ } catch (e: IndexOutOfBoundsException) {
2951
+ throw RuntimeException("invalid enum value, something is very wrong!!", e)
2952
+ }
2953
+
2954
+ override fun allocationSize(value: NoteFailure) = 4UL
2955
+
2956
+ override fun write(value: NoteFailure, buf: ByteBuffer) {
2957
+ buf.putInt(value.ordinal + 1)
2958
+ }
2959
+ }
2960
+
2961
+
2962
+
2963
+
2964
+
2965
+ /**
2966
+ * What a [`Wallet`] was built from, and so what it can do. Each kind can
2967
+ * do everything the next one can.
2968
+ */
2969
+
2970
+ enum class WalletKind {
2971
+
2972
+ /**
2973
+ * From a seed or mnemonic: finds, opens and spends.
2974
+ */
2975
+ SPEND,
2976
+ /**
2977
+ * From a view key: finds and opens every payment, cannot spend.
2978
+ */
2979
+ VIEW,
2980
+ /**
2981
+ * From a receiving key: finds every payment, cannot open or spend.
2982
+ */
2983
+ RECEIVE;
2984
+
2985
+
2986
+
2987
+
2988
+ companion object
2989
+ }
2990
+
2991
+
2992
+ /**
2993
+ * @suppress
2994
+ */
2995
+ public object FfiConverterTypeWalletKind: FfiConverterRustBuffer<WalletKind> {
2996
+ override fun read(buf: ByteBuffer) = try {
2997
+ WalletKind.values()[buf.getInt() - 1]
2998
+ } catch (e: IndexOutOfBoundsException) {
2999
+ throw RuntimeException("invalid enum value, something is very wrong!!", e)
3000
+ }
3001
+
3002
+ override fun allocationSize(value: WalletKind) = 4UL
3003
+
3004
+ override fun write(value: WalletKind, buf: ByteBuffer) {
3005
+ buf.putInt(value.ordinal + 1)
3006
+ }
3007
+ }
3008
+
3009
+
3010
+
3011
+
3012
+
2572
3013
 
2573
3014
  /**
2574
3015
  * @suppress