react-native-zcash 0.6.14 → 0.7.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.
- package/CHANGELOG.md +8 -0
- package/android/build.gradle +4 -4
- package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2470000.json +8 -0
- package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2480000.json +8 -0
- package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +51 -9
- package/ios/RNZcash.m +8 -0
- package/ios/RNZcash.swift +66 -16
- package/ios/ZCashLightClientKit/Block/Actions/DownloadAction.swift +1 -1
- package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +3 -1
- package/ios/ZCashLightClientKit/Block/Actions/FetchUTXOsAction.swift +1 -1
- package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +11 -2
- package/ios/ZCashLightClientKit/Block/Actions/RewindAction.swift +2 -2
- package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +28 -11
- package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +4 -4
- package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +36 -7
- package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +1 -1
- package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +93 -51
- package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +0 -26
- package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +5 -6
- package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +1 -11
- package/ios/ZCashLightClientKit/Block/SaplingParameters/SaplingParametersHandler.swift +6 -4
- package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +10 -12
- package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointSource.swift +38 -0
- package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointURLProvider.swift +40 -0
- package/ios/ZCashLightClientKit/{Constants/Checkpoint+Constants.swift → Checkpoint/Checkpoint+helpers.swift} +1 -33
- package/ios/ZCashLightClientKit/Checkpoint/CheckpointSource.swift +34 -0
- package/ios/ZCashLightClientKit/Checkpoint/CheckpointSourceFactory.swift +14 -0
- package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +61 -6
- package/ios/ZCashLightClientKit/CombineSynchronizer.swift +63 -4
- package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +4 -0
- package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +21 -33
- package/ios/ZCashLightClientKit/DAO/UnspentTransactionOutputDao.swift +0 -182
- package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +0 -173
- package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +5 -2
- package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
- package/ios/ZCashLightClientKit/Error/ZcashError.swift +53 -1
- package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +19 -1
- package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +32 -0
- package/ios/ZCashLightClientKit/Initializer.swift +8 -17
- package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +103 -217
- package/ios/ZCashLightClientKit/Model/Proposal.swift +45 -0
- package/ios/ZCashLightClientKit/Model/ScanSummary.swift +14 -0
- package/ios/ZCashLightClientKit/Model/WalletSummary.swift +58 -0
- package/ios/ZCashLightClientKit/Model/WalletTypes.swift +0 -16
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +5 -3
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proposal.pb.swift +934 -0
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/proposal.proto +138 -0
- package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +2 -4
- package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +9 -1
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2272500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2275000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2277500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2282500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2285000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2287500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2292500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2295000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2297500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2302500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2305000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2307500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2312500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2315000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2317500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2322500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2325000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2327500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2332500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2335000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2337500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2342500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2345000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2347500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2352500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2355000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2357500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2362500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2365000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2367500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2372500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2375000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2377500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2382500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2385000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2387500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2392500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2395000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2397500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2402500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2405000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2407500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2412500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2415000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2417500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2422500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2425000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2427500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2432500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2435000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2437500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2442500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2445000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2447500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2452500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2455000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2457500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2462500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2465000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2467500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2470000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2472500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2480000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2560000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2570000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2580000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2590000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2600000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2610000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2620000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2630000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2640000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2650000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2660000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2670000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2680000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2690000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2700000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2710000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2720000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2730000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2740000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2750000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2760000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2770000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2780000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2790000.json +8 -0
- package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackend.swift +1 -5
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +327 -153
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +78 -36
- package/ios/ZCashLightClientKit/Rust/zcashlc.h +402 -118
- package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +43 -14
- package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +52 -14
- package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +10 -6
- package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +220 -70
- package/ios/ZCashLightClientKit/Synchronizer.swift +105 -29
- package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +61 -32
- package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +52 -61
- package/ios/ZCashLightClientKit/Utils/DBActor.swift +21 -0
- package/ios/ZCashLightClientKit/Utils/LoggingProxy.swift +5 -0
- package/ios/ZCashLightClientKit/Utils/OSLogger.swift +71 -14
- package/ios/libzcashlc.xcframework/Info.plist +5 -5
- package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
- package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
- package/lib/rnzcash.rn.js +21 -6
- package/lib/rnzcash.rn.js.map +1 -1
- package/lib/src/react-native.d.ts +2 -1
- package/lib/src/types.d.ts +9 -1
- package/package.json +1 -1
- package/src/react-native.ts +23 -4
- package/src/types.ts +10 -1
- package/ios/ZCashLightClientKit/Model/ScanProgress.swift +0 -29
- package/ios/ZCashLightClientKit/Repository/UnspentTransactionOutputRepository.swift +0 -16
- /package/ios/ZCashLightClientKit/{Model → Checkpoint}/Checkpoint.swift +0 -0
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
#include <stdint.h>
|
|
4
4
|
#include <stdlib.h>
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* A struct that contains details about an account in the wallet.
|
|
8
|
+
*/
|
|
9
|
+
typedef struct FfiAccount {
|
|
10
|
+
uint8_t seed_fingerprint[32];
|
|
11
|
+
uint32_t account_index;
|
|
12
|
+
} FfiAccount;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
16
|
+
* slice of [`FfiAccount`] values.
|
|
17
|
+
*
|
|
18
|
+
* # Safety
|
|
19
|
+
*
|
|
20
|
+
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<FfiAccount>()`
|
|
21
|
+
* many bytes, and it must be properly aligned. This means in particular:
|
|
22
|
+
* - The entire memory range pointed to by `ptr` must be contained within a single allocated
|
|
23
|
+
* object. Slices can never span across multiple allocated objects.
|
|
24
|
+
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
25
|
+
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
26
|
+
* [`FfiAccount`].
|
|
27
|
+
* - The total size `len * mem::size_of::<FfiAccount>()` of the slice pointed to
|
|
28
|
+
* by `ptr` must be no larger than isize::MAX. See the safety documentation of pointer::offset.
|
|
29
|
+
* - See the safety documentation of [`FfiAccount`]
|
|
30
|
+
*/
|
|
31
|
+
typedef struct FfiAccounts {
|
|
32
|
+
struct FfiAccount *ptr;
|
|
33
|
+
uintptr_t len;
|
|
34
|
+
} FfiAccounts;
|
|
35
|
+
|
|
6
36
|
/**
|
|
7
37
|
* A struct that contains an account identifier along with a pointer to the binary encoding
|
|
8
38
|
* of an associated key.
|
|
@@ -91,6 +121,56 @@ typedef struct FfiSubtreeRoots {
|
|
|
91
121
|
uintptr_t len;
|
|
92
122
|
} FfiSubtreeRoots;
|
|
93
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Balance information for a value within a single pool in an account.
|
|
126
|
+
*/
|
|
127
|
+
typedef struct FfiBalance {
|
|
128
|
+
/**
|
|
129
|
+
* The value in the account that may currently be spent; it is possible to compute witnesses
|
|
130
|
+
* for all the notes that comprise this value, and all of this value is confirmed to the
|
|
131
|
+
* required confirmation depth.
|
|
132
|
+
*/
|
|
133
|
+
int64_t spendable_value;
|
|
134
|
+
/**
|
|
135
|
+
* The value in the account of shielded change notes that do not yet have sufficient
|
|
136
|
+
* confirmations to be spendable.
|
|
137
|
+
*/
|
|
138
|
+
int64_t change_pending_confirmation;
|
|
139
|
+
/**
|
|
140
|
+
* The value in the account of all remaining received notes that either do not have sufficient
|
|
141
|
+
* confirmations to be spendable, or for which witnesses cannot yet be constructed without
|
|
142
|
+
* additional scanning.
|
|
143
|
+
*/
|
|
144
|
+
int64_t value_pending_spendability;
|
|
145
|
+
} FfiBalance;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Balance information for a single account.
|
|
149
|
+
*
|
|
150
|
+
* The sum of this struct's fields is the total balance of the account.
|
|
151
|
+
*/
|
|
152
|
+
typedef struct FfiAccountBalance {
|
|
153
|
+
uint32_t account_id;
|
|
154
|
+
/**
|
|
155
|
+
* The value of unspent Sapling outputs belonging to the account.
|
|
156
|
+
*/
|
|
157
|
+
struct FfiBalance sapling_balance;
|
|
158
|
+
/**
|
|
159
|
+
* The value of unspent Orchard outputs belonging to the account.
|
|
160
|
+
*/
|
|
161
|
+
struct FfiBalance orchard_balance;
|
|
162
|
+
/**
|
|
163
|
+
* The value of all unspent transparent outputs belonging to the account,
|
|
164
|
+
* irrespective of confirmation depth.
|
|
165
|
+
*
|
|
166
|
+
* Unshielded balances are not subject to confirmation-depth constraints, because the
|
|
167
|
+
* only possible operation on a transparent balance is to shield it, it is possible
|
|
168
|
+
* to create a zero-conf transaction to perform that shielding, and the resulting
|
|
169
|
+
* shielded notes will be subject to normal confirmation rules.
|
|
170
|
+
*/
|
|
171
|
+
int64_t unshielded;
|
|
172
|
+
} FfiAccountBalance;
|
|
173
|
+
|
|
94
174
|
/**
|
|
95
175
|
* A struct that contains details about scan progress.
|
|
96
176
|
*
|
|
@@ -103,6 +183,42 @@ typedef struct FfiScanProgress {
|
|
|
103
183
|
uint64_t denominator;
|
|
104
184
|
} FfiScanProgress;
|
|
105
185
|
|
|
186
|
+
/**
|
|
187
|
+
* A type representing the potentially-spendable value of unspent outputs in the wallet.
|
|
188
|
+
*
|
|
189
|
+
* The balances reported using this data structure may overestimate the total spendable
|
|
190
|
+
* value of the wallet, in the case that the spend of a previously received shielded note
|
|
191
|
+
* has not yet been detected by the process of scanning the chain. The balances reported
|
|
192
|
+
* using this data structure can only be certain to be unspent in the case that
|
|
193
|
+
* [`Self::is_synced`] is true, and even in this circumstance it is possible that a newly
|
|
194
|
+
* created transaction could conflict with a not-yet-mined transaction in the mempool.
|
|
195
|
+
*
|
|
196
|
+
* # Safety
|
|
197
|
+
*
|
|
198
|
+
* - `account_balances` must be non-null and must be valid for reads for
|
|
199
|
+
* `account_balances_len * mem::size_of::<FfiAccountBalance>()` many bytes, and it must
|
|
200
|
+
* be properly aligned. This means in particular:
|
|
201
|
+
* - The entire memory range pointed to by `account_balances` must be contained within
|
|
202
|
+
* a single allocated object. Slices can never span across multiple allocated objects.
|
|
203
|
+
* - `account_balances` must be non-null and aligned even for zero-length slices.
|
|
204
|
+
* - `account_balances` must point to `len` consecutive properly initialized values of
|
|
205
|
+
* type [`FfiAccountBalance`].
|
|
206
|
+
* - The total size `account_balances_len * mem::size_of::<FfiAccountBalance>()` of the
|
|
207
|
+
* slice pointed to by `account_balances` must be no larger than `isize::MAX`. See the
|
|
208
|
+
* safety documentation of `pointer::offset`.
|
|
209
|
+
* - `scan_progress` must, if non-null, point to a struct having the layout of
|
|
210
|
+
* [`FfiScanProgress`].
|
|
211
|
+
*/
|
|
212
|
+
typedef struct FfiWalletSummary {
|
|
213
|
+
struct FfiAccountBalance *account_balances;
|
|
214
|
+
uintptr_t account_balances_len;
|
|
215
|
+
int32_t chain_tip_height;
|
|
216
|
+
int32_t fully_scanned_height;
|
|
217
|
+
struct FfiScanProgress *scan_progress;
|
|
218
|
+
uint64_t next_sapling_subtree_index;
|
|
219
|
+
uint64_t next_orchard_subtree_index;
|
|
220
|
+
} FfiWalletSummary;
|
|
221
|
+
|
|
106
222
|
/**
|
|
107
223
|
* A struct that contains the start (inclusive) and end (exclusive) of a range of blocks
|
|
108
224
|
* to scan.
|
|
@@ -135,6 +251,17 @@ typedef struct FfiScanRanges {
|
|
|
135
251
|
uintptr_t len;
|
|
136
252
|
} FfiScanRanges;
|
|
137
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Metadata about modifications to the wallet state made in the course of scanning a set
|
|
256
|
+
* of blocks.
|
|
257
|
+
*/
|
|
258
|
+
typedef struct FfiScanSummary {
|
|
259
|
+
int32_t scanned_start;
|
|
260
|
+
int32_t scanned_end;
|
|
261
|
+
uint64_t spent_sapling_note_count;
|
|
262
|
+
uint64_t received_sapling_note_count;
|
|
263
|
+
} FfiScanSummary;
|
|
264
|
+
|
|
138
265
|
typedef struct FFIBlockMeta {
|
|
139
266
|
uint32_t height;
|
|
140
267
|
uint8_t *block_hash_ptr;
|
|
@@ -149,6 +276,46 @@ typedef struct FFIBlocksMeta {
|
|
|
149
276
|
uintptr_t len;
|
|
150
277
|
} FFIBlocksMeta;
|
|
151
278
|
|
|
279
|
+
/**
|
|
280
|
+
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
281
|
+
* boxed slice.
|
|
282
|
+
*
|
|
283
|
+
* # Safety
|
|
284
|
+
*
|
|
285
|
+
* - `ptr` must be non-null and valid for reads for `len` bytes, and it must have an
|
|
286
|
+
* alignment of `1`. Its contents must be an encoded Proposal protobuf.
|
|
287
|
+
* - The memory referenced by `ptr` must not be mutated for the lifetime of the struct
|
|
288
|
+
* (up until [`zcashlc_free_boxed_slice`] is called with it).
|
|
289
|
+
* - The total size `len` must be no larger than `isize::MAX`. See the safety
|
|
290
|
+
* documentation of `pointer::offset`.
|
|
291
|
+
*/
|
|
292
|
+
typedef struct FfiBoxedSlice {
|
|
293
|
+
uint8_t *ptr;
|
|
294
|
+
uintptr_t len;
|
|
295
|
+
} FfiBoxedSlice;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
299
|
+
* slice of `[u8; 32]` arrays.
|
|
300
|
+
*
|
|
301
|
+
* # Safety
|
|
302
|
+
*
|
|
303
|
+
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<[u8; 32]>()`
|
|
304
|
+
* many bytes, and it must be properly aligned. This means in particular:
|
|
305
|
+
* - The entire memory range pointed to by `ptr` must be contained within a single
|
|
306
|
+
* allocated object. Slices can never span across multiple allocated objects.
|
|
307
|
+
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
308
|
+
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
309
|
+
* `[u8; 32]`.
|
|
310
|
+
* - The total size `len * mem::size_of::<[u8; 32]>()` of the slice pointed to
|
|
311
|
+
* by `ptr` must be no larger than isize::MAX. See the safety documentation of
|
|
312
|
+
* `pointer::offset`.
|
|
313
|
+
*/
|
|
314
|
+
typedef struct FfiTxIds {
|
|
315
|
+
uint8_t (*ptr)[32];
|
|
316
|
+
uintptr_t len;
|
|
317
|
+
} FfiTxIds;
|
|
318
|
+
|
|
152
319
|
/**
|
|
153
320
|
* Initializes global Rust state, such as the logging infrastructure and threadpools.
|
|
154
321
|
*
|
|
@@ -188,8 +355,11 @@ void zcashlc_clear_last_error(void);
|
|
|
188
355
|
* null pointer if the caller wishes to attempt migrations without providing the wallet's seed
|
|
189
356
|
* value.
|
|
190
357
|
*
|
|
191
|
-
* Returns
|
|
192
|
-
*
|
|
358
|
+
* Returns:
|
|
359
|
+
* - 0 if successful.
|
|
360
|
+
* - 1 if the seed must be provided in order to execute the requested migrations
|
|
361
|
+
* - 2 if the provided seed is not relevant to any of the derived accounts in the wallet.
|
|
362
|
+
* - -1 on error.
|
|
193
363
|
*
|
|
194
364
|
* # Safety
|
|
195
365
|
*
|
|
@@ -211,6 +381,34 @@ int32_t zcashlc_init_data_database(const uint8_t *db_data,
|
|
|
211
381
|
uintptr_t seed_len,
|
|
212
382
|
uint32_t network_id);
|
|
213
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Frees an array of FfiAccounts values as allocated by `zcashlc_list_accounts`.
|
|
386
|
+
*
|
|
387
|
+
* # Safety
|
|
388
|
+
*
|
|
389
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiAccounts`].
|
|
390
|
+
* See the safety documentation of [`FfiAccounts`].
|
|
391
|
+
*/
|
|
392
|
+
void zcashlc_free_accounts(struct FfiAccounts *ptr);
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Returns a list of the accounts in the wallet.
|
|
396
|
+
*
|
|
397
|
+
* # Safety
|
|
398
|
+
*
|
|
399
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
400
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
401
|
+
* operating system's preferred representation.
|
|
402
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
403
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
404
|
+
* documentation of pointer::offset.
|
|
405
|
+
* - Call [`zcashlc_free_accounts`] to free the memory associated with the returned pointer
|
|
406
|
+
* when done using it.
|
|
407
|
+
*/
|
|
408
|
+
struct FfiAccounts *zcashlc_list_accounts(const uint8_t *db_data,
|
|
409
|
+
uintptr_t db_data_len,
|
|
410
|
+
uint32_t network_id);
|
|
411
|
+
|
|
214
412
|
/**
|
|
215
413
|
* Frees a FFIBinaryKey value
|
|
216
414
|
*
|
|
@@ -264,6 +462,20 @@ struct FFIBinaryKey *zcashlc_create_account(const uint8_t *db_data,
|
|
|
264
462
|
int64_t recover_until,
|
|
265
463
|
uint32_t network_id);
|
|
266
464
|
|
|
465
|
+
/**
|
|
466
|
+
* Checks whether the given seed is relevant to any of the accounts in the wallet.
|
|
467
|
+
*
|
|
468
|
+
* Returns:
|
|
469
|
+
* - `1` for `Ok(true)`.
|
|
470
|
+
* - `0` for `Ok(false)`.
|
|
471
|
+
* - `-1` for `Err(_)`.
|
|
472
|
+
*/
|
|
473
|
+
int8_t zcashlc_is_seed_relevant_to_any_derived_account(const uint8_t *db_data,
|
|
474
|
+
uintptr_t db_data_len,
|
|
475
|
+
const uint8_t *seed,
|
|
476
|
+
uintptr_t seed_len,
|
|
477
|
+
uint32_t network_id);
|
|
478
|
+
|
|
267
479
|
/**
|
|
268
480
|
* Frees an array of FFIEncodedKeys values as allocated by `zcashlc_derive_unified_viewing_keys_from_seed`
|
|
269
481
|
*
|
|
@@ -434,7 +646,7 @@ char *zcashlc_get_sapling_receiver_for_unified_address(const char *ua);
|
|
|
434
646
|
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
435
647
|
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
436
648
|
*/
|
|
437
|
-
bool
|
|
649
|
+
bool zcashlc_is_valid_sapling_address(const char *address, uint32_t network_id);
|
|
438
650
|
|
|
439
651
|
/**
|
|
440
652
|
* Returns the network type and address kind for the given address string,
|
|
@@ -512,42 +724,6 @@ bool zcashlc_is_valid_unified_full_viewing_key(const char *ufvk, uint32_t networ
|
|
|
512
724
|
*/
|
|
513
725
|
bool zcashlc_is_valid_unified_address(const char *address, uint32_t network_id);
|
|
514
726
|
|
|
515
|
-
/**
|
|
516
|
-
* Returns the balance for the specified account, including all unspent notes that we know about.
|
|
517
|
-
*
|
|
518
|
-
* # Safety
|
|
519
|
-
*
|
|
520
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
521
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
522
|
-
* operating system's preferred representation.
|
|
523
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
524
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
525
|
-
* documentation of pointer::offset.
|
|
526
|
-
*/
|
|
527
|
-
int64_t zcashlc_get_balance(const uint8_t *db_data,
|
|
528
|
-
uintptr_t db_data_len,
|
|
529
|
-
int32_t account,
|
|
530
|
-
uint32_t network_id);
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Returns the verified balance for the account, which ignores notes that have been
|
|
534
|
-
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
535
|
-
*
|
|
536
|
-
* # Safety
|
|
537
|
-
*
|
|
538
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
539
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
540
|
-
* operating system's preferred representation.
|
|
541
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
542
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
543
|
-
* documentation of pointer::offset.
|
|
544
|
-
*/
|
|
545
|
-
int64_t zcashlc_get_verified_balance(const uint8_t *db_data,
|
|
546
|
-
uintptr_t db_data_len,
|
|
547
|
-
int32_t account,
|
|
548
|
-
uint32_t network_id,
|
|
549
|
-
uint32_t min_confirmations);
|
|
550
|
-
|
|
551
727
|
/**
|
|
552
728
|
* Returns the verified transparent balance for `address`, which ignores utxos that have been
|
|
553
729
|
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
@@ -647,6 +823,7 @@ int64_t zcashlc_get_total_transparent_balance_for_account(const uint8_t *db_data
|
|
|
647
823
|
bool zcashlc_get_memo(const uint8_t *db_data,
|
|
648
824
|
uintptr_t db_data_len,
|
|
649
825
|
const uint8_t *txid_bytes,
|
|
826
|
+
uint32_t output_pool,
|
|
650
827
|
uint16_t output_index,
|
|
651
828
|
uint8_t *memo_bytes_ret,
|
|
652
829
|
uint32_t network_id);
|
|
@@ -748,6 +925,29 @@ bool zcashlc_put_sapling_subtree_roots(const uint8_t *db_data,
|
|
|
748
925
|
const struct FfiSubtreeRoots *roots,
|
|
749
926
|
uint32_t network_id);
|
|
750
927
|
|
|
928
|
+
/**
|
|
929
|
+
* Adds a sequence of Orchard subtree roots to the data store.
|
|
930
|
+
*
|
|
931
|
+
* Returns true if the subtrees could be stored, false otherwise. When false is returned,
|
|
932
|
+
* caller should check for errors.
|
|
933
|
+
*
|
|
934
|
+
* # Safety
|
|
935
|
+
*
|
|
936
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
937
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
938
|
+
* operating system's preferred representation.
|
|
939
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
940
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
941
|
+
* documentation of `pointer::offset`.
|
|
942
|
+
* - `roots` must be non-null and initialized.
|
|
943
|
+
* - The memory referenced by `roots` must not be mutated for the duration of the function call.
|
|
944
|
+
*/
|
|
945
|
+
bool zcashlc_put_orchard_subtree_roots(const uint8_t *db_data,
|
|
946
|
+
uintptr_t db_data_len,
|
|
947
|
+
uint64_t start_index,
|
|
948
|
+
const struct FfiSubtreeRoots *roots,
|
|
949
|
+
uint32_t network_id);
|
|
950
|
+
|
|
751
951
|
/**
|
|
752
952
|
* Updates the wallet's view of the blockchain.
|
|
753
953
|
*
|
|
@@ -815,7 +1015,10 @@ int64_t zcashlc_max_scanned_height(const uint8_t *db_data,
|
|
|
815
1015
|
uint32_t network_id);
|
|
816
1016
|
|
|
817
1017
|
/**
|
|
818
|
-
* Returns the
|
|
1018
|
+
* Returns the account balances and sync status given the specified minimum number of
|
|
1019
|
+
* confirmations.
|
|
1020
|
+
*
|
|
1021
|
+
* Returns `fully_scanned_height = -1` if the wallet has no balance data available.
|
|
819
1022
|
*
|
|
820
1023
|
* # Safety
|
|
821
1024
|
*
|
|
@@ -827,9 +1030,20 @@ int64_t zcashlc_max_scanned_height(const uint8_t *db_data,
|
|
|
827
1030
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
828
1031
|
* documentation of pointer::offset.
|
|
829
1032
|
*/
|
|
830
|
-
struct
|
|
831
|
-
|
|
832
|
-
|
|
1033
|
+
struct FfiWalletSummary *zcashlc_get_wallet_summary(const uint8_t *db_data,
|
|
1034
|
+
uintptr_t db_data_len,
|
|
1035
|
+
uint32_t network_id,
|
|
1036
|
+
uint32_t min_confirmations);
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Frees an [`FfiWalletSummary`] value.
|
|
1040
|
+
*
|
|
1041
|
+
* # Safety
|
|
1042
|
+
*
|
|
1043
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiWalletSummary`].
|
|
1044
|
+
* See the safety documentation of [`FfiWalletSummary`].
|
|
1045
|
+
*/
|
|
1046
|
+
void zcashlc_free_wallet_summary(struct FfiWalletSummary *ptr);
|
|
833
1047
|
|
|
834
1048
|
/**
|
|
835
1049
|
* Frees an array of FfiScanRanges values as allocated by `zcashlc_derive_unified_viewing_keys_from_seed`
|
|
@@ -898,13 +1112,24 @@ struct FfiScanRanges *zcashlc_suggest_scan_ranges(const uint8_t *db_data,
|
|
|
898
1112
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
899
1113
|
* documentation of pointer::offset.
|
|
900
1114
|
*/
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1115
|
+
struct FfiScanSummary *zcashlc_scan_blocks(const uint8_t *fs_block_cache_root,
|
|
1116
|
+
uintptr_t fs_block_cache_root_len,
|
|
1117
|
+
const uint8_t *db_data,
|
|
1118
|
+
uintptr_t db_data_len,
|
|
1119
|
+
int32_t from_height,
|
|
1120
|
+
const uint8_t *from_state,
|
|
1121
|
+
uintptr_t from_state_len,
|
|
1122
|
+
uint32_t scan_limit,
|
|
1123
|
+
uint32_t network_id);
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Frees an [`FfiScanSummary`] value.
|
|
1127
|
+
*
|
|
1128
|
+
* # Safety
|
|
1129
|
+
*
|
|
1130
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiScanSummary`].
|
|
1131
|
+
*/
|
|
1132
|
+
void zcashlc_free_scan_summary(struct FfiScanSummary *ptr);
|
|
908
1133
|
|
|
909
1134
|
/**
|
|
910
1135
|
* Inserts a UTXO into the wallet database.
|
|
@@ -1045,14 +1270,19 @@ int32_t zcashlc_decrypt_and_store_transaction(const uint8_t *db_data,
|
|
|
1045
1270
|
uint32_t network_id);
|
|
1046
1271
|
|
|
1047
1272
|
/**
|
|
1048
|
-
*
|
|
1273
|
+
* Frees an [`FfiBoxedSlice`].
|
|
1049
1274
|
*
|
|
1050
|
-
*
|
|
1051
|
-
* within the data database. The caller can read the raw transaction bytes from the `raw`
|
|
1052
|
-
* column in order to broadcast the transaction to the network.
|
|
1275
|
+
* # Safety
|
|
1053
1276
|
*
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1277
|
+
* - `ptr` must be non-null and must point to a struct having the layout of
|
|
1278
|
+
* [`FfiBoxedSlice`]. See the safety documentation of [`FfiBoxedSlice`].
|
|
1279
|
+
*/
|
|
1280
|
+
void zcashlc_free_boxed_slice(struct FfiBoxedSlice *ptr);
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* Select transaction inputs, compute fees, and construct a proposal for a transaction
|
|
1284
|
+
* that can then be authorized and made ready for submission to the network with
|
|
1285
|
+
* `zcashlc_create_proposed_transaction`.
|
|
1056
1286
|
*
|
|
1057
1287
|
* # Safety
|
|
1058
1288
|
*
|
|
@@ -1062,42 +1292,45 @@ int32_t zcashlc_decrypt_and_store_transaction(const uint8_t *db_data,
|
|
|
1062
1292
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1063
1293
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1064
1294
|
* documentation of pointer::offset.
|
|
1065
|
-
* - `usk_ptr` must be non-null and must point to an array of `usk_len` bytes containing a unified
|
|
1066
|
-
* spending key encoded as returned from the `zcashlc_create_account` or
|
|
1067
|
-
* `zcashlc_derive_spending_key` functions.
|
|
1068
|
-
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the function call.
|
|
1069
|
-
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
1070
|
-
* of pointer::offset.
|
|
1071
1295
|
* - `to` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1072
1296
|
* - `memo` must either be null (indicating an empty memo or a transparent recipient) or point to a
|
|
1073
1297
|
* 512-byte array.
|
|
1074
|
-
|
|
1075
|
-
*
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
*
|
|
1079
|
-
|
|
1080
|
-
*
|
|
1081
|
-
|
|
1082
|
-
|
|
1298
|
+
*/
|
|
1299
|
+
struct FfiBoxedSlice *zcashlc_propose_transfer(const uint8_t *db_data,
|
|
1300
|
+
uintptr_t db_data_len,
|
|
1301
|
+
int32_t account,
|
|
1302
|
+
const char *to,
|
|
1303
|
+
int64_t value,
|
|
1304
|
+
const uint8_t *memo,
|
|
1305
|
+
uint32_t network_id,
|
|
1306
|
+
uint32_t min_confirmations,
|
|
1307
|
+
bool use_zip317_fees);
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* Select transaction inputs, compute fees, and construct a proposal for a transaction
|
|
1311
|
+
* from a ZIP-321 payment URI that can then be authorized and made ready for submission to the
|
|
1312
|
+
* network with `zcashlc_create_proposed_transaction`.
|
|
1313
|
+
*
|
|
1314
|
+
* # Safety
|
|
1315
|
+
*
|
|
1316
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1317
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1318
|
+
* operating system's preferred representation.
|
|
1319
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1320
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1083
1321
|
* documentation of pointer::offset.
|
|
1084
|
-
* - `
|
|
1322
|
+
* - `payment_uri` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1323
|
+
* - `network_id` a u32. 0 for Testnet and 1 for Mainnet
|
|
1324
|
+
* - `min_confirmations` number of confirmations of the funds to spend
|
|
1325
|
+
* - `use_zip317_fees` `true`` to use ZIP-317 fees.
|
|
1085
1326
|
*/
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
const uint8_t *spend_params,
|
|
1094
|
-
uintptr_t spend_params_len,
|
|
1095
|
-
const uint8_t *output_params,
|
|
1096
|
-
uintptr_t output_params_len,
|
|
1097
|
-
uint32_t network_id,
|
|
1098
|
-
uint32_t min_confirmations,
|
|
1099
|
-
bool use_zip317_fees,
|
|
1100
|
-
uint8_t *txid_bytes_ret);
|
|
1327
|
+
struct FfiBoxedSlice *zcashlc_propose_transfer_from_uri(const uint8_t *db_data,
|
|
1328
|
+
uintptr_t db_data_len,
|
|
1329
|
+
int32_t account,
|
|
1330
|
+
const char *payment_uri,
|
|
1331
|
+
uint32_t network_id,
|
|
1332
|
+
uint32_t min_confirmations,
|
|
1333
|
+
bool use_zip317_fees);
|
|
1101
1334
|
|
|
1102
1335
|
int32_t zcashlc_branch_id_for_height(int32_t height, uint32_t network_id);
|
|
1103
1336
|
|
|
@@ -1111,8 +1344,9 @@ int32_t zcashlc_branch_id_for_height(int32_t height, uint32_t network_id);
|
|
|
1111
1344
|
void zcashlc_string_free(char *s);
|
|
1112
1345
|
|
|
1113
1346
|
/**
|
|
1114
|
-
*
|
|
1115
|
-
*
|
|
1347
|
+
* Select transaction inputs, compute fees, and construct a proposal for a shielding
|
|
1348
|
+
* transaction that can then be authorized and made ready for submission to the network
|
|
1349
|
+
* with `zcashlc_create_proposed_transaction`.
|
|
1116
1350
|
*
|
|
1117
1351
|
* # Safety
|
|
1118
1352
|
*
|
|
@@ -1122,36 +1356,86 @@ void zcashlc_string_free(char *s);
|
|
|
1122
1356
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1123
1357
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1124
1358
|
* documentation of pointer::offset.
|
|
1125
|
-
* - `usk_ptr` must be non-null and must point to an array of `usk_len` bytes containing a unified
|
|
1126
|
-
* spending key encoded as returned from the `zcashlc_create_account` or
|
|
1127
|
-
* `zcashlc_derive_spending_key` functions.
|
|
1128
|
-
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the function call.
|
|
1129
|
-
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
1130
|
-
* - `memo` must either be null (indicating an empty memo) or point to a 512-byte array.
|
|
1131
1359
|
* - `shielding_threshold` a non-negative shielding threshold amount in zatoshi
|
|
1132
|
-
|
|
1133
|
-
*
|
|
1134
|
-
|
|
1360
|
+
*/
|
|
1361
|
+
struct FfiBoxedSlice *zcashlc_propose_shielding(const uint8_t *db_data,
|
|
1362
|
+
uintptr_t db_data_len,
|
|
1363
|
+
int32_t account,
|
|
1364
|
+
const uint8_t *memo,
|
|
1365
|
+
uint64_t shielding_threshold,
|
|
1366
|
+
const char *transparent_receiver,
|
|
1367
|
+
uint32_t network_id,
|
|
1368
|
+
uint32_t min_confirmations,
|
|
1369
|
+
bool use_zip317_fees);
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Frees an array of FfiTxIds values as allocated by `zcashlc_create_proposed_transactions`.
|
|
1373
|
+
*
|
|
1374
|
+
* # Safety
|
|
1375
|
+
*
|
|
1376
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiTxIds`].
|
|
1377
|
+
* See the safety documentation of [`FfiTxIds`].
|
|
1378
|
+
*/
|
|
1379
|
+
void zcashlc_free_txids(struct FfiTxIds *ptr);
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Creates a transaction from the given proposal.
|
|
1383
|
+
*
|
|
1384
|
+
* Returns the row index of the newly-created transaction in the `transactions` table
|
|
1385
|
+
* within the data database. The caller can read the raw transaction bytes from the `raw`
|
|
1386
|
+
* column in order to broadcast the transaction to the network.
|
|
1387
|
+
*
|
|
1388
|
+
* Do not call this multiple times in parallel, or you will generate transactions that
|
|
1389
|
+
* double-spend the same notes.
|
|
1390
|
+
*
|
|
1391
|
+
* # Safety
|
|
1392
|
+
*
|
|
1393
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must
|
|
1394
|
+
* have an alignment of `1`. Its contents must be a string representing a valid system
|
|
1395
|
+
* path in the operating system's preferred representation.
|
|
1396
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the
|
|
1397
|
+
* function call.
|
|
1398
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1399
|
+
* documentation of `pointer::offset`.
|
|
1400
|
+
* - `proposal_ptr` must be non-null and valid for reads for `proposal_len` bytes, and it
|
|
1401
|
+
* must have an alignment of `1`. Its contents must be an encoded Proposal protobuf.
|
|
1402
|
+
* - The memory referenced by `proposal_ptr` must not be mutated for the duration of the
|
|
1403
|
+
* function call.
|
|
1404
|
+
* - The total size `proposal_len` must be no larger than `isize::MAX`. See the safety
|
|
1405
|
+
* documentation of `pointer::offset`.
|
|
1406
|
+
* - `usk_ptr` must be non-null and must point to an array of `usk_len` bytes containing
|
|
1407
|
+
* a unified spending key encoded as returned from the `zcashlc_create_account` or
|
|
1408
|
+
* `zcashlc_derive_spending_key` functions.
|
|
1409
|
+
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the
|
|
1410
|
+
* function call.
|
|
1411
|
+
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety
|
|
1412
|
+
* documentation of `pointer::offset`.
|
|
1413
|
+
* - `to` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1414
|
+
* - `memo` must either be null (indicating an empty memo or a transparent recipient) or
|
|
1415
|
+
* point to a 512-byte array.
|
|
1416
|
+
* - `spend_params` must be non-null and valid for reads for `spend_params_len` bytes,
|
|
1417
|
+
* and it must have an alignment of `1`. Its contents must be the Sapling spend proving
|
|
1418
|
+
* parameters.
|
|
1419
|
+
* - The memory referenced by `spend_params` must not be mutated for the duration of the
|
|
1420
|
+
* function call.
|
|
1135
1421
|
* - The total size `spend_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1136
|
-
* documentation of pointer::offset
|
|
1137
|
-
* - `output_params` must be non-null and valid for reads for `output_params_len` bytes,
|
|
1138
|
-
* alignment of `1`. Its contents must be the Sapling output
|
|
1139
|
-
*
|
|
1422
|
+
* documentation of `pointer::offset`.
|
|
1423
|
+
* - `output_params` must be non-null and valid for reads for `output_params_len` bytes,
|
|
1424
|
+
* and it must have an alignment of `1`. Its contents must be the Sapling output
|
|
1425
|
+
* proving parameters.
|
|
1426
|
+
* - The memory referenced by `output_params` must not be mutated for the duration of the
|
|
1427
|
+
* function call.
|
|
1140
1428
|
* - The total size `output_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1141
1429
|
* documentation of pointer::offset.
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
uint32_t network_id,
|
|
1155
|
-
uint32_t min_confirmations,
|
|
1156
|
-
bool use_zip317_fees,
|
|
1157
|
-
uint8_t *txid_bytes_ret);
|
|
1430
|
+
*/
|
|
1431
|
+
struct FfiTxIds *zcashlc_create_proposed_transactions(const uint8_t *db_data,
|
|
1432
|
+
uintptr_t db_data_len,
|
|
1433
|
+
const uint8_t *proposal_ptr,
|
|
1434
|
+
uintptr_t proposal_len,
|
|
1435
|
+
const uint8_t *usk_ptr,
|
|
1436
|
+
uintptr_t usk_len,
|
|
1437
|
+
const uint8_t *spend_params,
|
|
1438
|
+
uintptr_t spend_params_len,
|
|
1439
|
+
const uint8_t *output_params,
|
|
1440
|
+
uintptr_t output_params_len,
|
|
1441
|
+
uint32_t network_id);
|