react-native-zcash 0.6.11 → 0.6.13

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 (148) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/ios/ZCashLightClientKit/Block/Actions/Action.swift +98 -0
  3. package/ios/ZCashLightClientKit/Block/Actions/ClearAlreadyScannedBlocksAction.swift +35 -0
  4. package/ios/ZCashLightClientKit/Block/Actions/ClearCacheAction.swift +30 -0
  5. package/ios/ZCashLightClientKit/Block/Actions/DownloadAction.swift +67 -0
  6. package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +97 -0
  7. package/ios/ZCashLightClientKit/Block/Actions/FetchUTXOsAction.swift +33 -0
  8. package/ios/ZCashLightClientKit/Block/Actions/MigrateLegacyCacheDBAction.swift +70 -0
  9. package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +60 -0
  10. package/ios/ZCashLightClientKit/Block/Actions/RewindAction.swift +48 -0
  11. package/ios/ZCashLightClientKit/Block/Actions/SaplingParamsAction.swift +33 -0
  12. package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +95 -0
  13. package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +55 -0
  14. package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +58 -0
  15. package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +60 -0
  16. package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +425 -937
  17. package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +31 -17
  18. package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +2 -2
  19. package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +46 -15
  20. package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +4 -15
  21. package/ios/ZCashLightClientKit/Block/FilesystemStorage/FSCompactBlockRepository.swift +4 -4
  22. package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +10 -35
  23. package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +24 -0
  24. package/ios/ZCashLightClientKit/Block/Utils/SyncControlData.swift +25 -0
  25. package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +1 -2
  26. package/ios/ZCashLightClientKit/CombineSynchronizer.swift +2 -5
  27. package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +13 -26
  28. package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +40 -42
  29. package/ios/ZCashLightClientKit/DAO/UnspentTransactionOutputDao.swift +13 -4
  30. package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +9 -0
  31. package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +7 -10
  32. package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
  33. package/ios/ZCashLightClientKit/Error/ZcashError.swift +121 -12
  34. package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +43 -5
  35. package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +72 -6
  36. package/ios/ZCashLightClientKit/Extensions/Bool+ToData.swift +15 -0
  37. package/ios/ZCashLightClientKit/Extensions/Data+ToOtherTypes.swift +18 -0
  38. package/ios/ZCashLightClientKit/Extensions/Int+ToData.swift +15 -0
  39. package/ios/ZCashLightClientKit/Initializer.swift +47 -26
  40. package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +0 -12
  41. package/ios/ZCashLightClientKit/Model/Checkpoint.swift +12 -0
  42. package/ios/ZCashLightClientKit/Model/ScanProgress.swift +29 -0
  43. package/ios/ZCashLightClientKit/Model/ScanRange.swift +31 -0
  44. package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +15 -0
  45. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/compact_formats.pb.swift +150 -46
  46. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/compact_formats.proto +30 -16
  47. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/service.proto +32 -6
  48. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.grpc.swift +259 -22
  49. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.pb.swift +193 -7
  50. package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +8 -0
  51. package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +18 -28
  52. package/ios/ZCashLightClientKit/Repository/CompactBlockRepository.swift +1 -1
  53. package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +2 -6
  54. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2092500.json +8 -0
  55. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2095000.json +8 -0
  56. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2097500.json +8 -0
  57. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2102500.json +8 -0
  58. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2105000.json +8 -0
  59. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2107500.json +8 -0
  60. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2112500.json +8 -0
  61. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2115000.json +8 -0
  62. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2117500.json +8 -0
  63. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2122500.json +8 -0
  64. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2125000.json +8 -0
  65. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2127500.json +8 -0
  66. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2132500.json +8 -0
  67. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2135000.json +8 -0
  68. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2137500.json +8 -0
  69. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2142500.json +8 -0
  70. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2145000.json +8 -0
  71. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2147500.json +8 -0
  72. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2152500.json +8 -0
  73. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2155000.json +8 -0
  74. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2157500.json +8 -0
  75. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2162500.json +8 -0
  76. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2165000.json +8 -0
  77. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2167500.json +8 -0
  78. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2172500.json +8 -0
  79. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2175000.json +8 -0
  80. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2177500.json +8 -0
  81. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2182500.json +8 -0
  82. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2185000.json +8 -0
  83. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2187500.json +8 -0
  84. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2192500.json +8 -0
  85. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2195000.json +8 -0
  86. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2197500.json +8 -0
  87. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2202500.json +8 -0
  88. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2205000.json +8 -0
  89. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2207500.json +8 -0
  90. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2212500.json +8 -0
  91. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2215000.json +8 -0
  92. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2217500.json +8 -0
  93. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2222500.json +8 -0
  94. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2225000.json +8 -0
  95. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2227500.json +8 -0
  96. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2232500.json +8 -0
  97. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2235000.json +8 -0
  98. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2237500.json +8 -0
  99. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2242500.json +8 -0
  100. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2245000.json +8 -0
  101. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2247500.json +8 -0
  102. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2252500.json +8 -0
  103. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2255000.json +8 -0
  104. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2257500.json +8 -0
  105. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2262500.json +8 -0
  106. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2265000.json +8 -0
  107. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2267500.json +8 -0
  108. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2350000.json +8 -0
  109. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2360000.json +8 -0
  110. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2370000.json +8 -0
  111. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2380000.json +8 -0
  112. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2390000.json +8 -0
  113. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2400000.json +8 -0
  114. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2410000.json +8 -0
  115. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2420000.json +8 -0
  116. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2430000.json +8 -0
  117. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2440000.json +8 -0
  118. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2450000.json +8 -0
  119. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2460000.json +8 -0
  120. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2470000.json +8 -0
  121. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2480000.json +8 -0
  122. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2490000.json +8 -0
  123. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2500000.json +8 -0
  124. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2510000.json +8 -0
  125. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2520000.json +8 -0
  126. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2530000.json +8 -0
  127. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2540000.json +8 -0
  128. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2550000.json +8 -0
  129. package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +293 -158
  130. package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +58 -64
  131. package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +2 -8
  132. package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +3 -15
  133. package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +11 -30
  134. package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +41 -50
  135. package/ios/ZCashLightClientKit/Synchronizer.swift +51 -65
  136. package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +2 -2
  137. package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +7 -7
  138. package/ios/ZCashLightClientKit/Utils/OSLogger.swift +3 -3
  139. package/ios/ZCashLightClientKit/Utils/ZcashFileManager.swift +16 -0
  140. package/ios/libzcashlc.xcframework/Info.plist +9 -5
  141. package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
  142. package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
  143. package/package.json +2 -2
  144. package/ios/ZCashLightClientKit/Block/Utils/InternalSyncProgress.swift +0 -200
  145. package/ios/ZCashLightClientKit/Block/Validate/BlockValidator.swift +0 -51
  146. package/ios/ZCashLightClientKit/DAO/BlockDao.swift +0 -112
  147. package/ios/ZCashLightClientKit/Entity/BlockProgress.swift +0 -24
  148. package/ios/ZCashLightClientKit/Rust/zcashlc.h +0 -1051
@@ -1,112 +0,0 @@
1
- //
2
- // BlockDao.swift
3
- // ZcashLightClientKit
4
- //
5
- // Created by Francisco Gindre on 10/16/19.
6
- // Copyright © 2019 Electric Coin Company. All rights reserved.
7
- //
8
-
9
- import Foundation
10
- import SQLite
11
-
12
- protocol BlockDao {
13
- func latestBlockHeight() throws -> BlockHeight
14
- func latestBlock() throws -> Block?
15
- func block(at height: BlockHeight) throws -> Block?
16
- }
17
-
18
- struct Block: Codable {
19
- enum CodingKeys: String, CodingKey {
20
- case height
21
- case hash
22
- case time
23
- case saplingTree = "sapling_tree"
24
- }
25
-
26
- enum TableStructure {
27
- static let height = Expression<Int>(Block.CodingKeys.height.rawValue)
28
- static let hash = Expression<Blob>(Block.CodingKeys.hash.rawValue)
29
- static let time = Expression<Int>(Block.CodingKeys.time.rawValue)
30
- static let saplingTree = Expression<Blob>(Block.CodingKeys.saplingTree.rawValue)
31
- }
32
-
33
- let height: BlockHeight
34
- let hash: Data
35
- let time: Int
36
- let saplingTree: Data
37
-
38
- static let table = Table("blocks")
39
- }
40
-
41
- class BlockSQLDAO: BlockDao {
42
- let dbProvider: ConnectionProvider
43
- let table: Table
44
- let height = Expression<Int>("height")
45
-
46
- init(dbProvider: ConnectionProvider) {
47
- self.dbProvider = dbProvider
48
- self.table = Table("Blocks")
49
- }
50
-
51
- /// - Throws:
52
- /// - `blockDAOCantDecode` if block data loaded from DB can't be decoded to `Block` object.
53
- /// - `blockDAOBlock` if sqlite query to load block metadata failed.
54
- func block(at height: BlockHeight) throws -> Block? {
55
- do {
56
- return try dbProvider
57
- .connection()
58
- .prepare(Block.table.filter(Block.TableStructure.height == height).limit(1))
59
- .map {
60
- do {
61
- return try $0.decode()
62
- } catch {
63
- throw ZcashError.blockDAOCantDecode(error)
64
- }
65
- }
66
- .first
67
- } catch {
68
- if let error = error as? ZcashError {
69
- throw error
70
- } else {
71
- throw ZcashError.blockDAOBlock(error)
72
- }
73
- }
74
- }
75
-
76
- /// - Throws: `blockDAOLatestBlockHeight` if sqlite to fetch height fails.
77
- func latestBlockHeight() throws -> BlockHeight {
78
- do {
79
- return try dbProvider.connection().scalar(table.select(height.max)) ?? BlockHeight.empty()
80
- } catch {
81
- throw ZcashError.blockDAOLatestBlockHeight(error)
82
- }
83
- }
84
-
85
- func latestBlock() throws -> Block? {
86
- do {
87
- return try dbProvider
88
- .connection()
89
- .prepare(Block.table.order(height.desc).limit(1))
90
- .map {
91
- do {
92
- return try $0.decode()
93
- } catch {
94
- throw ZcashError.blockDAOLatestBlockCantDecode(error)
95
- }
96
- }
97
- .first
98
- } catch {
99
- if let error = error as? ZcashError {
100
- throw error
101
- } else {
102
- throw ZcashError.blockDAOLatestBlock(error)
103
- }
104
- }
105
- }
106
- }
107
-
108
- extension BlockSQLDAO: BlockRepository {
109
- func lastScannedBlockHeight() -> BlockHeight {
110
- (try? self.latestBlockHeight()) ?? BlockHeight.empty()
111
- }
112
- }
@@ -1,24 +0,0 @@
1
- //
2
- // BlockProgress.swift
3
- //
4
- //
5
- // Created by Michal Fousek on 03.02.2023.
6
- //
7
-
8
- import Foundation
9
-
10
- public struct BlockProgress: Equatable {
11
- public let startHeight: BlockHeight
12
- public let targetHeight: BlockHeight
13
- public let progressHeight: BlockHeight
14
-
15
- public var progress: Float {
16
- let overall = self.targetHeight - self.startHeight
17
-
18
- return overall > 0 ? Float((self.progressHeight - self.startHeight)) / Float(overall) : 0
19
- }
20
- }
21
-
22
- public extension BlockProgress {
23
- static let nullProgress = BlockProgress(startHeight: 0, targetHeight: 0, progressHeight: 0)
24
- }