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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/android/build.gradle +6 -6
  3. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/3130000.json +8 -0
  4. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/3140000.json +8 -0
  5. package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +126 -69
  6. package/ios/RNZcash.m +0 -5
  7. package/ios/RNZcash.swift +153 -104
  8. package/ios/ZCashLightClientKit/Account/Account.swift +48 -0
  9. package/ios/ZCashLightClientKit/Account/AccountMetadataKey.swift +96 -0
  10. package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +23 -4
  11. package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +6 -2
  12. package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +4 -2
  13. package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +4 -1
  14. package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +83 -16
  15. package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +4 -2
  16. package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +22 -19
  17. package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +50 -19
  18. package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +5 -3
  19. package/ios/ZCashLightClientKit/Block/SaplingParameters/SaplingParametersHandler.swift +22 -5
  20. package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +2 -1
  21. package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +5 -3
  22. package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointSource.swift +88 -0
  23. package/ios/ZCashLightClientKit/Checkpoint/CheckpointSource.swift +4 -0
  24. package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +52 -21
  25. package/ios/ZCashLightClientKit/CombineSynchronizer.swift +49 -27
  26. package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +8 -2
  27. package/ios/ZCashLightClientKit/DAO/BlockDao.swift +65 -0
  28. package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +86 -1
  29. package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +4 -4
  30. package/ios/ZCashLightClientKit/Entity/Pczt.swift +10 -0
  31. package/ios/ZCashLightClientKit/Entity/SentNoteEntity.swift +2 -2
  32. package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +40 -16
  33. package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
  34. package/ios/ZCashLightClientKit/Error/ZcashError.swift +182 -14
  35. package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +63 -5
  36. package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +122 -12
  37. package/ios/ZCashLightClientKit/Initializer.swift +49 -14
  38. package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +15 -6
  39. package/ios/ZCashLightClientKit/Model/SingleUseTransparentAddress.swift +29 -0
  40. package/ios/ZCashLightClientKit/Model/TransactionDataRequest.swift +83 -2
  41. package/ios/ZCashLightClientKit/Model/WalletSummary.swift +21 -4
  42. package/ios/ZCashLightClientKit/Model/WalletTypes.swift +38 -8
  43. package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +177 -45
  44. package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +63 -16
  45. package/ios/ZCashLightClientKit/Modules/Service/Tor/LightWalletGRPCServiceOverTor.swift +273 -0
  46. package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +5 -2
  47. package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +2 -0
  48. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2675000.json +8 -0
  49. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2677500.json +8 -0
  50. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2682500.json +8 -0
  51. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2685000.json +8 -0
  52. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2687500.json +8 -0
  53. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2692500.json +8 -0
  54. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2695000.json +8 -0
  55. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2697500.json +8 -0
  56. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2702500.json +8 -0
  57. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2705000.json +8 -0
  58. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2707500.json +8 -0
  59. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2712500.json +8 -0
  60. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2715000.json +8 -0
  61. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2717500.json +8 -0
  62. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2722500.json +8 -0
  63. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2725000.json +8 -0
  64. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2727500.json +8 -0
  65. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2732500.json +8 -0
  66. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2735000.json +8 -0
  67. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2737500.json +8 -0
  68. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2742500.json +8 -0
  69. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2745000.json +8 -0
  70. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2747500.json +8 -0
  71. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2752500.json +8 -0
  72. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2755000.json +8 -0
  73. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2757500.json +8 -0
  74. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2762500.json +8 -0
  75. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2765000.json +8 -0
  76. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2767500.json +8 -0
  77. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2772500.json +8 -0
  78. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2775000.json +8 -0
  79. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2777500.json +8 -0
  80. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2782500.json +8 -0
  81. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2785000.json +8 -0
  82. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2787500.json +8 -0
  83. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2792500.json +8 -0
  84. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2795000.json +8 -0
  85. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2797500.json +8 -0
  86. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2802500.json +8 -0
  87. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2805000.json +8 -0
  88. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2807500.json +8 -0
  89. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2812500.json +8 -0
  90. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2815000.json +8 -0
  91. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2817500.json +8 -0
  92. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2822500.json +8 -0
  93. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2825000.json +8 -0
  94. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2827500.json +8 -0
  95. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2832500.json +8 -0
  96. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2835000.json +8 -0
  97. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2837500.json +8 -0
  98. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2842500.json +8 -0
  99. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2845000.json +8 -0
  100. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2847500.json +8 -0
  101. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2852500.json +8 -0
  102. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2855000.json +8 -0
  103. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2857500.json +8 -0
  104. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2862500.json +8 -0
  105. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2865000.json +8 -0
  106. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2867500.json +8 -0
  107. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2872500.json +8 -0
  108. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2875000.json +8 -0
  109. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2877500.json +8 -0
  110. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2882500.json +8 -0
  111. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2885000.json +8 -0
  112. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2887500.json +8 -0
  113. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2892500.json +8 -0
  114. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2895000.json +8 -0
  115. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2897500.json +8 -0
  116. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2902500.json +8 -0
  117. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2905000.json +8 -0
  118. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2907500.json +8 -0
  119. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2912500.json +8 -0
  120. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2915000.json +8 -0
  121. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2917500.json +8 -0
  122. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2922500.json +8 -0
  123. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2925000.json +8 -0
  124. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2927500.json +8 -0
  125. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2932500.json +8 -0
  126. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2935000.json +8 -0
  127. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2937500.json +8 -0
  128. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2942500.json +8 -0
  129. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2945000.json +8 -0
  130. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2947500.json +8 -0
  131. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2952500.json +8 -0
  132. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2955000.json +8 -0
  133. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2957500.json +8 -0
  134. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2962500.json +8 -0
  135. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2965000.json +8 -0
  136. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2967500.json +8 -0
  137. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2972500.json +8 -0
  138. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2975000.json +8 -0
  139. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2977500.json +8 -0
  140. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2982500.json +8 -0
  141. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2985000.json +8 -0
  142. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2987500.json +8 -0
  143. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2992500.json +8 -0
  144. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2995000.json +8 -0
  145. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2997500.json +8 -0
  146. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3002500.json +8 -0
  147. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3005000.json +8 -0
  148. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3007500.json +8 -0
  149. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3012500.json +8 -0
  150. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3015000.json +8 -0
  151. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3017500.json +8 -0
  152. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3022500.json +8 -0
  153. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3025000.json +8 -0
  154. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3027500.json +8 -0
  155. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3032500.json +8 -0
  156. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3035000.json +8 -0
  157. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3037500.json +8 -0
  158. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3042500.json +8 -0
  159. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3045000.json +8 -0
  160. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3047500.json +8 -0
  161. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3052500.json +8 -0
  162. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3055000.json +8 -0
  163. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3057500.json +8 -0
  164. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3062500.json +8 -0
  165. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3065000.json +8 -0
  166. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3067500.json +8 -0
  167. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3072500.json +8 -0
  168. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3075000.json +8 -0
  169. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3077500.json +8 -0
  170. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3082500.json +8 -0
  171. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3085000.json +8 -0
  172. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3087500.json +8 -0
  173. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3092500.json +8 -0
  174. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3095000.json +8 -0
  175. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3097500.json +8 -0
  176. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3102500.json +8 -0
  177. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3105000.json +8 -0
  178. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3107500.json +8 -0
  179. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3112500.json +8 -0
  180. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3115000.json +8 -0
  181. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3117500.json +8 -0
  182. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3122500.json +8 -0
  183. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3125000.json +8 -0
  184. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3127500.json +8 -0
  185. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3130000.json +8 -0
  186. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3140000.json +8 -0
  187. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3010000.json +8 -0
  188. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3020000.json +8 -0
  189. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3030000.json +8 -0
  190. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3040000.json +8 -0
  191. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3050000.json +8 -0
  192. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3060000.json +8 -0
  193. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3070000.json +8 -0
  194. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3080000.json +8 -0
  195. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3090000.json +8 -0
  196. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3100000.json +8 -0
  197. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3110000.json +8 -0
  198. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3120000.json +8 -0
  199. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3130000.json +8 -0
  200. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3140000.json +8 -0
  201. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3150000.json +8 -0
  202. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3160000.json +8 -0
  203. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3170000.json +8 -0
  204. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3180000.json +8 -0
  205. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3190000.json +8 -0
  206. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3200000.json +8 -0
  207. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3210000.json +8 -0
  208. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3220000.json +8 -0
  209. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3230000.json +8 -0
  210. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3240000.json +8 -0
  211. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3250000.json +8 -0
  212. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3260000.json +8 -0
  213. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3270000.json +8 -0
  214. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3280000.json +8 -0
  215. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3290000.json +8 -0
  216. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3300000.json +8 -0
  217. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3310000.json +8 -0
  218. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3320000.json +8 -0
  219. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3330000.json +8 -0
  220. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3340000.json +8 -0
  221. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3350000.json +8 -0
  222. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3360000.json +8 -0
  223. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3370000.json +8 -0
  224. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3380000.json +8 -0
  225. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3390000.json +8 -0
  226. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3400000.json +8 -0
  227. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3410000.json +8 -0
  228. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3420000.json +8 -0
  229. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3430000.json +8 -0
  230. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3440000.json +8 -0
  231. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3450000.json +8 -0
  232. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3460000.json +8 -0
  233. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3470000.json +8 -0
  234. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3480000.json +8 -0
  235. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3490000.json +8 -0
  236. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3500000.json +8 -0
  237. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3510000.json +8 -0
  238. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3520000.json +8 -0
  239. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3530000.json +8 -0
  240. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3540000.json +8 -0
  241. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3550000.json +8 -0
  242. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3560000.json +8 -0
  243. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3570000.json +8 -0
  244. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3580000.json +8 -0
  245. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3590000.json +8 -0
  246. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3600000.json +8 -0
  247. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3610000.json +8 -0
  248. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3620000.json +8 -0
  249. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3630000.json +8 -0
  250. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3640000.json +8 -0
  251. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3650000.json +8 -0
  252. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3660000.json +8 -0
  253. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3670000.json +8 -0
  254. package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackend.swift +89 -10
  255. package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackendWelding.swift +39 -3
  256. package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +532 -74
  257. package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +97 -14
  258. package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +104 -28
  259. package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +105 -31
  260. package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +36 -9
  261. package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +401 -175
  262. package/ios/ZCashLightClientKit/Synchronizer.swift +192 -69
  263. package/ios/ZCashLightClientKit/Tool/DerivationTool.swift +69 -12
  264. package/ios/ZCashLightClientKit/Tor/TorClient.swift +502 -11
  265. package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +10 -6
  266. package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +24 -9
  267. package/ios/ZCashLightClientKit/Utils/SDKFlags.swift +71 -0
  268. package/ios/libzcashlc.xcframework/Info.plist +5 -5
  269. package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
  270. package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
  271. package/ios/zcashlc.h +1640 -378
  272. package/lib/rnzcash.rn.js.map +1 -1
  273. package/lib/src/react-native.d.ts +2 -2
  274. package/lib/src/types.d.ts +2 -0
  275. package/package.json +1 -1
  276. package/src/react-native.ts +2 -3
  277. package/src/types.ts +2 -0
@@ -8,11 +8,48 @@
8
8
  import Foundation
9
9
 
10
10
 
11
- public class TorClient {
12
- private let runtime: OpaquePointer
11
+ public actor TorClient {
12
+ private var underlyingRuntime: OpaquePointer?
13
+ private var torDir: URL
14
+
13
15
  public var cachedFiatCurrencyResult: FiatCurrencyResult?
14
16
 
15
- init(torDir: URL) async throws {
17
+ init(torDir: URL) {
18
+ self.torDir = torDir
19
+ }
20
+
21
+ private init(runtimePtr: OpaquePointer, torDir: URL) {
22
+ underlyingRuntime = runtimePtr
23
+ self.torDir = torDir
24
+ }
25
+
26
+ deinit {
27
+ guard let runtime = underlyingRuntime else { return }
28
+
29
+ zcashlc_free_tor_runtime(runtime)
30
+ }
31
+
32
+ func prepare() throws {
33
+ _ = try resolveRuntime()
34
+ }
35
+
36
+ func close() throws {
37
+ guard let runtime = underlyingRuntime else { return }
38
+
39
+ zcashlc_free_tor_runtime(runtime)
40
+
41
+ underlyingRuntime = nil
42
+ }
43
+
44
+ public func updateCachedFiatCurrencyResult(_ result: FiatCurrencyResult?) async {
45
+ cachedFiatCurrencyResult = result
46
+ }
47
+
48
+ private func resolveRuntime() throws -> OpaquePointer {
49
+ if let runtime = underlyingRuntime {
50
+ return runtime
51
+ }
52
+
16
53
  // Ensure that the directory exists.
17
54
  let fileManager = FileManager()
18
55
  if !fileManager.fileExists(atPath: torDir.path) {
@@ -25,19 +62,134 @@ public class TorClient {
25
62
 
26
63
  let rawDir = torDir.osPathStr()
27
64
  let runtimePtr = zcashlc_create_tor_runtime(rawDir.0, rawDir.1)
28
-
65
+
29
66
  guard let runtimePtr else {
30
67
  throw ZcashError.rustTorClientInit(lastErrorMessage(fallback: "`TorClient` init failed with unknown error"))
31
68
  }
69
+
70
+ underlyingRuntime = runtimePtr
32
71
 
33
- runtime = runtimePtr
72
+ return runtimePtr
34
73
  }
35
74
 
36
- deinit {
37
- zcashlc_free_tor_runtime(runtime)
75
+ public func isolatedClient() throws -> TorClient {
76
+ let runtime = try resolveRuntime()
77
+
78
+ let isolatedPtr = zcashlc_tor_isolated_client(runtime)
79
+
80
+ guard let isolatedPtr else {
81
+ throw ZcashError.rustTorIsolatedClient(
82
+ lastErrorMessage(fallback: "`TorClient.isolatedClient` failed with unknown error")
83
+ )
84
+ }
85
+
86
+ return TorClient(runtimePtr: isolatedPtr, torDir: torDir)
87
+ }
88
+
89
+ /// Changes the client's current dormant mode, putting background tasks to sleep or waking
90
+ /// them up as appropriate.
91
+ ///
92
+ /// This can be used to conserve CPU usage if you aren’t planning on using the client for
93
+ /// a while, especially on mobile platforms.
94
+ ///
95
+ /// - Parameter mode: what level of sleep to put a Tor client into.
96
+ func setDormant(mode: TorDormantMode) throws {
97
+ let runtime = try resolveRuntime()
98
+
99
+ if !zcashlc_tor_set_dormant(runtime, mode) {
100
+ throw ZcashError.rustTorIsolatedClient(
101
+ lastErrorMessage(
102
+ fallback:
103
+ "`TorClient.setDormant` failed with unknown error"
104
+ )
105
+ )
106
+ }
107
+ }
108
+
109
+ public func sleep() {
110
+ try? setDormant(mode: Soft)
111
+ }
112
+
113
+ public func wake() {
114
+ try? setDormant(mode: Normal)
115
+ }
116
+
117
+ /// Makes an HTTP request over Tor.
118
+ ///
119
+ /// - Parameter retryLimit: the maximum number of times that a failed request should be retried.
120
+ /// Set this to 0 to disable retries.
121
+ public func httpRequest(for request: URLRequest, retryLimit: UInt8) throws -> (data: Data, response: HTTPURLResponse) {
122
+ let runtime = try resolveRuntime()
123
+
124
+ let url = request.url
125
+ guard let url else {
126
+ throw ZcashError.rustTorHttpRequest("`TorClient.httpRequest` requires a URL")
127
+ }
128
+
129
+ let headers = request.allHTTPHeaderFields ?? [:]
130
+ // Duplicate the header names and values into C strings.
131
+ let cHeadersMut = headers.map { key, value in
132
+ (strdup(key), strdup(value))
133
+ }
134
+ // Create the array of const pointers we will actually pass to Rust.
135
+ let cHeaders = cHeadersMut.map { key, value in
136
+ FfiHttpRequestHeader(name: key, value: value)
137
+ }
138
+ // Free the duplicate C strings once we are done.
139
+ defer {
140
+ for (namePtr, valuePtr) in cHeadersMut {
141
+ free(namePtr)
142
+ free(valuePtr)
143
+ }
144
+ }
145
+
146
+ var responsePtr: UnsafeMutablePointer<FfiHttpResponseBytes>?
147
+ try cHeaders.withUnsafeBufferPointer { headersPtr in
148
+ switch request.httpMethod?.lowercased() {
149
+ case "get":
150
+ responsePtr = zcashlc_tor_http_get(
151
+ runtime,
152
+ [CChar](url.absoluteString.utf8CString),
153
+ headersPtr.baseAddress,
154
+ UInt(headersPtr.count),
155
+ retryLimit
156
+ )
157
+ case "post":
158
+ let data = request.httpBody ?? Data()
159
+ responsePtr = zcashlc_tor_http_post(
160
+ runtime,
161
+ [CChar](url.absoluteString.utf8CString),
162
+ headersPtr.baseAddress,
163
+ UInt(headersPtr.count),
164
+ data.bytes,
165
+ UInt(data.count),
166
+ retryLimit
167
+ )
168
+ default:
169
+ throw ZcashError.rustTorHttpRequest("Only GET and POST requests are supported")
170
+ }
171
+ }
172
+
173
+ guard let responsePtr else {
174
+ throw ZcashError.rustTorHttpRequest(
175
+ lastErrorMessage(fallback: "`TorClient.httpRequest` failed with unknown error")
176
+ )
177
+ }
178
+
179
+ defer { zcashlc_free_http_response_bytes(responsePtr) }
180
+
181
+ let response = responsePtr.pointee.unsafeToResponse(url: url)
182
+
183
+ guard let response else {
184
+ throw ZcashError.rustTorHttpRequest("`TorClient.httpRequest` returned invalid HTTP response")
185
+ }
186
+
187
+ return response
38
188
  }
39
189
 
40
- public func getExchangeRateUSD() async throws -> FiatCurrencyResult {
190
+ public func getExchangeRateUSD() throws -> FiatCurrencyResult {
191
+ let runtime = try resolveRuntime()
192
+
41
193
  let rate = zcashlc_get_exchange_rate_usd(runtime)
42
194
 
43
195
  if rate.is_sign_negative {
@@ -46,12 +198,351 @@ public class TorClient {
46
198
 
47
199
  let newValue = FiatCurrencyResult(
48
200
  date: Date(),
49
- rate: NSDecimalNumber(mantissa: rate.mantissa, exponent: rate.exponent, isNegative: rate.is_sign_negative),
201
+ rate: NSDecimalNumber(
202
+ mantissa: rate.mantissa,
203
+ exponent: rate.exponent,
204
+ isNegative: rate.is_sign_negative
205
+ ),
50
206
  state: .success
51
207
  )
52
-
208
+
53
209
  cachedFiatCurrencyResult = newValue
54
-
210
+
55
211
  return newValue
56
212
  }
213
+
214
+ public func connectToLightwalletd(endpoint: String) throws -> TorLwdConn {
215
+ let runtime = try resolveRuntime()
216
+
217
+ guard !endpoint.containsCStringNullBytesBeforeStringEnding() else {
218
+ throw ZcashError.rustTorConnectToLightwalletd("endpoint string contains null bytes")
219
+ }
220
+
221
+ let lwdConnPtr = zcashlc_tor_connect_to_lightwalletd(
222
+ runtime, [CChar](endpoint.utf8CString)
223
+ )
224
+
225
+ guard let lwdConnPtr else {
226
+ throw ZcashError.rustTorConnectToLightwalletd(
227
+ lastErrorMessage(fallback: "`TorClient.connectToLightwalletd` failed with unknown error")
228
+ )
229
+ }
230
+
231
+ return TorLwdConn(connPtr: lwdConnPtr)
232
+ }
233
+ }
234
+
235
+ public class TorLwdConn {
236
+ private let conn: OpaquePointer
237
+
238
+ // swiftlint:disable:next strict_fileprivate
239
+ fileprivate init(connPtr: OpaquePointer) {
240
+ conn = connPtr
241
+ }
242
+
243
+ deinit {
244
+ zcashlc_free_tor_lwd_conn(conn)
245
+ }
246
+
247
+ /// Submits a raw transaction over lightwalletd.
248
+ /// - Parameter spendTransaction: data representing the transaction to be sent
249
+ /// - Throws: `serviceSubmitFailed` when GRPC call fails.
250
+ func submit(spendTransaction: Data) throws -> LightWalletServiceResponse {
251
+ let success = zcashlc_tor_lwd_conn_submit_transaction(
252
+ conn,
253
+ spendTransaction.bytes,
254
+ UInt(spendTransaction.count)
255
+ )
256
+
257
+ var response = SendResponse()
258
+
259
+ if !success {
260
+ let err = lastErrorMessage(fallback: "`TorLwdConn.submit` failed with unknown error")
261
+
262
+ if err.hasPrefix("Failed to submit transaction (") && err.contains(")") {
263
+ guard let startOfCode = err.firstIndex(of: "(") else {
264
+ throw ZcashError.rustTorLwdSubmit(err)
265
+ }
266
+ guard let endOfCode = err.firstIndex(of: ")") else {
267
+ throw ZcashError.rustTorLwdSubmit(err)
268
+ }
269
+ guard let errorCode = Int32(err[err.index(startOfCode, offsetBy: 1)..<endOfCode]) else {
270
+ throw ZcashError.rustTorLwdSubmit(err)
271
+ }
272
+ let errorMessage = String(err[err.index(endOfCode, offsetBy: 3)...])
273
+
274
+ response.errorCode = errorCode
275
+ response.errorMessage = errorMessage
276
+ } else {
277
+ throw ZcashError.rustTorLwdSubmit(err)
278
+ }
279
+ }
280
+
281
+ return response
282
+ }
283
+
284
+ /// Gets a transaction by id
285
+ /// - Parameter txId: data representing the transaction ID
286
+ /// - Throws: LightWalletServiceError
287
+ /// - Returns: LightWalletServiceResponse
288
+ /// - Throws: `serviceFetchTransactionFailed` when GRPC call fails.
289
+ func fetchTransaction(txId: Data) throws -> (tx: ZcashTransaction.Fetched?, status: TransactionStatus) {
290
+ guard txId.count == 32 else {
291
+ throw ZcashError.rustGetMemoInvalidTxIdLength
292
+ }
293
+
294
+ var height: UInt64 = 0
295
+
296
+ let txPtr = zcashlc_tor_lwd_conn_fetch_transaction(conn, txId.bytes, &height)
297
+
298
+ guard let txPtr else {
299
+ let lastErrorMessage = lastErrorMessage(fallback: "`TorLwdConn.fetchTransaction` failed with unknown error")
300
+
301
+ if lastErrorMessage.contains("No such mempool or main chain transaction") {
302
+ return (tx: nil, status: .txidNotRecognized)
303
+ } else if lastErrorMessage.contains("Transaction not found") {
304
+ return (tx: nil, status: .txidNotRecognized)
305
+ } else if lastErrorMessage.contains("No such mempool or blockchain transaction. Use gettransaction for wallet transactions.") {
306
+ return (tx: nil, status: .txidNotRecognized)
307
+ } else {
308
+ throw ZcashError.rustTorLwdFetchTransaction(
309
+ lastErrorMessage
310
+ )
311
+ }
312
+ }
313
+
314
+ defer { zcashlc_free_boxed_slice(txPtr) }
315
+
316
+ let isNotMined = height == 0 || height > UInt32.max
317
+
318
+ return (
319
+ tx:
320
+ ZcashTransaction.Fetched(
321
+ rawID: txId,
322
+ minedHeight: isNotMined ? nil : UInt32(height),
323
+ raw: Data(
324
+ bytes: txPtr.pointee.ptr,
325
+ count: Int(txPtr.pointee.len)
326
+ )
327
+ ),
328
+ status: isNotMined ? .notInMainChain : .mined(Int(height))
329
+ )
330
+ }
331
+
332
+ /// Gets a lightwalletd server info
333
+ /// - Returns: LightWalletdInfo
334
+ func getInfo() throws -> LightWalletdInfo {
335
+ let infoPtr = zcashlc_tor_lwd_conn_get_info(conn)
336
+
337
+ guard let infoPtr else {
338
+ throw ZcashError.rustTorLwdGetInfo(
339
+ lastErrorMessage(fallback: "`TorLwdConn.getInfo` failed with unknown error")
340
+ )
341
+ }
342
+
343
+ defer { zcashlc_free_boxed_slice(infoPtr) }
344
+
345
+ let slice = infoPtr.pointee
346
+ guard let rawPtr = slice.ptr else {
347
+ throw ZcashError.rustTorLwdGetInfo("`TorLwdConn.getInfo` Null pointer in FfiBoxedSlice")
348
+ }
349
+
350
+ let buffer = UnsafeBufferPointer<UInt8>(start: rawPtr, count: Int(slice.len))
351
+ let data = Data(buffer: buffer)
352
+
353
+ do {
354
+ let info = try LightdInfo(serializedData: data)
355
+ return info
356
+ } catch {
357
+ throw ZcashError.rustTorLwdGetInfo("`TorLwdConn.getInfo` Failed to decode protobuf LightdInfo: \(error)")
358
+ }
359
+ }
360
+
361
+ /// Gets a block at the chain tip of the blockchain
362
+ /// - Returns: Block
363
+ func latestBlock() throws -> BlockID {
364
+ var height: UInt32 = 0
365
+
366
+ let blockIDPtr = zcashlc_tor_lwd_conn_latest_block(conn, &height)
367
+
368
+ guard let blockIDPtr else {
369
+ throw ZcashError.rustTorLwdLatestBlockHeight(
370
+ lastErrorMessage(fallback: "`TorLwdConn.latestBlockHeight` failed with unknown error")
371
+ )
372
+ }
373
+
374
+ defer { zcashlc_free_boxed_slice(blockIDPtr) }
375
+
376
+ return BlockID(height: BlockHeight(height))
377
+ }
378
+
379
+ /// Gets a tree state for a given height
380
+ /// - Parameter height: heght for what a tree state is requested
381
+ /// - Returns: TreeState
382
+ func getTreeState(height: BlockHeight) throws -> TreeState {
383
+ let treeStatePtr = zcashlc_tor_lwd_conn_get_tree_state(conn, UInt32(height))
384
+
385
+ guard let treeStatePtr else {
386
+ throw ZcashError.rustTorLwdGetTreeState(
387
+ lastErrorMessage(fallback: "`TorLwdConn.getTreeState` failed with unknown error")
388
+ )
389
+ }
390
+
391
+ defer { zcashlc_free_boxed_slice(treeStatePtr) }
392
+
393
+ let slice = treeStatePtr.pointee
394
+ guard let rawPtr = slice.ptr else {
395
+ throw ZcashError.rustTorLwdGetTreeState("`TorLwdConn.getTreeState` Null pointer in FfiBoxedSlice")
396
+ }
397
+
398
+ let buffer = UnsafeBufferPointer<UInt8>(start: rawPtr, count: Int(slice.len))
399
+ let data = Data(buffer: buffer)
400
+
401
+ do {
402
+ let treeState = try TreeState(serializedData: data)
403
+ return treeState
404
+ } catch {
405
+ throw ZcashError.rustTorLwdGetTreeState("`TorLwdConn.getTreeState` Failed to decode protobuf TreeState: \(error)")
406
+ }
407
+ }
408
+
409
+ func checkSingleUseTransparentAddresses(
410
+ dbData: (String, UInt),
411
+ networkType: NetworkType,
412
+ accountUUID: AccountUUID
413
+ ) async throws -> TransparentAddressCheckResult {
414
+ let addressCheckResultPtr = zcashlc_tor_lwd_conn_check_single_use_taddr(
415
+ conn,
416
+ dbData.0,
417
+ dbData.1,
418
+ networkType.networkId,
419
+ accountUUID.id
420
+ )
421
+
422
+ guard let addressCheckResultPtr else {
423
+ throw ZcashError.rustCheckSingleUseTransparentAddresses(
424
+ lastErrorMessage(fallback: "`checkSingleUseTransparentAddresses` failed with unknown error")
425
+ )
426
+ }
427
+
428
+ defer { zcashlc_free_address_check_result(addressCheckResultPtr) }
429
+
430
+ if addressCheckResultPtr.pointee.tag == 0 {
431
+ return TransparentAddressCheckResult.notFound
432
+ } else {
433
+ return TransparentAddressCheckResult.found(
434
+ String(cString: addressCheckResultPtr.pointee.found.address)
435
+ )
436
+ }
437
+ }
438
+
439
+ func updateTransparentAddressTransactions(
440
+ address: String,
441
+ start: BlockHeight,
442
+ end: BlockHeight,
443
+ dbData: (String, UInt),
444
+ networkType: NetworkType
445
+ ) async throws -> TransparentAddressCheckResult {
446
+ let addressCheckResultPtr = zcashlc_tor_lwd_conn_update_transparent_address_transactions(
447
+ conn,
448
+ dbData.0,
449
+ dbData.1,
450
+ networkType.networkId,
451
+ address,
452
+ UInt32(start),
453
+ Int64(end)
454
+ )
455
+
456
+ guard let addressCheckResultPtr else {
457
+ throw ZcashError.rustUpdateTransparentAddressTransactions(
458
+ lastErrorMessage(fallback: "`updateTransparentAddressTransactions` failed with unknown error")
459
+ )
460
+ }
461
+
462
+ defer { zcashlc_free_address_check_result(addressCheckResultPtr) }
463
+
464
+ if addressCheckResultPtr.pointee.tag == 0 {
465
+ return TransparentAddressCheckResult.notFound
466
+ } else {
467
+ return TransparentAddressCheckResult.found(
468
+ String(cString: addressCheckResultPtr.pointee.found.address)
469
+ )
470
+ }
471
+ }
472
+
473
+ func fetchUTXOsByAddress(
474
+ address: String,
475
+ dbData: (String, UInt),
476
+ networkType: NetworkType,
477
+ accountUUID: AccountUUID
478
+ ) async throws -> TransparentAddressCheckResult {
479
+ let addressCheckResultPtr = zcashlc_tor_lwd_conn_fetch_utxos_by_address(
480
+ conn,
481
+ dbData.0,
482
+ dbData.1,
483
+ networkType.networkId,
484
+ accountUUID.id,
485
+ address
486
+ )
487
+
488
+ guard let addressCheckResultPtr else {
489
+ throw ZcashError.rustFetchUTXOsByAddress(
490
+ lastErrorMessage(fallback: "`fetchUTXOsByAddress` failed with unknown error")
491
+ )
492
+ }
493
+
494
+ defer { zcashlc_free_address_check_result(addressCheckResultPtr) }
495
+
496
+ if addressCheckResultPtr.pointee.tag == 0 {
497
+ return TransparentAddressCheckResult.notFound
498
+ } else {
499
+ return TransparentAddressCheckResult.found(
500
+ String(cString: addressCheckResultPtr.pointee.found.address)
501
+ )
502
+ }
503
+ }
504
+ }
505
+
506
+ extension FfiHttpResponseBytes {
507
+ func unsafeToResponse(url: URL) -> (data: Data, response: HTTPURLResponse)? {
508
+ var headerFields: [String: String] = [:]
509
+
510
+ for i in (0 ..< Int(headers_len)) {
511
+ let headerPtr = headers_ptr.advanced(by: i).pointee
512
+
513
+ let name = String(validatingCString: headerPtr.name)
514
+ let value = String(validatingCString: headerPtr.value)
515
+
516
+ guard let name, let value else {
517
+ return nil
518
+ }
519
+
520
+ if headerFields.contains(where: { $0.key == name }) {
521
+ // Duplicate header names correspond to a single header name
522
+ // with multiple values separated by commas.
523
+ headerFields[name]?.append(", \(value)")
524
+ } else {
525
+ headerFields[name] = value
526
+ }
527
+ }
528
+
529
+ let response = HTTPURLResponse(
530
+ url: url,
531
+ statusCode: Int(status),
532
+ httpVersion: String(validatingCString: version),
533
+ headerFields: headerFields
534
+ )
535
+
536
+ guard let response else {
537
+ return nil
538
+ }
539
+
540
+ return (
541
+ data: Data(
542
+ bytes: body_ptr,
543
+ count: Int(body_len)
544
+ ),
545
+ response: response
546
+ )
547
+ }
57
548
  }
@@ -21,7 +21,7 @@ public enum TransactionEncoderError: Error {
21
21
  protocol TransactionEncoder {
22
22
  /// Creates a proposal for transferring funds to the given recipient.
23
23
  ///
24
- /// - Parameter accountIndex: the account from which to transfer funds.
24
+ /// - Parameter accountUUID: the account from which to transfer funds.
25
25
  /// - Parameter recipient: string containing the recipient's address.
26
26
  /// - Parameter amount: the amount to send in Zatoshi.
27
27
  /// - Parameter memoBytes: an optional memo to include as part of the proposal's transactions. Use `nil` when sending to transparent receivers otherwise the function will throw an error.
@@ -29,7 +29,7 @@ protocol TransactionEncoder {
29
29
  /// If `prepare()` hasn't already been called since creation of the synchronizer instance or since the last wipe then this method throws
30
30
  /// `SynchronizerErrors.notPrepared`.
31
31
  func proposeTransfer(
32
- accountIndex: Int,
32
+ accountUUID: AccountUUID,
33
33
  recipient: String,
34
34
  amount: Zatoshi,
35
35
  memoBytes: MemoBytes?
@@ -37,7 +37,7 @@ protocol TransactionEncoder {
37
37
 
38
38
  /// Creates a proposal for shielding any transparent funds received by the given account.
39
39
  ///
40
- /// - Parameter accountIndex: the account for which to shield funds.
40
+ /// - Parameter accountUUID:the account from which to shield funds.
41
41
  /// - Parameter shieldingThreshold: the minimum transparent balance required before a proposal will be created.
42
42
  /// - Parameter memoBytes: an optional memo to include as part of the proposal's transactions.
43
43
  /// - Parameter transparentReceiver: a specific transparent receiver within the account
@@ -51,7 +51,7 @@ protocol TransactionEncoder {
51
51
  /// If `prepare()` hasn't already been called since creation of the synchronizer instance or since the last wipe then this method throws
52
52
  /// `SynchronizerErrors.notPrepared`.
53
53
  func proposeShielding(
54
- accountIndex: Int,
54
+ accountUUID: AccountUUID,
55
55
  shieldingThreshold: Zatoshi,
56
56
  memoBytes: MemoBytes?,
57
57
  transparentReceiver: String?
@@ -78,18 +78,22 @@ protocol TransactionEncoder {
78
78
  ///
79
79
  /// - Parameters:
80
80
  /// - Parameter uri: a valid ZIP-321 payment URI.
81
- /// - Parameter accountIndex: the index of the account the proposal should be made from.
81
+ /// - Parameter accountUUID: the account the proposal should be made from.
82
82
  /// - Throws:
83
83
  /// - `walletTransEncoderCreateTransactionMissingSaplingParams` if the sapling parameters aren't downloaded.
84
84
  /// - Some `ZcashError.rust*` if the creation of transaction fails.
85
85
  func proposeFulfillingPaymentFromURI(
86
86
  _ uri: String,
87
- accountIndex: Int
87
+ accountUUID: AccountUUID
88
88
  ) async throws -> Proposal
89
89
 
90
90
  /// submits a transaction to the Zcash peer-to-peer network.
91
91
  /// - Parameter transaction: a transaction overview
92
92
  func submit(transaction: EncodedTransaction) async throws
93
93
 
94
+ /// Tries to fetch the transaction for the given transaction ids.
95
+ /// - Parameter txIds: an array of transaction ids to be fetched from the DB.
96
+ func fetchTransactionsForTxIds(_ txIds: [Data]) async throws -> [ZcashTransaction.Overview]
97
+
94
98
  func closeDBConnection()
95
99
  }