react-native-zcash 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # React Native Zcash
2
2
 
3
+ ## 0.6.3 (2023-10-19)
4
+
5
+ iOS:
6
+
7
+ - changed: Emit all txs the first time the synchronizer says it's synced. This is a workaround for the synchronizer not publishing some transactions
8
+ - fixed: Fix fee amount returned with transaction.
9
+
3
10
  ## 0.6.2 (2023-10-16)
4
11
 
5
12
  - changed: Upgrade ZcashLightClientKit to v2.0.2
package/ios/RNZcash.swift CHANGED
@@ -294,6 +294,7 @@ class RNZcash: RCTEventEmitter {
294
294
  wallet.cancellables.forEach { $0.cancel() }
295
295
  try await wallet.synchronizer.start()
296
296
  wallet.subscribe()
297
+ wallet.firstSyncEmitTransactionsHack = false
297
298
  resolve(nil)
298
299
  case .failure:
299
300
  reject("RescanError", "Failed to rescan wallet", genericError)
@@ -410,6 +411,7 @@ class WalletSynchronizer: NSObject {
410
411
  var processorState: ProcessorState
411
412
  var cancellables: [AnyCancellable] = []
412
413
  var balances: TotalBalances
414
+ var firstSyncEmitTransactionsHack: Bool
413
415
 
414
416
  init(alias: String, initializer: Initializer, emitter: @escaping (String, Any) -> Void) throws {
415
417
  self.alias = alias
@@ -417,6 +419,7 @@ class WalletSynchronizer: NSObject {
417
419
  self.status = "STOPPED"
418
420
  self.emit = emitter
419
421
  self.fullySynced = false
422
+ self.firstSyncEmitTransactionsHack = false
420
423
  self.restart = false
421
424
  self.processorState = ProcessorState(
422
425
  scanProgress: 0,
@@ -464,6 +467,16 @@ class WalletSynchronizer: NSObject {
464
467
  return
465
468
  }
466
469
  status = "SYNCED"
470
+
471
+ // HACK: do this once the synchronizer finishes the first time. For some reason the SDK isn't returning these through the eventStream
472
+ if !self.firstSyncEmitTransactionsHack {
473
+ self.firstSyncEmitTransactionsHack = true
474
+ Task {
475
+ let txs = await self.synchronizer.transactions
476
+ emitTxs(transactions: txs)
477
+ }
478
+ }
479
+
467
480
  self.fullySynced = true
468
481
  default:
469
482
  break
@@ -558,7 +571,7 @@ class WalletSynchronizer: NSObject {
558
571
  confTx.raw = tx.raw!.hexEncodedString()
559
572
  }
560
573
  if tx.fee != nil {
561
- confTx.fee = String(describing: abs(tx.value.amount))
574
+ confTx.fee = String(describing: abs(tx.fee!.amount))
562
575
  }
563
576
  if tx.isSentTransaction {
564
577
  let recipients = await self.synchronizer.getRecipients(for: tx)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-zcash",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Zcash library for React Native",
5
5
  "homepage": "https://github.com/EdgeApp/react-native-zcash",
6
6
  "repository": {