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
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "test",
3
+ "height": "3620000",
4
+ "hash": "00052a1efb59ac73963ffa56c29eb2543f16b06024ef9ea447ee603a75fb01e5",
5
+ "time": 1760455780,
6
+ "saplingTree": "0132f66e1d070bfc0a96827abfc6512c459ea415d10f425936650d89f7eefbf1620180a9e72c08992751cb877a6b78189330ce82a7ff2c107530286502dd6b6ca9581f0159fa19f986909db72bfe1ca0960bda00c5b2ddd7882c02be4d0de683bdd70816000170067eeba09b47394b8063db861a2cb595283a34fd6ae037dcbd1b21f46f2f4f017ba274fcb3ebe11e270e06755b479a74bb80d9b2f055f469d08c81d841839c5000015f407330d2f48b1764f1ee2240c9a8acf19ce74c17572f8bcedf8bf7a7af4a0b000001846bfb982baf84c4d5832f9d8e267c3cc444dc54151dd02c2b2b50b4d8f6de2800000001381aa6dfe03e945e943fe6d128cb664fe3fd78de4cafebd334c231e243bba31b00016c9647f801e7c1048fc845ec265ec3e886df91c1acdacad501de9608b54a63490000016c8ccd12a93c240aa208bfcd527270aab8afd0b7e9f160114a10335b8167d34900000000000000000000000000",
7
+ "orchardTree": "01eb4c5568aca8a2ef026692dd0450d8f89d45733e5eb219f5e54c01822c841320001f01252669207efc73a6ce4dcd8ab0134813964f7c8b153a35223d19316e3c8b230201e3d317ef91ddf86df4bb941d8dc803f6fbcd787ed5863e33321a7b7f5380b13401ad8edf346446bab37d5cd8648213441bc623236ba6927583cfb4b31153402526014873756dcbe9aca4c43c2f24c1f567840989e18d74ab9ef763dd97e7e65a930001148c5620d32811e1d6822e80d92f188927002f3c0fe05a352fcd0788aa58000f0191ae9319eb928a8bc080cc1ac1a43991d3511ed864cebc7083b0db1b7797840701550682643aef66fb9d829f26b7cdf36c14abfd0457481658b31e61fad3e18b05000001baddc63339bcecc8faed385b6f16576c6378d9cae9ec60974265b4afc1781f050173ae007fce7670a9f40639ef998b23b8e8b7990c9894b13de595d7592f32c22301622c7605d17857460d412e4fff3265e15416029f607b7a5daaf2511a4020151101067fc882d2ebfdf7969fc02814cbe49dda32e267e963a0e79fad8eb7e0694b0400017f93215cf466b333690a951c86254d6729672189dc06160f378267efb70b580a0125934a8c8cde7b4ba7e51d78f2321c7e286d140811a192f692f29d3f0ecce510000000000000000000000000000000"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "test",
3
+ "height": "3630000",
4
+ "hash": "000ea2233e0ac4b3ce39c6754b1bb31818733bbcc56f6c415cfcf77e1d72bdca",
5
+ "time": 1760942071,
6
+ "saplingTree": "019c8a519919379f9d0214082ef1a63ef491bb4c806a3ca8e738215f4b364e1532001f0000000000000000000001e7cc0b98ed9a79a2265e371157a60b9500e3050d427e327c869fe7d99c29e0720001381aa6dfe03e945e943fe6d128cb664fe3fd78de4cafebd334c231e243bba31b00016c9647f801e7c1048fc845ec265ec3e886df91c1acdacad501de9608b54a63490000016c8ccd12a93c240aa208bfcd527270aab8afd0b7e9f160114a10335b8167d34900000000000000000000000000",
7
+ "orchardTree": "01821d33d6136168987e34cd53f8a36a4f91259e1e9d80477c000fd33aa9508429001f000001c3d687aa7ba53bc60f4ec86dbc904184c9349a74a6446967b156cbcf26a3f121016f96229df53a9b48a1d6250a9ebc824f9c124c6461b603e1ce20596652e6b5040001c522d7422ba81f39a07e8e0a4ba4e626c9435da7570ce7a772201ac03fba401f01291b7e15ca410ea6f32f2d9da3900c288e0f841be8281f6228d1bafcd0f34d1e01499225d6d20b571e3f7378de8918a3d87942198f5f49fe79526c00b65be580110001baddc63339bcecc8faed385b6f16576c6378d9cae9ec60974265b4afc1781f050173ae007fce7670a9f40639ef998b23b8e8b7990c9894b13de595d7592f32c22301622c7605d17857460d412e4fff3265e15416029f607b7a5daaf2511a4020151101067fc882d2ebfdf7969fc02814cbe49dda32e267e963a0e79fad8eb7e0694b0400017f93215cf466b333690a951c86254d6729672189dc06160f378267efb70b580a0125934a8c8cde7b4ba7e51d78f2321c7e286d140811a192f692f29d3f0ecce510000000000000000000000000000000"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "test",
3
+ "height": "3640000",
4
+ "hash": "00603418682be6315c6c3fb5f95f5b109c26e9fa5e8d7fdd027649830ce5160d",
5
+ "time": 1761349315,
6
+ "saplingTree": "0162ef7cb81362b6059dbc395509763f71f960618bb80ccb1b038eb7710e265a45001f019cec46b4150a816a044e70d80c1049fc13374239ebb4d3451f2d3249693c8355017e194dd47f8847c19e8d92cff6a259d2786d91aae1e8e6202177ce9861e544640183df6f677445e2b9e7d0559fe08bdb6a081cdf57f7f6c93fcddbe313ef83c42e01c10dc9d7451d9ca1ee065fb17b45ed3d0ab0c454fd99af88335b2f0e6b865d27000001ad9c49434f1b3ac45a49b1c45044ce21567f777da1dab6038a0e12d40d40322401cd0c3aaaa17c135171045a6f4f282da4cf87c54a1684909d7cc123a1377e641a00015e95cd8e34301c9675721d490965828837420c68d2442042539d2723ada8482601e7cc0b98ed9a79a2265e371157a60b9500e3050d427e327c869fe7d99c29e0720001381aa6dfe03e945e943fe6d128cb664fe3fd78de4cafebd334c231e243bba31b00016c9647f801e7c1048fc845ec265ec3e886df91c1acdacad501de9608b54a63490000016c8ccd12a93c240aa208bfcd527270aab8afd0b7e9f160114a10335b8167d34900000000000000000000000000",
7
+ "orchardTree": "0197a6997e2220a367b5027f932829106cf5bea6279dd4d83894abb29dfa3ffa1d01c8bb6987eea34321aedaa4b8b3678f35410e02036ccc09c0cefb79e9d8b6501e1f000001d3c6308d75b3ccf34b258914265420908a5063133a3c3633ce85bcee980a9f2f0109617761ee652cc9a895a1639bc4cd2cce38a3068982827012833f177a8d1b220001012e55fdb78e846c44975dd9c6cfe6edd2bf605964fe141690a992bdabc1183c0000019e1bfb94f5dc4b7c15092ad23d89c4e3f197db541f54b3587f404c1d4d981b0a01baddc63339bcecc8faed385b6f16576c6378d9cae9ec60974265b4afc1781f050173ae007fce7670a9f40639ef998b23b8e8b7990c9894b13de595d7592f32c22301622c7605d17857460d412e4fff3265e15416029f607b7a5daaf2511a4020151101067fc882d2ebfdf7969fc02814cbe49dda32e267e963a0e79fad8eb7e0694b0400017f93215cf466b333690a951c86254d6729672189dc06160f378267efb70b580a0125934a8c8cde7b4ba7e51d78f2321c7e286d140811a192f692f29d3f0ecce510000000000000000000000000000000"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "test",
3
+ "height": "3650000",
4
+ "hash": "00067490f8cf65a5e769efefbc781f151e1ee3b1803a39c6282587acd6d19171",
5
+ "time": 1761796831,
6
+ "saplingTree": "01926500b947cb82b43c4a6d6a01b9fe4593c08dc53960ed1853efe29eb903f94101613fdda68e22f9abf54080348476c16e680c169d2d4ccd02ea0e166fa5f4394f1f0000019d0f27d77319f2f7384521f24f44469e099c94838998366d917429c6d62e731f00011ceb5e5afbb2c104ad016d06d956468b5ea34c6c74a4ff9980f6fb997f43773400019af801d182789c520fa0acce68f062c4d6ef1a64fb5c567b781373af4ef79c30017ac683606139b0c7f3c635d90eb3661fd0ac0f09a340672effb211696c609b060190bf43e79655eaf302bd5fcd32e12013179e8efa8348c18fd536e6b92757e850000001b61a4aeb2a01567a25f746b7fd28a636a7ff5fc6489bee86d4da03d4a77d573f01381aa6dfe03e945e943fe6d128cb664fe3fd78de4cafebd334c231e243bba31b00016c9647f801e7c1048fc845ec265ec3e886df91c1acdacad501de9608b54a63490000016c8ccd12a93c240aa208bfcd527270aab8afd0b7e9f160114a10335b8167d34900000000000000000000000000",
7
+ "orchardTree": "01501b3d441b6b3903ee09681da2dd617d617db3cf446763a6cc576ff6bd94393a01ad965d4ab33f722e96b6716626e907c98d6b3a59a13c589d6c8783ab5e1499211f000001c5f99f1f55bb5be2324301827b5f7f1a2c58db6d5a5af584e8633c1f6b1217270001b33b32a4d69abd2d17b830b17e965a99444e8e5f28c48a1a7e59afa747087e0300017bb74adcadc0aeee4333c9303b6b4ca42761f510cd430168bcce42b0cc80643700019e1bfb94f5dc4b7c15092ad23d89c4e3f197db541f54b3587f404c1d4d981b0a01baddc63339bcecc8faed385b6f16576c6378d9cae9ec60974265b4afc1781f050173ae007fce7670a9f40639ef998b23b8e8b7990c9894b13de595d7592f32c22301622c7605d17857460d412e4fff3265e15416029f607b7a5daaf2511a4020151101067fc882d2ebfdf7969fc02814cbe49dda32e267e963a0e79fad8eb7e0694b0400017f93215cf466b333690a951c86254d6729672189dc06160f378267efb70b580a0125934a8c8cde7b4ba7e51d78f2321c7e286d140811a192f692f29d3f0ecce510000000000000000000000000000000"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "test",
3
+ "height": "3660000",
4
+ "hash": "000060175a33760c57e4b76d163917588a589eb6fb1cb14b782c868d187c7db5",
5
+ "time": 1762246118,
6
+ "saplingTree": "0177787b949a0328f7d6b8d7bf12096c53c34235e3c3224fa8e3fa7c625cde4648001f019ae360e3607817c2016bce012db81de5542c6b06258146e6e1b35c855f35364a018498cd69a459c0fedf6fdc04ad2cd93fd044492ebd836119384255bb847b11170001d32e1d2e50310291859c3ffe6dc1a26aad99a806fe75b88021668942e64fb047010d4d64feda8fcbbf2cbab0deec5b3749d60b70be00deeb02a25dc850d97b6b3d00011cb597eca8d34adced5e082c70d07976c872c6202ce4bd2e0b9d3bc7e58e7a050001b6f4d2455328ded63cf99ba4d55865a485da4f2a7bff9694cc5881ceef367c710001bbff4bc7f0695b8e9362fc4ea2b205f248648f22ca0a670d373d5cb45aabec2301b61a4aeb2a01567a25f746b7fd28a636a7ff5fc6489bee86d4da03d4a77d573f01381aa6dfe03e945e943fe6d128cb664fe3fd78de4cafebd334c231e243bba31b00016c9647f801e7c1048fc845ec265ec3e886df91c1acdacad501de9608b54a63490000016c8ccd12a93c240aa208bfcd527270aab8afd0b7e9f160114a10335b8167d34900000000000000000000000000",
7
+ "orchardTree": "01b4c3a89e0f4a5e2b4ae8dfd9e85ac12062a7bb4c97db4d3894591628c2619309001f01c467188e86f4f597019dcdfdb97a30c9bb61e02c64d46cf58563a1a805e2410f01ed400d833428359f7d5df7d7386ff95bf88b956aa78a6d35da0aa34d74d9a23b00000191af6bc58f747ba41c76162fad7fd01390b033a7043f3f751f85e00dd5168808000001ff003576721efedc9ec62db4bcba91fc1a0738b18cac5c15eb316f77c5243826019e1bfb94f5dc4b7c15092ad23d89c4e3f197db541f54b3587f404c1d4d981b0a01baddc63339bcecc8faed385b6f16576c6378d9cae9ec60974265b4afc1781f050173ae007fce7670a9f40639ef998b23b8e8b7990c9894b13de595d7592f32c22301622c7605d17857460d412e4fff3265e15416029f607b7a5daaf2511a4020151101067fc882d2ebfdf7969fc02814cbe49dda32e267e963a0e79fad8eb7e0694b0400017f93215cf466b333690a951c86254d6729672189dc06160f378267efb70b580a0125934a8c8cde7b4ba7e51d78f2321c7e286d140811a192f692f29d3f0ecce510000000000000000000000000000000"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "test",
3
+ "height": "3670000",
4
+ "hash": "007b830e2085459d6664744e23bbccade5419321f75f403da984cbbe8738a203",
5
+ "time": 1762637018,
6
+ "saplingTree": "0173a970c890d8d7b995a670f06725e2e6d776b342c878ab3e5c516069d4feb548012e8eb25af1e8114b0fa656ba7d7409b75f26196fa6b4feea428f0bfed7edb71a1f0152c6d9861e4104318622347eb8f9fc9d3ec3786ddd66f4619d4ee2470096024b01a9f423c5d9a6ac89f2bbc16bc6cf52f63f1f5b56da1ab15b47f176abe9f7f1530101b35b4342a14380384925d41c4e7c1bda66d0c6810cd2c7c4c54e4f591e9c460001f7a1f87d0a650e6c491ce43905b844d968fd5d1a10769d0f9ceba06592a6d52701c1cd287cf0f8685f301e2acf83d50df8a00a24dc7fcd451b12375a454538950e019b4189ad65743e8a119fa7e16bec8c88352a0e1003e4e3f219d840d16e19fc3b000000000000018b0a3f358e958d827dd8e9df4da31aa2cf8b6844220553d0df9b40cce3a50d09016c9647f801e7c1048fc845ec265ec3e886df91c1acdacad501de9608b54a63490000016c8ccd12a93c240aa208bfcd527270aab8afd0b7e9f160114a10335b8167d34900000000000000000000000000",
7
+ "orchardTree": "01ec23d10d549e8edcb8eef56c090b67f1551aa374e8ff56dddf782e3d77cb8312001f013fb80b00d2d1172892712812cd957f4d64180baa04db66290b8c30c52348c013000000000114685d870f35ab94efc2972908c0d3121295750745bda57af9f62f4f9cdf8c130186c7a8020a25e94fa40b606eab684131bd9a9593f6f27b615cdd55e56b423d1801ff003576721efedc9ec62db4bcba91fc1a0738b18cac5c15eb316f77c5243826019e1bfb94f5dc4b7c15092ad23d89c4e3f197db541f54b3587f404c1d4d981b0a01baddc63339bcecc8faed385b6f16576c6378d9cae9ec60974265b4afc1781f050173ae007fce7670a9f40639ef998b23b8e8b7990c9894b13de595d7592f32c22301622c7605d17857460d412e4fff3265e15416029f607b7a5daaf2511a4020151101067fc882d2ebfdf7969fc02814cbe49dda32e267e963a0e79fad8eb7e0694b0400017f93215cf466b333690a951c86254d6729672189dc06160f378267efb70b580a0125934a8c8cde7b4ba7e51d78f2321c7e286d140811a192f692f29d3f0ecce510000000000000000000000000000000"
8
+ }
@@ -93,26 +93,46 @@ struct ZcashKeyDerivationBackend: ZcashKeyDerivationBackendWelding {
93
93
 
94
94
  // MARK: Address Derivation
95
95
 
96
+ func deriveUnifiedAddressFrom(ufvk: String) throws -> UnifiedAddress {
97
+ let ffiAddressPtr = zcashlc_derive_address_from_ufvk(
98
+ networkType.networkId,
99
+ [CChar](ufvk.utf8CString),
100
+ nil
101
+ )
102
+
103
+ guard let ffiAddressPtr else {
104
+ throw ZcashError.rustDeriveAddressFromUfvk(
105
+ ZcashKeyDerivationBackend.lastErrorMessage(fallback: "`deriveAddressFromUfvk` failed with unknown error")
106
+ )
107
+ }
108
+
109
+ defer { zcashlc_free_ffi_address(ffiAddressPtr) }
110
+
111
+ return ffiAddressPtr.pointee.unsafeToUnifiedAddress(networkType)
112
+ }
113
+
96
114
  func deriveUnifiedSpendingKey(
97
115
  from seed: [UInt8],
98
- accountIndex: Int32
116
+ accountIndex: Zip32AccountIndex
99
117
  ) throws -> UnifiedSpendingKey {
100
- let binaryKeyPtr = seed.withUnsafeBufferPointer { seedBufferPtr in
118
+ let boxedSlicePtr = seed.withUnsafeBufferPointer { seedBufferPtr in
101
119
  return zcashlc_derive_spending_key(
102
120
  seedBufferPtr.baseAddress,
103
121
  UInt(seed.count),
104
- accountIndex,
122
+ LCZip32Index(accountIndex.index),
105
123
  networkType.networkId
106
124
  )
107
125
  }
108
126
 
109
- defer { zcashlc_free_binary_key(binaryKeyPtr) }
127
+ defer { zcashlc_free_boxed_slice(boxedSlicePtr) }
110
128
 
111
- guard let binaryKey = binaryKeyPtr?.pointee else {
112
- throw ZcashError.rustDeriveUnifiedSpendingKey(lastErrorMessage(fallback: "`deriveUnifiedSpendingKey` failed with unknown error"))
129
+ guard let boxedSlice = boxedSlicePtr?.pointee else {
130
+ throw ZcashError.rustDeriveUnifiedSpendingKey(
131
+ ZcashKeyDerivationBackend.lastErrorMessage(fallback: "`deriveUnifiedSpendingKey` failed with unknown error")
132
+ )
113
133
  }
114
134
 
115
- return binaryKey.unsafeToUnifiedSpendingKey(network: networkType)
135
+ return boxedSlice.unsafeToUnifiedSpendingKey(network: networkType)
116
136
  }
117
137
 
118
138
  func deriveUnifiedFullViewingKey(from spendingKey: UnifiedSpendingKey) throws -> UnifiedFullViewingKey {
@@ -123,7 +143,7 @@ struct ZcashKeyDerivationBackend: ZcashKeyDerivationBackendWelding {
123
143
  networkType.networkId
124
144
  ) else {
125
145
  throw ZcashError.rustDeriveUnifiedFullViewingKey(
126
- lastErrorMessage(fallback: "`deriveUnifiedFullViewingKey` failed with unknown error")
146
+ ZcashKeyDerivationBackend.lastErrorMessage(fallback: "`deriveUnifiedFullViewingKey` failed with unknown error")
127
147
  )
128
148
  }
129
149
 
@@ -136,7 +156,7 @@ struct ZcashKeyDerivationBackend: ZcashKeyDerivationBackendWelding {
136
156
  throw ZcashError.rustDeriveUnifiedFullViewingKeyInvalidDerivedKey
137
157
  }
138
158
 
139
- return UnifiedFullViewingKey(validatedEncoding: derived, account: spendingKey.account)
159
+ return UnifiedFullViewingKey(validatedEncoding: derived)
140
160
  }
141
161
 
142
162
  func getSaplingReceiver(for uAddr: UnifiedAddress) throws -> SaplingAddress {
@@ -171,9 +191,68 @@ struct ZcashKeyDerivationBackend: ZcashKeyDerivationBackendWelding {
171
191
  return TransparentAddress(validatedEncoding: transparentReceiverStr)
172
192
  }
173
193
 
194
+ static func deriveArbitraryWalletKey(
195
+ contextString: [UInt8],
196
+ from seed: [UInt8]
197
+ ) throws -> [UInt8] {
198
+ let boxedSlicePtr = contextString.withUnsafeBufferPointer { contextStringBufferPtr in
199
+ seed.withUnsafeBufferPointer { seedBufferPtr in
200
+ return zcashlc_derive_arbitrary_wallet_key(
201
+ contextStringBufferPtr.baseAddress,
202
+ UInt(contextString.count),
203
+ seedBufferPtr.baseAddress,
204
+ UInt(seed.count)
205
+ )
206
+ }
207
+ }
208
+
209
+ defer { zcashlc_free_boxed_slice(boxedSlicePtr) }
210
+
211
+ guard let key = boxedSlicePtr?.pointee else {
212
+ throw ZcashError.rustDeriveArbitraryWalletKey(
213
+ ZcashKeyDerivationBackend.lastErrorMessage(fallback: "`deriveArbitraryWalletKey` failed with unknown error")
214
+ )
215
+ }
216
+
217
+ return key.ptr.toByteArray(
218
+ length: Int(key.len)
219
+ )
220
+ }
221
+
222
+ func deriveArbitraryAccountKey(
223
+ contextString: [UInt8],
224
+ from seed: [UInt8],
225
+ accountIndex: Zip32AccountIndex
226
+ ) throws -> [UInt8] {
227
+ let boxedSlicePtr = contextString.withUnsafeBufferPointer { contextStringBufferPtr in
228
+ seed.withUnsafeBufferPointer { seedBufferPtr in
229
+ return zcashlc_derive_arbitrary_account_key(
230
+ contextStringBufferPtr.baseAddress,
231
+ UInt(contextString.count),
232
+ seedBufferPtr.baseAddress,
233
+ UInt(seed.count),
234
+ LCZip32Index(accountIndex.index),
235
+ networkType.networkId
236
+ )
237
+ }
238
+ }
239
+
240
+ defer { zcashlc_free_boxed_slice(boxedSlicePtr) }
241
+
242
+ guard let key = boxedSlicePtr?.pointee else {
243
+ throw ZcashError.rustDeriveArbitraryAccountKey(
244
+ ZcashKeyDerivationBackend.lastErrorMessage(fallback: "`deriveArbitraryAccountKey` failed with unknown error")
245
+ )
246
+ }
247
+
248
+ return key.ptr.toByteArray(
249
+ length: Int(key.len)
250
+ )
251
+ }
252
+
174
253
  // MARK: Error Handling
175
254
 
176
- private func lastErrorMessage(fallback: String) -> String {
255
+ private static func lastErrorMessage(fallback: String) -> String {
177
256
  let errorLen = zcashlc_last_error_length()
178
257
  defer { zcashlc_clear_last_error() }
179
258
 
@@ -40,12 +40,17 @@ protocol ZcashKeyDerivationBackendWelding {
40
40
  /// - Returns: true when the encoded string is a valid UFVK. false in any other case
41
41
  func isValidUnifiedFullViewingKey(_ ufvk: String) -> Bool
42
42
 
43
- /// Derives and returns a unified spending key from the given seed for the given account ID.
43
+ /// Derives and returns a UnifiedAddress from a UnifiedFullViewingKey
44
+ /// - Parameter ufvk: UTF-8 encoded String containing a valid UFVK
45
+ /// - Returns: the corresponding default `UnifiedAddress`
46
+ func deriveUnifiedAddressFrom(ufvk: String) throws -> UnifiedAddress
47
+
48
+ /// Derives and returns a unified spending key from the given seed and ZIP 32 account index.
44
49
  /// Returns the binary encoding of the spending key. The caller should manage the memory of (and store, if necessary) the returned spending key in a secure fashion.
45
50
  /// - Parameter seed: a Byte Array with the seed
46
- /// - Parameter accountIndex:account index that the key can spend from
51
+ /// - Parameter accountIndex: the ZIP 32 index of the account from which the key can spend
47
52
  /// - Throws: `rustDeriveUnifiedSpendingKey` if rust layer returns error.
48
- func deriveUnifiedSpendingKey(from seed: [UInt8], accountIndex: Int32) throws -> UnifiedSpendingKey
53
+ func deriveUnifiedSpendingKey(from seed: [UInt8], accountIndex: Zip32AccountIndex) throws -> UnifiedSpendingKey
49
54
 
50
55
  /// Derives a `UnifiedFullViewingKey` from a `UnifiedSpendingKey`
51
56
  /// - Parameter spendingKey: the `UnifiedSpendingKey` to derive from
@@ -70,4 +75,35 @@ protocol ZcashKeyDerivationBackendWelding {
70
75
  /// - `rustGetTransparentReceiverInvalidAddress` if failed to get transparent receiver for unified address.
71
76
  /// - `rustGetTransparentReceiverInvalidReceiver` if generated transparent receiver is invalid.
72
77
  func getTransparentReceiver(for uAddr: UnifiedAddress) throws -> TransparentAddress
78
+
79
+ /// Derives and returns a ZIP 32 Arbitrary Key from the given seed at the "wallet level", i.e.
80
+ /// directly from the seed with no ZIP 32 path applied.
81
+ ///
82
+ /// The resulting key will be the same across all networks (Zcash mainnet, Zcash testnet,
83
+ /// OtherCoin mainnet, and so on). You can think of it as a context-specific seed fingerprint
84
+ /// that can be used as (static) key material.
85
+ ///
86
+ /// - Parameter contextString: a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
87
+ /// - Parameter seed: `[Uint8]` seed bytes
88
+ /// - Throws:
89
+ /// - some `ZcashError.rust*` error if the derivation fails.
90
+ /// - Returns a `[Uint8]`
91
+ static func deriveArbitraryWalletKey(
92
+ contextString: [UInt8],
93
+ from seed: [UInt8]
94
+ ) throws -> [UInt8]
95
+
96
+ /// Derives and returns a ZIP 32 Arbitrary Key from the given seed at the account level.
97
+ ///
98
+ /// - Parameter contextString: a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
99
+ /// - Parameter seed: `[Uint8]` seed bytes
100
+ /// - Parameter accountIndex: the ZIP 32 index of the account
101
+ /// - Throws:
102
+ /// - some `ZcashError.rust*` error if the derivation fails.
103
+ /// - Returns a `[Uint8]`
104
+ func deriveArbitraryAccountKey(
105
+ contextString: [UInt8],
106
+ from seed: [UInt8],
107
+ accountIndex: Zip32AccountIndex
108
+ ) throws -> [UInt8]
73
109
  }