react-native-zcash 0.9.13 → 0.10.1-beta.1

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 (277) 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/assets/co.electriccoin.zcash/checkpoint/mainnet/3140000.json +8 -0
  5. package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +126 -69
  6. package/ios/RNZcash.m +0 -5
  7. package/ios/RNZcash.swift +153 -104
  8. package/ios/ZCashLightClientKit/Account/Account.swift +48 -0
  9. package/ios/ZCashLightClientKit/Account/AccountMetadataKey.swift +96 -0
  10. package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +23 -4
  11. package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +6 -2
  12. package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +4 -2
  13. package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +4 -1
  14. package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +83 -16
  15. package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +4 -2
  16. package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +22 -19
  17. package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +50 -19
  18. package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +5 -3
  19. package/ios/ZCashLightClientKit/Block/SaplingParameters/SaplingParametersHandler.swift +22 -5
  20. package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +2 -1
  21. package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +5 -3
  22. package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointSource.swift +88 -0
  23. package/ios/ZCashLightClientKit/Checkpoint/CheckpointSource.swift +4 -0
  24. package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +52 -21
  25. package/ios/ZCashLightClientKit/CombineSynchronizer.swift +49 -27
  26. package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +8 -2
  27. package/ios/ZCashLightClientKit/DAO/BlockDao.swift +65 -0
  28. package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +86 -1
  29. package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +4 -4
  30. package/ios/ZCashLightClientKit/Entity/Pczt.swift +10 -0
  31. package/ios/ZCashLightClientKit/Entity/SentNoteEntity.swift +2 -2
  32. package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +40 -16
  33. package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
  34. package/ios/ZCashLightClientKit/Error/ZcashError.swift +182 -14
  35. package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +63 -5
  36. package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +122 -12
  37. package/ios/ZCashLightClientKit/Initializer.swift +49 -14
  38. package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +15 -6
  39. package/ios/ZCashLightClientKit/Model/SingleUseTransparentAddress.swift +29 -0
  40. package/ios/ZCashLightClientKit/Model/TransactionDataRequest.swift +83 -2
  41. package/ios/ZCashLightClientKit/Model/WalletSummary.swift +21 -4
  42. package/ios/ZCashLightClientKit/Model/WalletTypes.swift +38 -8
  43. package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +177 -45
  44. package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +63 -16
  45. package/ios/ZCashLightClientKit/Modules/Service/Tor/LightWalletGRPCServiceOverTor.swift +273 -0
  46. package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +5 -2
  47. package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +2 -0
  48. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2675000.json +8 -0
  49. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2677500.json +8 -0
  50. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2682500.json +8 -0
  51. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2685000.json +8 -0
  52. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2687500.json +8 -0
  53. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2692500.json +8 -0
  54. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2695000.json +8 -0
  55. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2697500.json +8 -0
  56. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2702500.json +8 -0
  57. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2705000.json +8 -0
  58. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2707500.json +8 -0
  59. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2712500.json +8 -0
  60. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2715000.json +8 -0
  61. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2717500.json +8 -0
  62. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2722500.json +8 -0
  63. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2725000.json +8 -0
  64. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2727500.json +8 -0
  65. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2732500.json +8 -0
  66. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2735000.json +8 -0
  67. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2737500.json +8 -0
  68. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2742500.json +8 -0
  69. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2745000.json +8 -0
  70. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2747500.json +8 -0
  71. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2752500.json +8 -0
  72. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2755000.json +8 -0
  73. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2757500.json +8 -0
  74. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2762500.json +8 -0
  75. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2765000.json +8 -0
  76. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2767500.json +8 -0
  77. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2772500.json +8 -0
  78. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2775000.json +8 -0
  79. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2777500.json +8 -0
  80. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2782500.json +8 -0
  81. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2785000.json +8 -0
  82. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2787500.json +8 -0
  83. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2792500.json +8 -0
  84. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2795000.json +8 -0
  85. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2797500.json +8 -0
  86. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2802500.json +8 -0
  87. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2805000.json +8 -0
  88. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2807500.json +8 -0
  89. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2812500.json +8 -0
  90. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2815000.json +8 -0
  91. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2817500.json +8 -0
  92. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2822500.json +8 -0
  93. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2825000.json +8 -0
  94. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2827500.json +8 -0
  95. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2832500.json +8 -0
  96. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2835000.json +8 -0
  97. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2837500.json +8 -0
  98. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2842500.json +8 -0
  99. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2845000.json +8 -0
  100. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2847500.json +8 -0
  101. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2852500.json +8 -0
  102. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2855000.json +8 -0
  103. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2857500.json +8 -0
  104. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2862500.json +8 -0
  105. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2865000.json +8 -0
  106. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2867500.json +8 -0
  107. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2872500.json +8 -0
  108. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2875000.json +8 -0
  109. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2877500.json +8 -0
  110. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2882500.json +8 -0
  111. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2885000.json +8 -0
  112. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2887500.json +8 -0
  113. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2892500.json +8 -0
  114. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2895000.json +8 -0
  115. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2897500.json +8 -0
  116. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2902500.json +8 -0
  117. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2905000.json +8 -0
  118. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2907500.json +8 -0
  119. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2912500.json +8 -0
  120. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2915000.json +8 -0
  121. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2917500.json +8 -0
  122. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2922500.json +8 -0
  123. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2925000.json +8 -0
  124. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2927500.json +8 -0
  125. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2932500.json +8 -0
  126. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2935000.json +8 -0
  127. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2937500.json +8 -0
  128. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2942500.json +8 -0
  129. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2945000.json +8 -0
  130. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2947500.json +8 -0
  131. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2952500.json +8 -0
  132. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2955000.json +8 -0
  133. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2957500.json +8 -0
  134. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2962500.json +8 -0
  135. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2965000.json +8 -0
  136. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2967500.json +8 -0
  137. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2972500.json +8 -0
  138. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2975000.json +8 -0
  139. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2977500.json +8 -0
  140. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2982500.json +8 -0
  141. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2985000.json +8 -0
  142. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2987500.json +8 -0
  143. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2992500.json +8 -0
  144. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2995000.json +8 -0
  145. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2997500.json +8 -0
  146. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3002500.json +8 -0
  147. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3005000.json +8 -0
  148. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3007500.json +8 -0
  149. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3012500.json +8 -0
  150. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3015000.json +8 -0
  151. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3017500.json +8 -0
  152. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3022500.json +8 -0
  153. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3025000.json +8 -0
  154. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3027500.json +8 -0
  155. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3032500.json +8 -0
  156. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3035000.json +8 -0
  157. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3037500.json +8 -0
  158. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3042500.json +8 -0
  159. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3045000.json +8 -0
  160. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3047500.json +8 -0
  161. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3052500.json +8 -0
  162. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3055000.json +8 -0
  163. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3057500.json +8 -0
  164. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3062500.json +8 -0
  165. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3065000.json +8 -0
  166. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3067500.json +8 -0
  167. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3072500.json +8 -0
  168. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3075000.json +8 -0
  169. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3077500.json +8 -0
  170. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3082500.json +8 -0
  171. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3085000.json +8 -0
  172. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3087500.json +8 -0
  173. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3092500.json +8 -0
  174. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3095000.json +8 -0
  175. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3097500.json +8 -0
  176. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3102500.json +8 -0
  177. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3105000.json +8 -0
  178. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3107500.json +8 -0
  179. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3112500.json +8 -0
  180. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3115000.json +8 -0
  181. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3117500.json +8 -0
  182. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3122500.json +8 -0
  183. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3125000.json +8 -0
  184. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3127500.json +8 -0
  185. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3130000.json +8 -0
  186. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3140000.json +8 -0
  187. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3010000.json +8 -0
  188. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3020000.json +8 -0
  189. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3030000.json +8 -0
  190. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3040000.json +8 -0
  191. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3050000.json +8 -0
  192. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3060000.json +8 -0
  193. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3070000.json +8 -0
  194. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3080000.json +8 -0
  195. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3090000.json +8 -0
  196. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3100000.json +8 -0
  197. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3110000.json +8 -0
  198. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3120000.json +8 -0
  199. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3130000.json +8 -0
  200. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3140000.json +8 -0
  201. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3150000.json +8 -0
  202. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3160000.json +8 -0
  203. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3170000.json +8 -0
  204. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3180000.json +8 -0
  205. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3190000.json +8 -0
  206. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3200000.json +8 -0
  207. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3210000.json +8 -0
  208. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3220000.json +8 -0
  209. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3230000.json +8 -0
  210. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3240000.json +8 -0
  211. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3250000.json +8 -0
  212. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3260000.json +8 -0
  213. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3270000.json +8 -0
  214. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3280000.json +8 -0
  215. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3290000.json +8 -0
  216. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3300000.json +8 -0
  217. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3310000.json +8 -0
  218. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3320000.json +8 -0
  219. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3330000.json +8 -0
  220. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3340000.json +8 -0
  221. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3350000.json +8 -0
  222. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3360000.json +8 -0
  223. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3370000.json +8 -0
  224. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3380000.json +8 -0
  225. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3390000.json +8 -0
  226. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3400000.json +8 -0
  227. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3410000.json +8 -0
  228. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3420000.json +8 -0
  229. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3430000.json +8 -0
  230. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3440000.json +8 -0
  231. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3450000.json +8 -0
  232. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3460000.json +8 -0
  233. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3470000.json +8 -0
  234. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3480000.json +8 -0
  235. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3490000.json +8 -0
  236. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3500000.json +8 -0
  237. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3510000.json +8 -0
  238. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3520000.json +8 -0
  239. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3530000.json +8 -0
  240. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3540000.json +8 -0
  241. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3550000.json +8 -0
  242. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3560000.json +8 -0
  243. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3570000.json +8 -0
  244. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3580000.json +8 -0
  245. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3590000.json +8 -0
  246. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3600000.json +8 -0
  247. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3610000.json +8 -0
  248. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3620000.json +8 -0
  249. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3630000.json +8 -0
  250. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3640000.json +8 -0
  251. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3650000.json +8 -0
  252. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3660000.json +8 -0
  253. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3670000.json +8 -0
  254. package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackend.swift +89 -10
  255. package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackendWelding.swift +39 -3
  256. package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +532 -74
  257. package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +97 -14
  258. package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +104 -28
  259. package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +105 -31
  260. package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +36 -9
  261. package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +401 -175
  262. package/ios/ZCashLightClientKit/Synchronizer.swift +192 -69
  263. package/ios/ZCashLightClientKit/Tool/DerivationTool.swift +69 -12
  264. package/ios/ZCashLightClientKit/Tor/TorClient.swift +502 -11
  265. package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +10 -6
  266. package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +24 -9
  267. package/ios/ZCashLightClientKit/Utils/SDKFlags.swift +71 -0
  268. package/ios/libzcashlc.xcframework/Info.plist +5 -5
  269. package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
  270. package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
  271. package/ios/zcashlc.h +1640 -378
  272. package/lib/rnzcash.rn.js.map +1 -1
  273. package/lib/src/react-native.d.ts +2 -2
  274. package/lib/src/types.d.ts +2 -0
  275. package/package.json +1 -1
  276. package/src/react-native.ts +2 -3
  277. package/src/types.ts +2 -0
@@ -83,6 +83,27 @@ enum ZcashErrorDefinition {
83
83
  /// LightWalletService.getTaddressTxids failed.
84
84
  // sourcery: code="ZSRVC0010"
85
85
  case serviceGetTaddressTxidsFailed(_ error: LightWalletServiceError)
86
+ /// LightWalletService.getMempoolStream failed.
87
+ // sourcery: code="ZSRVC0011"
88
+ case serviceGetMempoolStreamFailed(_ error: LightWalletServiceError)
89
+
90
+ // MARK: - Tor
91
+
92
+ /// Endpoint is not provided
93
+ // sourcery: code="ZTSRV0001"
94
+ case torServiceMissingEndpoint
95
+ /// Tor client fails to resolve ServiceMode
96
+ // sourcery: code="ZTSRV0002"
97
+ case torServiceUnresolvedMode
98
+ /// GRPC Service is called with a Tor mode instead of direct one
99
+ // sourcery: code="ZTSRV0003"
100
+ case grpcServiceCalledWithTorMode
101
+ /// TorClient is nil
102
+ // sourcery: code="ZTSRV0004"
103
+ case torClientUnavailable
104
+ /// TorClient is called but SDKFlags are set as Tor disabled
105
+ // sourcery: code="ZTSRV0005"
106
+ case torNotEnabled
86
107
 
87
108
  // MARK: SQLite connection
88
109
 
@@ -178,15 +199,11 @@ enum ZcashErrorDefinition {
178
199
  /// Unified address generated by rust layer is invalid when calling ZcashRustBackend.getNextAvailableAddress
179
200
  // sourcery: code="ZRUST0009"
180
201
  case rustGetNextAvailableAddressInvalidAddress
181
- /// account parameter is lower than 0 when calling ZcashRustBackend.getTransparentBalance
182
- /// - `account` is account passed to ZcashRustBackend.getTransparentBalance.
183
- // sourcery: code="ZRUST0010"
184
- case rustGetTransparentBalanceNegativeAccount(_ account: Int)
185
202
  /// Error from rust layer when calling ZcashRustBackend.getTransparentBalance
186
203
  /// - `account` is account passed to ZcashRustBackend.getTransparentBalance.
187
204
  /// - `rustError` contains error generated by the rust layer.
188
205
  // sourcery: code="ZRUST0011"
189
- case rustGetTransparentBalance(_ account: Int, _ rustError: String)
206
+ case rustGetTransparentBalance(_ accountUUID: AccountUUID, _ rustError: String)
190
207
  /// Error from rust layer when calling ZcashRustBackend.getVerifiedBalance
191
208
  /// - `account` is account passed to ZcashRustBackend.getVerifiedBalance.
192
209
  /// - `rustError` contains error generated by the rust layer.
@@ -200,7 +217,7 @@ enum ZcashErrorDefinition {
200
217
  /// - `account` is account passed to ZcashRustBackend.getVerifiedTransparentBalance.
201
218
  /// - `rustError` contains error generated by the rust layer.
202
219
  // sourcery: code="ZRUST0014"
203
- case rustGetVerifiedTransparentBalance(_ account: Int, _ rustError: String)
220
+ case rustGetVerifiedTransparentBalance(_ accountUUID: AccountUUID, _ rustError: String)
204
221
  /// Error from rust layer when calling ZcashRustBackend.initDataDb
205
222
  /// - `rustError` contains error generated by the rust layer.
206
223
  // sourcery: code="ZRUST0015"
@@ -382,6 +399,105 @@ enum ZcashErrorDefinition {
382
399
  /// - `rustError` contains error generated by the rust layer.
383
400
  /// sourcery: code="ZRUST0064"
384
401
  case rustTransactionDataRequests(_ rustError: String)
402
+ /// Error from rust layer when calling ZcashRustBackend.deriveArbitraryWalletKey
403
+ /// - `rustError` contains error generated by the rust layer.
404
+ // sourcery: code="ZRUST0065"
405
+ case rustDeriveArbitraryWalletKey(_ rustError: String)
406
+ /// Error from rust layer when calling ZcashRustBackend.deriveArbitraryAccountKey
407
+ /// - `rustError` contains error generated by the rust layer.
408
+ // sourcery: code="ZRUST0066"
409
+ case rustDeriveArbitraryAccountKey(_ rustError: String)
410
+ /// Error from rust layer when calling ZcashRustBackend.importAccountUfvk
411
+ /// - `rustError` contains error generated by the rust layer.
412
+ // sourcery: code="ZRUST0067"
413
+ case rustImportAccountUfvk(_ rustError: String)
414
+ /// Error from rust layer when calling ZcashRustBackend.deriveAddressFromUfvk
415
+ /// - `rustError` contains error generated by the rust layer.
416
+ // sourcery: code="ZRUST0068"
417
+ case rustDeriveAddressFromUfvk(_ rustError: String)
418
+ /// Error from rust layer when calling ZcashRustBackend.createPCZTFromProposal
419
+ /// - `rustError` contains error generated by the rust layer.
420
+ // sourcery: code="ZRUST0069"
421
+ case rustCreatePCZTFromProposal(_ rustError: String)
422
+ /// Error from rust layer when calling ZcashRustBackend.addProofsToPCZT
423
+ /// - `rustError` contains error generated by the rust layer.
424
+ // sourcery: code="ZRUST0070"
425
+ case rustAddProofsToPCZT(_ rustError: String)
426
+ /// Error from rust layer when calling ZcashRustBackend.extractAndStoreTxFromPCZT
427
+ /// - `rustError` contains error generated by the rust layer.
428
+ // sourcery: code="ZRUST0071"
429
+ case rustExtractAndStoreTxFromPCZT(_ rustError: String)
430
+ /// Error from rust layer when calling ZcashRustBackend.getAccount
431
+ /// - `rustError` contains error generated by the rust layer.
432
+ // sourcery: code="ZRUST0072"
433
+ case rustUUIDAccountNotFound(_ rustError: String)
434
+ /// Error from rust layer when calling ZcashRustBackend.extractAndStoreTxFromPCZT
435
+ /// - `rustError` contains error generated by the rust layer.
436
+ // sourcery: code="ZRUST0073"
437
+ case rustTxidPtrIncorrectLength(_ rustError: String)
438
+ /// Error from rust layer when calling ZcashRustBackend.redactPCZTForSigner
439
+ /// - `rustError` contains error generated by the rust layer.
440
+ // sourcery: code="ZRUST0074"
441
+ case rustRedactPCZTForSigner(_ rustError: String)
442
+ /// Error from rust layer when calling AccountMetadatKey.init with a seed.
443
+ /// - `rustError` contains error generated by the rust layer.
444
+ // sourcery: code="ZRUST0075"
445
+ case rustDeriveAccountMetadataKey(_ rustError: String)
446
+ /// Error from rust layer when calling AccountMetadatKey.derivePrivateUseMetadataKey
447
+ /// - `rustError` contains error generated by the rust layer.
448
+ // sourcery: code="ZRUST0076"
449
+ case rustDerivePrivateUseMetadataKey(_ rustError: String)
450
+ /// Error from rust layer when calling TorClient.isolatedClient
451
+ /// - `rustError` contains error generated by the rust layer.
452
+ // sourcery: code="ZRUST0077"
453
+ case rustTorIsolatedClient(_ rustError: String)
454
+ /// Error from rust layer when calling TorClient.connectToLightwalletd
455
+ /// - `rustError` contains error generated by the rust layer.
456
+ // sourcery: code="ZRUST0078"
457
+ case rustTorConnectToLightwalletd(_ rustError: String)
458
+ /// Error from rust layer when calling TorLwdConn.fetchTransaction
459
+ /// - `rustError` contains error generated by the rust layer.
460
+ // sourcery: code="ZRUST0079"
461
+ case rustTorLwdFetchTransaction(_ rustError: String)
462
+ /// Error from rust layer when calling TorLwdConn.submit
463
+ /// - `rustError` contains error generated by the rust layer.
464
+ // sourcery: code="ZRUST0080"
465
+ case rustTorLwdSubmit(_ rustError: String)
466
+ /// Error from rust layer when calling TorLwdConn.getInfo
467
+ /// - `rustError` contains error generated by the rust layer.
468
+ // sourcery: code="ZRUST0081"
469
+ case rustTorLwdGetInfo(_ rustError: String)
470
+ /// Error from rust layer when calling TorLwdConn.latestBlockHeight
471
+ /// - `rustError` contains error generated by the rust layer.
472
+ // sourcery: code="ZRUST0082"
473
+ case rustTorLwdLatestBlockHeight(_ rustError: String)
474
+ /// Error from rust layer when calling TorLwdConn.getTreeState
475
+ /// - `rustError` contains error generated by the rust layer.
476
+ // sourcery: code="ZRUST0083"
477
+ case rustTorLwdGetTreeState(_ rustError: String)
478
+ /// Error from rust layer when calling TorClient.httpRequest
479
+ /// - `rustError` contains error generated by the rust layer.
480
+ // sourcery: code="ZRUST0084"
481
+ case rustTorHttpRequest(_ rustError: String)
482
+ /// Error from rust layer when calling ZcashRustBackend.getSingleUseTransparentAddress
483
+ /// - `rustError` contains error generated by the rust layer.
484
+ // sourcery: code="ZRUST0085"
485
+ case rustGetSingleUseTransparentAddress(_ rustError: String)
486
+ /// Single use transparent address generated by rust layer is invalid when calling ZcashRustBackend.getSingleUseTransparentAddress
487
+ // sourcery: code="ZRUST0086"
488
+ case rustGetSingleUseTransparentAddressInvalidAddress
489
+ /// Error from rust layer when calling ZcashRustBackend.checkSingleUseTransparentAddresses
490
+ /// - `rustError` contains error generated by the rust layer.
491
+ // sourcery: code="ZRUST0087"
492
+ case rustCheckSingleUseTransparentAddresses(_ rustError: String)
493
+ /// Error from rust layer when calling ZcashRustBackend.updateTransparentAddressTransactions
494
+ /// - `rustError` contains error generated by the rust layer.
495
+ // sourcery: code="ZRUST0088"
496
+ case rustUpdateTransparentAddressTransactions(_ rustError: String)
497
+ /// Error from rust layer when calling ZcashRustBackend.fetchUTXOsByAddress
498
+ /// - `rustError` contains error generated by the rust layer.
499
+ // sourcery: code="ZRUST0089"
500
+ case rustFetchUTXOsByAddress(_ rustError: String)
385
501
 
386
502
  // MARK: - Account DAO
387
503
 
@@ -530,12 +646,6 @@ enum ZcashErrorDefinition {
530
646
  // sourcery: code="ZCHKP0002"
531
647
  case checkpointDecode(_ error: Error)
532
648
 
533
- // MARK: - DerivationTool
534
-
535
- /// Invalid account when trying to derive spending key
536
- // sourcery: code="ZDRVT0001"
537
- case derivationToolSpendingKeyInvalidAccount
538
-
539
649
  // MARK: - UnspentTransactionOutputDAO
540
650
 
541
651
  /// Creation of the table for unspent transaction output failed.
@@ -40,6 +40,10 @@ public struct LightWalletEndpoint {
40
40
  self.singleCallTimeoutInMillis = singleCallTimeoutInMillis
41
41
  self.streamingCallTimeoutInMillis = streamingCallTimeoutInMillis
42
42
  }
43
+
44
+ var urlString: String {
45
+ String(format: "%@://%@:%d", secure ? "https" : "http", host, port)
46
+ }
43
47
  }
44
48
 
45
49
  /// This contains URLs from which can the SDK fetch files that contain sapling parameters.
@@ -49,7 +53,7 @@ public struct SaplingParamsSourceURL {
49
53
  public let outputParamFileURL: URL
50
54
 
51
55
  public static var `default`: SaplingParamsSourceURL {
52
- return SaplingParamsSourceURL(spendParamFileURL: ZcashSDK.spendParamFileURL, outputParamFileURL: ZcashSDK.outputParamFileURL)
56
+ SaplingParamsSourceURL(spendParamFileURL: ZcashSDK.spendParamFileURL, outputParamFileURL: ZcashSDK.outputParamFileURL)
53
57
  }
54
58
  }
55
59
 
@@ -167,7 +171,9 @@ public class Initializer {
167
171
  outputParamsURL: URL,
168
172
  saplingParamsSourceURL: SaplingParamsSourceURL,
169
173
  alias: ZcashSynchronizerAlias = .default,
170
- loggingPolicy: LoggingPolicy = .default(.debug)
174
+ loggingPolicy: LoggingPolicy = .default(.debug),
175
+ isTorEnabled: Bool,
176
+ isExchangeRateEnabled: Bool
171
177
  ) {
172
178
  let container = DIContainer()
173
179
 
@@ -186,7 +192,9 @@ public class Initializer {
186
192
  outputParamsURL: outputParamsURL,
187
193
  saplingParamsSourceURL: saplingParamsSourceURL,
188
194
  alias: alias,
189
- loggingPolicy: loggingPolicy
195
+ loggingPolicy: loggingPolicy,
196
+ isTorEnabled: isTorEnabled,
197
+ isExchangeRateEnabled: isExchangeRateEnabled
190
198
  )
191
199
 
192
200
  self.init(
@@ -198,7 +206,9 @@ public class Initializer {
198
206
  saplingParamsSourceURL: saplingParamsSourceURL,
199
207
  alias: alias,
200
208
  urlsParsingError: parsingError,
201
- loggingPolicy: loggingPolicy
209
+ loggingPolicy: loggingPolicy,
210
+ isTorEnabled: isTorEnabled,
211
+ isExchangeRateEnabled: isExchangeRateEnabled
202
212
  )
203
213
  }
204
214
 
@@ -216,7 +226,9 @@ public class Initializer {
216
226
  outputParamsURL: URL,
217
227
  saplingParamsSourceURL: SaplingParamsSourceURL,
218
228
  alias: ZcashSynchronizerAlias = .default,
219
- loggingPolicy: LoggingPolicy = .default(.debug)
229
+ loggingPolicy: LoggingPolicy = .default(.debug),
230
+ isTorEnabled: Bool,
231
+ isExchangeRateEnabled: Bool
220
232
  ) {
221
233
  // It's not possible to fail from constructor. Technically it's possible but it can be pain for the client apps to handle errors thrown
222
234
  // from constructor. So `parsingError` is just stored in initializer and `SDKSynchronizer.prepare()` throw this error if it exists.
@@ -233,7 +245,9 @@ public class Initializer {
233
245
  outputParamsURL: outputParamsURL,
234
246
  saplingParamsSourceURL: saplingParamsSourceURL,
235
247
  alias: alias,
236
- loggingPolicy: loggingPolicy
248
+ loggingPolicy: loggingPolicy,
249
+ isTorEnabled: isTorEnabled,
250
+ isExchangeRateEnabled: isExchangeRateEnabled
237
251
  )
238
252
 
239
253
  self.init(
@@ -245,7 +259,9 @@ public class Initializer {
245
259
  saplingParamsSourceURL: saplingParamsSourceURL,
246
260
  alias: alias,
247
261
  urlsParsingError: parsingError,
248
- loggingPolicy: loggingPolicy
262
+ loggingPolicy: loggingPolicy,
263
+ isTorEnabled: isTorEnabled,
264
+ isExchangeRateEnabled: isExchangeRateEnabled
249
265
  )
250
266
  }
251
267
 
@@ -258,7 +274,9 @@ public class Initializer {
258
274
  saplingParamsSourceURL: SaplingParamsSourceURL,
259
275
  alias: ZcashSynchronizerAlias,
260
276
  urlsParsingError: ZcashError?,
261
- loggingPolicy: LoggingPolicy = .default(.debug)
277
+ loggingPolicy: LoggingPolicy = .default(.debug),
278
+ isTorEnabled: Bool,
279
+ isExchangeRateEnabled: Bool
262
280
  ) {
263
281
  self.container = container
264
282
  self.cacheDbURL = cacheDbURL
@@ -296,7 +314,9 @@ public class Initializer {
296
314
  outputParamsURL: URL,
297
315
  saplingParamsSourceURL: SaplingParamsSourceURL,
298
316
  alias: ZcashSynchronizerAlias,
299
- loggingPolicy: LoggingPolicy = .default(.debug)
317
+ loggingPolicy: LoggingPolicy = .default(.debug),
318
+ isTorEnabled: Bool,
319
+ isExchangeRateEnabled: Bool
300
320
  ) -> (URLs, ZcashError?) {
301
321
  let urls = URLs(
302
322
  fsBlockDbRoot: fsBlockDbRoot,
@@ -317,7 +337,9 @@ public class Initializer {
317
337
  alias: alias,
318
338
  networkType: network.networkType,
319
339
  endpoint: endpoint,
320
- loggingPolicy: loggingPolicy
340
+ loggingPolicy: loggingPolicy,
341
+ isTorEnabled: isTorEnabled,
342
+ isExchangeRateEnabled: isExchangeRateEnabled
321
343
  )
322
344
 
323
345
  return (updatedURLs, parsingError)
@@ -406,7 +428,13 @@ public class Initializer {
406
428
  /// - Parameter seed: ZIP-32 Seed bytes for the wallet that will be initialized
407
429
  /// - Throws: `InitializerError.dataDbInitFailed` if the creation of the dataDb fails
408
430
  /// `InitializerError.accountInitFailed` if the account table can't be initialized.
409
- func initialize(with seed: [UInt8]?, walletBirthday: BlockHeight, for walletMode: WalletInitMode) async throws -> InitializationResult {
431
+ func initialize(
432
+ with seed: [UInt8]?,
433
+ walletBirthday: BlockHeight,
434
+ for walletMode: WalletInitMode,
435
+ name: String,
436
+ keySource: String? = nil
437
+ ) async throws -> InitializationResult {
410
438
  try await storage.create()
411
439
 
412
440
  if case .seedRequired = try await rustBackend.initDataDb(seed: seed) {
@@ -423,14 +451,21 @@ public class Initializer {
423
451
  if let seed, try await rustBackend.listAccounts().isEmpty {
424
452
  var chainTip: UInt32?
425
453
 
426
- if walletMode == .restoreWallet, let latestBlockHeight = try? await lightWalletService.latestBlockHeight() {
427
- chainTip = UInt32(latestBlockHeight)
454
+ let sdkFlags = container.resolve(SDKFlags.self)
455
+
456
+ // called when client starts and restore of the wallet is in progress
457
+ if walletMode == .restoreWallet {
458
+ if let latestBlockHeight = try? await lightWalletService.latestBlockHeight(mode: await sdkFlags.ifTor(.uniqueTor)) {
459
+ chainTip = UInt32(latestBlockHeight)
460
+ }
428
461
  }
429
462
 
430
463
  _ = try await rustBackend.createAccount(
431
464
  seed: seed,
432
465
  treeState: checkpoint.treeState(),
433
- recoverUntil: chainTip
466
+ recoverUntil: chainTip,
467
+ name: name,
468
+ keySource: keySource
434
469
  )
435
470
  }
436
471
 
@@ -101,20 +101,29 @@ final class SDKMetricsImpl: SDKMetrics {
101
101
  cbpOverview[lastActionInRun] = report
102
102
  }
103
103
 
104
- // swiftlint:disable string_concatenation
104
+ // swiftlint:disable:next string_concatenation
105
105
  func logCBPOverviewReport(_ logger: Logger, walletSummary: WalletSummary?) async {
106
106
  actionStop()
107
107
 
108
- let accountBalance = walletSummary?.accountBalances[0]
109
108
  logger.sync(
110
109
  """
111
110
  SYNC (\(syncs)) REPORT
112
111
  finished in: \(Date().timeIntervalSince1970 - cbpStartTime)
113
- verified balance: \(accountBalance?.saplingBalance.spendableValue.amount ?? 0)
114
- total balance: \(accountBalance?.saplingBalance.total().amount ?? 0)
115
112
  """
116
113
  )
117
114
 
115
+ if let accountBalances = walletSummary?.accountBalances {
116
+ for accountBalance in accountBalances {
117
+ logger.sync(
118
+ """
119
+ account index: \(accountBalance.key)
120
+ verified balance: \(accountBalance.value.saplingBalance.spendableValue.amount)
121
+ total balance: \(accountBalance.value.saplingBalance.total().amount)
122
+ """
123
+ )
124
+ }
125
+ }
126
+
118
127
  try? await Task.sleep(nanoseconds: 100_000)
119
128
 
120
129
  for action in cbpOverview {
@@ -130,10 +139,10 @@ final class SDKMetricsImpl: SDKMetrics {
130
139
  """
131
140
 
132
141
  if !report.details.isEmpty {
133
- resText += "\ndetails:\n"
142
+ resText = "\(resText)\ndetails:\n"
134
143
 
135
144
  for detail in report.details {
136
- resText += "\t\(detail)\n"
145
+ resText = "\(resText)\t\(detail)\n"
137
146
  }
138
147
  }
139
148
 
@@ -0,0 +1,29 @@
1
+ //
2
+ // SingleUseTransparentAddress.swift
3
+ // ZcashLightClientKit
4
+ //
5
+ // Created by Lukáš Korba on 2025-10-27.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ public struct SingleUseTransparentAddress: Equatable {
11
+ let address: String
12
+ let gapPosition: UInt32
13
+ let gapLimit: UInt32
14
+
15
+ public init(address: String, gapPosition: UInt32, gapLimit: UInt32) {
16
+ self.address = address
17
+ self.gapPosition = gapPosition
18
+ self.gapLimit = gapLimit
19
+ }
20
+ }
21
+
22
+ public enum TransparentAddressCheckResult: Equatable {
23
+ /// Some funds found with a string of the address associated with the funds
24
+ case found(String)
25
+ /// No funds found
26
+ case notFound
27
+ /// Fallback for the non-Tor path, there is no grpc method at the moment
28
+ case torRequired
29
+ }
@@ -7,20 +7,101 @@
7
7
 
8
8
  import Foundation
9
9
 
10
- struct SpendsFromAddress: Equatable {
10
+ /// A type describing the mined-ness of transactions that should be returned in response to a
11
+ /// `TransactionDataRequest`.
12
+ enum TransactionStatusFilter: Equatable {
13
+ /// Only mined transactions should be returned.
14
+ case mined
15
+ /// Only mempool transactions should be returned.
16
+ case mempool
17
+ /// Both mined transactions and transactions in the mempool should be returned.
18
+ case all
19
+ }
20
+
21
+ /// A type used to filter transactions to be returned in response to a `TransactionDataRequest`,
22
+ /// in terms of the spentness of the transaction's transparent outputs.
23
+ enum OutputStatusFilter: Equatable {
24
+ /// Only transactions that have currently-unspent transparent outputs should be returned.
25
+ case unspent
26
+ /// All transactions corresponding to the data request should be returned, irrespective of
27
+ /// whether or not those transactions produce transparent outputs that are currently unspent.
28
+ case all
29
+ }
30
+
31
+ struct TransactionsInvolvingAddress: Equatable {
32
+ /// The address to request transactions and/or UTXOs for.
11
33
  let address: String
34
+ /// Only transactions mined at heights greater than or equal to this height should be
35
+ /// returned.
12
36
  let blockRangeStart: UInt32
37
+ /// If set, only transactions mined at heights less than this height should be returned.
13
38
  let blockRangeEnd: UInt32?
39
+ /// If `request_at` is set, the caller evaluating this request should attempt to
40
+ /// retrieve transaction data related to the specified address at a time that is as close
41
+ /// as practical to the specified instant, and in a fashion that decorrelates this request
42
+ /// to a light wallet server from other requests made by the same caller.
43
+ ///
44
+ /// This may be ignored by callers that are able to satisfy the request without exposing
45
+ /// correlations between addresses to untrusted parties; for example, a wallet application
46
+ /// that uses a private, trusted-for-privacy supplier of chain data can safely ignore this
47
+ /// field.
48
+ let requestAt: Date?
49
+ /// The caller should respond to this request only with transactions that conform to the
50
+ /// specified transaction status filter.
51
+ let txStatusFilter: TransactionStatusFilter
52
+ /// The caller should respond to this request only with transactions containing outputs
53
+ /// that conform to the specified output status filter.
54
+ let outputStatusFilter: OutputStatusFilter
14
55
  }
15
56
 
57
+ /// A request for transaction data enhancement, spentness check, or discovery
58
+ /// of spends from a given transparent address within a specific block range.
16
59
  enum TransactionDataRequest: Equatable {
60
+ /// Information about the chain's view of a transaction is requested.
61
+ ///
62
+ /// The caller evaluating this request on behalf of the wallet backend should respond to this
63
+ /// request by determining the status of the specified transaction with respect to the main
64
+ /// chain; if using `lightwalletd` for access to chain data, this may be obtained by
65
+ /// interpreting the results of the `GetTransaction` RPC method. It should then call
66
+ /// `ZcashRustBackend.setTransactionStatus` to provide the resulting transaction status
67
+ /// information to the wallet backend.
17
68
  case getStatus([UInt8])
69
+ /// Transaction enhancement (download of complete raw transaction data) is requested.
70
+ ///
71
+ /// The caller evaluating this request on behalf of the wallet backend should respond to this
72
+ /// request by providing complete data for the specified transaction to
73
+ /// `ZcashRustBackend.decryptAndStoreTransaction`; if using `lightwalletd` for access to chain
74
+ /// state, this may be obtained via the `GetTransaction` RPC method. If no data is available
75
+ /// for the specified transaction, this should be reported to the backend using
76
+ /// `ZcashRustBackend.setTransactionStatus`. A `TransactionDataRequest.enhancement` request
77
+ /// subsumes any previously existing `TransactionDataRequest.getStatus` request.
18
78
  case enhancement([UInt8])
19
- case spendsFromAddress(SpendsFromAddress)
79
+ /// Information about transactions that receive or spend funds belonging to the specified
80
+ /// transparent address is requested.
81
+ ///
82
+ /// Fully transparent transactions, and transactions that do not contain either shielded inputs
83
+ /// or shielded outputs belonging to the wallet, may not be discovered by the process of chain
84
+ /// scanning; as a consequence, the wallet must actively query to find transactions that spend
85
+ /// such funds. Ideally we'd be able to query by `OutPoint` but this is not currently
86
+ /// functionality that is supported by the light wallet server.
87
+ ///
88
+ /// The caller evaluating this request on behalf of the wallet backend should respond to this
89
+ /// request by detecting transactions involving the specified address within the provided block
90
+ /// range; if using `lightwalletd` for access to chain data, this may be performed using the
91
+ /// `GetTaddressTxids` RPC method. It should then call `ZcashRustBackend.decryptAndStoreTransaction`
92
+ /// for each transaction so detected.
93
+ case transactionsInvolvingAddress(TransactionsInvolvingAddress)
20
94
  }
21
95
 
96
+ /// Metadata about the status of a transaction obtained by inspecting the chain state.
22
97
  enum TransactionStatus: Equatable {
98
+ /// The requested transaction ID was not recognized by the node.
23
99
  case txidNotRecognized
100
+ /// The requested transaction ID corresponds to a transaction that is recognized by the node,
101
+ /// but is in the mempool or is otherwise not mined in the main chain (but may have been mined
102
+ /// on a fork that was reorged away).
24
103
  case notInMainChain
104
+ /// The requested transaction ID corresponds to a transaction that has been included in the
105
+ /// block at the provided height.
25
106
  case mined(BlockHeight)
26
107
  }
@@ -24,17 +24,33 @@ public struct AccountBalance: Equatable {
24
24
  public let orchardBalance: PoolBalance
25
25
  public let unshielded: Zatoshi
26
26
 
27
- static let zero = AccountBalance(saplingBalance: .zero, orchardBalance: .zero, unshielded: .zero)
27
+ /// This field is reserved for special operations.
28
+ /// Its current use relates to the time period when the chain tip has not yet been updated, and an attempt would otherwise be made to shield transparent funds.
29
+ /// Such a scenario would result in failure, so the funds are moved to `awaitingResolution` until the chain tip is updated.
30
+ /// The goal is to report the total amount along with the expected value.
31
+ public let awaitingResolution: Zatoshi
32
+
33
+ static let zero = AccountBalance(saplingBalance: .zero, orchardBalance: .zero, unshielded: .zero, awaitingResolution: .zero)
34
+
35
+ init(saplingBalance: PoolBalance, orchardBalance: PoolBalance, unshielded: Zatoshi, awaitingResolution: Zatoshi = .zero) {
36
+ self.saplingBalance = saplingBalance
37
+ self.orchardBalance = orchardBalance
38
+ self.unshielded = unshielded
39
+ self.awaitingResolution = awaitingResolution
40
+ }
28
41
  }
29
42
 
30
43
  struct ScanProgress: Equatable {
31
44
  let numerator: UInt64
32
45
  let denominator: UInt64
33
46
 
47
+ var isComplete: Bool {
48
+ numerator == denominator
49
+ }
50
+
34
51
  func progress() throws -> Float {
35
52
  guard denominator != 0 else {
36
- // this shouldn't happen but if it does, we need to get notified by clients and work on a fix
37
- throw ZcashError.rustScanProgressOutOfRange("\(numerator)/\(denominator)")
53
+ return 1.0
38
54
  }
39
55
 
40
56
  let value = Float(numerator) / Float(denominator)
@@ -49,9 +65,10 @@ struct ScanProgress: Equatable {
49
65
  }
50
66
 
51
67
  struct WalletSummary: Equatable {
52
- let accountBalances: [UInt32: AccountBalance]
68
+ let accountBalances: [AccountUUID: AccountBalance]
53
69
  let chainTipHeight: BlockHeight
54
70
  let fullyScannedHeight: BlockHeight
71
+ let recoveryProgress: ScanProgress?
55
72
  let scanProgress: ScanProgress?
56
73
  let nextSaplingSubtreeIndex: UInt32
57
74
  let nextOrchardSubtreeIndex: UInt32
@@ -10,10 +10,18 @@ public protocol StringEncoded {
10
10
  var stringEncoded: String { get }
11
11
  }
12
12
 
13
+ public struct Account: Equatable, Hashable, Codable, Identifiable {
14
+ public let id: AccountUUID
15
+ public let name: String?
16
+ public let keySource: String?
17
+ public let seedFingerprint: [UInt8]?
18
+ public let hdAccountIndex: Zip32AccountIndex?
19
+ public let ufvk: UnifiedFullViewingKey?
20
+ }
21
+
13
22
  public struct UnifiedSpendingKey: Equatable, Undescribable {
14
23
  let network: NetworkType
15
24
  let bytes: [UInt8]
16
- public let account: UInt32
17
25
  }
18
26
 
19
27
  /// Sapling Extended Spending Key
@@ -43,25 +51,22 @@ public struct TransparentAccountPrivKey: Equatable, Undescribable {
43
51
  }
44
52
 
45
53
  /// A ZIP 316 Unified Full Viewing Key.
46
- public struct UnifiedFullViewingKey: Equatable, StringEncoded, Undescribable {
54
+ public struct UnifiedFullViewingKey: Equatable, StringEncoded, Undescribable, Hashable, Codable {
47
55
  let encoding: String
48
- public let account: UInt32
49
56
 
50
57
  public var stringEncoded: String { encoding }
51
58
 
52
59
  /// Initializes a new UnifiedFullViewingKey (UFVK) from the provided string encoding
53
60
  /// - Parameters:
54
61
  /// - parameter encoding: String encoding of unified full viewing key
55
- /// - parameter account: account number of the given UFVK
56
62
  /// - parameter network: `NetworkType` corresponding to the encoding (Mainnet or Testnet)
57
63
  /// - Throws: `unifiedFullViewingKeyInvalidInput`when the provided encoding is found to be invalid
58
- public init(encoding: String, account: UInt32, network: NetworkType) throws {
64
+ public init(encoding: String, network: NetworkType) throws {
59
65
  guard DerivationTool(networkType: network).isValidUnifiedFullViewingKey(encoding) else {
60
66
  throw ZcashError.unifiedFullViewingKeyInvalidInput
61
67
  }
62
68
 
63
69
  self.encoding = encoding
64
- self.account = account
65
70
  }
66
71
  }
67
72
 
@@ -115,6 +120,31 @@ extension AddressType {
115
120
  }
116
121
  }
117
122
 
123
+ /// Receiver types supported in a `UnifiedAddress` generated by the SDK.
124
+ public enum ReceiverType: Equatable {
125
+ /// A transparent P2PKH receiver.
126
+ case p2pkh
127
+ /// A shielded Sapling receiver.
128
+ case sapling
129
+ /// A shielded Orchard receiver.
130
+ case orchard
131
+ }
132
+
133
+ extension Set<ReceiverType> {
134
+ /// The set of all possible receivers in a `UnifiedAddress` generated by the SDK.
135
+ static let all: Set<ReceiverType> = [.p2pkh, .sapling, .orchard]
136
+ /// The set of all shielded receivers in a `UnifiedAddress` generated by the SDK.
137
+ static let shielded: Set<ReceiverType> = [.sapling, .orchard]
138
+
139
+ func toFlags() -> UInt32 {
140
+ var flags: UInt32 = 0
141
+ if contains(.p2pkh) { flags |= 1 << 0 }
142
+ if contains(.sapling) { flags |= 1 << 2 }
143
+ if contains(.orchard) { flags |= 1 << 3 }
144
+ return flags
145
+ }
146
+ }
147
+
118
148
  /// A Transparent Address that can be encoded as a String
119
149
  ///
120
150
  /// Transactions sent to this address are totally visible in the public
@@ -166,7 +196,7 @@ public struct SaplingAddress: Equatable, StringEncoded {
166
196
  }
167
197
  }
168
198
 
169
- public struct UnifiedAddress: Equatable, StringEncoded {
199
+ public struct UnifiedAddress: Equatable, StringEncoded, Codable, Hashable {
170
200
  let networkType: NetworkType
171
201
 
172
202
  public enum ReceiverTypecodes: Hashable {
@@ -247,7 +277,7 @@ public struct TexAddress: Equatable, StringEncoded, Comparable {
247
277
 
248
278
  public enum TransactionRecipient: Equatable {
249
279
  case address(Recipient)
250
- case internalAccount(UInt32)
280
+ case internalAccount(AccountUUID)
251
281
  }
252
282
 
253
283
  /// Represents a valid recipient of Zcash