cojson-core-rn 0.19.22 → 0.20.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.
@@ -37,7 +37,6 @@ import {
37
37
  type UniffiRustArcPtr,
38
38
  type UnsafeMutableRawPointer,
39
39
  AbstractFfiConverterByteArray,
40
- FfiConverterArray,
41
40
  FfiConverterArrayBuffer,
42
41
  FfiConverterBool,
43
42
  FfiConverterFloat64,
@@ -1737,6 +1736,27 @@ const FfiConverterTypeBlake3Hasher = new FfiConverterObject(
1737
1736
  );
1738
1737
 
1739
1738
  export interface SessionLogInterface {
1739
+ /**
1740
+ * Add an existing private transaction to the staging area.
1741
+ * The transaction is NOT committed until commit_transactions() succeeds.
1742
+ * Note: made_at uses f64 because JavaScript's number type is f64.
1743
+ */
1744
+ addExistingPrivateTransaction(
1745
+ encryptedChanges: string,
1746
+ keyUsed: string,
1747
+ madeAt: /*f64*/ number,
1748
+ meta: string | undefined
1749
+ ) /*throws*/ : void;
1750
+ /**
1751
+ * Add an existing trusting transaction to the staging area.
1752
+ * The transaction is NOT committed until commit_transactions() succeeds.
1753
+ * Note: made_at uses f64 because JavaScript's number type is f64.
1754
+ */
1755
+ addExistingTrustingTransaction(
1756
+ changes: string,
1757
+ madeAt: /*f64*/ number,
1758
+ meta: string | undefined
1759
+ ) /*throws*/ : void;
1740
1760
  addNewPrivateTransaction(
1741
1761
  changesJson: string,
1742
1762
  signerSecret: string,
@@ -1752,6 +1772,15 @@ export interface SessionLogInterface {
1752
1772
  meta: string | undefined
1753
1773
  ) /*throws*/ : string;
1754
1774
  cloneSessionLog() /*throws*/ : SessionLogInterface;
1775
+ /**
1776
+ * Commit pending transactions to the main state.
1777
+ * If skip_validate is false, validates the signature first.
1778
+ * If skip_validate is true, commits without validation.
1779
+ */
1780
+ commitTransactions(
1781
+ newSignatureStr: string,
1782
+ skipValidate: boolean
1783
+ ) /*throws*/ : void;
1755
1784
  decryptNextTransactionChangesJson(
1756
1785
  txIndex: /*u32*/ number,
1757
1786
  encryptionKey: string
@@ -1760,11 +1789,6 @@ export interface SessionLogInterface {
1760
1789
  txIndex: /*u32*/ number,
1761
1790
  encryptionKey: string
1762
1791
  ) /*throws*/ : string | undefined;
1763
- tryAdd(
1764
- transactionsJson: Array<string>,
1765
- newSignatureStr: string,
1766
- skipVerify: boolean
1767
- ) /*throws*/ : void;
1768
1792
  }
1769
1793
 
1770
1794
  export class SessionLog
@@ -1792,6 +1816,62 @@ export class SessionLog
1792
1816
  uniffiTypeSessionLogObjectFactory.bless(pointer);
1793
1817
  }
1794
1818
 
1819
+ /**
1820
+ * Add an existing private transaction to the staging area.
1821
+ * The transaction is NOT committed until commit_transactions() succeeds.
1822
+ * Note: made_at uses f64 because JavaScript's number type is f64.
1823
+ */
1824
+ public addExistingPrivateTransaction(
1825
+ encryptedChanges: string,
1826
+ keyUsed: string,
1827
+ madeAt: /*f64*/ number,
1828
+ meta: string | undefined
1829
+ ): void /*throws*/ {
1830
+ uniffiCaller.rustCallWithError(
1831
+ /*liftError:*/ FfiConverterTypeSessionLogError.lift.bind(
1832
+ FfiConverterTypeSessionLogError
1833
+ ),
1834
+ /*caller:*/ (callStatus) => {
1835
+ nativeModule().ubrn_uniffi_cojson_core_rn_fn_method_sessionlog_add_existing_private_transaction(
1836
+ uniffiTypeSessionLogObjectFactory.clonePointer(this),
1837
+ FfiConverterString.lower(encryptedChanges),
1838
+ FfiConverterString.lower(keyUsed),
1839
+ FfiConverterFloat64.lower(madeAt),
1840
+ FfiConverterOptionalString.lower(meta),
1841
+ callStatus
1842
+ );
1843
+ },
1844
+ /*liftString:*/ FfiConverterString.lift
1845
+ );
1846
+ }
1847
+
1848
+ /**
1849
+ * Add an existing trusting transaction to the staging area.
1850
+ * The transaction is NOT committed until commit_transactions() succeeds.
1851
+ * Note: made_at uses f64 because JavaScript's number type is f64.
1852
+ */
1853
+ public addExistingTrustingTransaction(
1854
+ changes: string,
1855
+ madeAt: /*f64*/ number,
1856
+ meta: string | undefined
1857
+ ): void /*throws*/ {
1858
+ uniffiCaller.rustCallWithError(
1859
+ /*liftError:*/ FfiConverterTypeSessionLogError.lift.bind(
1860
+ FfiConverterTypeSessionLogError
1861
+ ),
1862
+ /*caller:*/ (callStatus) => {
1863
+ nativeModule().ubrn_uniffi_cojson_core_rn_fn_method_sessionlog_add_existing_trusting_transaction(
1864
+ uniffiTypeSessionLogObjectFactory.clonePointer(this),
1865
+ FfiConverterString.lower(changes),
1866
+ FfiConverterFloat64.lower(madeAt),
1867
+ FfiConverterOptionalString.lower(meta),
1868
+ callStatus
1869
+ );
1870
+ },
1871
+ /*liftString:*/ FfiConverterString.lift
1872
+ );
1873
+ }
1874
+
1795
1875
  public addNewPrivateTransaction(
1796
1876
  changesJson: string,
1797
1877
  signerSecret: string,
@@ -1865,6 +1945,31 @@ export class SessionLog
1865
1945
  );
1866
1946
  }
1867
1947
 
1948
+ /**
1949
+ * Commit pending transactions to the main state.
1950
+ * If skip_validate is false, validates the signature first.
1951
+ * If skip_validate is true, commits without validation.
1952
+ */
1953
+ public commitTransactions(
1954
+ newSignatureStr: string,
1955
+ skipValidate: boolean
1956
+ ): void /*throws*/ {
1957
+ uniffiCaller.rustCallWithError(
1958
+ /*liftError:*/ FfiConverterTypeSessionLogError.lift.bind(
1959
+ FfiConverterTypeSessionLogError
1960
+ ),
1961
+ /*caller:*/ (callStatus) => {
1962
+ nativeModule().ubrn_uniffi_cojson_core_rn_fn_method_sessionlog_commit_transactions(
1963
+ uniffiTypeSessionLogObjectFactory.clonePointer(this),
1964
+ FfiConverterString.lower(newSignatureStr),
1965
+ FfiConverterBool.lower(skipValidate),
1966
+ callStatus
1967
+ );
1968
+ },
1969
+ /*liftString:*/ FfiConverterString.lift
1970
+ );
1971
+ }
1972
+
1868
1973
  public decryptNextTransactionChangesJson(
1869
1974
  txIndex: /*u32*/ number,
1870
1975
  encryptionKey: string
@@ -1909,28 +2014,6 @@ export class SessionLog
1909
2014
  );
1910
2015
  }
1911
2016
 
1912
- public tryAdd(
1913
- transactionsJson: Array<string>,
1914
- newSignatureStr: string,
1915
- skipVerify: boolean
1916
- ): void /*throws*/ {
1917
- uniffiCaller.rustCallWithError(
1918
- /*liftError:*/ FfiConverterTypeSessionLogError.lift.bind(
1919
- FfiConverterTypeSessionLogError
1920
- ),
1921
- /*caller:*/ (callStatus) => {
1922
- nativeModule().ubrn_uniffi_cojson_core_rn_fn_method_sessionlog_try_add(
1923
- uniffiTypeSessionLogObjectFactory.clonePointer(this),
1924
- FfiConverterArrayString.lower(transactionsJson),
1925
- FfiConverterString.lower(newSignatureStr),
1926
- FfiConverterBool.lower(skipVerify),
1927
- callStatus
1928
- );
1929
- },
1930
- /*liftString:*/ FfiConverterString.lift
1931
- );
1932
- }
1933
-
1934
2017
  /**
1935
2018
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1936
2019
  */
@@ -2021,9 +2104,6 @@ const FfiConverterTypeSessionLog = new FfiConverterObject(
2021
2104
  // FfiConverter for string | undefined
2022
2105
  const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
2023
2106
 
2024
- // FfiConverter for Array<string>
2025
- const FfiConverterArrayString = new FfiConverterArray(FfiConverterString);
2026
-
2027
2107
  /**
2028
2108
  * This should be called before anything else.
2029
2109
  *
@@ -2264,6 +2344,22 @@ function uniffiEnsureInitialized() {
2264
2344
  'uniffi_cojson_core_rn_checksum_method_blake3hasher_update'
2265
2345
  );
2266
2346
  }
2347
+ if (
2348
+ nativeModule().ubrn_uniffi_cojson_core_rn_checksum_method_sessionlog_add_existing_private_transaction() !==
2349
+ 30773
2350
+ ) {
2351
+ throw new UniffiInternalError.ApiChecksumMismatch(
2352
+ 'uniffi_cojson_core_rn_checksum_method_sessionlog_add_existing_private_transaction'
2353
+ );
2354
+ }
2355
+ if (
2356
+ nativeModule().ubrn_uniffi_cojson_core_rn_checksum_method_sessionlog_add_existing_trusting_transaction() !==
2357
+ 44589
2358
+ ) {
2359
+ throw new UniffiInternalError.ApiChecksumMismatch(
2360
+ 'uniffi_cojson_core_rn_checksum_method_sessionlog_add_existing_trusting_transaction'
2361
+ );
2362
+ }
2267
2363
  if (
2268
2364
  nativeModule().ubrn_uniffi_cojson_core_rn_checksum_method_sessionlog_add_new_private_transaction() !==
2269
2365
  3753
@@ -2288,6 +2384,14 @@ function uniffiEnsureInitialized() {
2288
2384
  'uniffi_cojson_core_rn_checksum_method_sessionlog_clone_session_log'
2289
2385
  );
2290
2386
  }
2387
+ if (
2388
+ nativeModule().ubrn_uniffi_cojson_core_rn_checksum_method_sessionlog_commit_transactions() !==
2389
+ 16470
2390
+ ) {
2391
+ throw new UniffiInternalError.ApiChecksumMismatch(
2392
+ 'uniffi_cojson_core_rn_checksum_method_sessionlog_commit_transactions'
2393
+ );
2394
+ }
2291
2395
  if (
2292
2396
  nativeModule().ubrn_uniffi_cojson_core_rn_checksum_method_sessionlog_decrypt_next_transaction_changes_json() !==
2293
2397
  22072
@@ -2304,14 +2408,6 @@ function uniffiEnsureInitialized() {
2304
2408
  'uniffi_cojson_core_rn_checksum_method_sessionlog_decrypt_next_transaction_meta_json'
2305
2409
  );
2306
2410
  }
2307
- if (
2308
- nativeModule().ubrn_uniffi_cojson_core_rn_checksum_method_sessionlog_try_add() !==
2309
- 21226
2310
- ) {
2311
- throw new UniffiInternalError.ApiChecksumMismatch(
2312
- 'uniffi_cojson_core_rn_checksum_method_sessionlog_try_add'
2313
- );
2314
- }
2315
2411
  if (
2316
2412
  nativeModule().ubrn_uniffi_cojson_core_rn_checksum_constructor_blake3hasher_new() !==
2317
2413
  24312