react-native-zcash 0.9.13 → 0.10.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 (275) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/android/build.gradle +6 -6
  3. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/3130000.json +8 -0
  4. package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +126 -69
  5. package/ios/RNZcash.m +0 -5
  6. package/ios/RNZcash.swift +153 -104
  7. package/ios/ZCashLightClientKit/Account/Account.swift +48 -0
  8. package/ios/ZCashLightClientKit/Account/AccountMetadataKey.swift +96 -0
  9. package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +23 -4
  10. package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +6 -2
  11. package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +4 -2
  12. package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +4 -1
  13. package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +83 -16
  14. package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +4 -2
  15. package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +22 -19
  16. package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +50 -19
  17. package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +5 -3
  18. package/ios/ZCashLightClientKit/Block/SaplingParameters/SaplingParametersHandler.swift +22 -5
  19. package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +2 -1
  20. package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +5 -3
  21. package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointSource.swift +88 -0
  22. package/ios/ZCashLightClientKit/Checkpoint/CheckpointSource.swift +4 -0
  23. package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +52 -21
  24. package/ios/ZCashLightClientKit/CombineSynchronizer.swift +49 -27
  25. package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +8 -2
  26. package/ios/ZCashLightClientKit/DAO/BlockDao.swift +65 -0
  27. package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +86 -1
  28. package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +4 -4
  29. package/ios/ZCashLightClientKit/Entity/Pczt.swift +10 -0
  30. package/ios/ZCashLightClientKit/Entity/SentNoteEntity.swift +2 -2
  31. package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +40 -16
  32. package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
  33. package/ios/ZCashLightClientKit/Error/ZcashError.swift +182 -14
  34. package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +63 -5
  35. package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +122 -12
  36. package/ios/ZCashLightClientKit/Initializer.swift +49 -14
  37. package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +15 -6
  38. package/ios/ZCashLightClientKit/Model/SingleUseTransparentAddress.swift +29 -0
  39. package/ios/ZCashLightClientKit/Model/TransactionDataRequest.swift +83 -2
  40. package/ios/ZCashLightClientKit/Model/WalletSummary.swift +21 -4
  41. package/ios/ZCashLightClientKit/Model/WalletTypes.swift +38 -8
  42. package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +177 -45
  43. package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +63 -16
  44. package/ios/ZCashLightClientKit/Modules/Service/Tor/LightWalletGRPCServiceOverTor.swift +273 -0
  45. package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +5 -2
  46. package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +2 -0
  47. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2675000.json +8 -0
  48. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2677500.json +8 -0
  49. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2682500.json +8 -0
  50. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2685000.json +8 -0
  51. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2687500.json +8 -0
  52. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2692500.json +8 -0
  53. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2695000.json +8 -0
  54. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2697500.json +8 -0
  55. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2702500.json +8 -0
  56. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2705000.json +8 -0
  57. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2707500.json +8 -0
  58. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2712500.json +8 -0
  59. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2715000.json +8 -0
  60. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2717500.json +8 -0
  61. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2722500.json +8 -0
  62. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2725000.json +8 -0
  63. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2727500.json +8 -0
  64. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2732500.json +8 -0
  65. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2735000.json +8 -0
  66. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2737500.json +8 -0
  67. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2742500.json +8 -0
  68. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2745000.json +8 -0
  69. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2747500.json +8 -0
  70. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2752500.json +8 -0
  71. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2755000.json +8 -0
  72. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2757500.json +8 -0
  73. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2762500.json +8 -0
  74. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2765000.json +8 -0
  75. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2767500.json +8 -0
  76. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2772500.json +8 -0
  77. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2775000.json +8 -0
  78. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2777500.json +8 -0
  79. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2782500.json +8 -0
  80. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2785000.json +8 -0
  81. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2787500.json +8 -0
  82. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2792500.json +8 -0
  83. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2795000.json +8 -0
  84. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2797500.json +8 -0
  85. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2802500.json +8 -0
  86. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2805000.json +8 -0
  87. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2807500.json +8 -0
  88. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2812500.json +8 -0
  89. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2815000.json +8 -0
  90. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2817500.json +8 -0
  91. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2822500.json +8 -0
  92. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2825000.json +8 -0
  93. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2827500.json +8 -0
  94. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2832500.json +8 -0
  95. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2835000.json +8 -0
  96. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2837500.json +8 -0
  97. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2842500.json +8 -0
  98. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2845000.json +8 -0
  99. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2847500.json +8 -0
  100. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2852500.json +8 -0
  101. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2855000.json +8 -0
  102. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2857500.json +8 -0
  103. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2862500.json +8 -0
  104. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2865000.json +8 -0
  105. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2867500.json +8 -0
  106. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2872500.json +8 -0
  107. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2875000.json +8 -0
  108. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2877500.json +8 -0
  109. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2882500.json +8 -0
  110. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2885000.json +8 -0
  111. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2887500.json +8 -0
  112. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2892500.json +8 -0
  113. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2895000.json +8 -0
  114. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2897500.json +8 -0
  115. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2902500.json +8 -0
  116. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2905000.json +8 -0
  117. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2907500.json +8 -0
  118. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2912500.json +8 -0
  119. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2915000.json +8 -0
  120. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2917500.json +8 -0
  121. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2922500.json +8 -0
  122. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2925000.json +8 -0
  123. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2927500.json +8 -0
  124. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2932500.json +8 -0
  125. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2935000.json +8 -0
  126. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2937500.json +8 -0
  127. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2942500.json +8 -0
  128. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2945000.json +8 -0
  129. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2947500.json +8 -0
  130. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2952500.json +8 -0
  131. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2955000.json +8 -0
  132. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2957500.json +8 -0
  133. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2962500.json +8 -0
  134. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2965000.json +8 -0
  135. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2967500.json +8 -0
  136. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2972500.json +8 -0
  137. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2975000.json +8 -0
  138. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2977500.json +8 -0
  139. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2982500.json +8 -0
  140. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2985000.json +8 -0
  141. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2987500.json +8 -0
  142. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2992500.json +8 -0
  143. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2995000.json +8 -0
  144. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2997500.json +8 -0
  145. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3002500.json +8 -0
  146. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3005000.json +8 -0
  147. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3007500.json +8 -0
  148. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3012500.json +8 -0
  149. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3015000.json +8 -0
  150. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3017500.json +8 -0
  151. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3022500.json +8 -0
  152. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3025000.json +8 -0
  153. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3027500.json +8 -0
  154. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3032500.json +8 -0
  155. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3035000.json +8 -0
  156. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3037500.json +8 -0
  157. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3042500.json +8 -0
  158. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3045000.json +8 -0
  159. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3047500.json +8 -0
  160. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3052500.json +8 -0
  161. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3055000.json +8 -0
  162. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3057500.json +8 -0
  163. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3062500.json +8 -0
  164. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3065000.json +8 -0
  165. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3067500.json +8 -0
  166. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3072500.json +8 -0
  167. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3075000.json +8 -0
  168. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3077500.json +8 -0
  169. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3082500.json +8 -0
  170. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3085000.json +8 -0
  171. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3087500.json +8 -0
  172. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3092500.json +8 -0
  173. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3095000.json +8 -0
  174. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3097500.json +8 -0
  175. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3102500.json +8 -0
  176. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3105000.json +8 -0
  177. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3107500.json +8 -0
  178. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3112500.json +8 -0
  179. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3115000.json +8 -0
  180. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3117500.json +8 -0
  181. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3122500.json +8 -0
  182. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3125000.json +8 -0
  183. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3127500.json +8 -0
  184. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3130000.json +8 -0
  185. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3010000.json +8 -0
  186. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3020000.json +8 -0
  187. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3030000.json +8 -0
  188. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3040000.json +8 -0
  189. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3050000.json +8 -0
  190. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3060000.json +8 -0
  191. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3070000.json +8 -0
  192. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3080000.json +8 -0
  193. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3090000.json +8 -0
  194. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3100000.json +8 -0
  195. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3110000.json +8 -0
  196. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3120000.json +8 -0
  197. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3130000.json +8 -0
  198. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3140000.json +8 -0
  199. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3150000.json +8 -0
  200. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3160000.json +8 -0
  201. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3170000.json +8 -0
  202. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3180000.json +8 -0
  203. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3190000.json +8 -0
  204. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3200000.json +8 -0
  205. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3210000.json +8 -0
  206. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3220000.json +8 -0
  207. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3230000.json +8 -0
  208. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3240000.json +8 -0
  209. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3250000.json +8 -0
  210. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3260000.json +8 -0
  211. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3270000.json +8 -0
  212. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3280000.json +8 -0
  213. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3290000.json +8 -0
  214. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3300000.json +8 -0
  215. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3310000.json +8 -0
  216. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3320000.json +8 -0
  217. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3330000.json +8 -0
  218. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3340000.json +8 -0
  219. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3350000.json +8 -0
  220. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3360000.json +8 -0
  221. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3370000.json +8 -0
  222. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3380000.json +8 -0
  223. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3390000.json +8 -0
  224. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3400000.json +8 -0
  225. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3410000.json +8 -0
  226. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3420000.json +8 -0
  227. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3430000.json +8 -0
  228. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3440000.json +8 -0
  229. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3450000.json +8 -0
  230. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3460000.json +8 -0
  231. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3470000.json +8 -0
  232. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3480000.json +8 -0
  233. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3490000.json +8 -0
  234. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3500000.json +8 -0
  235. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3510000.json +8 -0
  236. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3520000.json +8 -0
  237. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3530000.json +8 -0
  238. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3540000.json +8 -0
  239. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3550000.json +8 -0
  240. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3560000.json +8 -0
  241. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3570000.json +8 -0
  242. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3580000.json +8 -0
  243. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3590000.json +8 -0
  244. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3600000.json +8 -0
  245. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3610000.json +8 -0
  246. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3620000.json +8 -0
  247. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3630000.json +8 -0
  248. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3640000.json +8 -0
  249. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3650000.json +8 -0
  250. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3660000.json +8 -0
  251. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3670000.json +8 -0
  252. package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackend.swift +89 -10
  253. package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackendWelding.swift +39 -3
  254. package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +532 -74
  255. package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +97 -14
  256. package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +104 -28
  257. package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +105 -31
  258. package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +36 -9
  259. package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +401 -175
  260. package/ios/ZCashLightClientKit/Synchronizer.swift +192 -69
  261. package/ios/ZCashLightClientKit/Tool/DerivationTool.swift +69 -12
  262. package/ios/ZCashLightClientKit/Tor/TorClient.swift +502 -11
  263. package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +10 -6
  264. package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +24 -9
  265. package/ios/ZCashLightClientKit/Utils/SDKFlags.swift +71 -0
  266. package/ios/libzcashlc.xcframework/Info.plist +5 -5
  267. package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
  268. package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
  269. package/ios/zcashlc.h +1640 -378
  270. package/lib/rnzcash.rn.js.map +1 -1
  271. package/lib/src/react-native.d.ts +2 -2
  272. package/lib/src/types.d.ts +2 -0
  273. package/package.json +1 -1
  274. package/src/react-native.ts +2 -3
  275. package/src/types.ts +2 -0
@@ -31,4 +31,8 @@ protocol CheckpointSource {
31
31
  /// - Note: When the user knows the exact height of the first received funds for a wallet,
32
32
  /// the effective birthday of that wallet is `transaction.height - 1`.
33
33
  func birthday(for height: BlockHeight) -> Checkpoint
34
+
35
+ /// Takes a given date and finds out the closes checkpoint's height for it.
36
+ /// Each checkpoint has a timestamp stored so it can be used for the calculations.
37
+ func estimateBirthdayHeight(for date: Date) -> BlockHeight
34
38
  }
@@ -22,23 +22,27 @@ public protocol ClosureSynchronizer {
22
22
  var stateStream: AnyPublisher<SynchronizerState, Never> { get }
23
23
  var eventStream: AnyPublisher<SynchronizerEvent, Never> { get }
24
24
 
25
+ // swiftlint:disable:next function_parameter_count
25
26
  func prepare(
26
27
  with seed: [UInt8]?,
27
28
  walletBirthday: BlockHeight,
28
29
  for walletMode: WalletInitMode,
30
+ name: String,
31
+ keySource: String?,
29
32
  completion: @escaping (Result<Initializer.InitializationResult, Error>) -> Void
30
33
  )
31
34
 
32
35
  func start(retry: Bool, completion: @escaping (Error?) -> Void)
33
36
  func stop()
34
37
 
35
- func getSaplingAddress(accountIndex: Int, completion: @escaping (Result<SaplingAddress, Error>) -> Void)
36
- func getUnifiedAddress(accountIndex: Int, completion: @escaping (Result<UnifiedAddress, Error>) -> Void)
37
- func getTransparentAddress(accountIndex: Int, completion: @escaping (Result<TransparentAddress, Error>) -> Void)
38
+ func getSaplingAddress(accountUUID: AccountUUID, completion: @escaping (Result<SaplingAddress, Error>) -> Void)
39
+ func getUnifiedAddress(accountUUID: AccountUUID, completion: @escaping (Result<UnifiedAddress, Error>) -> Void)
40
+ func getTransparentAddress(accountUUID: AccountUUID, completion: @escaping (Result<TransparentAddress, Error>) -> Void)
41
+ func getCustomUnifiedAddress(accountUUID: AccountUUID, receivers: Set<ReceiverType>, completion: @escaping (Result<UnifiedAddress, Error>) -> Void)
38
42
 
39
43
  /// Creates a proposal for transferring funds to the given recipient.
40
44
  ///
41
- /// - Parameter accountIndex: the account from which to transfer funds.
45
+ /// - Parameter accountUUID: the account from which to transfer funds.
42
46
  /// - Parameter recipient: the recipient's address.
43
47
  /// - Parameter amount: the amount to send in Zatoshi.
44
48
  /// - Parameter memo: an optional memo to include as part of the proposal's transactions. Use `nil` when sending to transparent receivers otherwise the function will throw an error.
@@ -46,7 +50,7 @@ public protocol ClosureSynchronizer {
46
50
  /// If `prepare()` hasn't already been called since creation of the synchronizer instance or since the last wipe then this method throws
47
51
  /// `SynchronizerErrors.notPrepared`.
48
52
  func proposeTransfer(
49
- accountIndex: Int,
53
+ accountUUID: AccountUUID,
50
54
  recipient: Recipient,
51
55
  amount: Zatoshi,
52
56
  memo: Memo?,
@@ -55,7 +59,7 @@ public protocol ClosureSynchronizer {
55
59
 
56
60
  /// Creates a proposal for shielding any transparent funds received by the given account.
57
61
  ///
58
- /// - Parameter accountIndex: the account for which to shield funds.
62
+ /// - Parameter accountUUID: the account from which to shield funds.
59
63
  /// - Parameter shieldingThreshold: the minimum transparent balance required before a proposal will be created.
60
64
  /// - Parameter memo: an optional memo to include as part of the proposal's transactions.
61
65
  /// - Parameter transparentReceiver: a specific transparent receiver within the account
@@ -69,7 +73,7 @@ public protocol ClosureSynchronizer {
69
73
  /// If `prepare()` hasn't already been called since creation of the synchronizer instance or since the last wipe then this method throws
70
74
  /// `SynchronizerErrors.notPrepared`.
71
75
  func proposeShielding(
72
- accountIndex: Int,
76
+ accountUUID: AccountUUID,
73
77
  shieldingThreshold: Zatoshi,
74
78
  memo: Memo,
75
79
  transparentReceiver: TransparentAddress?,
@@ -93,23 +97,46 @@ public protocol ClosureSynchronizer {
93
97
  completion: @escaping (Result<AsyncThrowingStream<TransactionSubmitResult, Error>, Error>) -> Void
94
98
  )
95
99
 
96
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
97
- func sendToAddress(
98
- spendingKey: UnifiedSpendingKey,
99
- zatoshi: Zatoshi,
100
- toAddress: Recipient,
101
- memo: Memo?,
102
- completion: @escaping (Result<ZcashTransaction.Overview, Error>) -> Void
100
+ func createPCZTFromProposal(
101
+ accountUUID: AccountUUID,
102
+ proposal: Proposal,
103
+ completion: @escaping (Result<Pczt, Error>) -> Void
103
104
  )
104
105
 
105
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
106
- func shieldFunds(
107
- spendingKey: UnifiedSpendingKey,
108
- memo: Memo,
109
- shieldingThreshold: Zatoshi,
110
- completion: @escaping (Result<ZcashTransaction.Overview, Error>) -> Void
106
+ func redactPCZTForSigner(
107
+ pczt: Pczt,
108
+ completion: @escaping (Result<Pczt, Error>) -> Void
109
+ )
110
+
111
+ func PCZTRequiresSaplingProofs(
112
+ pczt: Pczt,
113
+ completion: @escaping (Bool) -> Void
111
114
  )
112
115
 
116
+ func addProofsToPCZT(
117
+ pczt: Pczt,
118
+ completion: @escaping (Result<Pczt, Error>) -> Void
119
+ )
120
+
121
+ func createTransactionFromPCZT(
122
+ pcztWithProofs: Pczt,
123
+ pcztWithSigs: Pczt,
124
+ completion: @escaping (Result<AsyncThrowingStream<TransactionSubmitResult, Error>, Error>) -> Void
125
+ )
126
+
127
+ func listAccounts(completion: @escaping (Result<[Account], Error>) -> Void)
128
+
129
+ // swiftlint:disable:next function_parameter_count
130
+ func importAccount(
131
+ ufvk: String,
132
+ seedFingerprint: [UInt8]?,
133
+ zip32AccountIndex: Zip32AccountIndex?,
134
+ purpose: AccountPurpose,
135
+ name: String,
136
+ keySource: String?,
137
+ completion: @escaping (Result<AccountUUID, Error>) -> Void
138
+ ) async throws
139
+
113
140
  func clearedTransactions(completion: @escaping ([ZcashTransaction.Overview]) -> Void)
114
141
  func sentTranscations(completion: @escaping ([ZcashTransaction.Overview]) -> Void)
115
142
  func receivedTransactions(completion: @escaping ([ZcashTransaction.Overview]) -> Void)
@@ -127,10 +154,14 @@ public protocol ClosureSynchronizer {
127
154
 
128
155
  func refreshUTXOs(address: TransparentAddress, from height: BlockHeight, completion: @escaping (Result<RefreshedUTXOs, Error>) -> Void)
129
156
 
130
- func getAccountBalance(accountIndex: Int, completion: @escaping (Result<AccountBalance?, Error>) -> Void)
157
+ func getAccountsBalances(_ completion: @escaping (Result<[AccountUUID: AccountBalance], Error>) -> Void)
131
158
 
132
159
  func refreshExchangeRateUSD()
133
160
 
161
+ func estimateBirthdayHeight(for date: Date, completion: @escaping (BlockHeight) -> Void)
162
+
163
+ func httpRequestOverTor(for request: URLRequest, retryLimit: UInt8, completion: @escaping (Result<(data: Data, response: HTTPURLResponse), Error>) -> Void)
164
+
134
165
  /*
135
166
  It can be missleading that these two methods are returning Publisher even this protocol is closure based. Reason is that Synchronizer doesn't
136
167
  provide different implementations for these two methods. So Combine it is even here.
@@ -25,19 +25,22 @@ public protocol CombineSynchronizer {
25
25
  func prepare(
26
26
  with seed: [UInt8]?,
27
27
  walletBirthday: BlockHeight,
28
- for walletMode: WalletInitMode
28
+ for walletMode: WalletInitMode,
29
+ name: String,
30
+ keySource: String?
29
31
  ) -> SinglePublisher<Initializer.InitializationResult, Error>
30
32
 
31
33
  func start(retry: Bool) -> CompletablePublisher<Error>
32
34
  func stop()
33
35
 
34
- func getSaplingAddress(accountIndex: Int) -> SinglePublisher<SaplingAddress, Error>
35
- func getUnifiedAddress(accountIndex: Int) -> SinglePublisher<UnifiedAddress, Error>
36
- func getTransparentAddress(accountIndex: Int) -> SinglePublisher<TransparentAddress, Error>
36
+ func getSaplingAddress(accountUUID: AccountUUID) -> SinglePublisher<SaplingAddress, Error>
37
+ func getUnifiedAddress(accountUUID: AccountUUID) -> SinglePublisher<UnifiedAddress, Error>
38
+ func getTransparentAddress(accountUUID: AccountUUID) -> SinglePublisher<TransparentAddress, Error>
39
+ func getCustomUnifiedAddress(accountUUID: AccountUUID, receivers: Set<ReceiverType>) -> SinglePublisher<UnifiedAddress, Error>
37
40
 
38
41
  /// Creates a proposal for transferring funds to the given recipient.
39
42
  ///
40
- /// - Parameter accountIndex: the account from which to transfer funds.
43
+ /// - Parameter accountUUID: the account from which to transfer funds.
41
44
  /// - Parameter recipient: the recipient's address.
42
45
  /// - Parameter amount: the amount to send in Zatoshi.
43
46
  /// - Parameter memo: an optional memo to include as part of the proposal's transactions. Use `nil` when sending to transparent receivers otherwise the function will throw an error.
@@ -45,7 +48,7 @@ public protocol CombineSynchronizer {
45
48
  /// If `prepare()` hasn't already been called since creation of the synchronizer instance or since the last wipe then this method throws
46
49
  /// `SynchronizerErrors.notPrepared`.
47
50
  func proposeTransfer(
48
- accountIndex: Int,
51
+ accountUUID: AccountUUID,
49
52
  recipient: Recipient,
50
53
  amount: Zatoshi,
51
54
  memo: Memo?
@@ -53,7 +56,7 @@ public protocol CombineSynchronizer {
53
56
 
54
57
  /// Creates a proposal for shielding any transparent funds received by the given account.
55
58
  ///
56
- /// - Parameter accountIndex: the account for which to shield funds.
59
+ /// - Parameter accountUUID: the account from which to shield funds.
57
60
  /// - Parameter shieldingThreshold: the minimum transparent balance required before a proposal will be created.
58
61
  /// - Parameter memo: an optional memo to include as part of the proposal's transactions.
59
62
  /// - Parameter transparentReceiver: a specific transparent receiver within the account
@@ -67,7 +70,7 @@ public protocol CombineSynchronizer {
67
70
  /// If `prepare()` hasn't already been called since creation of the synchronizer instance or since the last wipe then this method throws
68
71
  /// `SynchronizerErrors.notPrepared`.
69
72
  func proposeShielding(
70
- accountIndex: Int,
73
+ accountUUID: AccountUUID,
71
74
  shieldingThreshold: Zatoshi,
72
75
  memo: Memo,
73
76
  transparentReceiver: TransparentAddress?
@@ -89,30 +92,45 @@ public protocol CombineSynchronizer {
89
92
  spendingKey: UnifiedSpendingKey
90
93
  ) -> SinglePublisher<AsyncThrowingStream<TransactionSubmitResult, Error>, Error>
91
94
 
92
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
93
- func sendToAddress(
94
- spendingKey: UnifiedSpendingKey,
95
- zatoshi: Zatoshi,
96
- toAddress: Recipient,
97
- memo: Memo?
98
- ) -> SinglePublisher<ZcashTransaction.Overview, Error>
99
-
100
- @available(
101
- *,
102
- deprecated,
103
- message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients. use `proposeShielding:` instead"
104
- )
105
- func shieldFunds(
106
- spendingKey: UnifiedSpendingKey,
107
- memo: Memo,
108
- shieldingThreshold: Zatoshi
109
- ) -> SinglePublisher<ZcashTransaction.Overview, Error>
95
+ func createPCZTFromProposal(
96
+ accountUUID: AccountUUID,
97
+ proposal: Proposal
98
+ ) -> SinglePublisher<Pczt, Error>
99
+
100
+ func redactPCZTForSigner(
101
+ pczt: Pczt
102
+ ) -> SinglePublisher<Pczt, Error>
103
+
104
+ func PCZTRequiresSaplingProofs(
105
+ pczt: Pczt
106
+ ) -> SinglePublisher<Bool, Never>
107
+
108
+ func addProofsToPCZT(
109
+ pczt: Pczt
110
+ ) -> SinglePublisher<Pczt, Error>
110
111
 
112
+ func createTransactionFromPCZT(
113
+ pcztWithProofs: Pczt,
114
+ pcztWithSigs: Pczt
115
+ ) -> SinglePublisher<AsyncThrowingStream<TransactionSubmitResult, Error>, Error>
116
+
111
117
  func proposefulfillingPaymentURI(
112
118
  _ uri: String,
113
- accountIndex: Int
119
+ accountUUID: AccountUUID
114
120
  ) -> SinglePublisher<Proposal, Error>
115
121
 
122
+ func listAccounts() -> SinglePublisher<[Account], Error>
123
+
124
+ // swiftlint:disable:next function_parameter_count
125
+ func importAccount(
126
+ ufvk: String,
127
+ seedFingerprint: [UInt8]?,
128
+ zip32AccountIndex: Zip32AccountIndex?,
129
+ purpose: AccountPurpose,
130
+ name: String,
131
+ keySource: String?
132
+ ) async throws -> SinglePublisher<AccountUUID, Error>
133
+
116
134
  var allTransactions: SinglePublisher<[ZcashTransaction.Overview], Never> { get }
117
135
  var sentTransactions: SinglePublisher<[ZcashTransaction.Overview], Never> { get }
118
136
  var receivedTransactions: SinglePublisher<[ZcashTransaction.Overview], Never> { get }
@@ -131,6 +149,10 @@ public protocol CombineSynchronizer {
131
149
 
132
150
  func refreshExchangeRateUSD()
133
151
 
152
+ func estimateBirthdayHeight(for date: Date) -> SinglePublisher<BlockHeight, Error>
153
+
154
+ func httpRequestOverTor(for request: URLRequest, retryLimit: UInt8) -> SinglePublisher<(data: Data, response: HTTPURLResponse), Error>
155
+
134
156
  func rewind(_ policy: RewindPolicy) -> CompletablePublisher<Error>
135
157
  func wipe() -> CompletablePublisher<Error>
136
158
  }
@@ -11,7 +11,7 @@ public protocol ZcashNetwork {
11
11
  var constants: NetworkConstants.Type { get }
12
12
  }
13
13
 
14
- public enum NetworkType {
14
+ public enum NetworkType: Equatable, Codable, Hashable {
15
15
  case mainnet
16
16
  case testnet
17
17
 
@@ -136,7 +136,7 @@ public enum ZcashSDK {
136
136
  /// The Url that is used by default in zcashd.
137
137
  /// We'll want to make this externally configurable, rather than baking it into the SDK but
138
138
  /// this will do for now, since we're using a cloudfront URL that already redirects.
139
- public static let cloudParameterURL = "https://z.cash/downloads/"
139
+ public static let cloudParameterURL = "https://download.z.cash/downloads/"
140
140
 
141
141
  /// File name for the sapling spend params
142
142
  public static let spendParamFilename = "sapling-spend.params"
@@ -219,3 +219,9 @@ public enum ZcashSDKTestnetConstants: NetworkConstants {
219
219
 
220
220
  public static let defaultDbNamePrefix = "ZcashSdk_testnet_"
221
221
  }
222
+
223
+ /// Used when importing an account `importAccount(..., purpose: AccountPurpose)`
224
+ public enum AccountPurpose: UInt32, Equatable {
225
+ case spending = 0
226
+ case viewOnly
227
+ }
@@ -0,0 +1,65 @@
1
+ // BlockDao.swift
2
+ // ZcashLightClientKit
3
+ //
4
+ // Created by Lukas Korba on 2025-01-25.
5
+ //
6
+
7
+ import Foundation
8
+ import SQLite
9
+
10
+ protocol BlockDao {
11
+ func block(at height: BlockHeight) throws -> Block?
12
+ }
13
+
14
+ struct Block: Codable {
15
+ enum CodingKeys: String, CodingKey {
16
+ case height
17
+ case time
18
+ }
19
+
20
+ enum TableStructure {
21
+ static let height = SQLite.Expression<Int>(Block.CodingKeys.height.rawValue)
22
+ static let time = SQLite.Expression<Int>(Block.CodingKeys.time.rawValue)
23
+ }
24
+
25
+ let height: BlockHeight
26
+ let time: Int
27
+
28
+ static let table = Table("blocks")
29
+ }
30
+
31
+ class BlockSQLDAO: BlockDao {
32
+ let dbProvider: ConnectionProvider
33
+ let table: Table
34
+ let height = SQLite.Expression<Int>("height")
35
+
36
+ init(dbProvider: ConnectionProvider) {
37
+ self.dbProvider = dbProvider
38
+ self.table = Table("Blocks")
39
+ }
40
+
41
+ /// - Throws:
42
+ /// - `blockDAOCantDecode` if block data loaded from DB can't be decoded to `Block` object.
43
+ /// - `blockDAOBlock` if sqlite query to load block metadata failed.
44
+ func block(at height: BlockHeight) throws -> Block? {
45
+ do {
46
+ return try dbProvider
47
+ .connection()
48
+ .prepare(Block.table.filter(Block.TableStructure.height == height).limit(1))
49
+ .map {
50
+ do {
51
+ return try $0.decode()
52
+ } catch {
53
+ throw ZcashError.blockDAOCantDecode(error)
54
+ }
55
+ }
56
+ .first
57
+ } catch {
58
+ if let error = error as? ZcashError {
59
+ throw error
60
+ } else {
61
+ throw ZcashError.blockDAOBlock(error)
62
+ }
63
+ }
64
+ }
65
+ }
@@ -8,20 +8,53 @@
8
8
  import Foundation
9
9
  import SQLite
10
10
 
11
+ extension Connection {
12
+ func debugQuery(_ sql: String) -> String {
13
+ do {
14
+ let rows = try self.prepare(sql)
15
+ var result = ""
16
+
17
+ for row in rows {
18
+ let stringRow = row.map { value -> String in
19
+ if let value {
20
+ return "\(value)"
21
+ }
22
+ return "NULL"
23
+ }
24
+ .joined(separator: " | ")
25
+
26
+ result = "\(result)\n\(stringRow)"
27
+ }
28
+
29
+ return result.isEmpty ? "No results" : result
30
+ } catch {
31
+ return "Error: \(error)"
32
+ }
33
+ }
34
+ }
35
+
11
36
  class TransactionSQLDAO: TransactionRepository {
12
37
  enum NotesTableStructure {
13
38
  static let transactionID = SQLite.Expression<Int>("tx")
14
39
  static let memo = SQLite.Expression<Blob>("memo")
15
40
  }
16
41
 
42
+ enum UserMetadata {
43
+ static let txid = SQLite.Expression<Blob>("txid")
44
+ static let memoCount = SQLite.Expression<Int>("memo_count")
45
+ static let memo = SQLite.Expression<String>("memo")
46
+ }
47
+
17
48
  let dbProvider: ConnectionProvider
18
49
 
50
+ private let blockDao: BlockSQLDAO
19
51
  private let transactionsView = View("v_transactions")
20
52
  private let txOutputsView = View("v_tx_outputs")
21
53
  private let traceClosure: ((String) -> Void)?
22
54
 
23
55
  init(dbProvider: ConnectionProvider, traceClosure: ((String) -> Void)? = nil) {
24
56
  self.dbProvider = dbProvider
57
+ self.blockDao = BlockSQLDAO(dbProvider: dbProvider)
25
58
  self.traceClosure = traceClosure
26
59
  }
27
60
 
@@ -38,7 +71,49 @@ class TransactionSQLDAO: TransactionRepository {
38
71
  func isInitialized() async throws -> Bool {
39
72
  true
40
73
  }
74
+
75
+ func resolveMissingBlockTimes(for transactions: [ZcashTransaction.Overview]) async throws -> [ZcashTransaction.Overview] {
76
+ var transactionsCopy = transactions
77
+
78
+ for i in 0..<transactions.count {
79
+ let transaction = transactions[i]
80
+
81
+ guard transaction.blockTime == nil else {
82
+ continue
83
+ }
84
+
85
+ if let expiryHeight = transaction.expiryHeight {
86
+ if let block = try await blockForHeight(expiryHeight) {
87
+ transactionsCopy[i].blockTime = TimeInterval(block.time)
88
+ }
89
+ }
90
+ }
91
+
92
+ return transactionsCopy
93
+ }
41
94
 
95
+ @DBActor
96
+ func fetchTxidsWithMemoContaining(searchTerm: String) async throws -> [Data] {
97
+ let query = transactionsView
98
+ .join(txOutputsView, on: transactionsView[UserMetadata.txid] == txOutputsView[UserMetadata.txid])
99
+ .filter(transactionsView[UserMetadata.memoCount] > 0)
100
+ .filter(txOutputsView[UserMetadata.memo].like("%\(searchTerm)%"))
101
+
102
+ var txids: [Data] = []
103
+ for row in try connection().prepare(query) {
104
+ let txidBlob = try row.get(txOutputsView[UserMetadata.txid])
105
+ let txid = Data(blob: txidBlob)
106
+ txids.append(txid)
107
+ }
108
+
109
+ return txids
110
+ }
111
+
112
+ @DBActor
113
+ func blockForHeight(_ height: BlockHeight) async throws -> Block? {
114
+ try blockDao.block(at: height)
115
+ }
116
+
42
117
  @DBActor
43
118
  func countAll() async throws -> Int {
44
119
  do {
@@ -71,7 +146,9 @@ class TransactionSQLDAO: TransactionRepository {
71
146
  .filterQueryFor(kind: kind)
72
147
  .limit(limit, offset: offset)
73
148
 
74
- return try await execute(query) { try ZcashTransaction.Overview(row: $0) }
149
+ let transactions: [ZcashTransaction.Overview] = try await execute(query) { try ZcashTransaction.Overview(row: $0) }
150
+
151
+ return try await resolveMissingBlockTimes(for: transactions)
75
152
  }
76
153
 
77
154
  func find(in range: CompactBlockRange, limit: Int, kind: TransactionKind) async throws -> [ZcashTransaction.Overview] {
@@ -197,6 +274,14 @@ class TransactionSQLDAO: TransactionRepository {
197
274
  }
198
275
  }
199
276
  }
277
+
278
+ func debugDatabase(sql: String) -> String {
279
+ guard let connection = try? connection() else {
280
+ return "Connection failed"
281
+ }
282
+
283
+ return connection.debugQuery(sql)
284
+ }
200
285
  }
201
286
 
202
287
  private extension View {
@@ -9,24 +9,24 @@ import Foundation
9
9
  import SQLite
10
10
 
11
11
  protocol AccountEntity {
12
- var account: Int { get }
12
+ var accountIndex: Zip32AccountIndex { get }
13
13
  var ufvk: String { get }
14
14
  }
15
15
 
16
16
  struct DbAccount: AccountEntity, Encodable, Decodable {
17
- let account: Int
17
+ let accountIndex: Zip32AccountIndex
18
18
  let ufvk: String
19
19
  }
20
20
 
21
21
  extension DbAccount: Hashable {
22
22
  func hash(into hasher: inout Hasher) {
23
- hasher.combine(account)
23
+ hasher.combine(accountIndex.index)
24
24
  hasher.combine(ufvk)
25
25
  }
26
26
 
27
27
  static func == (lhs: Self, rhs: Self) -> Bool {
28
28
  guard
29
- lhs.account == rhs.account,
29
+ lhs.accountIndex == rhs.accountIndex,
30
30
  lhs.ufvk == rhs.ufvk
31
31
  else { return false }
32
32
 
@@ -0,0 +1,10 @@
1
+ //
2
+ // Pczt.swift
3
+ // ZcashLightClientKit
4
+ //
5
+ // Created by Lukáš Korba on 13.12.2024.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ public typealias Pczt = Data
@@ -11,9 +11,9 @@ protocol SentNoteEntity {
11
11
  var id: Int { get }
12
12
  var transactionId: Int { get }
13
13
  var outputIndex: Int { get }
14
- var fromAccount: Int { get }
14
+ var fromAccount: AccountId { get }
15
15
  var toAddress: String? { get }
16
- var toAccount: Int? { get }
16
+ var toAccount: AccountId? { get }
17
17
  var value: Int { get }
18
18
  var memo: Data? { get }
19
19
  }