react-native-zcash 0.6.14 → 0.7.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 (168) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -0
  3. package/android/build.gradle +4 -4
  4. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2470000.json +8 -0
  5. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2480000.json +8 -0
  6. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2490000.json +8 -0
  7. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2500000.json +8 -0
  8. package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +51 -9
  9. package/ios/RNZcash.m +8 -0
  10. package/ios/RNZcash.swift +66 -16
  11. package/ios/ZCashLightClientKit/Block/Actions/DownloadAction.swift +1 -1
  12. package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +3 -1
  13. package/ios/ZCashLightClientKit/Block/Actions/FetchUTXOsAction.swift +1 -1
  14. package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +11 -2
  15. package/ios/ZCashLightClientKit/Block/Actions/RewindAction.swift +2 -2
  16. package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +28 -11
  17. package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +4 -4
  18. package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +36 -7
  19. package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +1 -1
  20. package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +93 -51
  21. package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +0 -26
  22. package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +5 -6
  23. package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +1 -11
  24. package/ios/ZCashLightClientKit/Block/SaplingParameters/SaplingParametersHandler.swift +6 -4
  25. package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +10 -12
  26. package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointSource.swift +38 -0
  27. package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointURLProvider.swift +40 -0
  28. package/ios/ZCashLightClientKit/{Constants/Checkpoint+Constants.swift → Checkpoint/Checkpoint+helpers.swift} +1 -33
  29. package/ios/ZCashLightClientKit/Checkpoint/CheckpointSource.swift +34 -0
  30. package/ios/ZCashLightClientKit/Checkpoint/CheckpointSourceFactory.swift +14 -0
  31. package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +61 -6
  32. package/ios/ZCashLightClientKit/CombineSynchronizer.swift +63 -4
  33. package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +4 -0
  34. package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +21 -33
  35. package/ios/ZCashLightClientKit/DAO/UnspentTransactionOutputDao.swift +0 -182
  36. package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +0 -173
  37. package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +5 -2
  38. package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
  39. package/ios/ZCashLightClientKit/Error/ZcashError.swift +53 -1
  40. package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +19 -1
  41. package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +32 -0
  42. package/ios/ZCashLightClientKit/Initializer.swift +8 -17
  43. package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +103 -217
  44. package/ios/ZCashLightClientKit/Model/Proposal.swift +45 -0
  45. package/ios/ZCashLightClientKit/Model/ScanSummary.swift +14 -0
  46. package/ios/ZCashLightClientKit/Model/WalletSummary.swift +58 -0
  47. package/ios/ZCashLightClientKit/Model/WalletTypes.swift +0 -16
  48. package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +5 -3
  49. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proposal.pb.swift +934 -0
  50. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/proposal.proto +138 -0
  51. package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +2 -4
  52. package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +9 -1
  53. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2272500.json +8 -0
  54. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2275000.json +8 -0
  55. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2277500.json +8 -0
  56. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2282500.json +8 -0
  57. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2285000.json +8 -0
  58. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2287500.json +8 -0
  59. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2292500.json +8 -0
  60. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2295000.json +8 -0
  61. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2297500.json +8 -0
  62. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2302500.json +8 -0
  63. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2305000.json +8 -0
  64. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2307500.json +8 -0
  65. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2312500.json +8 -0
  66. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2315000.json +8 -0
  67. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2317500.json +8 -0
  68. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2322500.json +8 -0
  69. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2325000.json +8 -0
  70. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2327500.json +8 -0
  71. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2332500.json +8 -0
  72. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2335000.json +8 -0
  73. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2337500.json +8 -0
  74. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2342500.json +8 -0
  75. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2345000.json +8 -0
  76. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2347500.json +8 -0
  77. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2352500.json +8 -0
  78. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2355000.json +8 -0
  79. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2357500.json +8 -0
  80. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2362500.json +8 -0
  81. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2365000.json +8 -0
  82. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2367500.json +8 -0
  83. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2372500.json +8 -0
  84. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2375000.json +8 -0
  85. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2377500.json +8 -0
  86. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2382500.json +8 -0
  87. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2385000.json +8 -0
  88. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2387500.json +8 -0
  89. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2392500.json +8 -0
  90. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2395000.json +8 -0
  91. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2397500.json +8 -0
  92. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2402500.json +8 -0
  93. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2405000.json +8 -0
  94. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2407500.json +8 -0
  95. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2412500.json +8 -0
  96. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2415000.json +8 -0
  97. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2417500.json +8 -0
  98. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2422500.json +8 -0
  99. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2425000.json +8 -0
  100. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2427500.json +8 -0
  101. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2432500.json +8 -0
  102. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2435000.json +8 -0
  103. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2437500.json +8 -0
  104. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2442500.json +8 -0
  105. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2445000.json +8 -0
  106. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2447500.json +8 -0
  107. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2452500.json +8 -0
  108. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2455000.json +8 -0
  109. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2457500.json +8 -0
  110. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2462500.json +8 -0
  111. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2465000.json +8 -0
  112. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2467500.json +8 -0
  113. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2470000.json +8 -0
  114. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2472500.json +8 -0
  115. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2480000.json +8 -0
  116. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2490000.json +8 -0
  117. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2500000.json +8 -0
  118. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2560000.json +8 -0
  119. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2570000.json +8 -0
  120. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2580000.json +8 -0
  121. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2590000.json +8 -0
  122. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2600000.json +8 -0
  123. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2610000.json +8 -0
  124. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2620000.json +8 -0
  125. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2630000.json +8 -0
  126. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2640000.json +8 -0
  127. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2650000.json +8 -0
  128. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2660000.json +8 -0
  129. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2670000.json +8 -0
  130. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2680000.json +8 -0
  131. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2690000.json +8 -0
  132. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2700000.json +8 -0
  133. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2710000.json +8 -0
  134. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2720000.json +8 -0
  135. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2730000.json +8 -0
  136. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2740000.json +8 -0
  137. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2750000.json +8 -0
  138. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2760000.json +8 -0
  139. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2770000.json +8 -0
  140. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2780000.json +8 -0
  141. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2790000.json +8 -0
  142. package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackend.swift +1 -5
  143. package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +327 -153
  144. package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +78 -36
  145. package/ios/ZCashLightClientKit/Rust/zcashlc.h +402 -118
  146. package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +43 -14
  147. package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +52 -14
  148. package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +10 -6
  149. package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +220 -70
  150. package/ios/ZCashLightClientKit/Synchronizer.swift +105 -29
  151. package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +61 -32
  152. package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +52 -61
  153. package/ios/ZCashLightClientKit/Utils/DBActor.swift +21 -0
  154. package/ios/ZCashLightClientKit/Utils/LoggingProxy.swift +5 -0
  155. package/ios/ZCashLightClientKit/Utils/OSLogger.swift +71 -14
  156. package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
  157. package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
  158. package/lib/rnzcash.rn.js +21 -6
  159. package/lib/rnzcash.rn.js.map +1 -1
  160. package/lib/src/react-native.d.ts +2 -1
  161. package/lib/src/types.d.ts +9 -1
  162. package/package.json +1 -1
  163. package/react-native-zcash.podspec +1 -1
  164. package/src/react-native.ts +23 -4
  165. package/src/types.ts +10 -1
  166. package/ios/ZCashLightClientKit/Model/ScanProgress.swift +0 -29
  167. package/ios/ZCashLightClientKit/Repository/UnspentTransactionOutputRepository.swift +0 -16
  168. /package/ios/ZCashLightClientKit/{Model → Checkpoint}/Checkpoint.swift +0 -0
@@ -2,7 +2,7 @@
2
2
  // ZcashRustBackendWelding.swift
3
3
  // ZcashLightClientKit
4
4
  //
5
- // Created by Francisco Gindre on 12/09/2019.
5
+ // Created by Francisco 'Pacu' Gindre on 2019-12-09.
6
6
  // Copyright © 2019 Electric Coin Company. All rights reserved.
7
7
  //
8
8
 
@@ -11,15 +11,20 @@ import Foundation
11
11
  enum ZcashRustBackendWeldingConstants {
12
12
  static let validChain: Int32 = -1
13
13
  }
14
- /// Enumeration of potential return states for database initialization. If `seedRequired`
15
- /// is returned, the caller must re-attempt initialization providing the seed
14
+
15
+ /// Enumeration of potential return states for database initialization.
16
+ ///
17
+ /// If `seedRequired` is returned, the caller must re-attempt initialization providing the seed.
16
18
  public enum DbInitResult {
17
19
  case success
18
20
  case seedRequired
21
+ case seedNotRelevant
19
22
  }
20
23
 
21
- // sourcery: mockActor
22
24
  protocol ZcashRustBackendWelding {
25
+ /// Returns a list of the accounts in the wallet.
26
+ func listAccounts() async throws -> [Int32]
27
+
23
28
  /// Adds the next available account-level spend authority, given the current set of [ZIP 316]
24
29
  /// account identifiers known, to the wallet database.
25
30
  ///
@@ -41,18 +46,10 @@ protocol ZcashRustBackendWelding {
41
46
  /// - Throws: `rustCreateAccount`.
42
47
  func createAccount(seed: [UInt8], treeState: TreeState, recoverUntil: UInt32?) async throws -> UnifiedSpendingKey
43
48
 
44
- /// Creates a transaction to the given address from the given account
45
- /// - Parameter usk: `UnifiedSpendingKey` for the account that controls the funds to be spent.
46
- /// - Parameter to: recipient address
47
- /// - Parameter value: transaction amount in Zatoshi
48
- /// - Parameter memo: the `MemoBytes` for this transaction. pass `nil` when sending to transparent receivers
49
- /// - Throws: `rustCreateToAddress`.
50
- func createToAddress(
51
- usk: UnifiedSpendingKey,
52
- to address: String,
53
- value: Int64,
54
- memo: MemoBytes?
55
- ) async throws -> Data
49
+ /// Checks whether the given seed is relevant to any of the derived accounts in the wallet.
50
+ ///
51
+ /// - parameter seed: byte array of the seed
52
+ func isSeedRelevantToAnyDerivedAccount(seed: [UInt8]) async throws -> Bool
56
53
 
57
54
  /// Scans a transaction for any information that can be decrypted by the accounts in the wallet, and saves it to the wallet.
58
55
  /// - parameter tx: the transaction to decrypt
@@ -60,11 +57,6 @@ protocol ZcashRustBackendWelding {
60
57
  /// - Throws: `rustDecryptAndStoreTransaction`.
61
58
  func decryptAndStoreTransaction(txBytes: [UInt8], minedHeight: Int32) async throws
62
59
 
63
- /// Get the (unverified) balance from the given account.
64
- /// - parameter account: index of the given account
65
- /// - Throws: `rustGetBalance`.
66
- func getBalance(account: Int32) async throws -> Int64
67
-
68
60
  /// Returns the most-recently-generated unified payment address for the specified account.
69
61
  /// - parameter account: index of the given account
70
62
  /// - Throws:
@@ -93,8 +85,9 @@ protocol ZcashRustBackendWelding {
93
85
 
94
86
  /// Get memo from note.
95
87
  /// - parameter txId: ID of transaction containing the note
88
+ /// - parameter outputPool: output pool identifier (2 = Sapling, 3 = Orchard)
96
89
  /// - parameter outputIndex: output index of note
97
- func getMemo(txId: Data, outputIndex: UInt16) async throws -> Memo?
90
+ func getMemo(txId: Data, outputPool: UInt32, outputIndex: UInt16) async throws -> Memo?
98
91
 
99
92
  /// Get the verified cached transparent balance for the given address
100
93
  /// - parameter account; the account index to query
@@ -120,11 +113,6 @@ protocol ZcashRustBackendWelding {
120
113
  /// - `rustListTransparentReceiversInvalidAddress` if transarent received generated by rust is invalid.
121
114
  func listTransparentReceivers(account: Int32) async throws -> [TransparentAddress]
122
115
 
123
- /// Get the verified balance from the given account
124
- /// - parameter account: index of the given account
125
- /// - Throws: `rustGetVerifiedBalance` when rust layer throws error.
126
- func getVerifiedBalance(account: Int32) async throws -> Int64
127
-
128
116
  /// Get the verified cached transparent balance for the given account
129
117
  /// - parameter account: account index to query the balance for.
130
118
  /// - Throws:
@@ -145,6 +133,8 @@ protocol ZcashRustBackendWelding {
145
133
 
146
134
  func putSaplingSubtreeRoots(startIndex: UInt64, roots: [SubtreeRoot]) async throws
147
135
 
136
+ func putOrchardSubtreeRoots(startIndex: UInt64, roots: [SubtreeRoot]) async throws
137
+
148
138
  /// Updates the wallet's view of the blockchain.
149
139
  ///
150
140
  /// This method is used to provide the wallet with information about the state of the blockchain,
@@ -167,8 +157,8 @@ protocol ZcashRustBackendWelding {
167
157
  /// height due to the fact that out-of-order scanning can leave gaps.
168
158
  func maxScannedHeight() async throws -> BlockHeight?
169
159
 
170
- /// Returns the scan progress derived from the current wallet state.
171
- func getScanProgress() async throws -> ScanProgress?
160
+ /// Returns the account balances and sync status of the wallet.
161
+ func getWalletSummary() async throws -> WalletSummary?
172
162
 
173
163
  /// Returns a list of suggested scan ranges based upon the current wallet state.
174
164
  ///
@@ -196,9 +186,10 @@ protocol ZcashRustBackendWelding {
196
186
  /// cache, an error will be signalled.
197
187
  ///
198
188
  /// - parameter fromHeight: scan starting from the given height.
189
+ /// - parameter fromState: The TreeState Protobuf object for the height prior to `fromHeight`
199
190
  /// - parameter limit: scan up to limit blocks.
200
191
  /// - Throws: `rustScanBlocks` if rust layer returns error.
201
- func scanBlocks(fromHeight: Int32, limit: UInt32) async throws
192
+ func scanBlocks(fromHeight: Int32, fromState: TreeState, limit: UInt32) async throws -> ScanSummary
202
193
 
203
194
  /// Upserts a UTXO into the data db database
204
195
  /// - parameter txid: the txid bytes for the UTXO
@@ -215,15 +206,66 @@ protocol ZcashRustBackendWelding {
215
206
  height: BlockHeight
216
207
  ) async throws
217
208
 
218
- /// Creates a transaction to shield all found UTXOs in data db for the account the provided `UnifiedSpendingKey` has spend authority for.
219
- /// - Parameter usk: `UnifiedSpendingKey` that spend transparent funds and where the funds will be shielded to.
209
+ /// Select transaction inputs, compute fees, and construct a proposal for a transaction
210
+ /// that can then be authorized and made ready for submission to the network with
211
+ /// `createProposedTransaction`.
212
+ ///
213
+ /// - parameter account: index of the given account
214
+ /// - Parameter to: recipient address
215
+ /// - Parameter value: transaction amount in Zatoshi
216
+ /// - Parameter memo: the `MemoBytes` for this transaction. pass `nil` when sending to transparent receivers
217
+ /// - Throws: `rustCreateToAddress`.
218
+ func proposeTransfer(
219
+ account: Int32,
220
+ to address: String,
221
+ value: Int64,
222
+ memo: MemoBytes?
223
+ ) async throws -> FfiProposal
224
+
225
+ /// Select transaction inputs, compute fees, and construct a proposal for a transaction
226
+ /// that can then be authorized and made ready for submission to the network with
227
+ /// `createProposedTransaction` from a valid [ZIP-321](https://zips.z.cash/zip-0321) Payment Request UR
228
+ ///
229
+ /// - parameter uri: the URI String that the proposal will be made from.
230
+ /// - parameter account: index of the given account
231
+ /// - Parameter to: recipient address
232
+ /// - Parameter value: transaction amount in Zatoshi
233
+ /// - Parameter memo: the `MemoBytes` for this transaction. pass `nil` when sending to transparent receivers
234
+ /// - Throws: `rustCreateToAddress`.
235
+ func proposeTransferFromURI(
236
+ _ uri: String,
237
+ account: Int32
238
+ ) async throws -> FfiProposal
239
+
240
+ /// Constructs a transaction proposal to shield all found UTXOs in data db for the given account,
241
+ /// that can then be authorized and made ready for submission to the network with
242
+ /// `createProposedTransaction`.
243
+ ///
244
+ /// Returns the proposal, or `nil` if the transparent balance that would be shielded
245
+ /// is zero or below `shieldingThreshold`.
246
+ ///
247
+ /// - parameter account: index of the given account
220
248
  /// - Parameter memo: the `Memo` for this transaction
249
+ /// - Parameter transparentReceiver: a specific transparent receiver within the account
250
+ /// that should be the source of transparent funds. Default is `nil` which
251
+ /// will select whichever of the account's transparent receivers has funds
252
+ /// to shield.
221
253
  /// - Throws: `rustShieldFunds` if rust layer returns error.
222
- func shieldFunds(
223
- usk: UnifiedSpendingKey,
254
+ func proposeShielding(
255
+ account: Int32,
224
256
  memo: MemoBytes?,
225
- shieldingThreshold: Zatoshi
226
- ) async throws -> Data
257
+ shieldingThreshold: Zatoshi,
258
+ transparentReceiver: String?
259
+ ) async throws -> FfiProposal?
260
+
261
+ /// Creates a transaction from the given proposal.
262
+ /// - Parameter proposal: the transaction proposal.
263
+ /// - Parameter usk: `UnifiedSpendingKey` for the account that controls the funds to be spent.
264
+ /// - Throws: `rustCreateToAddress`.
265
+ func createProposedTransactions(
266
+ proposal: FfiProposal,
267
+ usk: UnifiedSpendingKey
268
+ ) async throws -> [Data]
227
269
 
228
270
  /// Gets the consensus branch id for the given height
229
271
  /// - Parameter height: the height you what to know the branch id for