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
@@ -36,7 +36,7 @@ public struct SynchronizerState: Equatable {
36
36
  /// SyncSessionIDs are provided to users
37
37
  public var syncSessionID: UUID
38
38
  /// account balance known to this synchronizer given the data that has processed locally
39
- public var accountBalance: AccountBalance?
39
+ public var accountsBalances: [AccountUUID: AccountBalance]
40
40
  /// status of the whole sync process
41
41
  var internalSyncStatus: InternalSyncStatus
42
42
  public var syncStatus: SyncStatus
@@ -47,7 +47,7 @@ public struct SynchronizerState: Equatable {
47
47
  public static var zero: SynchronizerState {
48
48
  SynchronizerState(
49
49
  syncSessionID: .nullID,
50
- accountBalance: .zero,
50
+ accountsBalances: [:],
51
51
  internalSyncStatus: .unprepared,
52
52
  latestBlockHeight: .zero
53
53
  )
@@ -55,12 +55,12 @@ public struct SynchronizerState: Equatable {
55
55
 
56
56
  init(
57
57
  syncSessionID: UUID,
58
- accountBalance: AccountBalance?,
58
+ accountsBalances: [AccountUUID: AccountBalance],
59
59
  internalSyncStatus: InternalSyncStatus,
60
60
  latestBlockHeight: BlockHeight
61
61
  ) {
62
62
  self.syncSessionID = syncSessionID
63
- self.accountBalance = accountBalance
63
+ self.accountsBalances = accountsBalances
64
64
  self.internalSyncStatus = internalSyncStatus
65
65
  self.latestBlockHeight = latestBlockHeight
66
66
  self.syncStatus = internalSyncStatus.mapToSyncStatus()
@@ -72,7 +72,7 @@ public enum SynchronizerEvent {
72
72
  case minedTransaction(ZcashTransaction.Overview)
73
73
 
74
74
  // Sent when the synchronizer finds a mined transaction
75
- case foundTransactions(_ transactions: [ZcashTransaction.Overview], _ inRange: CompactBlockRange)
75
+ case foundTransactions(_ transactions: [ZcashTransaction.Overview], _ inRange: CompactBlockRange?)
76
76
  // Sent when the synchronizer fetched utxos from lightwalletd attempted to store them.
77
77
  case storedUTXOs(_ inserted: [UnspentTransactionOutputEntity], _ skipped: [UnspentTransactionOutputEntity])
78
78
  // Connection state to LightwalletEndpoint changed.
@@ -103,7 +103,7 @@ public protocol Synchronizer: AnyObject {
103
103
 
104
104
  /// This stream emits the latest known USD/ZEC exchange rate, paired with the time it was queried. See `FiatCurrencyResult`.
105
105
  var exchangeRateUSDStream: AnyPublisher<FiatCurrencyResult?, Never> { get }
106
-
106
+
107
107
  /// Initialize the wallet. The ZIP-32 seed bytes can optionally be passed to perform
108
108
  /// database migrations. most of the times the seed won't be needed. If they do and are
109
109
  /// not provided this will fail with `InitializationResult.seedRequired`. It could
@@ -120,6 +120,8 @@ public protocol Synchronizer: AnyObject {
120
120
  /// - for: [walletMode] Set `.newWallet` when preparing synchronizer for a brand new generated wallet,
121
121
  /// `.restoreWallet` when wallet is about to be restored from a seed
122
122
  /// and `.existingWallet` for all other scenarios.
123
+ /// - name: name of the account.
124
+ /// - keySource: custom optional string for clients, used for example to help identify the type of the account.
123
125
  /// - Throws:
124
126
  /// - `aliasAlreadyInUse` if the Alias used to create this instance is already used by other instance.
125
127
  /// - `cantUpdateURLWithAlias` if the updating of paths in `Initilizer` according to alias fails. When this happens it means that
@@ -129,7 +131,9 @@ public protocol Synchronizer: AnyObject {
129
131
  func prepare(
130
132
  with seed: [UInt8]?,
131
133
  walletBirthday: BlockHeight,
132
- for walletMode: WalletInitMode
134
+ for walletMode: WalletInitMode,
135
+ name: String,
136
+ keySource: String?
133
137
  ) async throws -> Initializer.InitializationResult
134
138
 
135
139
  /// Starts this synchronizer within the given scope.
@@ -144,23 +148,29 @@ public protocol Synchronizer: AnyObject {
144
148
  func stop()
145
149
 
146
150
  /// Gets the sapling shielded address for the given account.
147
- /// - Parameter accountIndex: the optional accountId whose address is of interest. By default, the first account is used.
151
+ /// - Parameter accountUUID: the account whose address is of interest.
148
152
  /// - Returns the address or nil if account index is incorrect
149
- func getSaplingAddress(accountIndex: Int) async throws -> SaplingAddress
153
+ func getSaplingAddress(accountUUID: AccountUUID) async throws -> SaplingAddress
150
154
 
151
- /// Gets the unified address for the given account.
152
- /// - Parameter accountIndex: the optional accountId whose address is of interest. By default, the first account is used.
155
+ /// Gets the default unified address for the given account.
156
+ /// - Parameter accountUUID: the account whose address is of interest.
153
157
  /// - Returns the address or nil if account index is incorrect
154
- func getUnifiedAddress(accountIndex: Int) async throws -> UnifiedAddress
158
+ func getUnifiedAddress(accountUUID: AccountUUID) async throws -> UnifiedAddress
155
159
 
156
160
  /// Gets the transparent address for the given account.
157
- /// - Parameter accountIndex: the optional accountId whose address is of interest. By default, the first account is used.
161
+ /// - Parameter accountUUID: the account whose address is of interest. By default, the first account is used.
162
+ /// - Returns the address or nil if account index is incorrect
163
+ func getTransparentAddress(accountUUID: AccountUUID) async throws -> TransparentAddress
164
+
165
+ /// Obtains a fresh unified address for the given account with the specified receiver types.
166
+ /// - Parameter accountUUID: the account whose address is of interest.
167
+ /// - Parameter receivers: the receiver types to include in the address.
158
168
  /// - Returns the address or nil if account index is incorrect
159
- func getTransparentAddress(accountIndex: Int) async throws -> TransparentAddress
169
+ func getCustomUnifiedAddress(accountUUID: AccountUUID, receivers: Set<ReceiverType>) async throws -> UnifiedAddress
160
170
 
161
171
  /// Creates a proposal for transferring funds to the given recipient.
162
172
  ///
163
- /// - Parameter accountIndex: the account from which to transfer funds.
173
+ /// - Parameter accountUUID: the account from which to transfer funds.
164
174
  /// - Parameter recipient: the recipient's address.
165
175
  /// - Parameter amount: the amount to send in Zatoshi.
166
176
  /// - 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.
@@ -168,7 +178,7 @@ public protocol Synchronizer: AnyObject {
168
178
  /// If `prepare()` hasn't already been called since creation of the synchronizer instance or since the last wipe then this method throws
169
179
  /// `SynchronizerErrors.notPrepared`.
170
180
  func proposeTransfer(
171
- accountIndex: Int,
181
+ accountUUID: AccountUUID,
172
182
  recipient: Recipient,
173
183
  amount: Zatoshi,
174
184
  memo: Memo?
@@ -176,7 +186,7 @@ public protocol Synchronizer: AnyObject {
176
186
 
177
187
  /// Creates a proposal for shielding any transparent funds received by the given account.
178
188
  ///
179
- /// - Parameter accountIndex: the account for which to shield funds.
189
+ /// - Parameter accountUUID: the account for which to shield funds.
180
190
  /// - Parameter shieldingThreshold: the minimum transparent balance required before a proposal will be created.
181
191
  /// - Parameter memo: an optional memo to include as part of the proposal's transactions.
182
192
  /// - Parameter transparentReceiver: a specific transparent receiver within the account
@@ -190,7 +200,7 @@ public protocol Synchronizer: AnyObject {
190
200
  /// If `prepare()` hasn't already been called since creation of the synchronizer instance or since the last wipe then this method throws
191
201
  /// `SynchronizerErrors.notPrepared`.
192
202
  func proposeShielding(
193
- accountIndex: Int,
203
+ accountUUID: AccountUUID,
194
204
  shieldingThreshold: Zatoshi,
195
205
  memo: Memo,
196
206
  transparentReceiver: TransparentAddress?
@@ -212,46 +222,64 @@ public protocol Synchronizer: AnyObject {
212
222
  spendingKey: UnifiedSpendingKey
213
223
  ) async throws -> AsyncThrowingStream<TransactionSubmitResult, Error>
214
224
 
215
- /// Sends zatoshi.
216
- /// - Parameter spendingKey: the `UnifiedSpendingKey` that allows spends to occur.
217
- /// - Parameter zatoshi: the amount to send in Zatoshi.
218
- /// - Parameter toAddress: the recipient's address.
219
- /// - Parameter memo: an `Optional<Memo>`with the memo to include as part of the transaction. send `nil` when sending to transparent receivers otherwise the function will throw an error
220
- ///
221
- /// - NOTE: If `prepare()` hasn't already been called since creating of synchronizer instance or since the last wipe then this method throws
222
- /// `SynchronizerErrors.notPrepared`.
223
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
224
- func sendToAddress(
225
- spendingKey: UnifiedSpendingKey,
226
- zatoshi: Zatoshi,
227
- toAddress: Recipient,
228
- memo: Memo?
229
- ) async throws -> ZcashTransaction.Overview
230
-
231
- /// Attempts to propose fulfilling a [ZIP-321](https://zips.z.cash/zip-0321) payment URI using the given `accountIndex`
225
+ /// Attempts to propose fulfilling a [ZIP-321](https://zips.z.cash/zip-0321) payment URI by spending from the ZIP 32 account with the given index.
232
226
  /// - Parameter uri: a valid ZIP-321 payment URI
233
- /// - Parameter accountIndex: the account index that allows spends to occur.
227
+ /// - Parameter accountUUID: the account providing spend authority.
234
228
  ///
235
229
  /// - NOTE: If `prepare()` hasn't already been called since creating of synchronizer instance or since the last wipe then this method throws
236
230
  /// `SynchronizerErrors.notPrepared`.
237
231
  func proposefulfillingPaymentURI(
238
232
  _ uri: String,
239
- accountIndex: Int
233
+ accountUUID: AccountUUID
240
234
  ) async throws -> Proposal
241
235
 
242
- /// Shields transparent funds from the given private key into the best shielded pool of the account associated to the given `UnifiedSpendingKey`.
243
- /// - Parameter spendingKey: the `UnifiedSpendingKey` that allows to spend transparent funds
244
- /// - Parameter memo: the optional memo to include as part of the transaction.
245
- /// - Parameter shieldingThreshold: the minimum transparent balance required before a transaction will be created.
236
+ /// Creates a partially-created (unsigned without proofs) transaction from the given proposal.
246
237
  ///
247
- /// - Note: If `prepare()` hasn't already been called since creating of synchronizer instance or since the last wipe then this method throws
248
- /// `SynchronizerErrors.notPrepared`.
249
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
250
- func shieldFunds(
251
- spendingKey: UnifiedSpendingKey,
252
- memo: Memo,
253
- shieldingThreshold: Zatoshi
254
- ) async throws -> ZcashTransaction.Overview
238
+ /// Do not call this multiple times in parallel, or you will generate PCZT instances that, if
239
+ /// finalized, would double-spend the same notes.
240
+ ///
241
+ /// - Parameter accountUUID: The account for which the proposal was created.
242
+ /// - Parameter proposal: The proposal for which to create the transaction.
243
+ /// - Returns The partially created transaction in [Pczt] format.
244
+ ///
245
+ /// - Throws rustCreatePCZTFromProposal as a common indicator of the operation failure
246
+ func createPCZTFromProposal(accountUUID: AccountUUID, proposal: Proposal) async throws -> Pczt
247
+
248
+ /// Redacts information from the given PCZT that is unnecessary for the Signer role.
249
+ ///
250
+ /// - Parameter pczt: The partially created transaction in its serialized format.
251
+ ///
252
+ /// - Returns The updated PCZT in its serialized format.
253
+ ///
254
+ /// - Throws rustRedactPCZTForSigner as a common indicator of the operation failure
255
+ func redactPCZTForSigner(pczt: Pczt) async throws -> Pczt
256
+
257
+ /// Checks whether the caller needs to have downloaded the Sapling parameters.
258
+ ///
259
+ /// - Parameter pczt: The partially created transaction in its serialized format.
260
+ ///
261
+ /// - Returns `true` if this PCZT requires Sapling proofs.
262
+ func PCZTRequiresSaplingProofs(pczt: Pczt) async -> Bool
263
+
264
+ /// Adds proofs to the given PCZT.
265
+ ///
266
+ /// - Parameter pczt: The partially created transaction in its serialized format.
267
+ ///
268
+ /// - Returns The updated PCZT in its serialized format.
269
+ ///
270
+ /// - Throws rustAddProofsToPCZT as a common indicator of the operation failure
271
+ func addProofsToPCZT(pczt: Pczt) async throws -> Pczt
272
+
273
+ /// Takes a PCZT that has been separately proven and signed, finalizes it, and stores
274
+ /// it in the wallet. Internally, this logic also submits and checks the newly stored and encoded transaction.
275
+ ///
276
+ /// - Parameter pcztWithProofs
277
+ /// - Parameter pcztWithSigs
278
+ ///
279
+ /// - Returns The submission result of the completed transaction.
280
+ ///
281
+ /// - Throws PcztException.ExtractAndStoreTxFromPcztException as a common indicator of the operation failure
282
+ func createTransactionFromPCZT(pcztWithProofs: Pczt, pcztWithSigs: Pczt) async throws -> AsyncThrowingStream<TransactionSubmitResult, Error>
255
283
 
256
284
  /// all the transactions that are on the blockchain
257
285
  var transactions: [ZcashTransaction.Overview] { get async }
@@ -261,7 +289,7 @@ public protocol Synchronizer: AnyObject {
261
289
 
262
290
  /// all transactions related to receiving funds
263
291
  var receivedTransactions: [ZcashTransaction.Overview] { get async }
264
-
292
+
265
293
  /// A repository serving transactions in a paginated manner
266
294
  /// - Parameter kind: Transaction Kind expected from this PaginatedTransactionRepository
267
295
  func paginatedTransactions(of kind: TransactionKind) -> PaginatedTransactionRepository
@@ -286,7 +314,7 @@ public protocol Synchronizer: AnyObject {
286
314
 
287
315
  /// Attempt to get outputs involved in a given Transaction.
288
316
  /// - parameter transaction: A transaction overview
289
- /// - returns the array of outputs involved in this transaction. Transparent outputs might not be tracked
317
+ /// - returns the array of outputs involved in this transaction. Transparent outputs might not be tracked
290
318
  ///
291
319
  // sourcery: mockedName="getTransactionOutputsForTransaction"
292
320
  func getTransactionOutputs(for transaction: ZcashTransaction.Overview) async -> [ZcashTransaction.Output]
@@ -307,14 +335,34 @@ public protocol Synchronizer: AnyObject {
307
335
  /// `SynchronizerErrors.notPrepared`.
308
336
  func refreshUTXOs(address: TransparentAddress, from height: BlockHeight) async throws -> RefreshedUTXOs
309
337
 
310
- /// Account balances from the given account index
311
- /// - Parameter accountIndex: the index of the account
312
- /// - Returns: `AccountBalance`, struct that holds sapling and unshielded balances or `nil` when no account is associated with `accountIndex`
313
- func getAccountBalance(accountIndex: Int) async throws -> AccountBalance?
338
+ /// Accounts balances
339
+ /// - Returns: `[AccountUUID: AccountBalance]`, struct that holds Sapling and unshielded balances per account
340
+ func getAccountsBalances() async throws -> [AccountUUID: AccountBalance]
314
341
 
315
342
  /// Fetches the latest ZEC-USD exchange rate and updates `exchangeRateUSDSubject`.
316
343
  func refreshExchangeRateUSD()
317
344
 
345
+ /// Returns a list of the accounts in the wallet.
346
+ func listAccounts() async throws -> [Account]
347
+
348
+ /// Imports a new account with UnifiedFullViewingKey.
349
+ /// - Parameters:
350
+ /// - ufvk: unified full viewing key
351
+ /// - purpose: of the account, either `spending` or `viewOnly`
352
+ /// - name: name of the account.
353
+ /// - keySource: custom optional string for clients, used for example to help identify the type of the account.
354
+ // swiftlint:disable:next function_parameter_count
355
+ func importAccount(
356
+ ufvk: String,
357
+ seedFingerprint: [UInt8]?,
358
+ zip32AccountIndex: Zip32AccountIndex?,
359
+ purpose: AccountPurpose,
360
+ name: String,
361
+ keySource: String?
362
+ ) async throws -> AccountUUID
363
+
364
+ func fetchTxidsWithMemoContaining(searchTerm: String) async throws -> [Data]
365
+
318
366
  /// Rescans the known blocks with the current keys.
319
367
  ///
320
368
  /// `rewind(policy:)` can be called anytime. If the sync process is in progress then it is stopped first. In this case, it make some significant
@@ -354,9 +402,9 @@ public protocol Synchronizer: AnyObject {
354
402
  ///
355
403
  /// Returned publisher emits `initializerAliasAlreadyInUse` if the updating of paths in `Initilizer` according to alias fails. When
356
404
  /// this happens it means that some path passed to `Initializer` is invalid. The SDK can't recover from this and this instance won't do anything.
357
- ///
405
+ ///
358
406
  func wipe() -> AnyPublisher<Void, Error>
359
-
407
+
360
408
  /// This API stops the synchronization and re-initalizes everything according to the new endpoint provided.
361
409
  /// It can be called anytime.
362
410
  /// - Throws: ZcashError when failures occur and related to `synchronizer.start(retry: Bool)`, it's the only throwing operation
@@ -367,30 +415,104 @@ public protocol Synchronizer: AnyObject {
367
415
  ///
368
416
  /// - parameter seed: byte array of the seed
369
417
  func isSeedRelevantToAnyDerivedAccount(seed: [UInt8]) async throws -> Bool
370
-
418
+
371
419
  /// Takes the list of endpoints and runs it through a series of checks to evaluate its performance.
372
420
  /// - Parameters:
373
421
  /// - endpoints: Array of endpoints to evaluate.
374
- /// - latencyThresholdMillis: The mean latency of `getInfo` and `getTheLatestHeight` calls must be below this threshold. The default is 300 ms.
375
422
  /// - fetchThresholdSeconds: The time to download `nBlocksToFetch` blocks from the stream must be below this threshold. The default is 60 seconds.
376
423
  /// - nBlocksToFetch: The number of blocks expected to be downloaded from the stream, with the time compared to `fetchThresholdSeconds`. The default is 100.
377
- /// - kServers: The expected number of endpoints in the output. The default is 3.
424
+ /// - kServers: The required number of endpoints in the output. The default is 3.
378
425
  /// - network: Mainnet or testnet. The default is mainnet.
379
426
  func evaluateBestOf(
380
427
  endpoints: [LightWalletEndpoint],
381
- latencyThresholdMillis: Double,
382
428
  fetchThresholdSeconds: Double,
383
429
  nBlocksToFetch: UInt64,
384
430
  kServers: Int,
385
431
  network: NetworkType
386
432
  ) async -> [LightWalletEndpoint]
433
+
434
+ /// Takes a given date and finds out the closes checkpoint's height for it.
435
+ /// Each checkpoint has a timestamp stored so it can be used for the calculations.
436
+ func estimateBirthdayHeight(for date: Date) -> BlockHeight
437
+
438
+ /// Allows to setup the Tor opt-in/out runtime.
439
+ /// - Parameters:
440
+ /// - enabled: When true, the SDK ensures `TorClient` is ready. This flag controls http and lwd service calls.
441
+ /// - Throws: ZcashError when failures of the `TorClient` occur
442
+ func tor(enabled: Bool) async throws
443
+
444
+ /// Allows to setup exchange rate over Tor.
445
+ /// - Parameters:
446
+ /// - enabled: When true, the SDK ensures `TorClient` is ready. This flag controls whether exchange rate feature is possible to use or not.
447
+ /// - Throws: ZcashError when failures of the `TorClient` occur
448
+ func exchangeRateOverTor(enabled: Bool) async throws
449
+
450
+ /// Init of the SDK must always happen but initialization of `TorClient` can fail. This failure is designed to not block SDK initialization.
451
+ /// Instead, a result of the initialization is stored in the `SDKFLags`
452
+ /// - Returns: nil, the initialization hasn't been initiated, true/false = initialization succeeded/failed
453
+ func isTorSuccessfullyInitialized() async -> Bool?
454
+
455
+ /// Makes an HTTP request over Tor and delivers the `HTTPURLResponse`.
456
+ ///
457
+ /// This request is isolated (using separate circuits) from any other requests or
458
+ /// Tor usage, but may still be correlatable by the server through request timing
459
+ /// (if the caller does not mitigate timing attacks).
460
+ ///
461
+ /// The Swift's signature aligns with `URLSession.data(for request: URLRequest)`.
462
+ ///
463
+ /// - Parameters:
464
+ /// - for: URLRequest
465
+ /// - retryLimit: How many times the request will be retried in case of failure
466
+ func httpRequestOverTor(for request: URLRequest, retryLimit: UInt8) async throws -> (data: Data, response: HTTPURLResponse)
467
+
468
+ /// Performs an `sql` query on a database and returns some output as a string
469
+ /// Use cautiously!
470
+ /// The connection to the database is created in a read-only mode. it's a hard requirement.
471
+ /// Details: `TransactionSQLDAO(dbProvider: SimpleConnectionProvider(path: urls.dataDbURL.path, readonly: true))`
472
+ func debugDatabase(sql: String) -> String
473
+
474
+ /// Get an ephemeral single use transparent address
475
+ /// - Parameter accountUUID: The account for which the single use transparent address is going to be created.
476
+ /// - Returns The struct with an ephemeral transparent address and gap limit info
477
+ ///
478
+ /// - Throws rustGetSingleUseTransparentAddress as a common indicator of the operation failure
479
+ func getSingleUseTransparentAddress(accountUUID: AccountUUID) async throws -> SingleUseTransparentAddress
480
+
481
+ /// Checks to find any single-use ephemeral addresses exposed in the past day that have not yet
482
+ /// received funds, excluding any whose next check time is in the future. This will then choose the
483
+ /// address that is most overdue for checking, retrieve any UTXOs for that address over Tor, and
484
+ /// add them to the wallet database. If no such UTXOs are found, the check will be rescheduled
485
+ /// following an expoential-backoff-with-jitter algorithm.
486
+ /// - Parameter accountUUID: The account for which the single use transparent addresses are going to be checked.
487
+ /// - Returns `.found(String)` an address found if UTXOs were added to the wallet, `.notFound` otherwise.
488
+ ///
489
+ /// - Throws rustCheckSingleUseTransparentAddresses as a common indicator of the operation failure
490
+ func checkSingleUseTransparentAddresses(accountUUID: AccountUUID) async throws -> TransparentAddressCheckResult
491
+
492
+ /// Finds all transactions associated with the given transparent address.
493
+ /// - Parameter address: The address for which the transactions will be checked.
494
+ /// - Returns `.found(String)` an address found if UTXOs were added to the wallet, `.notFound` otherwise.
495
+ ///
496
+ /// - Throws rustUpdateTransparentAddressTransactions as a common indicator of the operation failure
497
+ func updateTransparentAddressTransactions(address: String) async throws -> TransparentAddressCheckResult
498
+
499
+ /// Checks to find any UTXOs associated with the given transparent address. This check will cover the block range starting at the exposure height for that address,
500
+ /// if known, or otherwise at the birthday height of the specified account.
501
+ /// - Parameters:
502
+ /// - address: The address for which the transactions will be checked.
503
+ /// - accountUUID: The account for which the single use transparent addresses are going to be checked.
504
+ /// - Returns `.found(String)` an address found if UTXOs were added to the wallet, `.notFound` otherwise.
505
+ ///
506
+ /// - Throws rustFetchUTXOsByAddress as a common indicator of the operation failure
507
+ func fetchUTXOsBy(address: String, accountUUID: AccountUUID) async throws -> TransparentAddressCheckResult
387
508
  }
388
509
 
389
510
  public enum SyncStatus: Equatable {
390
511
  public static func == (lhs: SyncStatus, rhs: SyncStatus) -> Bool {
391
512
  switch (lhs, rhs) {
392
513
  case (.unprepared, .unprepared): return true
393
- case let (.syncing(lhsProgress), .syncing(rhsProgress)): return lhsProgress == rhsProgress
514
+ case let (.syncing(lhsSyncProgress, lhsRecoveryPrgoress), .syncing(rhsSyncProgress, rhsRecoveryPrgoress)):
515
+ return lhsSyncProgress == rhsSyncProgress && lhsRecoveryPrgoress == rhsRecoveryPrgoress
394
516
  case (.upToDate, .upToDate): return true
395
517
  case (.error, .error): return true
396
518
  default: return false
@@ -402,7 +524,7 @@ public enum SyncStatus: Equatable {
402
524
  /// taking other maintenance steps that need to occur after an upgrade.
403
525
  case unprepared
404
526
 
405
- case syncing(_ progress: Float)
527
+ case syncing(_ syncProgress: Float, _ areFundsSpendable: Bool)
406
528
 
407
529
  /// Indicates that this Synchronizer is fully up to date and ready for all wallet functions.
408
530
  /// When set, a UI element may want to turn green.
@@ -455,7 +577,7 @@ enum InternalSyncStatus: Equatable {
455
577
  case unprepared
456
578
 
457
579
  /// Indicates that this Synchronizer is actively processing new blocks (consists of fetch, scan and enhance operations)
458
- case syncing(Float)
580
+ case syncing(Float, Bool)
459
581
 
460
582
  /// Indicates that this Synchronizer is fully up to date and ready for all wallet functions.
461
583
  /// When set, a UI element may want to turn green.
@@ -551,7 +673,8 @@ extension InternalSyncStatus {
551
673
  public static func == (lhs: InternalSyncStatus, rhs: InternalSyncStatus) -> Bool {
552
674
  switch (lhs, rhs) {
553
675
  case (.unprepared, .unprepared): return true
554
- case let (.syncing(lhsProgress), .syncing(rhsProgress)): return lhsProgress == rhsProgress
676
+ case let (.syncing(lhsSyncProgress, lhsRecoveryPrgoress), .syncing(rhsSyncProgress, rhsRecoveryPrgoress)):
677
+ return lhsSyncProgress == rhsSyncProgress && lhsRecoveryPrgoress == rhsRecoveryPrgoress
555
678
  case (.synced, .synced): return true
556
679
  case (.stopped, .stopped): return true
557
680
  case (.disconnected, .disconnected): return true
@@ -562,8 +685,8 @@ extension InternalSyncStatus {
562
685
  }
563
686
 
564
687
  extension InternalSyncStatus {
565
- init(_ blockProcessorProgress: Float) {
566
- self = .syncing(blockProcessorProgress)
688
+ init(_ syncProgress: Float, _ areFundsSpendable: Bool) {
689
+ self = .syncing(syncProgress, areFundsSpendable)
567
690
  }
568
691
  }
569
692
 
@@ -572,8 +695,8 @@ extension InternalSyncStatus {
572
695
  switch self {
573
696
  case .unprepared:
574
697
  return .unprepared
575
- case .syncing(let progress):
576
- return .syncing(progress)
698
+ case let .syncing(syncProgress, areFundsSpendable):
699
+ return .syncing(syncProgress, areFundsSpendable)
577
700
  case .synced:
578
701
  return .upToDate
579
702
  case .stopped:
@@ -17,14 +17,18 @@ public protocol KeyValidation {
17
17
  }
18
18
 
19
19
  public protocol KeyDeriving {
20
- /// Given the seed bytes tand the account index, return the UnifiedSpendingKey
20
+ /// Derives and returns a UnifiedAddress from a UnifiedFullViewingKey
21
+ /// - Parameter ufvk: UTF-8 encoded String containing a valid UFVK
22
+ /// - Returns: the corresponding default `UnifiedAddress`
23
+ func deriveUnifiedAddressFrom(ufvk: String) throws -> UnifiedAddress
24
+
25
+ /// Given the seed bytes and ZIP 32 account index, return the corresponding UnifiedSpendingKey.
21
26
  /// - Parameter seed: `[Uint8]` seed bytes
22
- /// - Parameter accountNumber: `Int` with the account number
27
+ /// - Parameter accountIndex: the ZIP 32 index of the account
23
28
  /// - Throws:
24
- /// - `derivationToolSpendingKeyInvalidAccount` if the `accountIndex` is invalid.
25
29
  /// - some `ZcashError.rust*` error if the derivation fails.
26
30
  /// - Returns a `UnifiedSpendingKey`
27
- func deriveUnifiedSpendingKey(seed: [UInt8], accountIndex: Int) throws -> UnifiedSpendingKey
31
+ func deriveUnifiedSpendingKey(seed: [UInt8], accountIndex: Zip32AccountIndex) throws -> UnifiedSpendingKey
28
32
 
29
33
  /// Given a spending key, return the associated viewing key.
30
34
  /// - Parameter spendingKey: the `UnifiedSpendingKey` from which to derive the `UnifiedFullViewingKey` from.
@@ -48,6 +52,30 @@ public protocol KeyDeriving {
48
52
  func receiverTypecodesFromUnifiedAddress(_ address: UnifiedAddress) throws -> [UnifiedAddress.ReceiverTypecodes]
49
53
 
50
54
  static func getAddressMetadata(_ addr: String) -> AddressMetadata?
55
+
56
+ /// Derives and returns a ZIP 32 Arbitrary Key from the given seed at the "wallet level", i.e.
57
+ /// directly from the seed with no ZIP 32 path applied.
58
+ ///
59
+ /// The resulting key will be the same across all networks (Zcash mainnet, Zcash testnet,
60
+ /// OtherCoin mainnet, and so on). You can think of it as a context-specific seed fingerprint
61
+ /// that can be used as (static) key material.
62
+ ///
63
+ /// - Parameter contextString: a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
64
+ /// - Parameter seed: `[Uint8]` seed bytes
65
+ /// - Throws:
66
+ /// - some `ZcashError.rust*` error if the derivation fails.
67
+ /// - Returns a `[Uint8]`
68
+ static func deriveArbitraryWalletKey(contextString: [UInt8], seed: [UInt8]) throws -> [UInt8]
69
+
70
+ /// Derives and returns a ZIP 32 Arbitrary Key from the given seed at the account level.
71
+ ///
72
+ /// - Parameter contextString: a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
73
+ /// - Parameter seed: `[Uint8]` seed bytes
74
+ /// - Parameter accountIndex: the ZIP 32 index of the account
75
+ /// - Throws:
76
+ /// - some `ZcashError.rust*` error if the derivation fails.
77
+ /// - Returns a `[Uint8]`
78
+ func deriveArbitraryAccountKey(contextString: [UInt8], seed: [UInt8], accountIndex: Zip32AccountIndex) throws -> [UInt8]
51
79
  }
52
80
 
53
81
  public class DerivationTool: KeyDeriving {
@@ -69,6 +97,10 @@ public class DerivationTool: KeyDeriving {
69
97
  ZcashKeyDerivationBackend.getAddressMetadata(addr)
70
98
  }
71
99
 
100
+ public func deriveUnifiedAddressFrom(ufvk: String) throws -> UnifiedAddress {
101
+ try backend.deriveUnifiedAddressFrom(ufvk: ufvk)
102
+ }
103
+
72
104
  /// Given a spending key, return the associated viewing key.
73
105
  /// - Parameter spendingKey: the `UnifiedSpendingKey` from which to derive the `UnifiedFullViewingKey` from.
74
106
  /// - Returns: the viewing key that corresponds to the spending key.
@@ -78,18 +110,44 @@ public class DerivationTool: KeyDeriving {
78
110
 
79
111
  /// Given a seed and a number of accounts, return the associated spending keys.
80
112
  /// - Parameter seed: the seed from which to derive spending keys.
81
- /// - Parameter numberOfAccounts: the number of accounts to use. Multiple accounts are not fully
82
- /// supported so the default value of 1 is recommended.
113
+ /// - Parameter accountIndex: the ZIP 32 index of the account
83
114
  /// - Returns: the spending keys that correspond to the seed, formatted as Strings.
84
- public func deriveUnifiedSpendingKey(seed: [UInt8], accountIndex: Int) throws -> UnifiedSpendingKey {
85
- guard accountIndex >= 0, let accountIndex = Int32(exactly: accountIndex) else { throw ZcashError.derivationToolSpendingKeyInvalidAccount }
86
- return try backend.deriveUnifiedSpendingKey(from: seed, accountIndex: accountIndex)
115
+ public func deriveUnifiedSpendingKey(seed: [UInt8], accountIndex: Zip32AccountIndex) throws -> UnifiedSpendingKey {
116
+ try backend.deriveUnifiedSpendingKey(from: seed, accountIndex: accountIndex)
87
117
  }
88
118
 
89
119
  public func receiverTypecodesFromUnifiedAddress(_ address: UnifiedAddress) throws -> [UnifiedAddress.ReceiverTypecodes] {
90
- return try backend.receiverTypecodesOnUnifiedAddress(address.stringEncoded)
120
+ try backend.receiverTypecodesOnUnifiedAddress(address.stringEncoded)
91
121
  .map { UnifiedAddress.ReceiverTypecodes(typecode: $0) }
92
122
  }
123
+
124
+ /// Derives and returns a ZIP 32 Arbitrary Key from the given seed at the "wallet level", i.e.
125
+ /// directly from the seed with no ZIP 32 path applied.
126
+ ///
127
+ /// The resulting key will be the same across all networks (Zcash mainnet, Zcash testnet,
128
+ /// OtherCoin mainnet, and so on). You can think of it as a context-specific seed fingerprint
129
+ /// that can be used as (static) key material.
130
+ ///
131
+ /// - Parameter contextString: a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
132
+ /// - Parameter seed: `[Uint8]` seed bytes
133
+ /// - Throws:
134
+ /// - some `ZcashError.rust*` error if the derivation fails.
135
+ /// - Returns a `[Uint8]`
136
+ public static func deriveArbitraryWalletKey(contextString: [UInt8], seed: [UInt8]) throws -> [UInt8] {
137
+ try ZcashKeyDerivationBackend.deriveArbitraryWalletKey(contextString: contextString, from: seed)
138
+ }
139
+
140
+ /// Derives and returns a ZIP 32 Arbitrary Key from the given seed at the account level.
141
+ ///
142
+ /// - Parameter contextString: a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
143
+ /// - Parameter seed: `[Uint8]` seed bytes
144
+ /// - Parameter accountIndex: the ZIP 32 index of the account
145
+ /// - Throws:
146
+ /// - some `ZcashError.rust*` error if the derivation fails.
147
+ /// - Returns a `[Uint8]`
148
+ public func deriveArbitraryAccountKey(contextString: [UInt8], seed: [UInt8], accountIndex: Zip32AccountIndex) throws -> [UInt8] {
149
+ try backend.deriveArbitraryAccountKey(contextString: contextString, from: seed, accountIndex: accountIndex)
150
+ }
93
151
  }
94
152
 
95
153
  public struct AddressMetadata {
@@ -184,9 +242,8 @@ extension UnifiedFullViewingKey {
184
242
  /// already validated by another function. only for internal use. Unless you are
185
243
  /// constructing an address from a primitive function of the FFI, you probably
186
244
  /// shouldn't be using this.
187
- init(validatedEncoding: String, account: UInt32) {
245
+ init(validatedEncoding: String) {
188
246
  self.encoding = validatedEncoding
189
- self.account = account
190
247
  }
191
248
  }
192
249