react-native-zcash 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +6 -3
- package/android/build.gradle +5 -4
- package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2240000.json +8 -0
- package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2250000.json +8 -0
- package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +94 -121
- package/ios/RNZcash.m +1 -12
- package/ios/RNZcash.swift +119 -152
- package/ios/ZCashLightClientKit/Block/Actions/Action.swift +98 -0
- package/ios/ZCashLightClientKit/Block/Actions/ClearAlreadyScannedBlocksAction.swift +35 -0
- package/ios/ZCashLightClientKit/Block/Actions/ClearCacheAction.swift +30 -0
- package/ios/ZCashLightClientKit/Block/Actions/DownloadAction.swift +67 -0
- package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +97 -0
- package/ios/ZCashLightClientKit/Block/Actions/FetchUTXOsAction.swift +33 -0
- package/ios/ZCashLightClientKit/Block/Actions/MigrateLegacyCacheDBAction.swift +70 -0
- package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +59 -0
- package/ios/ZCashLightClientKit/Block/Actions/RewindAction.swift +48 -0
- package/ios/ZCashLightClientKit/Block/Actions/SaplingParamsAction.swift +33 -0
- package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +95 -0
- package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +55 -0
- package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +58 -0
- package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +60 -0
- package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +421 -937
- package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +31 -17
- package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +2 -2
- package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +46 -15
- package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +4 -15
- package/ios/ZCashLightClientKit/Block/FilesystemStorage/FSCompactBlockRepository.swift +4 -4
- package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +10 -35
- package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +24 -0
- package/ios/ZCashLightClientKit/Block/Utils/SyncControlData.swift +25 -0
- package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +1 -2
- package/ios/ZCashLightClientKit/CombineSynchronizer.swift +2 -5
- package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +7 -25
- package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +40 -42
- package/ios/ZCashLightClientKit/DAO/UnspentTransactionOutputDao.swift +13 -4
- package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +9 -0
- package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +7 -10
- package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
- package/ios/ZCashLightClientKit/Error/ZcashError.swift +121 -12
- package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +43 -5
- package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +72 -6
- package/ios/ZCashLightClientKit/Extensions/Bool+ToData.swift +15 -0
- package/ios/ZCashLightClientKit/Extensions/Data+ToOtherTypes.swift +18 -0
- package/ios/ZCashLightClientKit/Extensions/Int+ToData.swift +15 -0
- package/ios/ZCashLightClientKit/Initializer.swift +47 -26
- package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +0 -12
- package/ios/ZCashLightClientKit/Model/Checkpoint.swift +12 -0
- package/ios/ZCashLightClientKit/Model/ScanProgress.swift +29 -0
- package/ios/ZCashLightClientKit/Model/ScanRange.swift +31 -0
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +15 -0
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/compact_formats.pb.swift +150 -46
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/compact_formats.proto +30 -16
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/service.proto +32 -6
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.grpc.swift +259 -22
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.pb.swift +193 -7
- package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +8 -0
- package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +18 -28
- package/ios/ZCashLightClientKit/Repository/CompactBlockRepository.swift +1 -1
- package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +2 -6
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2092500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2095000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2097500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2102500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2105000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2107500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2112500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2115000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2117500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2122500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2125000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2127500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2132500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2135000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2137500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2142500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2145000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2147500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2152500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2155000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2157500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2162500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2165000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2167500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2172500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2175000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2177500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2182500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2185000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2187500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2192500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2195000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2197500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2202500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2205000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2207500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2212500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2215000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2217500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2222500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2225000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2227500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2230000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2232500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2235000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2237500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2240000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2242500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2245000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2247500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2250000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2350000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2360000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2370000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2380000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2390000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2400000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2410000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2420000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2430000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2440000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2450000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2460000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2470000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2480000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2490000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2500000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2510000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2520000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2530000.json +8 -0
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +293 -158
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +58 -64
- package/ios/ZCashLightClientKit/Rust/zcashlc.h +618 -512
- package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +2 -8
- package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +3 -15
- package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +11 -30
- package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +41 -50
- package/ios/ZCashLightClientKit/Synchronizer.swift +51 -65
- 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/ZCashLightClientKit/Utils/ZcashFileManager.swift +16 -0
- package/ios/libzcashlc.xcframework/Info.plist +9 -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 +8 -30
- package/lib/rnzcash.rn.js.map +1 -1
- package/lib/src/react-native.d.ts +2 -4
- package/lib/src/types.d.ts +14 -14
- package/package.json +1 -1
- package/src/react-native.ts +11 -20
- package/src/types.ts +20 -23
- package/ios/ZCashLightClientKit/Block/Utils/InternalSyncProgress.swift +0 -200
- package/ios/ZCashLightClientKit/Block/Validate/BlockValidator.swift +0 -51
- package/ios/ZCashLightClientKit/DAO/BlockDao.swift +0 -112
- package/ios/ZCashLightClientKit/Entity/BlockProgress.swift +0 -24
|
@@ -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 FFIBinaryKey {
|
|
15
15
|
uint32_t account_id;
|
|
16
16
|
uint8_t *encoding;
|
|
17
17
|
uintptr_t encoding_len;
|
|
@@ -25,7 +25,7 @@ typedef struct {
|
|
|
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 FFIEncodedKey {
|
|
29
29
|
uint32_t account_id;
|
|
30
30
|
char *encoding;
|
|
31
31
|
} FFIEncodedKey;
|
|
@@ -47,12 +47,95 @@ typedef struct {
|
|
|
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
|
-
FFIEncodedKey *ptr;
|
|
50
|
+
typedef struct FFIEncodedKeys {
|
|
51
|
+
struct FFIEncodedKey *ptr;
|
|
52
52
|
uintptr_t len;
|
|
53
53
|
} FFIEncodedKeys;
|
|
54
54
|
|
|
55
|
-
|
|
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 {
|
|
56
139
|
uint32_t height;
|
|
57
140
|
uint8_t *block_hash_ptr;
|
|
58
141
|
uintptr_t block_hash_ptr_len;
|
|
@@ -61,18 +144,83 @@ typedef struct {
|
|
|
61
144
|
uint32_t orchard_actions_count;
|
|
62
145
|
} FFIBlockMeta;
|
|
63
146
|
|
|
64
|
-
typedef struct {
|
|
65
|
-
FFIBlockMeta *ptr;
|
|
147
|
+
typedef struct FFIBlocksMeta {
|
|
148
|
+
struct FFIBlockMeta *ptr;
|
|
66
149
|
uintptr_t len;
|
|
67
150
|
} FFIBlocksMeta;
|
|
68
151
|
|
|
69
|
-
|
|
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);
|
|
70
180
|
|
|
71
181
|
/**
|
|
72
182
|
* Clears the record of the last error message.
|
|
73
183
|
*/
|
|
74
184
|
void zcashlc_clear_last_error(void);
|
|
75
185
|
|
|
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
|
+
|
|
76
224
|
/**
|
|
77
225
|
* Adds the next available account-level spend authority, given the current set of [ZIP 316]
|
|
78
226
|
* account identifiers known, to the wallet database.
|
|
@@ -107,21 +255,67 @@ void zcashlc_clear_last_error(void);
|
|
|
107
255
|
*
|
|
108
256
|
* [ZIP 316]: https://zips.z.cash/zip-0316
|
|
109
257
|
*/
|
|
110
|
-
FFIBinaryKey *zcashlc_create_account(const uint8_t *db_data,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
258
|
+
struct FFIBinaryKey *zcashlc_create_account(const uint8_t *db_data,
|
|
259
|
+
uintptr_t db_data_len,
|
|
260
|
+
const uint8_t *seed,
|
|
261
|
+
uintptr_t seed_len,
|
|
262
|
+
const uint8_t *treestate,
|
|
263
|
+
uintptr_t treestate_len,
|
|
264
|
+
int64_t recover_until,
|
|
265
|
+
uint32_t network_id);
|
|
115
266
|
|
|
116
267
|
/**
|
|
117
|
-
*
|
|
268
|
+
* Frees an array of FFIEncodedKeys values as allocated by `zcashlc_derive_unified_viewing_keys_from_seed`
|
|
118
269
|
*
|
|
119
|
-
*
|
|
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.
|
|
270
|
+
* # Safety
|
|
122
271
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
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);
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Obtains the unified full viewing key for the given binary-encoded unified spending key
|
|
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.
|
|
303
|
+
*
|
|
304
|
+
* # Safety
|
|
305
|
+
*
|
|
306
|
+
* - `usk_ptr` must be non-null and must point to an array of `usk_len` bytes.
|
|
307
|
+
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the function call.
|
|
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.
|
|
125
319
|
*
|
|
126
320
|
* # Safety
|
|
127
321
|
*
|
|
@@ -131,43 +325,17 @@ FFIBinaryKey *zcashlc_create_account(const uint8_t *db_data,
|
|
|
131
325
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
132
326
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
133
327
|
* documentation of pointer::offset.
|
|
134
|
-
* - `
|
|
135
|
-
*
|
|
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.
|
|
328
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
329
|
+
* when done using it.
|
|
153
330
|
*/
|
|
154
|
-
|
|
331
|
+
char *zcashlc_get_current_address(const uint8_t *db_data,
|
|
155
332
|
uintptr_t db_data_len,
|
|
156
|
-
|
|
157
|
-
|
|
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);
|
|
333
|
+
int32_t account,
|
|
334
|
+
uint32_t network_id);
|
|
168
335
|
|
|
169
336
|
/**
|
|
170
|
-
*
|
|
337
|
+
* Returns a newly-generated unified payment address for the specified account, with the next
|
|
338
|
+
* available diversifier.
|
|
171
339
|
*
|
|
172
340
|
* # Safety
|
|
173
341
|
*
|
|
@@ -177,82 +345,96 @@ int64_t zcashlc_create_to_address(const uint8_t *db_data,
|
|
|
177
345
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
178
346
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
179
347
|
* documentation of pointer::offset.
|
|
180
|
-
* - `
|
|
181
|
-
*
|
|
182
|
-
|
|
183
|
-
*
|
|
348
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
349
|
+
* when done using it.
|
|
350
|
+
*/
|
|
351
|
+
char *zcashlc_get_next_available_address(const uint8_t *db_data,
|
|
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
|
|
184
367
|
* documentation of pointer::offset.
|
|
368
|
+
* - Call [`zcashlc_free_keys`] to free the memory associated with the returned pointer
|
|
369
|
+
* when done using it.
|
|
185
370
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
uint32_t _mined_height,
|
|
191
|
-
uint32_t network_id);
|
|
371
|
+
struct FFIEncodedKeys *zcashlc_list_transparent_receivers(const uint8_t *db_data,
|
|
372
|
+
uintptr_t db_data_len,
|
|
373
|
+
int32_t account_id,
|
|
374
|
+
uint32_t network_id);
|
|
192
375
|
|
|
193
376
|
/**
|
|
194
|
-
*
|
|
377
|
+
* Extracts the typecodes of the receivers within the given Unified Address.
|
|
195
378
|
*
|
|
196
|
-
* Returns
|
|
197
|
-
*
|
|
379
|
+
* Returns a pointer to a slice of typecodes. `len_ret` is set to the length of the
|
|
380
|
+
* slice.
|
|
381
|
+
*
|
|
382
|
+
* See the following sections of ZIP 316 for details on how to interpret typecodes:
|
|
383
|
+
* - [List of known typecodes](https://zips.z.cash/zip-0316#encoding-of-unified-addresses)
|
|
384
|
+
* - [Adding new types](https://zips.z.cash/zip-0316#adding-new-types)
|
|
385
|
+
* - [Metadata Items](https://zips.z.cash/zip-0316#metadata-items)
|
|
198
386
|
*
|
|
199
387
|
* # Safety
|
|
200
388
|
*
|
|
201
|
-
* - `
|
|
202
|
-
*
|
|
203
|
-
* -
|
|
204
|
-
*
|
|
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.
|
|
389
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string containing an
|
|
390
|
+
* encoded Unified Address.
|
|
391
|
+
* - Call [`zcashlc_free_typecodes`] to free the memory associated with the returned
|
|
392
|
+
* pointer when done using it.
|
|
208
393
|
*/
|
|
209
|
-
|
|
210
|
-
uintptr_t seed_len,
|
|
211
|
-
int32_t account,
|
|
212
|
-
uint32_t network_id);
|
|
394
|
+
uint32_t *zcashlc_get_typecodes_for_unified_address_receivers(const char *ua, uintptr_t *len_ret);
|
|
213
395
|
|
|
214
396
|
/**
|
|
215
|
-
*
|
|
397
|
+
* Frees a list of typecodes previously obtained from the FFI.
|
|
216
398
|
*
|
|
217
399
|
* # Safety
|
|
218
400
|
*
|
|
219
|
-
* - `
|
|
220
|
-
*
|
|
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.
|
|
401
|
+
* - `data` and `len` must have been obtained from
|
|
402
|
+
* [`zcashlc_get_typecodes_for_unified_address_receivers`].
|
|
224
403
|
*/
|
|
225
|
-
|
|
404
|
+
void zcashlc_free_typecodes(uint32_t *data, uintptr_t len);
|
|
226
405
|
|
|
227
406
|
/**
|
|
228
|
-
*
|
|
407
|
+
* Returns the transparent receiver within the given Unified Address, if any.
|
|
229
408
|
*
|
|
230
409
|
* # Safety
|
|
231
410
|
*
|
|
232
|
-
* - `
|
|
233
|
-
*
|
|
411
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
412
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
413
|
+
* when done using it.
|
|
234
414
|
*/
|
|
235
|
-
|
|
415
|
+
char *zcashlc_get_transparent_receiver_for_unified_address(const char *ua);
|
|
236
416
|
|
|
237
417
|
/**
|
|
238
|
-
*
|
|
418
|
+
* Returns the Sapling receiver within the given Unified Address, if any.
|
|
239
419
|
*
|
|
240
420
|
* # Safety
|
|
241
421
|
*
|
|
242
|
-
* - `
|
|
243
|
-
*
|
|
422
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
423
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
424
|
+
* when done using it.
|
|
244
425
|
*/
|
|
245
|
-
|
|
426
|
+
char *zcashlc_get_sapling_receiver_for_unified_address(const char *ua);
|
|
246
427
|
|
|
247
428
|
/**
|
|
248
|
-
*
|
|
429
|
+
* Returns true when the provided address decodes to a valid Sapling payment address for the
|
|
430
|
+
* specified network, false in any other case.
|
|
249
431
|
*
|
|
250
432
|
* # Safety
|
|
251
433
|
*
|
|
252
|
-
* - `
|
|
253
|
-
*
|
|
434
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
435
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
254
436
|
*/
|
|
255
|
-
|
|
437
|
+
bool zcashlc_is_valid_shielded_address(const char *address, uint32_t network_id);
|
|
256
438
|
|
|
257
439
|
/**
|
|
258
440
|
* Returns the network type and address kind for the given address string,
|
|
@@ -274,85 +456,64 @@ bool zcashlc_get_address_metadata(const char *address,
|
|
|
274
456
|
uint32_t *addr_kind_ret);
|
|
275
457
|
|
|
276
458
|
/**
|
|
277
|
-
* Returns
|
|
459
|
+
* Returns true when the address is a valid transparent payment address for the specified network,
|
|
460
|
+
* false in any other case.
|
|
278
461
|
*
|
|
279
462
|
* # Safety
|
|
280
463
|
*
|
|
281
|
-
* - `
|
|
282
|
-
*
|
|
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.
|
|
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.
|
|
287
466
|
*/
|
|
288
|
-
|
|
289
|
-
uintptr_t db_data_len,
|
|
290
|
-
int32_t account,
|
|
291
|
-
uint32_t network_id);
|
|
467
|
+
bool zcashlc_is_valid_transparent_address(const char *address, uint32_t network_id);
|
|
292
468
|
|
|
293
469
|
/**
|
|
294
|
-
* Returns the
|
|
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.
|
|
295
472
|
*
|
|
296
473
|
* # Safety
|
|
297
474
|
*
|
|
298
|
-
* - `
|
|
299
|
-
*
|
|
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.
|
|
475
|
+
* - `extsk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
476
|
+
* - The memory referenced by `extsk` must not be mutated for the duration of the function call.
|
|
306
477
|
*/
|
|
307
|
-
|
|
308
|
-
uintptr_t db_data_len,
|
|
309
|
-
int32_t account,
|
|
310
|
-
uint32_t network_id);
|
|
478
|
+
bool zcashlc_is_valid_sapling_extended_spending_key(const char *extsk, uint32_t network_id);
|
|
311
479
|
|
|
312
480
|
/**
|
|
313
|
-
* Returns the
|
|
314
|
-
*
|
|
481
|
+
* Returns true when the provided key decodes to a valid Sapling extended full viewing key for the
|
|
482
|
+
* specified network, false in any other case.
|
|
315
483
|
*
|
|
316
484
|
* # Safety
|
|
317
485
|
*
|
|
318
|
-
* - `
|
|
319
|
-
*
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
323
|
-
* documentation of pointer::offset.
|
|
324
|
-
*/
|
|
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);
|
|
486
|
+
* - `key` must be non-null and must point to a null-terminated UTF-8 string.
|
|
487
|
+
* - The memory referenced by `key` must not be mutated for the duration of the function call.
|
|
488
|
+
*/
|
|
489
|
+
bool zcashlc_is_valid_viewing_key(const char *key, uint32_t network_id);
|
|
329
490
|
|
|
330
491
|
/**
|
|
331
|
-
* Returns
|
|
332
|
-
*
|
|
492
|
+
* Returns true when the provided key decodes to a valid unified full viewing key for the
|
|
493
|
+
* specified network, false in any other case.
|
|
333
494
|
*
|
|
334
495
|
* # Safety
|
|
335
496
|
*
|
|
336
|
-
* - `
|
|
337
|
-
*
|
|
338
|
-
*
|
|
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.
|
|
497
|
+
* - `ufvk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
498
|
+
* - The memory referenced by `ufvk` must not be mutated for the duration of the
|
|
499
|
+
* function call.
|
|
344
500
|
*/
|
|
345
|
-
|
|
346
|
-
uintptr_t db_data_len,
|
|
347
|
-
int32_t account,
|
|
348
|
-
uint32_t network_id);
|
|
501
|
+
bool zcashlc_is_valid_unified_full_viewing_key(const char *ufvk, uint32_t network_id);
|
|
349
502
|
|
|
350
503
|
/**
|
|
351
|
-
* Returns
|
|
352
|
-
*
|
|
504
|
+
* Returns true when the provided key decodes to a valid unified address for the
|
|
505
|
+
* specified network, false in any other case.
|
|
506
|
+
*
|
|
507
|
+
* # Safety
|
|
353
508
|
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
509
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
510
|
+
* - The memory referenced by `address` must not be mutated for the duration of the
|
|
511
|
+
* function call.
|
|
512
|
+
*/
|
|
513
|
+
bool zcashlc_is_valid_unified_address(const char *address, uint32_t network_id);
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Returns the balance for the specified account, including all unspent notes that we know about.
|
|
356
517
|
*
|
|
357
518
|
* # Safety
|
|
358
519
|
*
|
|
@@ -362,19 +523,15 @@ char *zcashlc_get_next_available_address(const uint8_t *db_data,
|
|
|
362
523
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
363
524
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
364
525
|
* documentation of pointer::offset.
|
|
365
|
-
* - `memo_bytes_ret` must be non-null and must point to an allocated 512-byte region of memory.
|
|
366
526
|
*/
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
uint32_t network_id);
|
|
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);
|
|
372
531
|
|
|
373
532
|
/**
|
|
374
|
-
* Returns the
|
|
375
|
-
*
|
|
376
|
-
* The note is identified by its row index in the `received_notes` table within the data
|
|
377
|
-
* database.
|
|
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`.
|
|
378
535
|
*
|
|
379
536
|
* # Safety
|
|
380
537
|
*
|
|
@@ -384,31 +541,16 @@ bool zcashlc_get_received_memo(const uint8_t *db_data,
|
|
|
384
541
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
385
542
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
386
543
|
* documentation of pointer::offset.
|
|
387
|
-
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
388
|
-
* when done using it.
|
|
389
|
-
*/
|
|
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);
|
|
394
|
-
|
|
395
|
-
/**
|
|
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
544
|
*/
|
|
404
|
-
|
|
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);
|
|
405
550
|
|
|
406
551
|
/**
|
|
407
|
-
* Returns the
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
* The note is identified by its row index in the `sent_notes` table within the data
|
|
411
|
-
* database.
|
|
552
|
+
* Returns the verified transparent balance for `address`, which ignores utxos that have been
|
|
553
|
+
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
412
554
|
*
|
|
413
555
|
* # Safety
|
|
414
556
|
*
|
|
@@ -418,19 +560,18 @@ char *zcashlc_get_sapling_receiver_for_unified_address(const char *ua);
|
|
|
418
560
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
419
561
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
420
562
|
* documentation of pointer::offset.
|
|
421
|
-
* - `
|
|
563
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
564
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
422
565
|
*/
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
566
|
+
int64_t zcashlc_get_verified_transparent_balance(const uint8_t *db_data,
|
|
567
|
+
uintptr_t db_data_len,
|
|
568
|
+
const char *address,
|
|
569
|
+
uint32_t network_id,
|
|
570
|
+
uint32_t min_confirmations);
|
|
428
571
|
|
|
429
572
|
/**
|
|
430
|
-
* Returns the
|
|
431
|
-
*
|
|
432
|
-
* The note is identified by its row index in the `sent_notes` table within the data
|
|
433
|
-
* database.
|
|
573
|
+
* Returns the verified transparent balance for `account`, which ignores utxos that have been
|
|
574
|
+
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
434
575
|
*
|
|
435
576
|
* # Safety
|
|
436
577
|
*
|
|
@@ -440,13 +581,14 @@ bool zcashlc_get_sent_memo(const uint8_t *db_data,
|
|
|
440
581
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
441
582
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
442
583
|
* documentation of pointer::offset.
|
|
443
|
-
* -
|
|
444
|
-
*
|
|
584
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
585
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
445
586
|
*/
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
587
|
+
int64_t zcashlc_get_verified_transparent_balance_for_account(const uint8_t *db_data,
|
|
588
|
+
uintptr_t db_data_len,
|
|
589
|
+
uint32_t network_id,
|
|
590
|
+
int32_t account,
|
|
591
|
+
uint32_t min_confirmations);
|
|
450
592
|
|
|
451
593
|
/**
|
|
452
594
|
* Returns the balance for `address`, including all UTXOs that we know about.
|
|
@@ -487,39 +629,8 @@ int64_t zcashlc_get_total_transparent_balance_for_account(const uint8_t *db_data
|
|
|
487
629
|
int32_t account);
|
|
488
630
|
|
|
489
631
|
/**
|
|
490
|
-
* Returns the
|
|
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`.
|
|
632
|
+
* Returns the memo for a note by copying the corresponding bytes to the received
|
|
633
|
+
* pointer in `memo_bytes_ret`.
|
|
523
634
|
*
|
|
524
635
|
* # Safety
|
|
525
636
|
*
|
|
@@ -529,16 +640,19 @@ uint32_t *zcashlc_get_typecodes_for_unified_address_receivers(const char *ua, ui
|
|
|
529
640
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
530
641
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
531
642
|
* 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.
|
|
532
646
|
*/
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
647
|
+
bool zcashlc_get_memo(const uint8_t *db_data,
|
|
648
|
+
uintptr_t db_data_len,
|
|
649
|
+
const uint8_t *txid_bytes,
|
|
650
|
+
uint16_t output_index,
|
|
651
|
+
uint8_t *memo_bytes_ret,
|
|
652
|
+
uint32_t network_id);
|
|
538
653
|
|
|
539
654
|
/**
|
|
540
|
-
* Returns the
|
|
541
|
-
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
655
|
+
* Returns the memo for a note, if it is known and a valid UTF-8 string.
|
|
542
656
|
*
|
|
543
657
|
* # Safety
|
|
544
658
|
*
|
|
@@ -548,40 +662,34 @@ int64_t zcashlc_get_verified_balance(const uint8_t *db_data,
|
|
|
548
662
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
549
663
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
550
664
|
* documentation of pointer::offset.
|
|
551
|
-
* - `
|
|
552
|
-
*
|
|
665
|
+
* - `txid_bytes` must be non-null and valid for reads for 32 bytes, and it must have an alignment
|
|
666
|
+
* of `1`.
|
|
667
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
668
|
+
* when done using it.
|
|
553
669
|
*/
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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);
|
|
559
675
|
|
|
560
676
|
/**
|
|
561
|
-
* Returns
|
|
562
|
-
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
677
|
+
* Returns a ZIP-32 signature of the given seed bytes.
|
|
563
678
|
*
|
|
564
679
|
* # Safety
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
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.
|
|
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.
|
|
574
685
|
*/
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
int32_t account,
|
|
579
|
-
uint32_t min_confirmations);
|
|
686
|
+
bool zcashlc_seed_fingerprint(const uint8_t *seed,
|
|
687
|
+
uintptr_t seed_len,
|
|
688
|
+
uint8_t *signature_bytes_ret);
|
|
580
689
|
|
|
581
690
|
/**
|
|
582
|
-
*
|
|
583
|
-
*
|
|
584
|
-
* `zcashlc_create_account` for normal account creation purposes.
|
|
691
|
+
* Returns the most recent block height to which it is possible to reset the state
|
|
692
|
+
* of the data database.
|
|
585
693
|
*
|
|
586
694
|
* # Safety
|
|
587
695
|
*
|
|
@@ -591,42 +699,37 @@ int64_t zcashlc_get_verified_transparent_balance_for_account(const uint8_t *db_d
|
|
|
591
699
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
592
700
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
593
701
|
* 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.
|
|
599
702
|
*/
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
uint32_t network_id);
|
|
703
|
+
int32_t zcashlc_get_nearest_rewind_height(const uint8_t *db_data,
|
|
704
|
+
uintptr_t db_data_len,
|
|
705
|
+
int32_t height,
|
|
706
|
+
uint32_t network_id);
|
|
605
707
|
|
|
606
708
|
/**
|
|
709
|
+
* Rewinds the data database to the given height.
|
|
710
|
+
*
|
|
711
|
+
* If the requested height is greater than or equal to the height of the last scanned
|
|
712
|
+
* block, this function does nothing.
|
|
713
|
+
*
|
|
607
714
|
* # Safety
|
|
608
|
-
* Initializes the `FsBlockDb` sqlite database. Does nothing if already created
|
|
609
715
|
*
|
|
610
|
-
*
|
|
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
|
|
716
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
613
717
|
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
614
718
|
* operating system's preferred representation.
|
|
615
|
-
* - The memory referenced by `
|
|
616
|
-
* - The total size `
|
|
719
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
720
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
617
721
|
* documentation of pointer::offset.
|
|
618
722
|
*/
|
|
619
|
-
bool
|
|
620
|
-
|
|
723
|
+
bool zcashlc_rewind_to_height(const uint8_t *db_data,
|
|
724
|
+
uintptr_t db_data_len,
|
|
725
|
+
int32_t height,
|
|
726
|
+
uint32_t network_id);
|
|
621
727
|
|
|
622
728
|
/**
|
|
623
|
-
*
|
|
729
|
+
* Adds a sequence of Sapling subtree roots to the data store.
|
|
624
730
|
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
* The string represented by `sapling_tree_hex` should contain the encoded byte representation
|
|
629
|
-
* of a Sapling commitment tree.
|
|
731
|
+
* Returns true if the subtrees could be stored, false otherwise. When false is returned,
|
|
732
|
+
* caller should check for errors.
|
|
630
733
|
*
|
|
631
734
|
* # Safety
|
|
632
735
|
*
|
|
@@ -635,28 +738,24 @@ bool zcashlc_init_block_metadata_db(const uint8_t *fs_block_db_root,
|
|
|
635
738
|
* operating system's preferred representation.
|
|
636
739
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
637
740
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
638
|
-
* documentation of pointer::offset
|
|
639
|
-
* - `
|
|
640
|
-
* - The memory referenced by `
|
|
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.
|
|
741
|
+
* documentation of `pointer::offset`.
|
|
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.
|
|
644
744
|
*/
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
const char *sapling_tree_hex,
|
|
651
|
-
uint32_t network_id);
|
|
745
|
+
bool zcashlc_put_sapling_subtree_roots(const uint8_t *db_data,
|
|
746
|
+
uintptr_t db_data_len,
|
|
747
|
+
uint64_t start_index,
|
|
748
|
+
const struct FfiSubtreeRoots *roots,
|
|
749
|
+
uint32_t network_id);
|
|
652
750
|
|
|
653
751
|
/**
|
|
654
|
-
*
|
|
655
|
-
* null pointer if the caller wishes to attempt migrations without providing the wallet's seed
|
|
656
|
-
* value.
|
|
752
|
+
* Updates the wallet's view of the blockchain.
|
|
657
753
|
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
754
|
+
* This method is used to provide the wallet with information about the state of the blockchain,
|
|
755
|
+
* and detect any previously scanned data that needs to be re-validated before proceeding with
|
|
756
|
+
* scanning. It should be called at wallet startup prior to calling `zcashlc_suggest_scan_ranges`
|
|
757
|
+
* in order to provide the wallet with the information it needs to correctly prioritize scanning
|
|
758
|
+
* operations.
|
|
660
759
|
*
|
|
661
760
|
* # Safety
|
|
662
761
|
*
|
|
@@ -665,133 +764,147 @@ int32_t zcashlc_init_blocks_table(const uint8_t *db_data,
|
|
|
665
764
|
* operating system's preferred representation.
|
|
666
765
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
667
766
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
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.
|
|
767
|
+
* documentation of `pointer::offset`.
|
|
674
768
|
*/
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
uint32_t network_id);
|
|
769
|
+
bool zcashlc_update_chain_tip(const uint8_t *db_data,
|
|
770
|
+
uintptr_t db_data_len,
|
|
771
|
+
int32_t height,
|
|
772
|
+
uint32_t network_id);
|
|
680
773
|
|
|
681
774
|
/**
|
|
682
|
-
* Returns
|
|
683
|
-
* specified network, false in any other case.
|
|
775
|
+
* Returns the height to which the wallet has been fully scanned.
|
|
684
776
|
*
|
|
685
|
-
*
|
|
777
|
+
* This is the height for which the wallet has fully trial-decrypted this and all
|
|
778
|
+
* preceding blocks above the wallet's birthday height.
|
|
686
779
|
*
|
|
687
|
-
*
|
|
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);
|
|
691
|
-
|
|
692
|
-
/**
|
|
693
|
-
* Returns true when the provided address decodes to a valid Sapling payment address for the
|
|
694
|
-
* specified network, false in any other case.
|
|
780
|
+
* Returns a non-negative block height, -1 if empty, or -2 if an error occurred.
|
|
695
781
|
*
|
|
696
782
|
* # Safety
|
|
697
783
|
*
|
|
698
|
-
* - `
|
|
699
|
-
*
|
|
784
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
785
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
786
|
+
* operating system's preferred representation.
|
|
787
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
788
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
789
|
+
* documentation of `pointer::offset`.
|
|
700
790
|
*/
|
|
701
|
-
|
|
791
|
+
int64_t zcashlc_fully_scanned_height(const uint8_t *db_data,
|
|
792
|
+
uintptr_t db_data_len,
|
|
793
|
+
uint32_t network_id);
|
|
702
794
|
|
|
703
795
|
/**
|
|
704
|
-
* Returns
|
|
705
|
-
* false in any other case.
|
|
796
|
+
* Returns the maximum height that the wallet has scanned.
|
|
706
797
|
*
|
|
707
|
-
*
|
|
798
|
+
* If the wallet is fully synced, this will be equivalent to `zcashlc_block_fully_scanned`;
|
|
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.
|
|
708
801
|
*
|
|
709
|
-
*
|
|
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.
|
|
802
|
+
* Returns a non-negative block height, -1 if empty, or -2 if an error occurred.
|
|
717
803
|
*
|
|
718
804
|
* # Safety
|
|
719
|
-
*
|
|
720
|
-
* - `
|
|
721
|
-
*
|
|
722
|
-
*
|
|
805
|
+
*
|
|
806
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
807
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
808
|
+
* operating system's preferred representation.
|
|
809
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
810
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
811
|
+
* documentation of `pointer::offset`.
|
|
723
812
|
*/
|
|
724
|
-
|
|
813
|
+
int64_t zcashlc_max_scanned_height(const uint8_t *db_data,
|
|
814
|
+
uintptr_t db_data_len,
|
|
815
|
+
uint32_t network_id);
|
|
725
816
|
|
|
726
817
|
/**
|
|
727
|
-
* Returns
|
|
728
|
-
* specified network, false in any other case.
|
|
818
|
+
* Returns the scan progress derived from the current wallet state.
|
|
729
819
|
*
|
|
730
820
|
* # Safety
|
|
731
821
|
*
|
|
732
|
-
* - `
|
|
733
|
-
*
|
|
822
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must
|
|
823
|
+
* have an alignment of `1`. Its contents must be a string representing a valid system
|
|
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
|
|
734
826
|
* function call.
|
|
827
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
828
|
+
* documentation of pointer::offset.
|
|
735
829
|
*/
|
|
736
|
-
|
|
830
|
+
struct FfiScanProgress zcashlc_get_scan_progress(const uint8_t *db_data,
|
|
831
|
+
uintptr_t db_data_len,
|
|
832
|
+
uint32_t network_id);
|
|
737
833
|
|
|
738
834
|
/**
|
|
739
|
-
*
|
|
740
|
-
* specified network, false in any other case.
|
|
835
|
+
* Frees an array of FfiScanRanges values as allocated by `zcashlc_derive_unified_viewing_keys_from_seed`
|
|
741
836
|
*
|
|
742
837
|
* # Safety
|
|
743
838
|
*
|
|
744
|
-
* - `
|
|
745
|
-
*
|
|
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.
|
|
839
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiScanRanges`].
|
|
840
|
+
* See the safety documentation of [`FfiScanRanges`].
|
|
751
841
|
*/
|
|
752
|
-
|
|
842
|
+
void zcashlc_free_scan_ranges(struct FfiScanRanges *ptr);
|
|
753
843
|
|
|
754
844
|
/**
|
|
755
|
-
*
|
|
845
|
+
* Returns a list of suggested scan ranges based upon the current wallet state.
|
|
756
846
|
*
|
|
757
|
-
*
|
|
847
|
+
* This method should only be used in cases where the `CompactBlock` data that will be
|
|
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.
|
|
758
851
|
*
|
|
759
852
|
* # Safety
|
|
760
853
|
*
|
|
761
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must
|
|
762
|
-
* alignment of `1`. Its contents must be a string representing a valid system
|
|
763
|
-
* operating system's preferred representation.
|
|
764
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the
|
|
854
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must
|
|
855
|
+
* have an alignment of `1`. Its contents must be a string representing a valid system
|
|
856
|
+
* path in the operating system's preferred representation.
|
|
857
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the
|
|
858
|
+
* function call.
|
|
765
859
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
766
860
|
* documentation of pointer::offset.
|
|
767
|
-
* - `
|
|
768
|
-
*
|
|
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.
|
|
861
|
+
* - Call [`zcashlc_free_scan_ranges`] to free the memory associated with the returned
|
|
862
|
+
* pointer when done using it.
|
|
772
863
|
*/
|
|
773
|
-
|
|
774
|
-
|
|
864
|
+
struct FfiScanRanges *zcashlc_suggest_scan_ranges(const uint8_t *db_data,
|
|
865
|
+
uintptr_t db_data_len,
|
|
866
|
+
uint32_t network_id);
|
|
775
867
|
|
|
776
868
|
/**
|
|
777
|
-
*
|
|
778
|
-
*
|
|
869
|
+
* Scans new blocks added to the cache for any transactions received by the tracked
|
|
870
|
+
* accounts, while checking that they form a valid chan.
|
|
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.
|
|
779
885
|
*
|
|
780
886
|
* # Safety
|
|
781
887
|
*
|
|
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.
|
|
782
894
|
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
783
895
|
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
784
896
|
* operating system's preferred representation.
|
|
785
897
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
786
898
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
787
899
|
* documentation of pointer::offset.
|
|
788
|
-
* - Call [`zcashlc_free_keys`] to free the memory associated with the returned pointer
|
|
789
|
-
* when done using it.
|
|
790
900
|
*/
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
901
|
+
int32_t zcashlc_scan_blocks(const uint8_t *fs_block_cache_root,
|
|
902
|
+
uintptr_t fs_block_cache_root_len,
|
|
903
|
+
const uint8_t *db_data,
|
|
904
|
+
uintptr_t db_data_len,
|
|
905
|
+
int32_t from_height,
|
|
906
|
+
uint32_t scan_limit,
|
|
907
|
+
uint32_t network_id);
|
|
795
908
|
|
|
796
909
|
/**
|
|
797
910
|
* Inserts a UTXO into the wallet database.
|
|
@@ -826,6 +939,46 @@ bool zcashlc_put_utxo(const uint8_t *db_data,
|
|
|
826
939
|
int32_t height,
|
|
827
940
|
uint32_t network_id);
|
|
828
941
|
|
|
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
|
+
|
|
829
982
|
/**
|
|
830
983
|
* Rewinds the data database to the given height.
|
|
831
984
|
*
|
|
@@ -846,10 +999,9 @@ bool zcashlc_rewind_fs_block_cache_to_height(const uint8_t *fs_block_db_root,
|
|
|
846
999
|
int32_t height);
|
|
847
1000
|
|
|
848
1001
|
/**
|
|
849
|
-
*
|
|
1002
|
+
* Get the latest cached block height in the filesystem block cache
|
|
850
1003
|
*
|
|
851
|
-
*
|
|
852
|
-
* block, this function does nothing.
|
|
1004
|
+
* Returns a non-negative block height, -1 if empty, or -2 if an error occurred.
|
|
853
1005
|
*
|
|
854
1006
|
* # Safety
|
|
855
1007
|
*
|
|
@@ -859,64 +1011,48 @@ bool zcashlc_rewind_fs_block_cache_to_height(const uint8_t *fs_block_db_root,
|
|
|
859
1011
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
860
1012
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
861
1013
|
* 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.
|
|
862
1019
|
*/
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
int32_t height,
|
|
866
|
-
uint32_t network_id);
|
|
1020
|
+
int32_t zcashlc_latest_cached_block_height(const uint8_t *fs_block_db_root,
|
|
1021
|
+
uintptr_t fs_block_db_root_len);
|
|
867
1022
|
|
|
868
1023
|
/**
|
|
869
|
-
*
|
|
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.
|
|
1024
|
+
* Decrypts whatever parts of the specified transaction it can and stores them in db_data.
|
|
883
1025
|
*
|
|
884
1026
|
* # Safety
|
|
885
1027
|
*
|
|
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.
|
|
892
1028
|
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
893
1029
|
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
894
1030
|
* operating system's preferred representation.
|
|
895
1031
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
896
1032
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
897
1033
|
* documentation of pointer::offset.
|
|
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
|
|
1034
|
+
* - `tx` must be non-null and valid for reads for `tx_len` bytes, and it must have an
|
|
908
1035
|
* alignment of `1`.
|
|
909
|
-
* - The memory referenced by `
|
|
910
|
-
* - The total size `
|
|
911
|
-
* of pointer::offset.
|
|
1036
|
+
* - The memory referenced by `tx` must not be mutated for the duration of the function call.
|
|
1037
|
+
* - The total size `tx_len` must be no larger than `isize::MAX`. See the safety
|
|
1038
|
+
* documentation of pointer::offset.
|
|
912
1039
|
*/
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1040
|
+
int32_t zcashlc_decrypt_and_store_transaction(const uint8_t *db_data,
|
|
1041
|
+
uintptr_t db_data_len,
|
|
1042
|
+
const uint8_t *tx,
|
|
1043
|
+
uintptr_t tx_len,
|
|
1044
|
+
uint32_t _mined_height,
|
|
1045
|
+
uint32_t network_id);
|
|
916
1046
|
|
|
917
1047
|
/**
|
|
918
|
-
*
|
|
919
|
-
*
|
|
1048
|
+
* Creates a transaction paying the specified address from the given account.
|
|
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.
|
|
920
1056
|
*
|
|
921
1057
|
* # Safety
|
|
922
1058
|
*
|
|
@@ -931,8 +1067,10 @@ bool zcashlc_seed_fingerprint(const uint8_t *seed,
|
|
|
931
1067
|
* `zcashlc_derive_spending_key` functions.
|
|
932
1068
|
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the function call.
|
|
933
1069
|
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
934
|
-
*
|
|
935
|
-
* - `
|
|
1070
|
+
* of pointer::offset.
|
|
1071
|
+
* - `to` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1072
|
+
* - `memo` must either be null (indicating an empty memo or a transparent recipient) or point to a
|
|
1073
|
+
* 512-byte array.
|
|
936
1074
|
* - `spend_params` must be non-null and valid for reads for `spend_params_len` bytes, and it must have an
|
|
937
1075
|
* alignment of `1`. Its contents must be the Sapling spend proving parameters.
|
|
938
1076
|
* - The memory referenced by `spend_params` must not be mutated for the duration of the function call.
|
|
@@ -943,39 +1081,25 @@ bool zcashlc_seed_fingerprint(const uint8_t *seed,
|
|
|
943
1081
|
* - The memory referenced by `output_params` must not be mutated for the duration of the function call.
|
|
944
1082
|
* - The total size `output_params_len` must be no larger than `isize::MAX`. See the safety
|
|
945
1083
|
* documentation of pointer::offset.
|
|
1084
|
+
* - `txid_bytes_ret` must be non-null and must point to an allocated 32-byte region of memory.
|
|
946
1085
|
*/
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1086
|
+
bool zcashlc_create_to_address(const uint8_t *db_data,
|
|
1087
|
+
uintptr_t db_data_len,
|
|
1088
|
+
const uint8_t *usk_ptr,
|
|
1089
|
+
uintptr_t usk_len,
|
|
1090
|
+
const char *to,
|
|
1091
|
+
int64_t value,
|
|
1092
|
+
const uint8_t *memo,
|
|
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);
|
|
960
1101
|
|
|
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);
|
|
1102
|
+
int32_t zcashlc_branch_id_for_height(int32_t height, uint32_t network_id);
|
|
979
1103
|
|
|
980
1104
|
/**
|
|
981
1105
|
* Frees strings returned by other zcashlc functions.
|
|
@@ -987,65 +1111,47 @@ char *zcashlc_spending_key_to_full_viewing_key(const uint8_t *usk_ptr,
|
|
|
987
1111
|
void zcashlc_string_free(char *s);
|
|
988
1112
|
|
|
989
1113
|
/**
|
|
990
|
-
*
|
|
991
|
-
*
|
|
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.
|
|
1114
|
+
* Shield transparent UTXOs by sending them to an address associated with the specified Sapling
|
|
1115
|
+
* spending key.
|
|
1006
1116
|
*
|
|
1007
1117
|
* # Safety
|
|
1008
1118
|
*
|
|
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.
|
|
1015
1119
|
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1016
1120
|
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1017
1121
|
* operating system's preferred representation.
|
|
1018
1122
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1019
1123
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1020
1124
|
* documentation of pointer::offset.
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
*
|
|
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
|
|
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
|
+
* - `shielding_threshold` a non-negative shielding threshold amount in zatoshi
|
|
1132
|
+
* - `spend_params` must be non-null and valid for reads for `spend_params_len` bytes, and it must have an
|
|
1133
|
+
* alignment of `1`. Its contents must be the Sapling spend proving parameters.
|
|
1134
|
+
* - The memory referenced by `spend_params` must not be mutated for the duration of the function call.
|
|
1135
|
+
* - The total size `spend_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1044
1136
|
* documentation of pointer::offset.
|
|
1045
|
-
* -
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1137
|
+
* - `output_params` must be non-null and valid for reads for `output_params_len` bytes, and it must have an
|
|
1138
|
+
* alignment of `1`. Its contents must be the Sapling output proving parameters.
|
|
1139
|
+
* - The memory referenced by `output_params` must not be mutated for the duration of the function call.
|
|
1140
|
+
* - The total size `output_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1141
|
+
* documentation of pointer::offset.
|
|
1142
|
+
* - `txid_bytes_ret` must be non-null and must point to an allocated 32-byte region of memory.
|
|
1048
1143
|
*/
|
|
1049
|
-
bool
|
|
1050
|
-
|
|
1051
|
-
|
|
1144
|
+
bool zcashlc_shield_funds(const uint8_t *db_data,
|
|
1145
|
+
uintptr_t db_data_len,
|
|
1146
|
+
const uint8_t *usk_ptr,
|
|
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);
|