react-native-zcash 0.6.10 → 0.6.11
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 +4 -0
- package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2460000.json +8 -0
- package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +937 -425
- package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +17 -31
- package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +2 -2
- package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +15 -46
- package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +15 -4
- package/ios/ZCashLightClientKit/Block/FilesystemStorage/FSCompactBlockRepository.swift +4 -4
- package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +35 -10
- package/ios/ZCashLightClientKit/Block/Utils/InternalSyncProgress.swift +200 -0
- package/ios/ZCashLightClientKit/Block/Validate/BlockValidator.swift +51 -0
- package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +2 -1
- package/ios/ZCashLightClientKit/CombineSynchronizer.swift +5 -2
- package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +26 -13
- package/ios/ZCashLightClientKit/DAO/BlockDao.swift +112 -0
- package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +42 -40
- package/ios/ZCashLightClientKit/DAO/UnspentTransactionOutputDao.swift +4 -13
- package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +0 -9
- package/ios/ZCashLightClientKit/Entity/BlockProgress.swift +24 -0
- package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +10 -7
- package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
- package/ios/ZCashLightClientKit/Error/ZcashError.swift +12 -121
- package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +5 -43
- package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +6 -72
- package/ios/ZCashLightClientKit/Initializer.swift +26 -47
- package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +12 -0
- package/ios/ZCashLightClientKit/Model/Checkpoint.swift +0 -12
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +0 -15
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/compact_formats.pb.swift +46 -150
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/compact_formats.proto +16 -30
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/service.proto +6 -32
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.grpc.swift +22 -259
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.pb.swift +7 -193
- package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +0 -8
- package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +28 -18
- package/ios/ZCashLightClientKit/Repository/CompactBlockRepository.swift +1 -1
- package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +6 -2
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2460000.json +8 -0
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +158 -293
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +64 -58
- package/ios/ZCashLightClientKit/Rust/zcashlc.h +513 -619
- package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +8 -2
- package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +15 -3
- package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +30 -11
- package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +50 -41
- package/ios/ZCashLightClientKit/Synchronizer.swift +65 -51
- package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +2 -2
- package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +7 -7
- package/ios/ZCashLightClientKit/Utils/OSLogger.swift +3 -3
- package/ios/libzcashlc.xcframework/Info.plist +0 -4
- package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
- package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
- package/package.json +1 -1
- package/ios/ZCashLightClientKit/Block/Actions/Action.swift +0 -98
- package/ios/ZCashLightClientKit/Block/Actions/ClearAlreadyScannedBlocksAction.swift +0 -35
- package/ios/ZCashLightClientKit/Block/Actions/ClearCacheAction.swift +0 -30
- package/ios/ZCashLightClientKit/Block/Actions/DownloadAction.swift +0 -67
- package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +0 -97
- package/ios/ZCashLightClientKit/Block/Actions/FetchUTXOsAction.swift +0 -33
- package/ios/ZCashLightClientKit/Block/Actions/MigrateLegacyCacheDBAction.swift +0 -70
- package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +0 -60
- package/ios/ZCashLightClientKit/Block/Actions/RewindAction.swift +0 -48
- package/ios/ZCashLightClientKit/Block/Actions/SaplingParamsAction.swift +0 -33
- package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +0 -95
- package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +0 -55
- package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +0 -58
- package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +0 -60
- package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +0 -24
- package/ios/ZCashLightClientKit/Block/Utils/SyncControlData.swift +0 -25
- package/ios/ZCashLightClientKit/Extensions/Bool+ToData.swift +0 -15
- package/ios/ZCashLightClientKit/Extensions/Data+ToOtherTypes.swift +0 -18
- package/ios/ZCashLightClientKit/Extensions/Int+ToData.swift +0 -15
- package/ios/ZCashLightClientKit/Model/ScanProgress.swift +0 -29
- package/ios/ZCashLightClientKit/Model/ScanRange.swift +0 -31
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2092500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2095000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2097500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2102500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2105000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2107500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2112500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2115000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2117500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2122500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2125000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2127500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2132500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2135000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2137500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2142500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2145000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2147500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2152500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2155000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2157500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2162500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2165000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2167500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2172500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2175000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2177500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2182500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2185000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2187500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2192500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2195000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2197500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2202500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2205000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2207500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2212500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2215000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2217500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2222500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2225000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2227500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2232500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2235000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2237500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2242500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2245000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2247500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2252500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2255000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2257500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2262500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2265000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2267500.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2350000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2360000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2370000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2380000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2390000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2400000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2410000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2420000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2430000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2440000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2450000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2460000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2470000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2480000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2490000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2500000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2510000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2520000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2530000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2540000.json +0 -8
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2550000.json +0 -8
- package/ios/ZCashLightClientKit/Utils/ZcashFileManager.swift +0 -16
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* - `encoding` must be non-null and must point to an array of `encoding_len` bytes.
|
|
13
13
|
*/
|
|
14
|
-
typedef struct
|
|
14
|
+
typedef struct {
|
|
15
15
|
uint32_t account_id;
|
|
16
16
|
uint8_t *encoding;
|
|
17
17
|
uintptr_t encoding_len;
|
|
@@ -25,7 +25,7 @@ typedef struct FFIBinaryKey {
|
|
|
25
25
|
*
|
|
26
26
|
* - `encoding` must be non-null and must point to a null-terminated UTF-8 string.
|
|
27
27
|
*/
|
|
28
|
-
typedef struct
|
|
28
|
+
typedef struct {
|
|
29
29
|
uint32_t account_id;
|
|
30
30
|
char *encoding;
|
|
31
31
|
} FFIEncodedKey;
|
|
@@ -47,95 +47,12 @@ typedef struct FFIEncodedKey {
|
|
|
47
47
|
* by `ptr` must be no larger than isize::MAX. See the safety documentation of pointer::offset.
|
|
48
48
|
* - See the safety documentation of [`FFIEncodedKey`]
|
|
49
49
|
*/
|
|
50
|
-
typedef struct
|
|
51
|
-
|
|
50
|
+
typedef struct {
|
|
51
|
+
FFIEncodedKey *ptr;
|
|
52
52
|
uintptr_t len;
|
|
53
53
|
} FFIEncodedKeys;
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
* A struct that contains a subtree root.
|
|
57
|
-
*
|
|
58
|
-
* # Safety
|
|
59
|
-
*
|
|
60
|
-
* - `root_hash_ptr` must be non-null and must be valid for reads for `root_hash_ptr_len`
|
|
61
|
-
* bytes, and it must have an alignment of `1`.
|
|
62
|
-
* - The total size `root_hash_ptr_len` of the slice pointed to by `root_hash_ptr` must
|
|
63
|
-
* be no larger than `isize::MAX`. See the safety documentation of `pointer::offset`.
|
|
64
|
-
*/
|
|
65
|
-
typedef struct FfiSubtreeRoot {
|
|
66
|
-
uint8_t *root_hash_ptr;
|
|
67
|
-
uintptr_t root_hash_ptr_len;
|
|
68
|
-
uint32_t completing_block_height;
|
|
69
|
-
} FfiSubtreeRoot;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
73
|
-
* slice of [`FfiSubtreeRoot`] values.
|
|
74
|
-
*
|
|
75
|
-
* # Safety
|
|
76
|
-
*
|
|
77
|
-
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<FfiSubtreeRoot>()`
|
|
78
|
-
* many bytes, and it must be properly aligned. This means in particular:
|
|
79
|
-
* - The entire memory range pointed to by `ptr` must be contained within a single
|
|
80
|
-
* allocated object. Slices can never span across multiple allocated objects.
|
|
81
|
-
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
82
|
-
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
83
|
-
* [`FfiSubtreeRoot`].
|
|
84
|
-
* - The total size `len * mem::size_of::<FfiSubtreeRoot>()` of the slice pointed to
|
|
85
|
-
* by `ptr` must be no larger than isize::MAX. See the safety documentation of
|
|
86
|
-
* `pointer::offset`.
|
|
87
|
-
* - See the safety documentation of [`FfiSubtreeRoot`]
|
|
88
|
-
*/
|
|
89
|
-
typedef struct FfiSubtreeRoots {
|
|
90
|
-
struct FfiSubtreeRoot *ptr;
|
|
91
|
-
uintptr_t len;
|
|
92
|
-
} FfiSubtreeRoots;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* A struct that contains details about scan progress.
|
|
96
|
-
*
|
|
97
|
-
* When `denominator` is zero, the numerator encodes a non-progress indicator:
|
|
98
|
-
* - 0: progress is unknown.
|
|
99
|
-
* - 1: an error occurred.
|
|
100
|
-
*/
|
|
101
|
-
typedef struct FfiScanProgress {
|
|
102
|
-
uint64_t numerator;
|
|
103
|
-
uint64_t denominator;
|
|
104
|
-
} FfiScanProgress;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* A struct that contains the start (inclusive) and end (exclusive) of a range of blocks
|
|
108
|
-
* to scan.
|
|
109
|
-
*/
|
|
110
|
-
typedef struct FfiScanRange {
|
|
111
|
-
int32_t start;
|
|
112
|
-
int32_t end;
|
|
113
|
-
uint8_t priority;
|
|
114
|
-
} FfiScanRange;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
118
|
-
* slice of [`FfiScanRange`] values.
|
|
119
|
-
*
|
|
120
|
-
* # Safety
|
|
121
|
-
*
|
|
122
|
-
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<FfiScanRange>()`
|
|
123
|
-
* many bytes, and it must be properly aligned. This means in particular:
|
|
124
|
-
* - The entire memory range pointed to by `ptr` must be contained within a single
|
|
125
|
-
* allocated object. Slices can never span across multiple allocated objects.
|
|
126
|
-
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
127
|
-
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
128
|
-
* [`FfiScanRange`].
|
|
129
|
-
* - The total size `len * mem::size_of::<FfiScanRange>()` of the slice pointed to
|
|
130
|
-
* by `ptr` must be no larger than isize::MAX. See the safety documentation of
|
|
131
|
-
* `pointer::offset`.
|
|
132
|
-
*/
|
|
133
|
-
typedef struct FfiScanRanges {
|
|
134
|
-
struct FfiScanRange *ptr;
|
|
135
|
-
uintptr_t len;
|
|
136
|
-
} FfiScanRanges;
|
|
137
|
-
|
|
138
|
-
typedef struct FFIBlockMeta {
|
|
55
|
+
typedef struct {
|
|
139
56
|
uint32_t height;
|
|
140
57
|
uint8_t *block_hash_ptr;
|
|
141
58
|
uintptr_t block_hash_ptr_len;
|
|
@@ -144,83 +61,18 @@ typedef struct FFIBlockMeta {
|
|
|
144
61
|
uint32_t orchard_actions_count;
|
|
145
62
|
} FFIBlockMeta;
|
|
146
63
|
|
|
147
|
-
typedef struct
|
|
148
|
-
|
|
64
|
+
typedef struct {
|
|
65
|
+
FFIBlockMeta *ptr;
|
|
149
66
|
uintptr_t len;
|
|
150
67
|
} FFIBlocksMeta;
|
|
151
68
|
|
|
152
|
-
|
|
153
|
-
* Initializes global Rust state, such as the logging infrastructure and threadpools.
|
|
154
|
-
*
|
|
155
|
-
* When `show_trace_logs` is `true`, Rust events at the `TRACE` level will be logged.
|
|
156
|
-
*
|
|
157
|
-
* # Panics
|
|
158
|
-
*
|
|
159
|
-
* This method panics if called more than once.
|
|
160
|
-
*/
|
|
161
|
-
void zcashlc_init_on_load(bool show_trace_logs);
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Returns the length of the last error message to be logged.
|
|
165
|
-
*/
|
|
166
|
-
int32_t zcashlc_last_error_length(void);
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Copies the last error message into the provided allocated buffer.
|
|
170
|
-
*
|
|
171
|
-
* # Safety
|
|
172
|
-
*
|
|
173
|
-
* - `buf` must be non-null and valid for reads for `length` bytes, and it must have an alignment
|
|
174
|
-
* of `1`.
|
|
175
|
-
* - The memory referenced by `buf` must not be mutated for the duration of the function call.
|
|
176
|
-
* - The total size `length` must be no larger than `isize::MAX`. See the safety documentation of
|
|
177
|
-
* pointer::offset.
|
|
178
|
-
*/
|
|
179
|
-
int32_t zcashlc_error_message_utf8(char *buf, int32_t length);
|
|
69
|
+
int32_t zcashlc_branch_id_for_height(int32_t height, uint32_t network_id);
|
|
180
70
|
|
|
181
71
|
/**
|
|
182
72
|
* Clears the record of the last error message.
|
|
183
73
|
*/
|
|
184
74
|
void zcashlc_clear_last_error(void);
|
|
185
75
|
|
|
186
|
-
/**
|
|
187
|
-
* Sets up the internal structure of the data database. The value for `seed` may be provided as a
|
|
188
|
-
* null pointer if the caller wishes to attempt migrations without providing the wallet's seed
|
|
189
|
-
* value.
|
|
190
|
-
*
|
|
191
|
-
* Returns 0 if successful, 1 if the seed must be provided in order to execute the requested
|
|
192
|
-
* migrations, or -1 otherwise.
|
|
193
|
-
*
|
|
194
|
-
* # Safety
|
|
195
|
-
*
|
|
196
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
197
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
198
|
-
* operating system's preferred representation.
|
|
199
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
200
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
201
|
-
* documentation of pointer::offset.
|
|
202
|
-
* - `seed` must be non-null and valid for reads for `seed_len` bytes, and it must have an
|
|
203
|
-
* alignment of `1`.
|
|
204
|
-
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
205
|
-
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
206
|
-
* of pointer::offset.
|
|
207
|
-
*/
|
|
208
|
-
int32_t zcashlc_init_data_database(const uint8_t *db_data,
|
|
209
|
-
uintptr_t db_data_len,
|
|
210
|
-
const uint8_t *seed,
|
|
211
|
-
uintptr_t seed_len,
|
|
212
|
-
uint32_t network_id);
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Frees a FFIBinaryKey value
|
|
216
|
-
*
|
|
217
|
-
* # Safety
|
|
218
|
-
*
|
|
219
|
-
* - `ptr` must be non-null and must point to a struct having the layout of [`FFIBinaryKey`].
|
|
220
|
-
* See the safety documentation of [`FFIBinaryKey`].
|
|
221
|
-
*/
|
|
222
|
-
void zcashlc_free_binary_key(struct FFIBinaryKey *ptr);
|
|
223
|
-
|
|
224
76
|
/**
|
|
225
77
|
* Adds the next available account-level spend authority, given the current set of [ZIP 316]
|
|
226
78
|
* account identifiers known, to the wallet database.
|
|
@@ -255,67 +107,21 @@ void zcashlc_free_binary_key(struct FFIBinaryKey *ptr);
|
|
|
255
107
|
*
|
|
256
108
|
* [ZIP 316]: https://zips.z.cash/zip-0316
|
|
257
109
|
*/
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
uintptr_t treestate_len,
|
|
264
|
-
int64_t recover_until,
|
|
265
|
-
uint32_t network_id);
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Frees an array of FFIEncodedKeys values as allocated by `zcashlc_derive_unified_viewing_keys_from_seed`
|
|
269
|
-
*
|
|
270
|
-
* # Safety
|
|
271
|
-
*
|
|
272
|
-
* - `ptr` must be non-null and must point to a struct having the layout of [`FFIEncodedKeys`].
|
|
273
|
-
* See the safety documentation of [`FFIEncodedKeys`].
|
|
274
|
-
*/
|
|
275
|
-
void zcashlc_free_keys(struct FFIEncodedKeys *ptr);
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Derives and returns a unified spending key from the given seed for the given account ID.
|
|
279
|
-
*
|
|
280
|
-
* Returns the binary encoding of the spending key. The caller should manage the memory of (and
|
|
281
|
-
* store, if necessary) the returned spending key in a secure fashion.
|
|
282
|
-
*
|
|
283
|
-
* # Safety
|
|
284
|
-
*
|
|
285
|
-
* - `seed` must be non-null and valid for reads for `seed_len` bytes, and it must have an
|
|
286
|
-
* alignment of `1`.
|
|
287
|
-
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
288
|
-
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
289
|
-
* of pointer::offset.
|
|
290
|
-
* - Call `zcashlc_free_binary_key` to free the memory associated with the returned pointer when
|
|
291
|
-
* you are finished using it.
|
|
292
|
-
*/
|
|
293
|
-
struct FFIBinaryKey *zcashlc_derive_spending_key(const uint8_t *seed,
|
|
294
|
-
uintptr_t seed_len,
|
|
295
|
-
int32_t account,
|
|
296
|
-
uint32_t network_id);
|
|
110
|
+
FFIBinaryKey *zcashlc_create_account(const uint8_t *db_data,
|
|
111
|
+
uintptr_t db_data_len,
|
|
112
|
+
const uint8_t *seed,
|
|
113
|
+
uintptr_t seed_len,
|
|
114
|
+
uint32_t network_id);
|
|
297
115
|
|
|
298
116
|
/**
|
|
299
|
-
*
|
|
300
|
-
* and returns the resulting encoded UFVK string. `usk_ptr` should point to an array of `usk_len`
|
|
301
|
-
* bytes containing a unified spending key encoded as returned from the `zcashlc_create_account`
|
|
302
|
-
* or `zcashlc_derive_spending_key` functions.
|
|
117
|
+
* Creates a transaction paying the specified address from the given account.
|
|
303
118
|
*
|
|
304
|
-
*
|
|
119
|
+
* Returns the row index of the newly-created transaction in the `transactions` table
|
|
120
|
+
* within the data database. The caller can read the raw transaction bytes from the `raw`
|
|
121
|
+
* column in order to broadcast the transaction to the network.
|
|
305
122
|
*
|
|
306
|
-
*
|
|
307
|
-
* -
|
|
308
|
-
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
309
|
-
* of pointer::offset.
|
|
310
|
-
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
311
|
-
* when you are done using it.
|
|
312
|
-
*/
|
|
313
|
-
char *zcashlc_spending_key_to_full_viewing_key(const uint8_t *usk_ptr,
|
|
314
|
-
uintptr_t usk_len,
|
|
315
|
-
uint32_t network_id);
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Returns the most-recently-generated unified payment address for the specified account.
|
|
123
|
+
* Do not call this multiple times in parallel, or you will generate transactions that
|
|
124
|
+
* double-spend the same notes.
|
|
319
125
|
*
|
|
320
126
|
* # Safety
|
|
321
127
|
*
|
|
@@ -325,17 +131,43 @@ char *zcashlc_spending_key_to_full_viewing_key(const uint8_t *usk_ptr,
|
|
|
325
131
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
326
132
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
327
133
|
* documentation of pointer::offset.
|
|
328
|
-
* -
|
|
329
|
-
*
|
|
134
|
+
* - `usk_ptr` must be non-null and must point to an array of `usk_len` bytes containing a unified
|
|
135
|
+
* spending key encoded as returned from the `zcashlc_create_account` or
|
|
136
|
+
* `zcashlc_derive_spending_key` functions.
|
|
137
|
+
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the function call.
|
|
138
|
+
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
139
|
+
* of pointer::offset.
|
|
140
|
+
* - `to` must be non-null and must point to a null-terminated UTF-8 string.
|
|
141
|
+
* - `memo` must either be null (indicating an empty memo or a transparent recipient) or point to a
|
|
142
|
+
* 512-byte array.
|
|
143
|
+
* - `spend_params` must be non-null and valid for reads for `spend_params_len` bytes, and it must have an
|
|
144
|
+
* alignment of `1`. Its contents must be the Sapling spend proving parameters.
|
|
145
|
+
* - The memory referenced by `spend_params` must not be mutated for the duration of the function call.
|
|
146
|
+
* - The total size `spend_params_len` must be no larger than `isize::MAX`. See the safety
|
|
147
|
+
* documentation of pointer::offset.
|
|
148
|
+
* - `output_params` must be non-null and valid for reads for `output_params_len` bytes, and it must have an
|
|
149
|
+
* alignment of `1`. Its contents must be the Sapling output proving parameters.
|
|
150
|
+
* - The memory referenced by `output_params` must not be mutated for the duration of the function call.
|
|
151
|
+
* - The total size `output_params_len` must be no larger than `isize::MAX`. See the safety
|
|
152
|
+
* documentation of pointer::offset.
|
|
330
153
|
*/
|
|
331
|
-
|
|
154
|
+
int64_t zcashlc_create_to_address(const uint8_t *db_data,
|
|
332
155
|
uintptr_t db_data_len,
|
|
333
|
-
|
|
334
|
-
|
|
156
|
+
const uint8_t *usk_ptr,
|
|
157
|
+
uintptr_t usk_len,
|
|
158
|
+
const char *to,
|
|
159
|
+
int64_t value,
|
|
160
|
+
const uint8_t *memo,
|
|
161
|
+
const uint8_t *spend_params,
|
|
162
|
+
uintptr_t spend_params_len,
|
|
163
|
+
const uint8_t *output_params,
|
|
164
|
+
uintptr_t output_params_len,
|
|
165
|
+
uint32_t network_id,
|
|
166
|
+
uint32_t min_confirmations,
|
|
167
|
+
bool use_zip317_fees);
|
|
335
168
|
|
|
336
169
|
/**
|
|
337
|
-
*
|
|
338
|
-
* available diversifier.
|
|
170
|
+
* Decrypts whatever parts of the specified transaction it can and stores them in db_data.
|
|
339
171
|
*
|
|
340
172
|
* # Safety
|
|
341
173
|
*
|
|
@@ -345,96 +177,82 @@ char *zcashlc_get_current_address(const uint8_t *db_data,
|
|
|
345
177
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
346
178
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
347
179
|
* documentation of pointer::offset.
|
|
348
|
-
* -
|
|
349
|
-
*
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
uintptr_t db_data_len,
|
|
353
|
-
int32_t account,
|
|
354
|
-
uint32_t network_id);
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Returns a list of the transparent receivers for the diversified unified addresses that have
|
|
358
|
-
* been allocated for the provided account.
|
|
359
|
-
*
|
|
360
|
-
* # Safety
|
|
361
|
-
*
|
|
362
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
363
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
364
|
-
* operating system's preferred representation.
|
|
365
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
366
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
180
|
+
* - `tx` must be non-null and valid for reads for `tx_len` bytes, and it must have an
|
|
181
|
+
* alignment of `1`.
|
|
182
|
+
* - The memory referenced by `tx` must not be mutated for the duration of the function call.
|
|
183
|
+
* - The total size `tx_len` must be no larger than `isize::MAX`. See the safety
|
|
367
184
|
* documentation of pointer::offset.
|
|
368
|
-
* - Call [`zcashlc_free_keys`] to free the memory associated with the returned pointer
|
|
369
|
-
* when done using it.
|
|
370
185
|
*/
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
186
|
+
int32_t zcashlc_decrypt_and_store_transaction(const uint8_t *db_data,
|
|
187
|
+
uintptr_t db_data_len,
|
|
188
|
+
const uint8_t *tx,
|
|
189
|
+
uintptr_t tx_len,
|
|
190
|
+
uint32_t _mined_height,
|
|
191
|
+
uint32_t network_id);
|
|
375
192
|
|
|
376
193
|
/**
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
* Returns a pointer to a slice of typecodes. `len_ret` is set to the length of the
|
|
380
|
-
* slice.
|
|
194
|
+
* Derives and returns a unified spending key from the given seed for the given account ID.
|
|
381
195
|
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* - [Adding new types](https://zips.z.cash/zip-0316#adding-new-types)
|
|
385
|
-
* - [Metadata Items](https://zips.z.cash/zip-0316#metadata-items)
|
|
196
|
+
* Returns the binary encoding of the spending key. The caller should manage the memory of (and
|
|
197
|
+
* store, if necessary) the returned spending key in a secure fashion.
|
|
386
198
|
*
|
|
387
199
|
* # Safety
|
|
388
200
|
*
|
|
389
|
-
* - `
|
|
390
|
-
*
|
|
391
|
-
* -
|
|
392
|
-
*
|
|
201
|
+
* - `seed` must be non-null and valid for reads for `seed_len` bytes, and it must have an
|
|
202
|
+
* alignment of `1`.
|
|
203
|
+
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
204
|
+
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
205
|
+
* of pointer::offset.
|
|
206
|
+
* - Call `zcashlc_free_binary_key` to free the memory associated with the returned pointer when
|
|
207
|
+
* you are finished using it.
|
|
393
208
|
*/
|
|
394
|
-
|
|
209
|
+
FFIBinaryKey *zcashlc_derive_spending_key(const uint8_t *seed,
|
|
210
|
+
uintptr_t seed_len,
|
|
211
|
+
int32_t account,
|
|
212
|
+
uint32_t network_id);
|
|
395
213
|
|
|
396
214
|
/**
|
|
397
|
-
*
|
|
215
|
+
* Copies the last error message into the provided allocated buffer.
|
|
398
216
|
*
|
|
399
217
|
* # Safety
|
|
400
218
|
*
|
|
401
|
-
* - `
|
|
402
|
-
*
|
|
219
|
+
* - `buf` must be non-null and valid for reads for `length` bytes, and it must have an alignment
|
|
220
|
+
* of `1`.
|
|
221
|
+
* - The memory referenced by `buf` must not be mutated for the duration of the function call.
|
|
222
|
+
* - The total size `length` must be no larger than `isize::MAX`. See the safety documentation of
|
|
223
|
+
* pointer::offset.
|
|
403
224
|
*/
|
|
404
|
-
|
|
225
|
+
int32_t zcashlc_error_message_utf8(char *buf, int32_t length);
|
|
405
226
|
|
|
406
227
|
/**
|
|
407
|
-
*
|
|
228
|
+
* Frees a FFIBinaryKey value
|
|
408
229
|
*
|
|
409
230
|
* # Safety
|
|
410
231
|
*
|
|
411
|
-
* - `
|
|
412
|
-
*
|
|
413
|
-
* when done using it.
|
|
232
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`FFIBinaryKey`].
|
|
233
|
+
* See the safety documentation of [`FFIBinaryKey`].
|
|
414
234
|
*/
|
|
415
|
-
|
|
235
|
+
void zcashlc_free_binary_key(FFIBinaryKey *ptr);
|
|
416
236
|
|
|
417
237
|
/**
|
|
418
|
-
*
|
|
238
|
+
* Frees an array of FFIEncodedKeys values as allocated by `zcashlc_derive_unified_viewing_keys_from_seed`
|
|
419
239
|
*
|
|
420
240
|
* # Safety
|
|
421
241
|
*
|
|
422
|
-
* - `
|
|
423
|
-
*
|
|
424
|
-
* when done using it.
|
|
242
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`FFIEncodedKeys`].
|
|
243
|
+
* See the safety documentation of [`FFIEncodedKeys`].
|
|
425
244
|
*/
|
|
426
|
-
|
|
245
|
+
void zcashlc_free_keys(FFIEncodedKeys *ptr);
|
|
427
246
|
|
|
428
247
|
/**
|
|
429
|
-
*
|
|
430
|
-
* specified network, false in any other case.
|
|
248
|
+
* Frees a list of typecodes previously obtained from the FFI.
|
|
431
249
|
*
|
|
432
250
|
* # Safety
|
|
433
251
|
*
|
|
434
|
-
* - `
|
|
435
|
-
*
|
|
252
|
+
* - `data` and `len` must have been obtained from
|
|
253
|
+
* [`zcashlc_get_typecodes_for_unified_address_receivers`].
|
|
436
254
|
*/
|
|
437
|
-
|
|
255
|
+
void zcashlc_free_typecodes(uint32_t *data, uintptr_t len);
|
|
438
256
|
|
|
439
257
|
/**
|
|
440
258
|
* Returns the network type and address kind for the given address string,
|
|
@@ -456,64 +274,85 @@ bool zcashlc_get_address_metadata(const char *address,
|
|
|
456
274
|
uint32_t *addr_kind_ret);
|
|
457
275
|
|
|
458
276
|
/**
|
|
459
|
-
* Returns
|
|
460
|
-
* false in any other case.
|
|
461
|
-
*
|
|
462
|
-
* # Safety
|
|
463
|
-
*
|
|
464
|
-
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
465
|
-
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
466
|
-
*/
|
|
467
|
-
bool zcashlc_is_valid_transparent_address(const char *address, uint32_t network_id);
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Returns true when the provided key decodes to a valid Sapling extended spending key for the
|
|
471
|
-
* specified network, false in any other case.
|
|
277
|
+
* Returns the balance for the specified account, including all unspent notes that we know about.
|
|
472
278
|
*
|
|
473
279
|
* # Safety
|
|
474
280
|
*
|
|
475
|
-
* - `
|
|
476
|
-
*
|
|
281
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
282
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
283
|
+
* operating system's preferred representation.
|
|
284
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
285
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
286
|
+
* documentation of pointer::offset.
|
|
477
287
|
*/
|
|
478
|
-
|
|
288
|
+
int64_t zcashlc_get_balance(const uint8_t *db_data,
|
|
289
|
+
uintptr_t db_data_len,
|
|
290
|
+
int32_t account,
|
|
291
|
+
uint32_t network_id);
|
|
479
292
|
|
|
480
293
|
/**
|
|
481
|
-
* Returns
|
|
482
|
-
* specified network, false in any other case.
|
|
294
|
+
* Returns the most-recently-generated unified payment address for the specified account.
|
|
483
295
|
*
|
|
484
296
|
* # Safety
|
|
485
297
|
*
|
|
486
|
-
* - `
|
|
487
|
-
*
|
|
298
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
299
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
300
|
+
* operating system's preferred representation.
|
|
301
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
302
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
303
|
+
* documentation of pointer::offset.
|
|
304
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
305
|
+
* when done using it.
|
|
488
306
|
*/
|
|
489
|
-
|
|
307
|
+
char *zcashlc_get_current_address(const uint8_t *db_data,
|
|
308
|
+
uintptr_t db_data_len,
|
|
309
|
+
int32_t account,
|
|
310
|
+
uint32_t network_id);
|
|
490
311
|
|
|
491
312
|
/**
|
|
492
|
-
* Returns
|
|
493
|
-
*
|
|
313
|
+
* Returns the most recent block height to which it is possible to reset the state
|
|
314
|
+
* of the data database.
|
|
494
315
|
*
|
|
495
316
|
* # Safety
|
|
496
317
|
*
|
|
497
|
-
* - `
|
|
498
|
-
*
|
|
499
|
-
*
|
|
318
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
319
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
320
|
+
* operating system's preferred representation.
|
|
321
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
322
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
323
|
+
* documentation of pointer::offset.
|
|
500
324
|
*/
|
|
501
|
-
|
|
325
|
+
int32_t zcashlc_get_nearest_rewind_height(const uint8_t *db_data,
|
|
326
|
+
uintptr_t db_data_len,
|
|
327
|
+
int32_t height,
|
|
328
|
+
uint32_t network_id);
|
|
502
329
|
|
|
503
330
|
/**
|
|
504
|
-
* Returns
|
|
505
|
-
*
|
|
331
|
+
* Returns a newly-generated unified payment address for the specified account, with the next
|
|
332
|
+
* available diversifier.
|
|
506
333
|
*
|
|
507
334
|
* # Safety
|
|
508
335
|
*
|
|
509
|
-
* - `
|
|
510
|
-
*
|
|
511
|
-
*
|
|
336
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
337
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
338
|
+
* operating system's preferred representation.
|
|
339
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
340
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
341
|
+
* documentation of pointer::offset.
|
|
342
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
343
|
+
* when done using it.
|
|
512
344
|
*/
|
|
513
|
-
|
|
345
|
+
char *zcashlc_get_next_available_address(const uint8_t *db_data,
|
|
346
|
+
uintptr_t db_data_len,
|
|
347
|
+
int32_t account,
|
|
348
|
+
uint32_t network_id);
|
|
514
349
|
|
|
515
350
|
/**
|
|
516
|
-
* Returns the
|
|
351
|
+
* Returns the memo for a received note by copying the corresponding bytes to the received
|
|
352
|
+
* pointer in `memo_bytes_ret`.
|
|
353
|
+
*
|
|
354
|
+
* The note is identified by its row index in the `received_notes` table within the data
|
|
355
|
+
* database.
|
|
517
356
|
*
|
|
518
357
|
* # Safety
|
|
519
358
|
*
|
|
@@ -523,15 +362,19 @@ bool zcashlc_is_valid_unified_address(const char *address, uint32_t network_id);
|
|
|
523
362
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
524
363
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
525
364
|
* documentation of pointer::offset.
|
|
365
|
+
* - `memo_bytes_ret` must be non-null and must point to an allocated 512-byte region of memory.
|
|
526
366
|
*/
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
367
|
+
bool zcashlc_get_received_memo(const uint8_t *db_data,
|
|
368
|
+
uintptr_t db_data_len,
|
|
369
|
+
int64_t id_note,
|
|
370
|
+
uint8_t *memo_bytes_ret,
|
|
371
|
+
uint32_t network_id);
|
|
531
372
|
|
|
532
373
|
/**
|
|
533
|
-
* Returns the
|
|
534
|
-
*
|
|
374
|
+
* Returns the memo for a received note, if it is known and a valid UTF-8 string.
|
|
375
|
+
*
|
|
376
|
+
* The note is identified by its row index in the `received_notes` table within the data
|
|
377
|
+
* database.
|
|
535
378
|
*
|
|
536
379
|
* # Safety
|
|
537
380
|
*
|
|
@@ -541,16 +384,31 @@ int64_t zcashlc_get_balance(const uint8_t *db_data,
|
|
|
541
384
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
542
385
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
543
386
|
* documentation of pointer::offset.
|
|
387
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
388
|
+
* when done using it.
|
|
544
389
|
*/
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
uint32_t min_confirmations);
|
|
390
|
+
char *zcashlc_get_received_memo_as_utf8(const uint8_t *db_data,
|
|
391
|
+
uintptr_t db_data_len,
|
|
392
|
+
int64_t id_note,
|
|
393
|
+
uint32_t network_id);
|
|
550
394
|
|
|
551
395
|
/**
|
|
552
|
-
* Returns the
|
|
553
|
-
*
|
|
396
|
+
* Returns the Sapling receiver within the given Unified Address, if any.
|
|
397
|
+
*
|
|
398
|
+
* # Safety
|
|
399
|
+
*
|
|
400
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
401
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
402
|
+
* when done using it.
|
|
403
|
+
*/
|
|
404
|
+
char *zcashlc_get_sapling_receiver_for_unified_address(const char *ua);
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Returns the memo for a sent note, by copying the corresponding bytes to the received
|
|
408
|
+
* pointer in `memo_bytes_ret`.
|
|
409
|
+
*
|
|
410
|
+
* The note is identified by its row index in the `sent_notes` table within the data
|
|
411
|
+
* database.
|
|
554
412
|
*
|
|
555
413
|
* # Safety
|
|
556
414
|
*
|
|
@@ -560,18 +418,19 @@ int64_t zcashlc_get_verified_balance(const uint8_t *db_data,
|
|
|
560
418
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
561
419
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
562
420
|
* documentation of pointer::offset.
|
|
563
|
-
* - `
|
|
564
|
-
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
421
|
+
* - `memo_bytes_ret` must be non-null and must point to an allocated 512-byte region of memory.
|
|
565
422
|
*/
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
423
|
+
bool zcashlc_get_sent_memo(const uint8_t *db_data,
|
|
424
|
+
uintptr_t db_data_len,
|
|
425
|
+
int64_t id_note,
|
|
426
|
+
uint8_t *memo_bytes_ret,
|
|
427
|
+
uint32_t network_id);
|
|
571
428
|
|
|
572
429
|
/**
|
|
573
|
-
* Returns the
|
|
574
|
-
*
|
|
430
|
+
* Returns the memo for a sent note, if it is known and a valid UTF-8 string.
|
|
431
|
+
*
|
|
432
|
+
* The note is identified by its row index in the `sent_notes` table within the data
|
|
433
|
+
* database.
|
|
575
434
|
*
|
|
576
435
|
* # Safety
|
|
577
436
|
*
|
|
@@ -581,14 +440,13 @@ int64_t zcashlc_get_verified_transparent_balance(const uint8_t *db_data,
|
|
|
581
440
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
582
441
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
583
442
|
* documentation of pointer::offset.
|
|
584
|
-
* - `
|
|
585
|
-
*
|
|
443
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
444
|
+
* when done using it.
|
|
586
445
|
*/
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
uint32_t min_confirmations);
|
|
446
|
+
char *zcashlc_get_sent_memo_as_utf8(const uint8_t *db_data,
|
|
447
|
+
uintptr_t db_data_len,
|
|
448
|
+
int64_t id_note,
|
|
449
|
+
uint32_t network_id);
|
|
592
450
|
|
|
593
451
|
/**
|
|
594
452
|
* Returns the balance for `address`, including all UTXOs that we know about.
|
|
@@ -629,8 +487,39 @@ int64_t zcashlc_get_total_transparent_balance_for_account(const uint8_t *db_data
|
|
|
629
487
|
int32_t account);
|
|
630
488
|
|
|
631
489
|
/**
|
|
632
|
-
* Returns the
|
|
633
|
-
*
|
|
490
|
+
* Returns the transparent receiver within the given Unified Address, if any.
|
|
491
|
+
*
|
|
492
|
+
* # Safety
|
|
493
|
+
*
|
|
494
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
495
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
496
|
+
* when done using it.
|
|
497
|
+
*/
|
|
498
|
+
char *zcashlc_get_transparent_receiver_for_unified_address(const char *ua);
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Extracts the typecodes of the receivers within the given Unified Address.
|
|
502
|
+
*
|
|
503
|
+
* Returns a pointer to a slice of typecodes. `len_ret` is set to the length of the
|
|
504
|
+
* slice.
|
|
505
|
+
*
|
|
506
|
+
* See the following sections of ZIP 316 for details on how to interpret typecodes:
|
|
507
|
+
* - [List of known typecodes](https://zips.z.cash/zip-0316#encoding-of-unified-addresses)
|
|
508
|
+
* - [Adding new types](https://zips.z.cash/zip-0316#adding-new-types)
|
|
509
|
+
* - [Metadata Items](https://zips.z.cash/zip-0316#metadata-items)
|
|
510
|
+
*
|
|
511
|
+
* # Safety
|
|
512
|
+
*
|
|
513
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string containing an
|
|
514
|
+
* encoded Unified Address.
|
|
515
|
+
* - Call [`zcashlc_free_typecodes`] to free the memory associated with the returned
|
|
516
|
+
* pointer when done using it.
|
|
517
|
+
*/
|
|
518
|
+
uint32_t *zcashlc_get_typecodes_for_unified_address_receivers(const char *ua, uintptr_t *len_ret);
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Returns the verified balance for the account, which ignores notes that have been
|
|
522
|
+
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
634
523
|
*
|
|
635
524
|
* # Safety
|
|
636
525
|
*
|
|
@@ -640,19 +529,16 @@ int64_t zcashlc_get_total_transparent_balance_for_account(const uint8_t *db_data
|
|
|
640
529
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
641
530
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
642
531
|
* documentation of pointer::offset.
|
|
643
|
-
* - `txid_bytes` must be non-null and valid for reads for 32 bytes, and it must have an alignment
|
|
644
|
-
* of `1`.
|
|
645
|
-
* - `memo_bytes_ret` must be non-null and must point to an allocated 512-byte region of memory.
|
|
646
532
|
*/
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
uint32_t network_id);
|
|
533
|
+
int64_t zcashlc_get_verified_balance(const uint8_t *db_data,
|
|
534
|
+
uintptr_t db_data_len,
|
|
535
|
+
int32_t account,
|
|
536
|
+
uint32_t network_id,
|
|
537
|
+
uint32_t min_confirmations);
|
|
653
538
|
|
|
654
539
|
/**
|
|
655
|
-
* Returns the
|
|
540
|
+
* Returns the verified transparent balance for `address`, which ignores utxos that have been
|
|
541
|
+
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
656
542
|
*
|
|
657
543
|
* # Safety
|
|
658
544
|
*
|
|
@@ -662,34 +548,18 @@ bool zcashlc_get_memo(const uint8_t *db_data,
|
|
|
662
548
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
663
549
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
664
550
|
* documentation of pointer::offset.
|
|
665
|
-
* - `
|
|
666
|
-
*
|
|
667
|
-
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
668
|
-
* when done using it.
|
|
669
|
-
*/
|
|
670
|
-
char *zcashlc_get_memo_as_utf8(const uint8_t *db_data,
|
|
671
|
-
uintptr_t db_data_len,
|
|
672
|
-
const uint8_t *txid_bytes,
|
|
673
|
-
uint16_t output_index,
|
|
674
|
-
uint32_t network_id);
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* Returns a ZIP-32 signature of the given seed bytes.
|
|
678
|
-
*
|
|
679
|
-
* # Safety
|
|
680
|
-
* - `seed` must be non-null and valid for reads for `seed_len` bytes, and it must have an
|
|
681
|
-
* alignment of `1`.
|
|
682
|
-
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
683
|
-
* - The total size `seed_len` must be at least 32 no larger than `252`. See the safety documentation
|
|
684
|
-
* of pointer::offset.
|
|
551
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
552
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
685
553
|
*/
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
554
|
+
int64_t zcashlc_get_verified_transparent_balance(const uint8_t *db_data,
|
|
555
|
+
uintptr_t db_data_len,
|
|
556
|
+
const char *address,
|
|
557
|
+
uint32_t network_id,
|
|
558
|
+
uint32_t min_confirmations);
|
|
689
559
|
|
|
690
560
|
/**
|
|
691
|
-
* Returns the
|
|
692
|
-
*
|
|
561
|
+
* Returns the verified transparent balance for `account`, which ignores utxos that have been
|
|
562
|
+
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
693
563
|
*
|
|
694
564
|
* # Safety
|
|
695
565
|
*
|
|
@@ -699,17 +569,19 @@ bool zcashlc_seed_fingerprint(const uint8_t *seed,
|
|
|
699
569
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
700
570
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
701
571
|
* documentation of pointer::offset.
|
|
572
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
573
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
702
574
|
*/
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
575
|
+
int64_t zcashlc_get_verified_transparent_balance_for_account(const uint8_t *db_data,
|
|
576
|
+
uintptr_t db_data_len,
|
|
577
|
+
uint32_t network_id,
|
|
578
|
+
int32_t account,
|
|
579
|
+
uint32_t min_confirmations);
|
|
707
580
|
|
|
708
581
|
/**
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
* block, this function does nothing.
|
|
582
|
+
* Initialises the data database with the given set of unified full viewing keys. This
|
|
583
|
+
* should only be used in special cases for implementing wallet recovery; prefer
|
|
584
|
+
* `zcashlc_create_account` for normal account creation purposes.
|
|
713
585
|
*
|
|
714
586
|
* # Safety
|
|
715
587
|
*
|
|
@@ -719,43 +591,42 @@ int32_t zcashlc_get_nearest_rewind_height(const uint8_t *db_data,
|
|
|
719
591
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
720
592
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
721
593
|
* documentation of pointer::offset.
|
|
594
|
+
* - `ufvks` must be non-null and valid for reads for `ufvks_len * sizeof(FFIEncodedKey)` bytes.
|
|
595
|
+
* It must point to an array of `FFIEncodedKey` values.
|
|
596
|
+
* - The memory referenced by `ufvks` must not be mutated for the duration of the function call.
|
|
597
|
+
* - The total size `ufvks_len` must be no larger than `isize::MAX`. See the safety
|
|
598
|
+
* documentation of pointer::offset.
|
|
722
599
|
*/
|
|
723
|
-
bool
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
600
|
+
bool zcashlc_init_accounts_table_with_keys(const uint8_t *db_data,
|
|
601
|
+
uintptr_t db_data_len,
|
|
602
|
+
FFIEncodedKey *ufvks_ptr,
|
|
603
|
+
uintptr_t ufvks_len,
|
|
604
|
+
uint32_t network_id);
|
|
727
605
|
|
|
728
606
|
/**
|
|
729
|
-
* Adds a sequence of Sapling subtree roots to the data store.
|
|
730
|
-
*
|
|
731
|
-
* Returns true if the subtrees could be stored, false otherwise. When false is returned,
|
|
732
|
-
* caller should check for errors.
|
|
733
|
-
*
|
|
734
607
|
* # Safety
|
|
608
|
+
* Initializes the `FsBlockDb` sqlite database. Does nothing if already created
|
|
735
609
|
*
|
|
736
|
-
*
|
|
610
|
+
* Returns true when successful, false otherwise. When false is returned caller
|
|
611
|
+
* should check for errors.
|
|
612
|
+
* - `fs_block_db_root` must be non-null and valid for reads for `fs_block_db_root_len` bytes, and it must have an
|
|
737
613
|
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
738
614
|
* operating system's preferred representation.
|
|
739
|
-
* - The memory referenced by `
|
|
740
|
-
* - The total size `
|
|
741
|
-
* documentation of
|
|
742
|
-
* - `roots` must be non-null and initialized.
|
|
743
|
-
* - The memory referenced by `roots` must not be mutated for the duration of the function call.
|
|
615
|
+
* - The memory referenced by `fs_block_db_root` must not be mutated for the duration of the function call.
|
|
616
|
+
* - The total size `fs_block_db_root_len` must be no larger than `isize::MAX`. See the safety
|
|
617
|
+
* documentation of pointer::offset.
|
|
744
618
|
*/
|
|
745
|
-
bool
|
|
746
|
-
|
|
747
|
-
uint64_t start_index,
|
|
748
|
-
const struct FfiSubtreeRoots *roots,
|
|
749
|
-
uint32_t network_id);
|
|
619
|
+
bool zcashlc_init_block_metadata_db(const uint8_t *fs_block_db_root,
|
|
620
|
+
uintptr_t fs_block_db_root_len);
|
|
750
621
|
|
|
751
622
|
/**
|
|
752
|
-
*
|
|
623
|
+
* Initialises the data database with the given block metadata.
|
|
753
624
|
*
|
|
754
|
-
* This
|
|
755
|
-
*
|
|
756
|
-
*
|
|
757
|
-
*
|
|
758
|
-
*
|
|
625
|
+
* This enables a newly-created database to be immediately-usable, without needing to
|
|
626
|
+
* synchronise historic blocks.
|
|
627
|
+
*
|
|
628
|
+
* The string represented by `sapling_tree_hex` should contain the encoded byte representation
|
|
629
|
+
* of a Sapling commitment tree.
|
|
759
630
|
*
|
|
760
631
|
* # Safety
|
|
761
632
|
*
|
|
@@ -764,20 +635,28 @@ bool zcashlc_put_sapling_subtree_roots(const uint8_t *db_data,
|
|
|
764
635
|
* operating system's preferred representation.
|
|
765
636
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
766
637
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
767
|
-
* documentation of
|
|
638
|
+
* documentation of pointer::offset.
|
|
639
|
+
* - `hash_hex` must be non-null and must point to a null-terminated UTF-8 string.
|
|
640
|
+
* - The memory referenced by `hash_hex` must not be mutated for the duration of the function call.
|
|
641
|
+
* - `sapling_tree_hex` must be non-null and must point to a null-terminated UTF-8 string.
|
|
642
|
+
* - The memory referenced by `sapling_tree_hex` must not be mutated for the duration of the
|
|
643
|
+
* function call.
|
|
768
644
|
*/
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
645
|
+
int32_t zcashlc_init_blocks_table(const uint8_t *db_data,
|
|
646
|
+
uintptr_t db_data_len,
|
|
647
|
+
int32_t height,
|
|
648
|
+
const char *hash_hex,
|
|
649
|
+
uint32_t time,
|
|
650
|
+
const char *sapling_tree_hex,
|
|
651
|
+
uint32_t network_id);
|
|
773
652
|
|
|
774
653
|
/**
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
* preceding blocks above the wallet's birthday height.
|
|
654
|
+
* Sets up the internal structure of the data database. The value for `seed` may be provided as a
|
|
655
|
+
* null pointer if the caller wishes to attempt migrations without providing the wallet's seed
|
|
656
|
+
* value.
|
|
779
657
|
*
|
|
780
|
-
* Returns
|
|
658
|
+
* Returns 0 if successful, 1 if the seed must be provided in order to execute the requested
|
|
659
|
+
* migrations, or -1 otherwise.
|
|
781
660
|
*
|
|
782
661
|
* # Safety
|
|
783
662
|
*
|
|
@@ -786,125 +665,133 @@ bool zcashlc_update_chain_tip(const uint8_t *db_data,
|
|
|
786
665
|
* operating system's preferred representation.
|
|
787
666
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
788
667
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
789
|
-
* documentation of
|
|
668
|
+
* documentation of pointer::offset.
|
|
669
|
+
* - `seed` must be non-null and valid for reads for `seed_len` bytes, and it must have an
|
|
670
|
+
* alignment of `1`.
|
|
671
|
+
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
672
|
+
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
673
|
+
* of pointer::offset.
|
|
790
674
|
*/
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
675
|
+
int32_t zcashlc_init_data_database(const uint8_t *db_data,
|
|
676
|
+
uintptr_t db_data_len,
|
|
677
|
+
const uint8_t *seed,
|
|
678
|
+
uintptr_t seed_len,
|
|
679
|
+
uint32_t network_id);
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Returns true when the provided key decodes to a valid Sapling extended spending key for the
|
|
683
|
+
* specified network, false in any other case.
|
|
684
|
+
*
|
|
685
|
+
* # Safety
|
|
686
|
+
*
|
|
687
|
+
* - `extsk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
688
|
+
* - The memory referenced by `extsk` must not be mutated for the duration of the function call.
|
|
689
|
+
*/
|
|
690
|
+
bool zcashlc_is_valid_sapling_extended_spending_key(const char *extsk, uint32_t network_id);
|
|
794
691
|
|
|
795
692
|
/**
|
|
796
|
-
* Returns the
|
|
693
|
+
* Returns true when the provided address decodes to a valid Sapling payment address for the
|
|
694
|
+
* specified network, false in any other case.
|
|
797
695
|
*
|
|
798
|
-
*
|
|
799
|
-
* otherwise the maximal scanned height is likely to be greater than the fully scanned
|
|
800
|
-
* height due to the fact that out-of-order scanning can leave gaps.
|
|
696
|
+
* # Safety
|
|
801
697
|
*
|
|
802
|
-
*
|
|
698
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
699
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
700
|
+
*/
|
|
701
|
+
bool zcashlc_is_valid_shielded_address(const char *address, uint32_t network_id);
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Returns true when the address is a valid transparent payment address for the specified network,
|
|
705
|
+
* false in any other case.
|
|
803
706
|
*
|
|
804
707
|
* # Safety
|
|
805
708
|
*
|
|
806
|
-
* - `
|
|
807
|
-
*
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
709
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
710
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
711
|
+
*/
|
|
712
|
+
bool zcashlc_is_valid_transparent_address(const char *address, uint32_t network_id);
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Returns true when the provided key decodes to a valid unified address for the
|
|
716
|
+
* specified network, false in any other case.
|
|
717
|
+
*
|
|
718
|
+
* # Safety
|
|
719
|
+
*
|
|
720
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
721
|
+
* - The memory referenced by `address` must not be mutated for the duration of the
|
|
722
|
+
* function call.
|
|
812
723
|
*/
|
|
813
|
-
|
|
814
|
-
uintptr_t db_data_len,
|
|
815
|
-
uint32_t network_id);
|
|
724
|
+
bool zcashlc_is_valid_unified_address(const char *address, uint32_t network_id);
|
|
816
725
|
|
|
817
726
|
/**
|
|
818
|
-
* Returns the
|
|
727
|
+
* Returns true when the provided key decodes to a valid unified full viewing key for the
|
|
728
|
+
* specified network, false in any other case.
|
|
819
729
|
*
|
|
820
730
|
* # Safety
|
|
821
731
|
*
|
|
822
|
-
* - `
|
|
823
|
-
*
|
|
824
|
-
* path in the operating system's preferred representation.
|
|
825
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the
|
|
732
|
+
* - `ufvk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
733
|
+
* - The memory referenced by `ufvk` must not be mutated for the duration of the
|
|
826
734
|
* function call.
|
|
827
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
828
|
-
* documentation of pointer::offset.
|
|
829
735
|
*/
|
|
830
|
-
|
|
831
|
-
uintptr_t db_data_len,
|
|
832
|
-
uint32_t network_id);
|
|
736
|
+
bool zcashlc_is_valid_unified_full_viewing_key(const char *ufvk, uint32_t network_id);
|
|
833
737
|
|
|
834
738
|
/**
|
|
835
|
-
*
|
|
739
|
+
* Returns true when the provided key decodes to a valid Sapling extended full viewing key for the
|
|
740
|
+
* specified network, false in any other case.
|
|
836
741
|
*
|
|
837
742
|
* # Safety
|
|
838
743
|
*
|
|
839
|
-
* - `
|
|
840
|
-
*
|
|
744
|
+
* - `key` must be non-null and must point to a null-terminated UTF-8 string.
|
|
745
|
+
* - The memory referenced by `key` must not be mutated for the duration of the function call.
|
|
746
|
+
*/
|
|
747
|
+
bool zcashlc_is_valid_viewing_key(const char *key, uint32_t network_id);
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Returns the length of the last error message to be logged.
|
|
841
751
|
*/
|
|
842
|
-
|
|
752
|
+
int32_t zcashlc_last_error_length(void);
|
|
843
753
|
|
|
844
754
|
/**
|
|
845
|
-
*
|
|
755
|
+
* Get the latest cached block height in the filesystem block cache
|
|
846
756
|
*
|
|
847
|
-
*
|
|
848
|
-
* made available to `zcashlc_scan_blocks` for the requested block ranges includes note
|
|
849
|
-
* commitment tree size information for each block; or else the scan is likely to fail if
|
|
850
|
-
* notes belonging to the wallet are detected.
|
|
757
|
+
* Returns a positive blockheight or -1 if empty or an error occurred.
|
|
851
758
|
*
|
|
852
759
|
* # Safety
|
|
853
760
|
*
|
|
854
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the
|
|
858
|
-
* function call.
|
|
761
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
762
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
763
|
+
* operating system's preferred representation.
|
|
764
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
859
765
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
860
766
|
* documentation of pointer::offset.
|
|
861
|
-
* -
|
|
862
|
-
*
|
|
767
|
+
* - `tx` must be non-null and valid for reads for `tx_len` bytes, and it must have an
|
|
768
|
+
* alignment of `1`.
|
|
769
|
+
* - The memory referenced by `tx` must not be mutated for the duration of the function call.
|
|
770
|
+
* - The total size `tx_len` must be no larger than `isize::MAX`. See the safety
|
|
771
|
+
* documentation of pointer::offset.
|
|
863
772
|
*/
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
uint32_t network_id);
|
|
773
|
+
int32_t zcashlc_latest_cached_block_height(const uint8_t *fs_block_db_root,
|
|
774
|
+
uintptr_t fs_block_db_root_len);
|
|
867
775
|
|
|
868
776
|
/**
|
|
869
|
-
*
|
|
870
|
-
*
|
|
871
|
-
*
|
|
872
|
-
* This function is built on the core assumption that the information provided in the
|
|
873
|
-
* block cache is more likely to be accurate than the previously-scanned information.
|
|
874
|
-
* This follows from the design (and trust) assumption that the `lightwalletd` server
|
|
875
|
-
* provides accurate block information as of the time it was requested.
|
|
876
|
-
*
|
|
877
|
-
* This function **assumes** that the caller is handling rollbacks.
|
|
878
|
-
*
|
|
879
|
-
* For brand-new light client databases, this function starts scanning from the Sapling
|
|
880
|
-
* activation height. This height can be fast-forwarded to a more recent block by calling
|
|
881
|
-
* [`zcashlc_init_blocks_table`] before this function.
|
|
882
|
-
*
|
|
883
|
-
* Scanned blocks are required to be height-sequential. If a block is missing from the
|
|
884
|
-
* cache, an error will be signalled.
|
|
777
|
+
* Returns a list of the transparent receivers for the diversified unified addresses that have
|
|
778
|
+
* been allocated for the provided account.
|
|
885
779
|
*
|
|
886
780
|
* # Safety
|
|
887
781
|
*
|
|
888
|
-
* - `fs_block_db_root` must be non-null and valid for reads for `fs_block_db_root_len` bytes, and it must have an
|
|
889
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
890
|
-
* operating system's preferred representation.
|
|
891
|
-
* - The memory referenced by `fs_block_db_root` must not be mutated for the duration of the function call.
|
|
892
|
-
* - The total size `fs_block_db_root_len` must be no larger than `isize::MAX`. See the safety
|
|
893
|
-
* documentation of pointer::offset.
|
|
894
782
|
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
895
783
|
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
896
784
|
* operating system's preferred representation.
|
|
897
785
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
898
786
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
899
787
|
* documentation of pointer::offset.
|
|
788
|
+
* - Call [`zcashlc_free_keys`] to free the memory associated with the returned pointer
|
|
789
|
+
* when done using it.
|
|
900
790
|
*/
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
int32_t from_height,
|
|
906
|
-
uint32_t scan_limit,
|
|
907
|
-
uint32_t network_id);
|
|
791
|
+
FFIEncodedKeys *zcashlc_list_transparent_receivers(const uint8_t *db_data,
|
|
792
|
+
uintptr_t db_data_len,
|
|
793
|
+
int32_t account_id,
|
|
794
|
+
uint32_t network_id);
|
|
908
795
|
|
|
909
796
|
/**
|
|
910
797
|
* Inserts a UTXO into the wallet database.
|
|
@@ -939,46 +826,6 @@ bool zcashlc_put_utxo(const uint8_t *db_data,
|
|
|
939
826
|
int32_t height,
|
|
940
827
|
uint32_t network_id);
|
|
941
828
|
|
|
942
|
-
/**
|
|
943
|
-
* # Safety
|
|
944
|
-
* Initializes the `FsBlockDb` sqlite database. Does nothing if already created
|
|
945
|
-
*
|
|
946
|
-
* Returns true when successful, false otherwise. When false is returned caller
|
|
947
|
-
* should check for errors.
|
|
948
|
-
* - `fs_block_db_root` must be non-null and valid for reads for `fs_block_db_root_len` bytes, and it must have an
|
|
949
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
950
|
-
* operating system's preferred representation.
|
|
951
|
-
* - The memory referenced by `fs_block_db_root` must not be mutated for the duration of the function call.
|
|
952
|
-
* - The total size `fs_block_db_root_len` must be no larger than `isize::MAX`. See the safety
|
|
953
|
-
* documentation of pointer::offset.
|
|
954
|
-
*/
|
|
955
|
-
bool zcashlc_init_block_metadata_db(const uint8_t *fs_block_db_root,
|
|
956
|
-
uintptr_t fs_block_db_root_len);
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
* Writes the blocks provided in `blocks_meta` into the `BlockMeta` database
|
|
960
|
-
*
|
|
961
|
-
* Returns true if the `blocks_meta` could be stored into the `FsBlockDb`. False
|
|
962
|
-
* otherwise.
|
|
963
|
-
*
|
|
964
|
-
* When false is returned caller should check for errors.
|
|
965
|
-
*
|
|
966
|
-
* # Safety
|
|
967
|
-
*
|
|
968
|
-
* - `fs_block_db_root` must be non-null and valid for reads for `fs_block_db_root_len` bytes, and it must have an
|
|
969
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
970
|
-
* operating system's preferred representation.
|
|
971
|
-
* - The memory referenced by `fs_block_db_root` must not be mutated for the duration of the function call.
|
|
972
|
-
* - The total size `fs_block_db_root_len` must be no larger than `isize::MAX`. See the safety
|
|
973
|
-
* documentation of pointer::offset.
|
|
974
|
-
* - Block metadata represented in `blocks_meta` must be non-null. Caller must guarantee that the
|
|
975
|
-
* memory reference by this pointer is not freed up, dereferenced or invalidated while this function
|
|
976
|
-
* is invoked.
|
|
977
|
-
*/
|
|
978
|
-
bool zcashlc_write_block_metadata(const uint8_t *fs_block_db_root,
|
|
979
|
-
uintptr_t fs_block_db_root_len,
|
|
980
|
-
struct FFIBlocksMeta *blocks_meta);
|
|
981
|
-
|
|
982
829
|
/**
|
|
983
830
|
* Rewinds the data database to the given height.
|
|
984
831
|
*
|
|
@@ -999,9 +846,10 @@ bool zcashlc_rewind_fs_block_cache_to_height(const uint8_t *fs_block_db_root,
|
|
|
999
846
|
int32_t height);
|
|
1000
847
|
|
|
1001
848
|
/**
|
|
1002
|
-
*
|
|
849
|
+
* Rewinds the data database to the given height.
|
|
1003
850
|
*
|
|
1004
|
-
*
|
|
851
|
+
* If the requested height is greater than or equal to the height of the last scanned
|
|
852
|
+
* block, this function does nothing.
|
|
1005
853
|
*
|
|
1006
854
|
* # Safety
|
|
1007
855
|
*
|
|
@@ -1011,48 +859,64 @@ bool zcashlc_rewind_fs_block_cache_to_height(const uint8_t *fs_block_db_root,
|
|
|
1011
859
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1012
860
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1013
861
|
* documentation of pointer::offset.
|
|
1014
|
-
* - `tx` must be non-null and valid for reads for `tx_len` bytes, and it must have an
|
|
1015
|
-
* alignment of `1`.
|
|
1016
|
-
* - The memory referenced by `tx` must not be mutated for the duration of the function call.
|
|
1017
|
-
* - The total size `tx_len` must be no larger than `isize::MAX`. See the safety
|
|
1018
|
-
* documentation of pointer::offset.
|
|
1019
862
|
*/
|
|
1020
|
-
|
|
1021
|
-
|
|
863
|
+
bool zcashlc_rewind_to_height(const uint8_t *db_data,
|
|
864
|
+
uintptr_t db_data_len,
|
|
865
|
+
int32_t height,
|
|
866
|
+
uint32_t network_id);
|
|
1022
867
|
|
|
1023
868
|
/**
|
|
1024
|
-
*
|
|
869
|
+
* Scans new blocks added to the cache for any transactions received by the tracked
|
|
870
|
+
* accounts.
|
|
871
|
+
*
|
|
872
|
+
* This function pays attention only to cached blocks with heights greater than the
|
|
873
|
+
* highest scanned block in `db_data`. Cached blocks with lower heights are not verified
|
|
874
|
+
* against previously-scanned blocks. In particular, this function **assumes** that the
|
|
875
|
+
* caller is handling rollbacks.
|
|
876
|
+
*
|
|
877
|
+
* For brand-new light client databases, this function starts scanning from the Sapling
|
|
878
|
+
* activation height. This height can be fast-forwarded to a more recent block by calling
|
|
879
|
+
* [`zcashlc_init_blocks_table`] before this function.
|
|
880
|
+
*
|
|
881
|
+
* Scanned blocks are required to be height-sequential. If a block is missing from the
|
|
882
|
+
* cache, an error will be signalled.
|
|
1025
883
|
*
|
|
1026
884
|
* # Safety
|
|
1027
885
|
*
|
|
886
|
+
* - `fs_block_db_root` must be non-null and valid for reads for `fs_block_db_root_len` bytes, and it must have an
|
|
887
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
888
|
+
* operating system's preferred representation.
|
|
889
|
+
* - The memory referenced by `fs_block_db_root` must not be mutated for the duration of the function call.
|
|
890
|
+
* - The total size `fs_block_db_root_len` must be no larger than `isize::MAX`. See the safety
|
|
891
|
+
* documentation of pointer::offset.
|
|
1028
892
|
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1029
893
|
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1030
894
|
* operating system's preferred representation.
|
|
1031
895
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1032
896
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1033
897
|
* documentation of pointer::offset.
|
|
1034
|
-
|
|
898
|
+
*/
|
|
899
|
+
int32_t zcashlc_scan_blocks(const uint8_t *fs_block_cache_root,
|
|
900
|
+
uintptr_t fs_block_cache_root_len,
|
|
901
|
+
const uint8_t *db_data,
|
|
902
|
+
uintptr_t db_data_len,
|
|
903
|
+
uint32_t scan_limit,
|
|
904
|
+
uint32_t network_id);
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* - `seed` must be non-null and valid for reads for `seed_len` bytes, and it must have an
|
|
1035
908
|
* alignment of `1`.
|
|
1036
|
-
* - The memory referenced by `
|
|
1037
|
-
* - The total size `
|
|
1038
|
-
*
|
|
909
|
+
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
910
|
+
* - The total size `seed_len` must be at least 32 no larger than `252`. See the safety documentation
|
|
911
|
+
* of pointer::offset.
|
|
1039
912
|
*/
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
uintptr_t tx_len,
|
|
1044
|
-
uint32_t _mined_height,
|
|
1045
|
-
uint32_t network_id);
|
|
913
|
+
bool zcashlc_seed_fingerprint(const uint8_t *seed,
|
|
914
|
+
uintptr_t seed_len,
|
|
915
|
+
uint8_t *signature_bytes_ret);
|
|
1046
916
|
|
|
1047
917
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
* Returns the row index of the newly-created transaction in the `transactions` table
|
|
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.
|
|
1053
|
-
*
|
|
1054
|
-
* Do not call this multiple times in parallel, or you will generate transactions that
|
|
1055
|
-
* double-spend the same notes.
|
|
918
|
+
* Shield transparent UTXOs by sending them to an address associated with the specified Sapling
|
|
919
|
+
* spending key.
|
|
1056
920
|
*
|
|
1057
921
|
* # Safety
|
|
1058
922
|
*
|
|
@@ -1067,10 +931,8 @@ int32_t zcashlc_decrypt_and_store_transaction(const uint8_t *db_data,
|
|
|
1067
931
|
* `zcashlc_derive_spending_key` functions.
|
|
1068
932
|
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the function call.
|
|
1069
933
|
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
1070
|
-
*
|
|
1071
|
-
* - `
|
|
1072
|
-
* - `memo` must either be null (indicating an empty memo or a transparent recipient) or point to a
|
|
1073
|
-
* 512-byte array.
|
|
934
|
+
* - `memo` must either be null (indicating an empty memo) or point to a 512-byte array.
|
|
935
|
+
* - `shielding_threshold` a non-negative shielding threshold amount in zatoshi
|
|
1074
936
|
* - `spend_params` must be non-null and valid for reads for `spend_params_len` bytes, and it must have an
|
|
1075
937
|
* alignment of `1`. Its contents must be the Sapling spend proving parameters.
|
|
1076
938
|
* - The memory referenced by `spend_params` must not be mutated for the duration of the function call.
|
|
@@ -1081,25 +943,39 @@ int32_t zcashlc_decrypt_and_store_transaction(const uint8_t *db_data,
|
|
|
1081
943
|
* - The memory referenced by `output_params` must not be mutated for the duration of the function call.
|
|
1082
944
|
* - The total size `output_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1083
945
|
* documentation of pointer::offset.
|
|
1084
|
-
* - `txid_bytes_ret` must be non-null and must point to an allocated 32-byte region of memory.
|
|
1085
946
|
*/
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
bool use_zip317_fees,
|
|
1100
|
-
uint8_t *txid_bytes_ret);
|
|
947
|
+
int64_t zcashlc_shield_funds(const uint8_t *db_data,
|
|
948
|
+
uintptr_t db_data_len,
|
|
949
|
+
const uint8_t *usk_ptr,
|
|
950
|
+
uintptr_t usk_len,
|
|
951
|
+
const uint8_t *memo,
|
|
952
|
+
uint64_t shielding_threshold,
|
|
953
|
+
const uint8_t *spend_params,
|
|
954
|
+
uintptr_t spend_params_len,
|
|
955
|
+
const uint8_t *output_params,
|
|
956
|
+
uintptr_t output_params_len,
|
|
957
|
+
uint32_t network_id,
|
|
958
|
+
uint32_t min_confirmations,
|
|
959
|
+
bool use_zip317_fees);
|
|
1101
960
|
|
|
1102
|
-
|
|
961
|
+
/**
|
|
962
|
+
* Obtains the unified full viewing key for the given binary-encoded unified spending key
|
|
963
|
+
* and returns the resulting encoded UFVK string. `usk_ptr` should point to an array of `usk_len`
|
|
964
|
+
* bytes containing a unified spending key encoded as returned from the `zcashlc_create_account`
|
|
965
|
+
* or `zcashlc_derive_spending_key` functions.
|
|
966
|
+
*
|
|
967
|
+
* # Safety
|
|
968
|
+
*
|
|
969
|
+
* - `usk_ptr` must be non-null and must point to an array of `usk_len` bytes.
|
|
970
|
+
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the function call.
|
|
971
|
+
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
972
|
+
* of pointer::offset.
|
|
973
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
974
|
+
* when you are done using it.
|
|
975
|
+
*/
|
|
976
|
+
char *zcashlc_spending_key_to_full_viewing_key(const uint8_t *usk_ptr,
|
|
977
|
+
uintptr_t usk_len,
|
|
978
|
+
uint32_t network_id);
|
|
1103
979
|
|
|
1104
980
|
/**
|
|
1105
981
|
* Frees strings returned by other zcashlc functions.
|
|
@@ -1111,47 +987,65 @@ int32_t zcashlc_branch_id_for_height(int32_t height, uint32_t network_id);
|
|
|
1111
987
|
void zcashlc_string_free(char *s);
|
|
1112
988
|
|
|
1113
989
|
/**
|
|
1114
|
-
*
|
|
1115
|
-
*
|
|
990
|
+
* Checks that the scanned blocks in the data database, when combined with the recent
|
|
991
|
+
* `CompactBlock`s in the block cache, form a valid chain.
|
|
992
|
+
*
|
|
993
|
+
* This function is built on the core assumption that the information provided in the
|
|
994
|
+
* block cache is more likely to be accurate than the previously-scanned information.
|
|
995
|
+
* This follows from the design (and trust) assumption that the `lightwalletd` server
|
|
996
|
+
* provides accurate block information as of the time it was requested.
|
|
997
|
+
*
|
|
998
|
+
* Returns:
|
|
999
|
+
* - `-1` if the combined chain is valid.
|
|
1000
|
+
* - `upper_bound` if the combined chain is invalid.
|
|
1001
|
+
* `upper_bound` is the height of the highest invalid block (on the assumption that the
|
|
1002
|
+
* highest block in the block cache is correct).
|
|
1003
|
+
* - `0` if there was an error during validation unrelated to chain validity.
|
|
1004
|
+
*
|
|
1005
|
+
* This function does not mutate either of the databases.
|
|
1116
1006
|
*
|
|
1117
1007
|
* # Safety
|
|
1118
1008
|
*
|
|
1009
|
+
* - `fs_block_db_root` must be non-null and valid for reads for `fs_block_db_root_len` bytes, and it must have an
|
|
1010
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1011
|
+
* operating system's preferred representation.
|
|
1012
|
+
* - The memory referenced by `fs_block_db_root` must not be mutated for the duration of the function call.
|
|
1013
|
+
* - The total size `fs_block_db_root_len` must be no larger than `isize::MAX`. See the safety
|
|
1014
|
+
* documentation of pointer::offset.
|
|
1119
1015
|
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1120
1016
|
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1121
1017
|
* operating system's preferred representation.
|
|
1122
1018
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1123
1019
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1124
1020
|
* documentation of pointer::offset.
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
*
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
*
|
|
1021
|
+
*/
|
|
1022
|
+
int32_t zcashlc_validate_combined_chain(const uint8_t *fs_block_db_root,
|
|
1023
|
+
uintptr_t fs_block_db_root_len,
|
|
1024
|
+
const uint8_t *db_data,
|
|
1025
|
+
uintptr_t db_data_len,
|
|
1026
|
+
uint32_t validate_limit,
|
|
1027
|
+
uint32_t network_id);
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Writes the blocks provided in `blocks_meta` into the `BlockMeta` database
|
|
1031
|
+
*
|
|
1032
|
+
* Returns true if the `blocks_meta` could be stored into the `FsBlockDb`. False
|
|
1033
|
+
* otherwise.
|
|
1034
|
+
*
|
|
1035
|
+
* When false is returned caller should check for errors.
|
|
1036
|
+
*
|
|
1037
|
+
* # Safety
|
|
1038
|
+
*
|
|
1039
|
+
* - `fs_block_db_root` must be non-null and valid for reads for `fs_block_db_root_len` bytes, and it must have an
|
|
1040
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1041
|
+
* operating system's preferred representation.
|
|
1042
|
+
* - The memory referenced by `fs_block_db_root` must not be mutated for the duration of the function call.
|
|
1043
|
+
* - The total size `fs_block_db_root_len` must be no larger than `isize::MAX`. See the safety
|
|
1141
1044
|
* documentation of pointer::offset.
|
|
1142
|
-
* - `
|
|
1045
|
+
* - Block metadata represented in `blocks_meta` must be non-null. Caller must guarantee that the
|
|
1046
|
+
* memory reference by this pointer is not freed up, dereferenced or invalidated while this function
|
|
1047
|
+
* is invoked.
|
|
1143
1048
|
*/
|
|
1144
|
-
bool
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
uintptr_t usk_len,
|
|
1148
|
-
const uint8_t *memo,
|
|
1149
|
-
uint64_t shielding_threshold,
|
|
1150
|
-
const uint8_t *spend_params,
|
|
1151
|
-
uintptr_t spend_params_len,
|
|
1152
|
-
const uint8_t *output_params,
|
|
1153
|
-
uintptr_t output_params_len,
|
|
1154
|
-
uint32_t network_id,
|
|
1155
|
-
uint32_t min_confirmations,
|
|
1156
|
-
bool use_zip317_fees,
|
|
1157
|
-
uint8_t *txid_bytes_ret);
|
|
1049
|
+
bool zcashlc_write_block_metadata(const uint8_t *fs_block_db_root,
|
|
1050
|
+
uintptr_t fs_block_db_root_len,
|
|
1051
|
+
FFIBlocksMeta *blocks_meta);
|