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
@@ -8,6 +8,8 @@
8
8
 
9
9
  import Foundation
10
10
 
11
+ typealias LCZip32Index = Int32
12
+
11
13
  enum ZcashRustBackendWeldingConstants {
12
14
  static let validChain: Int32 = -1
13
15
  }
@@ -34,7 +36,28 @@ public enum RewindResult {
34
36
 
35
37
  protocol ZcashRustBackendWelding {
36
38
  /// Returns a list of the accounts in the wallet.
37
- func listAccounts() async throws -> [Int32]
39
+ func listAccounts() async throws -> [Account]
40
+
41
+ /// Adds a new account to the wallet by importing the UFVK that will be used to detect incoming
42
+ /// payments.
43
+ ///
44
+ /// Derivation metadata may optionally be included. To indicate that no derivation metadata is
45
+ /// available, `seedFingerprint` and `zip32AccountIndex` should be set to `nil`. Derivation
46
+ /// metadata will not be stored unless both the seed fingerprint and the HD account index are
47
+ /// provided.
48
+ ///
49
+ /// - Returns: the globally unique identifier for the account.
50
+ // swiftlint:disable:next function_parameter_count
51
+ func importAccount(
52
+ ufvk: String,
53
+ seedFingerprint: [UInt8]?,
54
+ zip32AccountIndex: Zip32AccountIndex?,
55
+ treeState: TreeState,
56
+ recoverUntil: UInt32?,
57
+ purpose: AccountPurpose,
58
+ name: String,
59
+ keySource: String?
60
+ ) async throws -> AccountUUID
38
61
 
39
62
  /// Adds the next available account-level spend authority, given the current set of [ZIP 316]
40
63
  /// account identifiers known, to the wallet database.
@@ -55,7 +78,13 @@ protocol ZcashRustBackendWelding {
55
78
  /// - parameter recoverUntil: the fully-scanned height up to which the account will be treated as "being recovered"
56
79
  /// - Returns: The `UnifiedSpendingKey` structs for the number of accounts created
57
80
  /// - Throws: `rustCreateAccount`.
58
- func createAccount(seed: [UInt8], treeState: TreeState, recoverUntil: UInt32?) async throws -> UnifiedSpendingKey
81
+ func createAccount(
82
+ seed: [UInt8],
83
+ treeState: TreeState,
84
+ recoverUntil: UInt32?,
85
+ name: String,
86
+ keySource: String?
87
+ ) async throws -> UnifiedSpendingKey
59
88
 
60
89
  /// Checks whether the given seed is relevant to any of the derived accounts in the wallet.
61
90
  ///
@@ -65,22 +94,24 @@ protocol ZcashRustBackendWelding {
65
94
  /// Scans a transaction for any information that can be decrypted by the accounts in the wallet, and saves it to the wallet.
66
95
  /// - parameter tx: the transaction to decrypt
67
96
  /// - parameter minedHeight: height on which this transaction was mined. this is used to fetch the consensus branch ID.
97
+ /// - Returns: The transaction's ID.
68
98
  /// - Throws: `rustDecryptAndStoreTransaction`.
69
- func decryptAndStoreTransaction(txBytes: [UInt8], minedHeight: UInt32?) async throws
99
+ func decryptAndStoreTransaction(txBytes: [UInt8], minedHeight: UInt32?) async throws -> Data
70
100
 
71
101
  /// Returns the most-recently-generated unified payment address for the specified account.
72
102
  /// - parameter account: index of the given account
73
103
  /// - Throws:
74
104
  /// - `rustGetCurrentAddress` if rust layer returns error.
75
105
  /// - `rustGetCurrentAddressInvalidAddress` if generated unified address isn't valid.
76
- func getCurrentAddress(account: Int32) async throws -> UnifiedAddress
106
+ func getCurrentAddress(accountUUID: AccountUUID) async throws -> UnifiedAddress
77
107
 
78
108
  /// Returns a newly-generated unified payment address for the specified account, with the next available diversifier.
79
109
  /// - parameter account: index of the given account
110
+ /// - parameter receiverFlags: bitflags specifying which receivers to include in the address.
80
111
  /// - Throws:
81
112
  /// - `rustGetNextAvailableAddress` if rust layer returns error.
82
113
  /// - `rustGetNextAvailableAddressInvalidAddress` if generated unified address isn't valid.
83
- func getNextAvailableAddress(account: Int32) async throws -> UnifiedAddress
114
+ func getNextAvailableAddress(accountUUID: AccountUUID, receiverFlags: UInt32) async throws -> UnifiedAddress
84
115
 
85
116
  /// Get memo from note.
86
117
  /// - parameter txId: ID of transaction containing the note
@@ -93,7 +124,7 @@ protocol ZcashRustBackendWelding {
93
124
  /// - Throws:
94
125
  /// - `rustGetTransparentBalanceNegativeAccount` if `account` is < 0.
95
126
  /// - `rustGetTransparentBalance` if rust layer returns error.
96
- func getTransparentBalance(account: Int32) async throws -> Int64
127
+ func getTransparentBalance(accountUUID: AccountUUID) async throws -> Int64
97
128
 
98
129
  /// Initializes the data db. This will performs any migrations needed on the sqlite file
99
130
  /// provided. Some migrations might need that callers provide the seed bytes.
@@ -110,14 +141,14 @@ protocol ZcashRustBackendWelding {
110
141
  /// - Throws:
111
142
  /// - `rustListTransparentReceivers` if rust layer returns error.
112
143
  /// - `rustListTransparentReceiversInvalidAddress` if transarent received generated by rust is invalid.
113
- func listTransparentReceivers(account: Int32) async throws -> [TransparentAddress]
144
+ func listTransparentReceivers(accountUUID: AccountUUID) async throws -> [TransparentAddress]
114
145
 
115
146
  /// Get the verified cached transparent balance for the given account
116
147
  /// - parameter account: account index to query the balance for.
117
148
  /// - Throws:
118
149
  /// - `rustGetVerifiedTransparentBalanceNegativeAccount` if `account` is < 0.
119
150
  /// - `rustGetVerifiedTransparentBalance` if rust layer returns error.
120
- func getVerifiedTransparentBalance(account: Int32) async throws -> Int64
151
+ func getVerifiedTransparentBalance(accountUUID: AccountUUID) async throws -> Int64
121
152
 
122
153
  /// Resets the state of the database to only contain block and transaction information up to the given height. clears up all derived data as well
123
154
  /// - parameter height: height to rewind to.
@@ -215,7 +246,7 @@ protocol ZcashRustBackendWelding {
215
246
  /// - Parameter memo: the `MemoBytes` for this transaction. pass `nil` when sending to transparent receivers
216
247
  /// - Throws: `rustCreateToAddress`.
217
248
  func proposeTransfer(
218
- account: Int32,
249
+ accountUUID: AccountUUID,
219
250
  to address: String,
220
251
  value: Int64,
221
252
  memo: MemoBytes?
@@ -227,13 +258,10 @@ protocol ZcashRustBackendWelding {
227
258
  ///
228
259
  /// - parameter uri: the URI String that the proposal will be made from.
229
260
  /// - parameter account: index of the given account
230
- /// - Parameter to: recipient address
231
- /// - Parameter value: transaction amount in Zatoshi
232
- /// - Parameter memo: the `MemoBytes` for this transaction. pass `nil` when sending to transparent receivers
233
261
  /// - Throws: `rustCreateToAddress`.
234
262
  func proposeTransferFromURI(
235
263
  _ uri: String,
236
- account: Int32
264
+ accountUUID: AccountUUID
237
265
  ) async throws -> FfiProposal
238
266
 
239
267
  /// Constructs a transaction proposal to shield all found UTXOs in data db for the given account,
@@ -251,7 +279,7 @@ protocol ZcashRustBackendWelding {
251
279
  /// to shield.
252
280
  /// - Throws: `rustShieldFunds` if rust layer returns error.
253
281
  func proposeShielding(
254
- account: Int32,
282
+ accountUUID: AccountUUID,
255
283
  memo: MemoBytes?,
256
284
  shieldingThreshold: Zatoshi,
257
285
  transparentReceiver: String?
@@ -266,6 +294,54 @@ protocol ZcashRustBackendWelding {
266
294
  usk: UnifiedSpendingKey
267
295
  ) async throws -> [Data]
268
296
 
297
+ /// Creates a partially-created (unsigned without proofs) transaction from the given proposal.
298
+ ///
299
+ /// Do not call this multiple times in parallel, or you will generate PCZT instances that, if
300
+ /// finalized, would double-spend the same notes.
301
+ ///
302
+ /// - Parameter accountUUID: The account for which the proposal was created.
303
+ /// - Parameter proposal: The proposal for which to create the transaction.
304
+ /// - Returns The partially created transaction in [Pczt] format.
305
+ ///
306
+ /// - Throws rustCreatePCZTFromProposal as a common indicator of the operation failure
307
+ func createPCZTFromProposal(accountUUID: AccountUUID, proposal: FfiProposal) async throws -> Pczt
308
+
309
+ /// Redacts information from the given PCZT that is unnecessary for the Signer role.
310
+ ///
311
+ /// - Parameter pczt: The partially created transaction in its serialized format.
312
+ ///
313
+ /// - Returns The updated PCZT in its serialized format.
314
+ ///
315
+ /// - Throws rustRedactPCZTForSigner as a common indicator of the operation failure
316
+ func redactPCZTForSigner(pczt: Pczt) async throws -> Pczt
317
+
318
+ /// Checks whether the caller needs to have downloaded the Sapling parameters.
319
+ ///
320
+ /// - Parameter pczt: The partially created transaction in its serialized format.
321
+ ///
322
+ /// - Returns `true` if this PCZT requires Sapling proofs.
323
+ func PCZTRequiresSaplingProofs(pczt: Pczt) async -> Bool
324
+
325
+ /// Adds proofs to the given PCZT.
326
+ ///
327
+ /// - Parameter pczt: The partially created transaction in its serialized format.
328
+ ///
329
+ /// - Returns The updated PCZT in its serialized format.
330
+ ///
331
+ /// - Throws rustAddProofsToPCZT as a common indicator of the operation failure
332
+ func addProofsToPCZT(pczt: Pczt) async throws -> Pczt
333
+
334
+ /// Takes a PCZT that has been separately proven and signed, finalizes it, and stores
335
+ /// it in the wallet. Internally, this logic also submits and checks the newly stored and encoded transaction.
336
+ ///
337
+ /// - Parameter pcztWithProofs
338
+ /// - Parameter pcztWithSigs
339
+ ///
340
+ /// - Returns The submission result of the completed transaction.
341
+ ///
342
+ /// - Throws PcztException.ExtractAndStoreTxFromPcztException as a common indicator of the operation failure
343
+ func extractAndStoreTxFromPCZT(pcztWithProofs: Pczt, pcztWithSigs: Pczt) async throws -> Data
344
+
269
345
  /// Gets the consensus branch id for the given height
270
346
  /// - Parameter height: the height you what to know the branch id for
271
347
  /// - Throws: `rustNoConsensusBranchId` if rust layer returns error.
@@ -305,4 +381,11 @@ protocol ZcashRustBackendWelding {
305
381
  /// scanning; as a consequence, the wallet must actively query to determine whether such
306
382
  /// transactions have been mined.
307
383
  func setTransactionStatus(txId: Data, status: TransactionStatus) async throws
384
+
385
+ /// Fix witnesses - addressing note commitment tree bug.
386
+ /// This function is supposed to be called occasionaly. It's handled by the SDK Synchronizer and called only once per version.
387
+ func fixWitnesses() async
388
+
389
+ /// Get an ephemeral single use transparent address
390
+ func getSingleUseTransparentAddress(accountUUID: AccountUUID) async throws -> SingleUseTransparentAddress
308
391
  }
@@ -31,14 +31,23 @@ extension ClosureSDKSynchronizer: ClosureSynchronizer {
31
31
  public var stateStream: AnyPublisher<SynchronizerState, Never> { synchronizer.stateStream }
32
32
  public var eventStream: AnyPublisher<SynchronizerEvent, Never> { synchronizer.eventStream }
33
33
 
34
+ // swiftlint:disable:next function_parameter_count
34
35
  public func prepare(
35
36
  with seed: [UInt8]?,
36
37
  walletBirthday: BlockHeight,
37
38
  for walletMode: WalletInitMode,
39
+ name: String,
40
+ keySource: String?,
38
41
  completion: @escaping (Result<Initializer.InitializationResult, Error>) -> Void
39
42
  ) {
40
43
  AsyncToClosureGateway.executeThrowingAction(completion) {
41
- return try await self.synchronizer.prepare(with: seed, walletBirthday: walletBirthday, for: walletMode)
44
+ return try await self.synchronizer.prepare(
45
+ with: seed,
46
+ walletBirthday: walletBirthday,
47
+ for: walletMode,
48
+ name: name,
49
+ keySource: keySource
50
+ )
42
51
  }
43
52
  }
44
53
 
@@ -52,38 +61,72 @@ extension ClosureSDKSynchronizer: ClosureSynchronizer {
52
61
  synchronizer.stop()
53
62
  }
54
63
 
55
- public func getSaplingAddress(accountIndex: Int, completion: @escaping (Result<SaplingAddress, Error>) -> Void) {
64
+ public func getSaplingAddress(accountUUID: AccountUUID, completion: @escaping (Result<SaplingAddress, Error>) -> Void) {
65
+ AsyncToClosureGateway.executeThrowingAction(completion) {
66
+ try await self.synchronizer.getSaplingAddress(accountUUID: accountUUID)
67
+ }
68
+ }
69
+
70
+ public func getUnifiedAddress(accountUUID: AccountUUID, completion: @escaping (Result<UnifiedAddress, Error>) -> Void) {
56
71
  AsyncToClosureGateway.executeThrowingAction(completion) {
57
- try await self.synchronizer.getSaplingAddress(accountIndex: accountIndex)
72
+ try await self.synchronizer.getUnifiedAddress(accountUUID: accountUUID)
58
73
  }
59
74
  }
60
75
 
61
- public func getUnifiedAddress(accountIndex: Int, completion: @escaping (Result<UnifiedAddress, Error>) -> Void) {
76
+ public func getTransparentAddress(accountUUID: AccountUUID, completion: @escaping (Result<TransparentAddress, Error>) -> Void) {
62
77
  AsyncToClosureGateway.executeThrowingAction(completion) {
63
- try await self.synchronizer.getUnifiedAddress(accountIndex: accountIndex)
78
+ try await self.synchronizer.getTransparentAddress(accountUUID: accountUUID)
64
79
  }
65
80
  }
66
81
 
67
- public func getTransparentAddress(accountIndex: Int, completion: @escaping (Result<TransparentAddress, Error>) -> Void) {
82
+ public func getCustomUnifiedAddress(accountUUID: AccountUUID, receivers: Set<ReceiverType>, completion: @escaping (Result<UnifiedAddress, Error>) -> Void) {
68
83
  AsyncToClosureGateway.executeThrowingAction(completion) {
69
- try await self.synchronizer.getTransparentAddress(accountIndex: accountIndex)
84
+ try await self.synchronizer.getCustomUnifiedAddress(accountUUID: accountUUID, receivers: receivers)
85
+ }
86
+ }
87
+
88
+ public func listAccounts(completion: @escaping (Result<[Account], Error>) -> Void) {
89
+ AsyncToClosureGateway.executeThrowingAction(completion) {
90
+ try await self.synchronizer.listAccounts()
91
+ }
92
+ }
93
+
94
+ // swiftlint:disable:next function_parameter_count
95
+ public func importAccount(
96
+ ufvk: String,
97
+ seedFingerprint: [UInt8]?,
98
+ zip32AccountIndex: Zip32AccountIndex?,
99
+ purpose: AccountPurpose,
100
+ name: String,
101
+ keySource: String?,
102
+ completion: @escaping (Result<AccountUUID, Error>) -> Void
103
+ ) async throws {
104
+ AsyncToClosureGateway.executeThrowingAction(completion) {
105
+ try await self.synchronizer.importAccount(
106
+ ufvk: ufvk,
107
+ seedFingerprint: seedFingerprint,
108
+ zip32AccountIndex: zip32AccountIndex,
109
+ purpose: purpose,
110
+ name: name,
111
+ keySource: keySource
112
+ )
70
113
  }
71
114
  }
72
115
 
73
116
  public func proposeTransfer(
74
- accountIndex: Int,
117
+ accountUUID: AccountUUID,
75
118
  recipient: Recipient,
76
119
  amount: Zatoshi,
77
120
  memo: Memo?,
78
121
  completion: @escaping (Result<Proposal, Error>) -> Void
79
122
  ) {
80
123
  AsyncToClosureGateway.executeThrowingAction(completion) {
81
- try await self.synchronizer.proposeTransfer(accountIndex: accountIndex, recipient: recipient, amount: amount, memo: memo)
124
+ try await self.synchronizer.proposeTransfer(accountUUID: accountUUID, recipient: recipient, amount: amount, memo: memo)
82
125
  }
83
126
  }
84
127
 
85
128
  public func proposeShielding(
86
- accountIndex: Int,
129
+ accountUUID: AccountUUID,
87
130
  shieldingThreshold: Zatoshi,
88
131
  memo: Memo,
89
132
  transparentReceiver: TransparentAddress? = nil,
@@ -91,7 +134,7 @@ extension ClosureSDKSynchronizer: ClosureSynchronizer {
91
134
  ) {
92
135
  AsyncToClosureGateway.executeThrowingAction(completion) {
93
136
  try await self.synchronizer.proposeShielding(
94
- accountIndex: accountIndex,
137
+ accountUUID: accountUUID,
95
138
  shieldingThreshold: shieldingThreshold,
96
139
  memo: memo,
97
140
  transparentReceiver: transparentReceiver
@@ -109,28 +152,50 @@ extension ClosureSDKSynchronizer: ClosureSynchronizer {
109
152
  }
110
153
  }
111
154
 
112
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
113
- public func sendToAddress(
114
- spendingKey: UnifiedSpendingKey,
115
- zatoshi: Zatoshi,
116
- toAddress: Recipient,
117
- memo: Memo?,
118
- completion: @escaping (Result<ZcashTransaction.Overview, Error>) -> Void
155
+ public func createPCZTFromProposal(
156
+ accountUUID: AccountUUID,
157
+ proposal: Proposal,
158
+ completion: @escaping (Result<Pczt, Error>) -> Void
119
159
  ) {
120
160
  AsyncToClosureGateway.executeThrowingAction(completion) {
121
- try await self.synchronizer.sendToAddress(spendingKey: spendingKey, zatoshi: zatoshi, toAddress: toAddress, memo: memo)
161
+ try await self.synchronizer.createPCZTFromProposal(accountUUID: accountUUID, proposal: proposal)
122
162
  }
123
163
  }
124
164
 
125
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
126
- public func shieldFunds(
127
- spendingKey: UnifiedSpendingKey,
128
- memo: Memo,
129
- shieldingThreshold: Zatoshi,
130
- completion: @escaping (Result<ZcashTransaction.Overview, Error>) -> Void
165
+ public func redactPCZTForSigner(
166
+ pczt: Pczt,
167
+ completion: @escaping (Result<Pczt, Error>) -> Void
168
+ ) {
169
+ AsyncToClosureGateway.executeThrowingAction(completion) {
170
+ try await self.synchronizer.redactPCZTForSigner(pczt: pczt)
171
+ }
172
+ }
173
+
174
+ public func PCZTRequiresSaplingProofs(
175
+ pczt: Pczt,
176
+ completion: @escaping (Bool) -> Void
177
+ ) {
178
+ AsyncToClosureGateway.executeAction(completion) {
179
+ await self.synchronizer.PCZTRequiresSaplingProofs(pczt: pczt)
180
+ }
181
+ }
182
+
183
+ public func addProofsToPCZT(
184
+ pczt: Pczt,
185
+ completion: @escaping (Result<Pczt, Error>) -> Void
131
186
  ) {
132
187
  AsyncToClosureGateway.executeThrowingAction(completion) {
133
- try await self.synchronizer.shieldFunds(spendingKey: spendingKey, memo: memo, shieldingThreshold: shieldingThreshold)
188
+ try await self.synchronizer.addProofsToPCZT(pczt: pczt)
189
+ }
190
+ }
191
+
192
+ public func createTransactionFromPCZT(
193
+ pcztWithProofs: Pczt,
194
+ pcztWithSigs: Pczt,
195
+ completion: @escaping (Result<AsyncThrowingStream<TransactionSubmitResult, Error>, Error>) -> Void
196
+ ) {
197
+ AsyncToClosureGateway.executeThrowingAction(completion) {
198
+ try await self.synchronizer.createTransactionFromPCZT(pcztWithProofs: pcztWithProofs, pcztWithSigs: pcztWithSigs)
134
199
  }
135
200
  }
136
201
 
@@ -188,9 +253,9 @@ extension ClosureSDKSynchronizer: ClosureSynchronizer {
188
253
  }
189
254
  }
190
255
 
191
- public func getAccountBalance(accountIndex: Int, completion: @escaping (Result<AccountBalance?, Error>) -> Void) {
256
+ public func getAccountsBalances(_ completion: @escaping (Result<[AccountUUID: AccountBalance], Error>) -> Void) {
192
257
  AsyncToClosureGateway.executeThrowingAction(completion) {
193
- try await self.synchronizer.getAccountBalance(accountIndex: accountIndex)
258
+ try await self.synchronizer.getAccountsBalances()
194
259
  }
195
260
  }
196
261
 
@@ -198,6 +263,17 @@ extension ClosureSDKSynchronizer: ClosureSynchronizer {
198
263
  synchronizer.refreshExchangeRateUSD()
199
264
  }
200
265
 
266
+ public func estimateBirthdayHeight(for date: Date, completion: @escaping (BlockHeight) -> Void) {
267
+ let height = synchronizer.estimateBirthdayHeight(for: date)
268
+ completion(height)
269
+ }
270
+
271
+ public func httpRequestOverTor(for request: URLRequest, retryLimit: UInt8, completion: @escaping (Result<(data: Data, response: HTTPURLResponse), Error>) -> Void) {
272
+ AsyncToClosureGateway.executeThrowingAction(completion) {
273
+ try await self.synchronizer.httpRequestOverTor(for: request, retryLimit: retryLimit)
274
+ }
275
+ }
276
+
201
277
  /*
202
278
  It can be missleading that these two methods are returning Publisher even this protocol is closure based. Reason is that Synchronizer doesn't
203
279
  provide different implementations for these two methods. So Combine it is even here.
@@ -34,10 +34,18 @@ extension CombineSDKSynchronizer: CombineSynchronizer {
34
34
  public func prepare(
35
35
  with seed: [UInt8]?,
36
36
  walletBirthday: BlockHeight,
37
- for walletMode: WalletInitMode
37
+ for walletMode: WalletInitMode,
38
+ name: String,
39
+ keySource: String?
38
40
  ) -> SinglePublisher<Initializer.InitializationResult, Error> {
39
41
  AsyncToCombineGateway.executeThrowingAction() {
40
- return try await self.synchronizer.prepare(with: seed, walletBirthday: walletBirthday, for: walletMode)
42
+ return try await self.synchronizer.prepare(
43
+ with: seed,
44
+ walletBirthday: walletBirthday,
45
+ for: walletMode,
46
+ name: name,
47
+ keySource: keySource
48
+ )
41
49
  }
42
50
  }
43
51
 
@@ -51,56 +59,62 @@ extension CombineSDKSynchronizer: CombineSynchronizer {
51
59
  synchronizer.stop()
52
60
  }
53
61
 
54
- public func getSaplingAddress(accountIndex: Int) -> SinglePublisher<SaplingAddress, Error> {
62
+ public func getSaplingAddress(accountUUID: AccountUUID) -> SinglePublisher<SaplingAddress, Error> {
63
+ AsyncToCombineGateway.executeThrowingAction() {
64
+ try await self.synchronizer.getSaplingAddress(accountUUID: accountUUID)
65
+ }
66
+ }
67
+
68
+ public func getUnifiedAddress(accountUUID: AccountUUID) -> SinglePublisher<UnifiedAddress, Error> {
55
69
  AsyncToCombineGateway.executeThrowingAction() {
56
- try await self.synchronizer.getSaplingAddress(accountIndex: accountIndex)
70
+ try await self.synchronizer.getUnifiedAddress(accountUUID: accountUUID)
57
71
  }
58
72
  }
59
73
 
60
- public func getUnifiedAddress(accountIndex: Int) -> SinglePublisher<UnifiedAddress, Error> {
74
+ public func getTransparentAddress(accountUUID: AccountUUID) -> SinglePublisher<TransparentAddress, Error> {
61
75
  AsyncToCombineGateway.executeThrowingAction() {
62
- try await self.synchronizer.getUnifiedAddress(accountIndex: accountIndex)
76
+ try await self.synchronizer.getTransparentAddress(accountUUID: accountUUID)
63
77
  }
64
78
  }
65
79
 
66
- public func getTransparentAddress(accountIndex: Int) -> SinglePublisher<TransparentAddress, Error> {
80
+ public func getCustomUnifiedAddress(accountUUID: AccountUUID, receivers: Set<ReceiverType>) -> SinglePublisher<UnifiedAddress, Error> {
67
81
  AsyncToCombineGateway.executeThrowingAction() {
68
- try await self.synchronizer.getTransparentAddress(accountIndex: accountIndex)
82
+ try await self.synchronizer.getCustomUnifiedAddress(accountUUID: accountUUID, receivers: receivers)
69
83
  }
70
84
  }
71
85
 
72
86
  public func proposeTransfer(
73
- accountIndex: Int,
87
+ accountUUID: AccountUUID,
74
88
  recipient: Recipient,
75
89
  amount: Zatoshi,
76
90
  memo: Memo?
77
91
  ) -> SinglePublisher<Proposal, Error> {
78
92
  AsyncToCombineGateway.executeThrowingAction() {
79
- try await self.synchronizer.proposeTransfer(accountIndex: accountIndex, recipient: recipient, amount: amount, memo: memo)
93
+ try await self.synchronizer.proposeTransfer(accountUUID: accountUUID, recipient: recipient, amount: amount, memo: memo)
80
94
  }
81
95
  }
82
96
 
83
97
  public func proposefulfillingPaymentURI(
84
98
  _ uri: String,
85
- accountIndex: Int
99
+ accountUUID: AccountUUID
86
100
  ) -> SinglePublisher<Proposal, Error> {
87
101
  AsyncToCombineGateway.executeThrowingAction() {
88
102
  try await self.synchronizer.proposefulfillingPaymentURI(
89
103
  uri,
90
- accountIndex: accountIndex
104
+ accountUUID: accountUUID
91
105
  )
92
106
  }
93
107
  }
94
108
 
95
109
  public func proposeShielding(
96
- accountIndex: Int,
110
+ accountUUID: AccountUUID,
97
111
  shieldingThreshold: Zatoshi,
98
112
  memo: Memo,
99
113
  transparentReceiver: TransparentAddress? = nil
100
114
  ) -> SinglePublisher<Proposal?, Error> {
101
115
  AsyncToCombineGateway.executeThrowingAction() {
102
116
  try await self.synchronizer.proposeShielding(
103
- accountIndex: accountIndex,
117
+ accountUUID: accountUUID,
104
118
  shieldingThreshold: shieldingThreshold,
105
119
  memo: memo,
106
120
  transparentReceiver: transparentReceiver
@@ -117,26 +131,72 @@ extension CombineSDKSynchronizer: CombineSynchronizer {
117
131
  }
118
132
  }
119
133
 
120
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
121
- public func sendToAddress(
122
- spendingKey: UnifiedSpendingKey,
123
- zatoshi: Zatoshi,
124
- toAddress: Recipient,
125
- memo: Memo?
126
- ) -> SinglePublisher<ZcashTransaction.Overview, Error> {
134
+ public func createPCZTFromProposal(
135
+ accountUUID: AccountUUID,
136
+ proposal: Proposal
137
+ ) -> SinglePublisher<Pczt, Error> {
127
138
  AsyncToCombineGateway.executeThrowingAction() {
128
- try await self.synchronizer.sendToAddress(spendingKey: spendingKey, zatoshi: zatoshi, toAddress: toAddress, memo: memo)
139
+ try await self.synchronizer.createPCZTFromProposal(accountUUID: accountUUID, proposal: proposal)
129
140
  }
130
141
  }
131
142
 
132
- @available(*, deprecated, message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients.")
133
- public func shieldFunds(
134
- spendingKey: UnifiedSpendingKey,
135
- memo: Memo,
136
- shieldingThreshold: Zatoshi
137
- ) -> SinglePublisher<ZcashTransaction.Overview, Error> {
143
+ public func redactPCZTForSigner(
144
+ pczt: Pczt
145
+ ) -> SinglePublisher<Pczt, Error> {
146
+ AsyncToCombineGateway.executeThrowingAction() {
147
+ try await self.synchronizer.redactPCZTForSigner(pczt: pczt)
148
+ }
149
+ }
150
+
151
+ public func PCZTRequiresSaplingProofs(
152
+ pczt: Pczt
153
+ ) -> SinglePublisher<Bool, Never> {
154
+ AsyncToCombineGateway.executeAction() {
155
+ await self.synchronizer.PCZTRequiresSaplingProofs(pczt: pczt)
156
+ }
157
+ }
158
+
159
+ public func addProofsToPCZT(
160
+ pczt: Pczt
161
+ ) -> SinglePublisher<Pczt, Error> {
138
162
  AsyncToCombineGateway.executeThrowingAction() {
139
- try await self.synchronizer.shieldFunds(spendingKey: spendingKey, memo: memo, shieldingThreshold: shieldingThreshold)
163
+ try await self.synchronizer.addProofsToPCZT(pczt: pczt)
164
+ }
165
+ }
166
+
167
+ public func createTransactionFromPCZT(
168
+ pcztWithProofs: Pczt,
169
+ pcztWithSigs: Pczt
170
+ ) -> SinglePublisher<AsyncThrowingStream<TransactionSubmitResult, Error>, Error> {
171
+ AsyncToCombineGateway.executeThrowingAction() {
172
+ try await self.synchronizer.createTransactionFromPCZT(pcztWithProofs: pcztWithProofs, pcztWithSigs: pcztWithSigs)
173
+ }
174
+ }
175
+
176
+ public func listAccounts() -> SinglePublisher<[Account], Error> {
177
+ AsyncToCombineGateway.executeThrowingAction() {
178
+ try await self.synchronizer.listAccounts()
179
+ }
180
+ }
181
+
182
+ // swiftlint:disable:next function_parameter_count
183
+ public func importAccount(
184
+ ufvk: String,
185
+ seedFingerprint: [UInt8]?,
186
+ zip32AccountIndex: Zip32AccountIndex?,
187
+ purpose: AccountPurpose,
188
+ name: String,
189
+ keySource: String?
190
+ ) async throws -> SinglePublisher<AccountUUID, Error> {
191
+ AsyncToCombineGateway.executeThrowingAction() {
192
+ try await self.synchronizer.importAccount(
193
+ ufvk: ufvk,
194
+ seedFingerprint: seedFingerprint,
195
+ zip32AccountIndex: zip32AccountIndex,
196
+ purpose: purpose,
197
+ name: name,
198
+ keySource: keySource
199
+ )
140
200
  }
141
201
  }
142
202
 
@@ -190,9 +250,9 @@ extension CombineSDKSynchronizer: CombineSynchronizer {
190
250
  }
191
251
  }
192
252
 
193
- public func getAccountBalance(accountIndex: Int) -> SinglePublisher<AccountBalance?, Error> {
253
+ public func getAccountsBalances() -> SinglePublisher<[AccountUUID: AccountBalance], Error> {
194
254
  AsyncToCombineGateway.executeThrowingAction() {
195
- try await self.synchronizer.getAccountBalance(accountIndex: accountIndex)
255
+ try await self.synchronizer.getAccountsBalances()
196
256
  }
197
257
  }
198
258
 
@@ -200,6 +260,20 @@ extension CombineSDKSynchronizer: CombineSynchronizer {
200
260
  synchronizer.refreshExchangeRateUSD()
201
261
  }
202
262
 
263
+ public func estimateBirthdayHeight(for date: Date) -> SinglePublisher<BlockHeight, Error> {
264
+ let height = synchronizer.estimateBirthdayHeight(for: date)
265
+ let subject = PassthroughSubject<BlockHeight, Error>()
266
+ subject.send(height)
267
+ subject.send(completion: .finished)
268
+ return subject.eraseToAnyPublisher()
269
+ }
270
+
271
+ public func httpRequestOverTor(for request: URLRequest, retryLimit: UInt8) -> SinglePublisher<(data: Data, response: HTTPURLResponse), Error> {
272
+ AsyncToCombineGateway.executeThrowingAction() {
273
+ try await self.synchronizer.httpRequestOverTor(for: request, retryLimit: retryLimit)
274
+ }
275
+ }
276
+
203
277
  public func rewind(_ policy: RewindPolicy) -> CompletablePublisher<Error> { synchronizer.rewind(policy) }
204
278
  public func wipe() -> CompletablePublisher<Error> { synchronizer.wipe() }
205
279
  }