react-native-zcash 0.4.2 → 0.6.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 (157) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +6 -3
  3. package/android/build.gradle +5 -4
  4. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2230000.json +8 -0
  5. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2240000.json +8 -0
  6. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2250000.json +8 -0
  7. package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +117 -122
  8. package/ios/RNZcash.m +1 -12
  9. package/ios/RNZcash.swift +127 -153
  10. package/ios/ZCashLightClientKit/Block/Actions/Action.swift +98 -0
  11. package/ios/ZCashLightClientKit/Block/Actions/ClearAlreadyScannedBlocksAction.swift +35 -0
  12. package/ios/ZCashLightClientKit/Block/Actions/ClearCacheAction.swift +30 -0
  13. package/ios/ZCashLightClientKit/Block/Actions/DownloadAction.swift +67 -0
  14. package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +97 -0
  15. package/ios/ZCashLightClientKit/Block/Actions/FetchUTXOsAction.swift +33 -0
  16. package/ios/ZCashLightClientKit/Block/Actions/MigrateLegacyCacheDBAction.swift +70 -0
  17. package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +59 -0
  18. package/ios/ZCashLightClientKit/Block/Actions/RewindAction.swift +48 -0
  19. package/ios/ZCashLightClientKit/Block/Actions/SaplingParamsAction.swift +33 -0
  20. package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +95 -0
  21. package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +55 -0
  22. package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +58 -0
  23. package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +60 -0
  24. package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +421 -937
  25. package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +31 -17
  26. package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +2 -2
  27. package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +46 -15
  28. package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +4 -15
  29. package/ios/ZCashLightClientKit/Block/FilesystemStorage/FSCompactBlockRepository.swift +4 -4
  30. package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +10 -35
  31. package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +24 -0
  32. package/ios/ZCashLightClientKit/Block/Utils/SyncControlData.swift +25 -0
  33. package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +1 -2
  34. package/ios/ZCashLightClientKit/CombineSynchronizer.swift +2 -5
  35. package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +7 -25
  36. package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +40 -42
  37. package/ios/ZCashLightClientKit/DAO/UnspentTransactionOutputDao.swift +13 -4
  38. package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +9 -0
  39. package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +7 -10
  40. package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
  41. package/ios/ZCashLightClientKit/Error/ZcashError.swift +121 -12
  42. package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +43 -5
  43. package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +72 -6
  44. package/ios/ZCashLightClientKit/Extensions/Bool+ToData.swift +15 -0
  45. package/ios/ZCashLightClientKit/Extensions/Data+ToOtherTypes.swift +18 -0
  46. package/ios/ZCashLightClientKit/Extensions/Int+ToData.swift +15 -0
  47. package/ios/ZCashLightClientKit/Initializer.swift +47 -26
  48. package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +0 -12
  49. package/ios/ZCashLightClientKit/Model/Checkpoint.swift +12 -0
  50. package/ios/ZCashLightClientKit/Model/ScanProgress.swift +29 -0
  51. package/ios/ZCashLightClientKit/Model/ScanRange.swift +31 -0
  52. package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +15 -0
  53. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/compact_formats.pb.swift +150 -46
  54. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/compact_formats.proto +30 -16
  55. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/service.proto +32 -6
  56. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.grpc.swift +259 -22
  57. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.pb.swift +193 -7
  58. package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +8 -0
  59. package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +18 -28
  60. package/ios/ZCashLightClientKit/Repository/CompactBlockRepository.swift +1 -1
  61. package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +2 -6
  62. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2092500.json +8 -0
  63. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2095000.json +8 -0
  64. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2097500.json +8 -0
  65. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2102500.json +8 -0
  66. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2105000.json +8 -0
  67. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2107500.json +8 -0
  68. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2112500.json +8 -0
  69. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2115000.json +8 -0
  70. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2117500.json +8 -0
  71. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2122500.json +8 -0
  72. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2125000.json +8 -0
  73. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2127500.json +8 -0
  74. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2132500.json +8 -0
  75. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2135000.json +8 -0
  76. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2137500.json +8 -0
  77. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2142500.json +8 -0
  78. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2145000.json +8 -0
  79. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2147500.json +8 -0
  80. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2152500.json +8 -0
  81. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2155000.json +8 -0
  82. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2157500.json +8 -0
  83. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2162500.json +8 -0
  84. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2165000.json +8 -0
  85. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2167500.json +8 -0
  86. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2172500.json +8 -0
  87. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2175000.json +8 -0
  88. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2177500.json +8 -0
  89. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2182500.json +8 -0
  90. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2185000.json +8 -0
  91. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2187500.json +8 -0
  92. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2192500.json +8 -0
  93. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2195000.json +8 -0
  94. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2197500.json +8 -0
  95. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2202500.json +8 -0
  96. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2205000.json +8 -0
  97. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2207500.json +8 -0
  98. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2212500.json +8 -0
  99. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2215000.json +8 -0
  100. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2217500.json +8 -0
  101. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2222500.json +8 -0
  102. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2225000.json +8 -0
  103. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2227500.json +8 -0
  104. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2230000.json +8 -0
  105. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2232500.json +8 -0
  106. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2235000.json +8 -0
  107. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2237500.json +8 -0
  108. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2240000.json +8 -0
  109. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2242500.json +8 -0
  110. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2245000.json +8 -0
  111. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2247500.json +8 -0
  112. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2250000.json +8 -0
  113. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2350000.json +8 -0
  114. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2360000.json +8 -0
  115. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2370000.json +8 -0
  116. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2380000.json +8 -0
  117. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2390000.json +8 -0
  118. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2400000.json +8 -0
  119. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2410000.json +8 -0
  120. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2420000.json +8 -0
  121. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2430000.json +8 -0
  122. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2440000.json +8 -0
  123. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2450000.json +8 -0
  124. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2460000.json +8 -0
  125. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2470000.json +8 -0
  126. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2480000.json +8 -0
  127. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2490000.json +8 -0
  128. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2500000.json +8 -0
  129. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2510000.json +8 -0
  130. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2520000.json +8 -0
  131. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2530000.json +8 -0
  132. package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +293 -158
  133. package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +58 -64
  134. package/ios/ZCashLightClientKit/Rust/zcashlc.h +618 -512
  135. package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +2 -8
  136. package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +3 -15
  137. package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +11 -30
  138. package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +41 -50
  139. package/ios/ZCashLightClientKit/Synchronizer.swift +51 -65
  140. package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +2 -2
  141. package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +7 -7
  142. package/ios/ZCashLightClientKit/Utils/OSLogger.swift +3 -3
  143. package/ios/ZCashLightClientKit/Utils/ZcashFileManager.swift +16 -0
  144. package/ios/libzcashlc.xcframework/Info.plist +9 -5
  145. package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
  146. package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
  147. package/lib/rnzcash.rn.js +8 -30
  148. package/lib/rnzcash.rn.js.map +1 -1
  149. package/lib/src/react-native.d.ts +3 -5
  150. package/lib/src/types.d.ts +19 -14
  151. package/package.json +1 -1
  152. package/src/react-native.ts +13 -21
  153. package/src/types.ts +26 -23
  154. package/ios/ZCashLightClientKit/Block/Utils/InternalSyncProgress.swift +0 -200
  155. package/ios/ZCashLightClientKit/Block/Validate/BlockValidator.swift +0 -51
  156. package/ios/ZCashLightClientKit/DAO/BlockDao.swift +0 -112
  157. package/ios/ZCashLightClientKit/Entity/BlockProgress.swift +0 -24
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # React Native Zcash
2
2
 
3
+ ## 0.6.0 (2023-10-10)
4
+
5
+ - added: Balances and transactions are no longer queryable and are now emitted as updates are found
6
+ - changed: Upgrade zcash-android-sdk to v2.0.1
7
+ - changed: Upgrade ZcashLightClientKit to v2.0.1
8
+ - changed: Return `raw` and `fee` with transactions
9
+ - removed: `getBalance` and `getTransactions`
10
+
11
+ Android:
12
+
13
+ - changed: Various syntax cleanups
14
+
15
+ iOS:
16
+
17
+ - fixed: Restart synchronizer on rescan
18
+ - fixed: Txid parsing
19
+
20
+ ## 0.5.0 (2023-09-20)
21
+
22
+ - changed: `deriveUnifiedAddress` will now return all three address types
23
+ - changed: Replace `runBlocking` with async/await (Android)
24
+ - fixed: Rewrite `getTransactions` (Android)
25
+ - fixed: Force balance refresh before grabbing balances in `getBalance` (workaround for bug in SDK) (Android)
26
+
3
27
  ## 0.4.2 (2023-09-14)
4
28
 
5
29
  - changed: Always return memos array with transactions
package/README.md CHANGED
@@ -41,12 +41,15 @@ buildscript {
41
41
  - `stop`
42
42
  - `rescan`
43
43
  - `getLatestNetworkHeight`
44
- - `getBalance`
45
- - `getTransactions`
46
44
  - `sendToAddress`
47
45
  - `deriveUnifiedAddress`
48
46
 
49
- `Tools` contains methods that don't require a running synchronizer (with one exception, `isValidAddress` on Android which does requires any synchronizer connected to the requested network).
47
+ `Tools` contains methods that don't require a running synchronizer (with one exception, `isValidAddress` on Android which does requires any synchronizer connected to the requested network). In addition to the methods above, the following events can be subscribed to:
48
+
49
+ - `BalanceEvent`- aggregate total and available balances
50
+ - `StatusEvent` - current synchronizer activity (`STOPPED`, `DISCONNECTED`, `SYNCING`, and `SYNCED`)
51
+ - `TransactionEvent`- confirmed transactions
52
+ - `UpdateEvent` - syncing progress and network height
50
53
 
51
54
  ## Developing
52
55
 
@@ -30,6 +30,7 @@ android {
30
30
  lintOptions {
31
31
  abortOnError false
32
32
  }
33
+ namespace 'app.edge.rnzcash'
33
34
  }
34
35
 
35
36
  repositories {
@@ -48,8 +49,8 @@ dependencies {
48
49
 
49
50
  implementation 'androidx.appcompat:appcompat:1.4.1'
50
51
  implementation 'androidx.paging:paging-runtime-ktx:2.1.2'
51
- implementation 'cash.z.ecc.android:zcash-android-sdk:1.20.0-beta01'
52
- implementation 'cash.z.ecc.android:zcash-android-sdk-incubator:1.20.0-beta01'
53
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
54
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
52
+ implementation 'cash.z.ecc.android:zcash-android-sdk:2.0.1'
53
+ implementation 'cash.z.ecc.android:zcash-android-sdk-incubator:2.0.1'
54
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
55
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
55
56
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "main",
3
+ "height": "2230000",
4
+ "hash": "00000000012d4b6a23c7fb155f41880059ab76b1e53eeb00fd815fec785d8c9f",
5
+ "time": 1694943243,
6
+ "saplingTree": "0153aa9b90d677f07c26197fa64bbb2ca536073a86fd33d2abd39ba7571e1bb32b01a3af5fed6ecb6d8adc882abc339c4478e738befc199aeeec86000964684580241a013bdf293a70d1fe712b7288c7b71b5ac3d1e1511253e8b2a8bbfce0d23dc160440001f00f1e31571c262208a894786cac5b6ec972789320249b9abde08dd776cbcc41000000000001aae6f66d11fd0fcff3e6aaa713857451f02ea45c85c2695262a51b4282185633012931e37c5440eeeee1be3c3f728062754b2b614f57483d6f60154c3676a69515000001579ced54cf6fbdf70a333d261545807f712a060ca270c4dd38b66761f77a98520000000182ac7ebe2f7e9d8084a38aa8be56b1bd86292babf05f98882a6959cf9d318c110001d8ccea507421a590ed38116b834189cdc22421b4764179fa4e364803dfa66d56018cf6f5034a55fed59d1d832620916a43c756d2379e50ef9440fc4c3e7a29aa2300011619f99023a69bb647eab2d2aa1a73c3673c74bb033c3c4930eacda19e6fd93b0000000160272b134ca494b602137d89e528c751c06d3ef4a87a45f33af343c15060cc1e",
7
+ "orchardTree": "017138fa0167df524c3b884dda160c109760bd63da1a83617390b5d84b558fe51a0145762a76c27a5531dabd7065983681a260ef6ff287bef443c767772ecdc4c20c1f0000015a69d102fca262dc52daa3c6f5afb3cdff72a9a970b7034f07573a03c4b7053201e17ab5213711283230fcc5c7a7a8024bfe59b4dfe75aa60aa66de84286c6752f0001eb2578733549c4e9ef210f060838b756fa26459421bd65e6f33c1fbf38ea2d07015b720382157758674694fb7ab102a26196abcc0e2b8b5f3481997620535fe23c0000000000000001dd3e61f3e1d497d923486bd000737ea0ffac885fa481316727d0d8f7fc2138100001cf3bf92f69798e68555548afcce1648add1fb2548d64fa9a1ec22a3e26e7890101e637281deb58dff0c44ba13149b784a95da1b493005efd057e6f4ac20ef5d81d000001cc2dcaa338b312112db04b435a706d63244dd435238f0aa1e9e1598d35470810012dcc4273c8a0ed2337ecf7879380a07e7d427c7f9d82e538002bd1442978402c01daf63debf5b40df902dae98dadc029f281474d190cddecef1b10653248a234150001e2bca6a8d987d668defba89dc082196a922634ed88e065c669e526bb8815ee1b000000000000"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "main",
3
+ "height": "2240000",
4
+ "hash": "000000000069a67c9ef4829f0b5742cbd27fdf2ae5cdec365c91c3b04d309647",
5
+ "time": 1695696312,
6
+ "saplingTree": "012d11971e09b4bbc63e78277847849e4843736aeff18a135a19ae200fe1970766012421255c867e37da2db4a3f9fbaa18084aca9816a621e2f8b3103787782c81291a018507b35ac4792682f3189c01f91f8479815c654eea791e6ab8e67f1822bcd1480163dcf884428127f8cd206316abb345d30bd4d3eeeca49145276cf7565787c83c0120900a176f78b83e32730da21f559ae18a98797d1a032c00438b6f192ac5f34a017d758ec17f8ff744218b78468d0d88259bfe1b4139eaa78b3c9268e2fdf54b1801bab9674e72ec2c946ec5ab3da729e6190d4c49bdac30b69ceee0e28d82ac464600017cd0f0d9198e1a3d140f4f40efddc64fb40d7443ba65deda6b3aa3c9a4322b0c0001f0cf9a379500ee4e71bced9683ff1e2b8483379faea159d63637febbfe5a1f1b0128a132203057c9e99c4090ff766658573ba170affa85b9237ccb5927b5ae1336012657f8a0a10c175b231460849cc1fbcff1e8bf7e668e0319f4ed13be1d3e0f5f01b19192921006a181a583899542df7bb68359c482e658142e42241d8a6c3e511e019a757058b6e952ffa49663a800cdef1d06b7a7ffd7c56e55355f2ad9f89b00140194bd4a72af1bf73b690a8129b9db24a508f7052d570f1d48657c72a0d4dc421b00000182ac7ebe2f7e9d8084a38aa8be56b1bd86292babf05f98882a6959cf9d318c110001d8ccea507421a590ed38116b834189cdc22421b4764179fa4e364803dfa66d56018cf6f5034a55fed59d1d832620916a43c756d2379e50ef9440fc4c3e7a29aa2300011619f99023a69bb647eab2d2aa1a73c3673c74bb033c3c4930eacda19e6fd93b0000000160272b134ca494b602137d89e528c751c06d3ef4a87a45f33af343c15060cc1e",
7
+ "orchardTree": "010a2edceb81a84b9fa465de87a9c3701c8a5f109dfac1bd9f7ac82eff5f291405015c75544f79cc861f1b401a8ee726adf63736f51d636609504ba99cd51ac513291f000170b0286597e58d725cd67e5845575bd4a5c6c9d91eb9d956c1b5662589ebb80100000199f76442c47c3e319a90c8e2f71ed243cf1e0115d3b962413e310f2cc4edd51c000112bcfce07875062a5ad577e2c97d67d7f6a000dc65aef03a0e520e21f12a8f1c01c114ee14f4296876cfb428aaccffa1091b13db6ffff5c1a2027c58b102b5530d00017abfa6e9773177d75a8006efe4868cbcafaf292d48e852ee06f519c5bf6667200162f63c4527bf1c0d7e4728649cbfd93cfe3d79d0834e0f5f548870d6df43671200000001dd3e61f3e1d497d923486bd000737ea0ffac885fa481316727d0d8f7fc2138100001cf3bf92f69798e68555548afcce1648add1fb2548d64fa9a1ec22a3e26e7890101e637281deb58dff0c44ba13149b784a95da1b493005efd057e6f4ac20ef5d81d000001cc2dcaa338b312112db04b435a706d63244dd435238f0aa1e9e1598d35470810012dcc4273c8a0ed2337ecf7879380a07e7d427c7f9d82e538002bd1442978402c01daf63debf5b40df902dae98dadc029f281474d190cddecef1b10653248a234150001e2bca6a8d987d668defba89dc082196a922634ed88e065c669e526bb8815ee1b000000000000"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "network": "main",
3
+ "height": "2250000",
4
+ "hash": "00000000012b3fe412a00b795a282135c30abd4b46d2bf2e7d0168e5c947ebf5",
5
+ "time": 1696451387,
6
+ "saplingTree": "01bf2a311d6302f905762ff13823d1dcff0fb9e68674059a7121f2f19b9c27882101575df84d954625511d141479c09bd602af93ed7cfca6e45cd9ac483beaf72d611a000001ee73c0c892f582faeb7690f1629ef9024b4ca8cff0bcd2226a43f896be3b275f000001cf2bbcec921924a0afd09235555b0a346d76081b45255d57ce2d691fd5c4175501f55cea93a7061448481c950ed26cfbabf9ace934177e39c2b78570385f413c35000001f45efd0bd694a391cd6d3773ae3e75c9251c68a8281469db451521bb3359004c00013f453edf224bb61a9c0b3d703fc97c5082dabde0bd78429f0798dbe8b6046f0c00018cdd71abb1799bfd51405067ea43033bf0a5253d3536b4b241e866a257b7916c01e055cec06072c1c4c7381264864f21db313d32511ef89fc09a6a60e41e0d0c2a000182ac7ebe2f7e9d8084a38aa8be56b1bd86292babf05f98882a6959cf9d318c110001d8ccea507421a590ed38116b834189cdc22421b4764179fa4e364803dfa66d56018cf6f5034a55fed59d1d832620916a43c756d2379e50ef9440fc4c3e7a29aa2300011619f99023a69bb647eab2d2aa1a73c3673c74bb033c3c4930eacda19e6fd93b0000000160272b134ca494b602137d89e528c751c06d3ef4a87a45f33af343c15060cc1e",
7
+ "orchardTree": "0108d0c8b7890fdfb38c4ba60d9c66da45cc2fb23e6698a0a0eaeb4508c5b37d39001f01c1782f10a594f13095cae37809ac3c2dd43e8029d62ef1282039429ab758ad2700010b5a16f6a11fc79b21f36c55261931cef68d6b00d4210ce90cc447e5ba656724014ffd7c660201b4c82c01b832a3153a8295197fa8945a12a79ca5d9a1aafcac1800015e0ad0bc0cd859186f456f1be54e8c6992f4cc61507b23e59d7fa3df8ec8d62b01e2aed22800fa2e21ce1ed9b89e84ef7161c6cc25f6653964bf5c4e134a030e2f0166e704cc940f0e24abfa2dfe74e94f6f1545a94c1f5114ba90c32a29cb2ec50701a0889c7b1f704d82004c6cfd6d91fe3115db60b121464b5237b49240d421cd3e015a85dd41ba7341c7d10885ea2add0b09c72b22f2fc398f0c8ba11123f27e9713000125529c4352762dea55de0005e0efadaadd1a6b55084f0ca7beac54f78c2af304000001dd3e61f3e1d497d923486bd000737ea0ffac885fa481316727d0d8f7fc2138100001cf3bf92f69798e68555548afcce1648add1fb2548d64fa9a1ec22a3e26e7890101e637281deb58dff0c44ba13149b784a95da1b493005efd057e6f4ac20ef5d81d000001cc2dcaa338b312112db04b435a706d63244dd435238f0aa1e9e1598d35470810012dcc4273c8a0ed2337ecf7879380a07e7d427c7f9d82e538002bd1442978402c01daf63debf5b40df902dae98dadc029f281474d190cddecef1b10653248a234150001e2bca6a8d987d668defba89dc082196a922634ed88e065c669e526bb8815ee1b000000000000"
8
+ }
@@ -2,6 +2,7 @@ package app.edge.rnzcash
2
2
 
3
3
  import cash.z.ecc.android.sdk.SdkSynchronizer
4
4
  import cash.z.ecc.android.sdk.Synchronizer
5
+ import cash.z.ecc.android.sdk.WalletInitMode
5
6
  import cash.z.ecc.android.sdk.exception.LightWalletException
6
7
  import cash.z.ecc.android.sdk.ext.*
7
8
  import cash.z.ecc.android.sdk.internal.*
@@ -14,12 +15,12 @@ import co.electriccoin.lightwallet.client.model.Response
14
15
  import co.electriccoin.lightwallet.client.new
15
16
  import com.facebook.react.bridge.*
16
17
  import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
18
+ import kotlinx.coroutines.async
17
19
  import kotlinx.coroutines.CoroutineScope
18
- import kotlinx.coroutines.cancel
20
+ import kotlinx.coroutines.Dispatchers
21
+ import kotlinx.coroutines.ExperimentalCoroutinesApi
19
22
  import kotlinx.coroutines.flow.*
20
23
  import kotlinx.coroutines.launch
21
- import kotlinx.coroutines.runBlocking
22
- import kotlin.coroutines.EmptyCoroutineContext
23
24
 
24
25
  class RNZcashModule(private val reactContext: ReactApplicationContext) :
25
26
  ReactContextBaseJavaModule(reactContext) {
@@ -28,52 +29,97 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
28
29
  * Scope for anything that out-lives the synchronizer, meaning anything that can be used before
29
30
  * the synchronizer starts or after it stops. Everything else falls within the scope of the
30
31
  * synchronizer and should use `synchronizer.coroutineScope` whenever a scope is needed.
31
- *
32
- * In a real production app, we'd use the scope of the parent activity
33
32
  */
34
- var moduleScope: CoroutineScope = CoroutineScope(EmptyCoroutineContext)
35
- var synchronizerMap = mutableMapOf<String, SdkSynchronizer>()
33
+ private var moduleScope: CoroutineScope = CoroutineScope(Dispatchers.IO)
34
+ private var synchronizerMap = mutableMapOf<String, SdkSynchronizer>()
36
35
 
37
- val networks = mapOf("mainnet" to ZcashNetwork.Mainnet, "testnet" to ZcashNetwork.Testnet)
36
+ private val networks = mapOf("mainnet" to ZcashNetwork.Mainnet, "testnet" to ZcashNetwork.Testnet)
38
37
 
39
38
  override fun getName() = "RNZcash"
40
39
 
41
40
  @ReactMethod
42
- fun initialize(seed: String, birthdayHeight: Int, alias: String, networkName: String = "mainnet", defaultHost: String = "mainnet.lightwalletd.com", defaultPort: Int = 9067, promise: Promise) =
41
+ fun initialize(seed: String, birthdayHeight: Int, alias: String, networkName: String = "mainnet", defaultHost: String = "mainnet.lightwalletd.com", defaultPort: Int = 9067, newWallet: Boolean, promise: Promise) =
43
42
  moduleScope.launch {
44
43
  promise.wrap {
45
- var network = networks.getOrDefault(networkName, ZcashNetwork.Mainnet)
46
- var endpoint = LightWalletEndpoint(defaultHost, defaultPort, true)
47
- var seedPhrase = SeedPhrase.new(seed)
44
+ val network = networks.getOrDefault(networkName, ZcashNetwork.Mainnet)
45
+ val endpoint = LightWalletEndpoint(defaultHost, defaultPort, true)
46
+ val seedPhrase = SeedPhrase.new(seed)
47
+ val initMode = if (newWallet) WalletInitMode.NewWallet else WalletInitMode.ExistingWallet
48
48
  if (!synchronizerMap.containsKey(alias)) {
49
- synchronizerMap.set(alias, Synchronizer.new(reactApplicationContext, network, alias, endpoint, seedPhrase.toByteArray(), BlockHeight.new(network, birthdayHeight.toLong())) as SdkSynchronizer)
49
+ synchronizerMap[alias] = Synchronizer.new(reactApplicationContext, network, alias, endpoint, seedPhrase.toByteArray(), BlockHeight.new(network, birthdayHeight.toLong()), initMode) as SdkSynchronizer
50
50
  }
51
51
  val wallet = getWallet(alias)
52
52
  val scope = wallet.coroutineScope
53
- wallet.processorInfo.collectWith(scope, { update ->
54
- var lastDownloadedHeight = runBlocking { wallet.processor.downloader.getLastDownloadedHeight() }
55
- if (lastDownloadedHeight == null) lastDownloadedHeight = BlockHeight.new(wallet.network, birthdayHeight.toLong())
56
-
57
- var lastScannedHeight = update.lastSyncedHeight
58
- if (lastScannedHeight == null) lastScannedHeight = BlockHeight.new(wallet.network, birthdayHeight.toLong())
59
-
60
- var networkBlockHeight = update.networkBlockHeight
53
+ combine(wallet.progress, wallet.networkHeight) { progress, networkHeight ->
54
+ return@combine mapOf("progress" to progress, "networkHeight" to networkHeight)
55
+ }.collectWith(scope) { map ->
56
+ val progress = map["progress"] as PercentDecimal
57
+ var networkBlockHeight = map["networkHeight"] as BlockHeight?
61
58
  if (networkBlockHeight == null) networkBlockHeight = BlockHeight.new(wallet.network, birthdayHeight.toLong())
62
59
 
63
60
  sendEvent("UpdateEvent") { args ->
64
61
  args.putString("alias", alias)
65
- args.putInt("lastDownloadedHeight", lastDownloadedHeight.value.toInt())
66
- args.putInt("lastScannedHeight", lastScannedHeight.value.toInt())
67
- args.putInt("scanProgress", wallet.processor.progress.value.toPercentage())
62
+ args.putInt(
63
+ "scanProgress",
64
+ progress.toPercentage()
65
+ )
68
66
  args.putInt("networkBlockHeight", networkBlockHeight.value.toInt())
69
67
  }
70
- })
71
- wallet.status.collectWith(scope, { status ->
68
+ }
69
+ wallet.status.collectWith(scope) { status ->
72
70
  sendEvent("StatusEvent") { args ->
73
71
  args.putString("alias", alias)
74
72
  args.putString("name", status.toString())
75
73
  }
76
- })
74
+ }
75
+ wallet.transactions.collectWith(scope) { txList ->
76
+ scope.launch {
77
+ val nativeArray = Arguments.createArray()
78
+ txList.filter { tx -> tx.transactionState == TransactionState.Confirmed }.map { tx -> launch {
79
+ val parsedTx = parseTx(wallet, tx)
80
+ nativeArray.pushMap(parsedTx)
81
+ } }.forEach { it.join() }
82
+
83
+ sendEvent("TransactionEvent") { args ->
84
+ args.putString("alias", alias)
85
+ args.putArray(
86
+ "transactions",
87
+ nativeArray
88
+ )
89
+ }
90
+ }
91
+ }
92
+ combine(wallet.transparentBalances, wallet.saplingBalances, wallet.orchardBalances) { transparentBalances, saplingBalances, orchardBalances ->
93
+ return@combine mapOf("transparentBalances" to transparentBalances, "saplingBalances" to saplingBalances, "orchardBalances" to orchardBalances)
94
+ }.collectWith(scope) { map ->
95
+ val transparentBalances = map["transparentBalances"]
96
+ val saplingBalances = map["saplingBalances"]
97
+ val orchardBalances = map["orchardBalances"]
98
+
99
+ var availableZatoshi = Zatoshi(0L)
100
+ var totalZatoshi = Zatoshi(0L)
101
+
102
+ availableZatoshi = availableZatoshi.plus(transparentBalances?.available ?: Zatoshi(0L))
103
+ totalZatoshi = totalZatoshi.plus(transparentBalances?.total ?: Zatoshi(0L))
104
+
105
+ availableZatoshi = availableZatoshi.plus(saplingBalances?.available ?: Zatoshi(0L))
106
+ totalZatoshi = totalZatoshi.plus(saplingBalances?.total ?: Zatoshi(0L))
107
+
108
+ availableZatoshi = availableZatoshi.plus(orchardBalances?.available ?: Zatoshi(0L))
109
+ totalZatoshi = totalZatoshi.plus(orchardBalances?.total ?: Zatoshi(0L))
110
+
111
+ sendEvent("BalanceEvent") { args ->
112
+ args.putString("alias", alias)
113
+ args.putString(
114
+ "totalZatoshi",
115
+ totalZatoshi.value.toString()
116
+ )
117
+ args.putString(
118
+ "availableZatoshi",
119
+ availableZatoshi.value.toString()
120
+ )
121
+ }
122
+ }
77
123
  return@wrap null
78
124
  }
79
125
  }
@@ -81,88 +127,57 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
81
127
  @ReactMethod
82
128
  fun stop(alias: String, promise: Promise) {
83
129
  val wallet = getWallet(alias)
84
- moduleScope.launch {
85
- runBlocking {
86
- wallet.close()
87
- synchronizerMap.remove(alias)
88
- promise.resolve(null)
89
- }
90
- }
91
- }
92
-
93
- fun inRange(tx: TransactionOverview, first: Int, last: Int): Boolean {
94
- if (tx.minedHeight != null && tx.minedHeight!!.value >= first.toLong() && tx.minedHeight!!.value <= last.toLong()) {
95
- return true
96
- }
97
- return false
130
+ wallet.close()
131
+ synchronizerMap.remove(alias)
132
+ promise.resolve(null)
98
133
  }
99
134
 
100
- @ReactMethod
101
- fun getTransactions(alias: String, first: Int, last: Int, promise: Promise) {
102
- val wallet = getWallet(alias)
103
-
104
- fun parseTx(tx: TransactionOverview): WritableMap {
105
- val map = Arguments.createMap()
135
+ private suspend fun parseTx(wallet: SdkSynchronizer, tx: TransactionOverview): WritableMap {
136
+ val map = Arguments.createMap()
137
+ val job = wallet.coroutineScope.launch {
106
138
  map.putString("value", tx.netValue.value.toString())
139
+ if (tx.feePaid != null) {
140
+ map.putString("fee", tx.feePaid!!.value.toString())
141
+ }
107
142
  map.putInt("minedHeight", tx.minedHeight!!.value.toInt())
108
- map.putInt("blockTimeInSeconds", tx.blockTimeEpochSeconds.toInt())
143
+ map.putInt("blockTimeInSeconds", tx.blockTimeEpochSeconds!!.toInt())
109
144
  map.putString("rawTransactionId", tx.rawId.byteArray.toHexReversed())
145
+ if (tx.raw != null) {
146
+ map.putString("raw", tx.raw!!.byteArray.toHex())
147
+ }
110
148
  if (tx.isSentTransaction) {
111
- val recipient = runBlocking { wallet.getRecipients(tx).first() }
149
+ val recipient = wallet.getRecipients(tx).first()
112
150
  if (recipient is TransactionRecipient.Address) {
113
151
  map.putString("toAddress", recipient.addressValue)
114
152
  }
115
153
  }
116
154
  if (tx.memoCount > 0) {
117
- val memos = runBlocking { wallet.getMemos(tx).take(tx.memoCount).toList() }
155
+ val memos = wallet.getMemos(tx).take(tx.memoCount).toList()
118
156
  map.putArray("memos", Arguments.fromList(memos))
119
157
  } else {
120
158
  map.putArray("memos", Arguments.createArray())
121
159
  }
122
- return map
123
- }
124
-
125
- moduleScope.launch {
126
- val numTxs = wallet.getTransactionCount()
127
- var txCount = 0
128
- val nativeArray = Arguments.createArray()
129
- if (numTxs == 0) {
130
- promise.resolve(nativeArray)
131
- return@launch
132
- }
133
- runBlocking {
134
- wallet.transactions.onEach {
135
- it.forEach { tx ->
136
- run {
137
- txCount++
138
- if (inRange(tx, first, last)) nativeArray.pushMap(parseTx(tx))
139
- }
140
- if (numTxs == txCount) {
141
- cancel()
142
- promise.resolve(nativeArray)
143
- }
144
- }
145
- }.collect()
146
- }
147
160
  }
161
+ job.join()
162
+ return map
148
163
  }
149
164
 
150
165
  @ReactMethod
151
166
  fun rescan(alias: String, promise: Promise) {
152
167
  val wallet = getWallet(alias)
153
- moduleScope.launch {
154
- runBlocking {
155
- wallet.rewindToNearestHeight(wallet.latestBirthdayHeight, true)
156
- promise.resolve(null)
157
- }
168
+ wallet.coroutineScope.launch {
169
+ wallet.coroutineScope.async { wallet.rewindToNearestHeight(wallet.latestBirthdayHeight) }.await()
170
+ promise.resolve(null)
158
171
  }
159
172
  }
160
173
 
161
174
  @ReactMethod
162
175
  fun deriveViewingKey(seed: String, network: String = "mainnet", promise: Promise) {
163
- var seedPhrase = SeedPhrase.new(seed)
164
- var keys = runBlocking { DerivationTool.getInstance().deriveUnifiedFullViewingKeys(seedPhrase.toByteArray(), networks.getOrDefault(network, ZcashNetwork.Mainnet), DerivationTool.DEFAULT_NUMBER_OF_ACCOUNTS)[0] }
165
- promise.resolve(keys.encoding)
176
+ val seedPhrase = SeedPhrase.new(seed)
177
+ moduleScope.launch {
178
+ val keys = moduleScope.async { DerivationTool.getInstance().deriveUnifiedFullViewingKeys(seedPhrase.toByteArray(), networks.getOrDefault(network, ZcashNetwork.Mainnet), DerivationTool.DEFAULT_NUMBER_OF_ACCOUNTS)[0] }.await()
179
+ promise.resolve(keys.encoding)
180
+ }
166
181
  }
167
182
 
168
183
  //
@@ -179,8 +194,8 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
179
194
  fun getBirthdayHeight(host: String, port: Int, promise: Promise) {
180
195
  moduleScope.launch {
181
196
  promise.wrap {
182
- var endpoint = LightWalletEndpoint(host, port, true)
183
- var lightwalletService = LightWalletClient.new(reactApplicationContext, endpoint)
197
+ val endpoint = LightWalletEndpoint(host, port, true)
198
+ val lightwalletService = LightWalletClient.new(reactApplicationContext, endpoint)
184
199
  return@wrap when (val response = lightwalletService.getLatestBlockHeight()) {
185
200
  is Response.Success -> {
186
201
  response.result.value.toInt()
@@ -198,28 +213,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
198
213
  }
199
214
  }
200
215
 
201
- @ReactMethod
202
- fun getBalance(alias: String, promise: Promise) = promise.wrap {
203
- val wallet = getWallet(alias)
204
- var availableZatoshi = Zatoshi(0L)
205
- var totalZatoshi = Zatoshi(0L)
206
-
207
- val transparentBalances = wallet.transparentBalances.value
208
- availableZatoshi = availableZatoshi.plus(transparentBalances?.available ?: Zatoshi(0L))
209
- totalZatoshi = totalZatoshi.plus(transparentBalances?.total ?: Zatoshi(0L))
210
- val saplingBalances = wallet.saplingBalances.value
211
- availableZatoshi = availableZatoshi.plus(saplingBalances?.available ?: Zatoshi(0L))
212
- totalZatoshi = totalZatoshi.plus(saplingBalances?.total ?: Zatoshi(0L))
213
- val orchardBalances = wallet.orchardBalances.value
214
- availableZatoshi = availableZatoshi.plus(orchardBalances?.available ?: Zatoshi(0L))
215
- totalZatoshi = totalZatoshi.plus(orchardBalances?.total ?: Zatoshi(0L))
216
-
217
- val map = Arguments.createMap()
218
- map.putString("totalZatoshi", totalZatoshi.value.toString())
219
- map.putString("availableZatoshi", availableZatoshi.value.toString())
220
- return@wrap map
221
- }
222
-
216
+ @OptIn(ExperimentalCoroutinesApi::class)
223
217
  @ReactMethod
224
218
  fun sendToAddress(
225
219
  alias: String,
@@ -231,8 +225,8 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
231
225
  ) {
232
226
  val wallet = getWallet(alias)
233
227
  wallet.coroutineScope.launch {
234
- var seedPhrase = SeedPhrase.new(seed)
235
- val usk = runBlocking { DerivationTool.getInstance().deriveUnifiedSpendingKey(seedPhrase.toByteArray(), wallet.network, Account.DEFAULT) }
228
+ val seedPhrase = SeedPhrase.new(seed)
229
+ val usk = wallet.coroutineScope.async { DerivationTool.getInstance().deriveUnifiedSpendingKey(seedPhrase.toByteArray(), wallet.network, Account.DEFAULT) }.await()
236
230
  try {
237
231
  val internalId = wallet.sendToAddress(
238
232
  usk,
@@ -240,9 +234,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
240
234
  toAddress,
241
235
  memo,
242
236
  )
243
- val tx = runBlocking { wallet.transactions.flatMapConcat { list -> flowOf(*list.toTypedArray()) } }.firstOrNull { item -> item.id == internalId }
244
- if (tx == null) throw Exception("transaction failed")
245
-
237
+ val tx = wallet.coroutineScope.async { wallet.transactions.first().first() }.await()
246
238
  val map = Arguments.createMap()
247
239
  map.putString("txId", tx.rawId.byteArray.toHexReversed())
248
240
  if (tx.raw != null) map.putString("raw", tx.raw?.byteArray?.toHex())
@@ -258,13 +250,18 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
258
250
  //
259
251
 
260
252
  @ReactMethod
261
- fun deriveUnifiedAddress(alias: String, promise: Promise) = promise.wrap {
253
+ fun deriveUnifiedAddress(alias: String, promise: Promise) {
262
254
  val wallet = getWallet(alias)
263
- moduleScope.launch {
264
- runBlocking {
265
- var unifiedAddress = wallet.getUnifiedAddress(Account(0))
266
- promise.resolve(unifiedAddress)
267
- }
255
+ wallet.coroutineScope.launch {
256
+ val unifiedAddress = wallet.coroutineScope.async { wallet.getUnifiedAddress(Account(0)) }.await()
257
+ val saplingAddress = wallet.coroutineScope.async { wallet.getSaplingAddress(Account(0)) }.await()
258
+ val transparentAddress = wallet.coroutineScope.async { wallet.getTransparentAddress(Account(0)) }.await()
259
+
260
+ val map = Arguments.createMap()
261
+ map.putString("unifiedAddress", unifiedAddress)
262
+ map.putString("saplingAddress", saplingAddress)
263
+ map.putString("transparentAddress", transparentAddress)
264
+ promise.resolve(map)
268
265
  }
269
266
  }
270
267
 
@@ -293,9 +290,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
293
290
  * Retrieve wallet object from synchronizer map
294
291
  */
295
292
  private fun getWallet(alias: String): SdkSynchronizer {
296
- val wallet = synchronizerMap.get(alias)
297
- if (wallet == null) throw Exception("Wallet not found")
298
- return wallet
293
+ return synchronizerMap[alias] ?: throw Exception("Wallet not found")
299
294
  }
300
295
 
301
296
  /**
@@ -317,7 +312,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
317
312
  .emit(eventName, args)
318
313
  }
319
314
 
320
- inline fun ByteArray.toHexReversed(): String {
315
+ private fun ByteArray.toHexReversed(): String {
321
316
  val sb = StringBuilder(size * 2)
322
317
  var i = size - 1
323
318
  while (i >= 0)
package/ios/RNZcash.m CHANGED
@@ -10,6 +10,7 @@ RCT_EXTERN_METHOD(initialize:(NSString *)seed
10
10
  :(NSString *)networkName
11
11
  :(NSString *)defaultHost
12
12
  :(NSInteger *)defaultPort
13
+ :(BOOL *)newWallet
13
14
  resolver:(RCTPromiseResolveBlock)resolve
14
15
  rejecter:(RCTPromiseRejectBlock)reject
15
16
  )
@@ -44,18 +45,6 @@ resolver:(RCTPromiseResolveBlock)resolve
44
45
  rejecter:(RCTPromiseRejectBlock)reject
45
46
  )
46
47
 
47
- RCT_EXTERN_METHOD(getTransactions:(NSString *)alias
48
- :(NSInteger *)first
49
- :(NSInteger *)last
50
- resolver:(RCTPromiseResolveBlock)resolve
51
- rejecter:(RCTPromiseRejectBlock)reject
52
- )
53
-
54
- RCT_EXTERN_METHOD(getBalance:(NSString *)alias
55
- resolver:(RCTPromiseResolveBlock)resolve
56
- rejecter:(RCTPromiseRejectBlock)reject
57
- )
58
-
59
48
  RCT_EXTERN_METHOD(rescan:(NSString *)alias
60
49
  resolver:(RCTPromiseResolveBlock)resolve
61
50
  rejecter:(RCTPromiseRejectBlock)reject