react-native-zcash 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +7 -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 +221 -169
- package/android/src/main/java/app/edge/rnzcash/RNZcashPackage.kt +1 -2
- package/ios/RNZcash.m +5 -8
- package/ios/RNZcash.swift +177 -137
- 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 +4 -0
- 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 +29 -29
- package/lib/rnzcash.rn.js.map +1 -1
- package/lib/src/react-native.d.ts +5 -5
- package/lib/src/types.d.ts +27 -15
- package/package.json +2 -1
- package/src/react-native.ts +40 -21
- package/src/types.ts +36 -24
- 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
|
@@ -8,6 +8,22 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
import SQLite
|
|
10
10
|
|
|
11
|
+
extension Connection {
|
|
12
|
+
public func scalarLocked<V: Value>(_ query: ScalarQuery<V?>) throws -> V.ValueType? {
|
|
13
|
+
globalDBLock.lock()
|
|
14
|
+
defer { globalDBLock.unlock() }
|
|
15
|
+
|
|
16
|
+
return try scalar(query)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public func scalarLocked<V: Value>(_ query: ScalarQuery<V>) throws -> V {
|
|
20
|
+
globalDBLock.lock()
|
|
21
|
+
defer { globalDBLock.unlock() }
|
|
22
|
+
|
|
23
|
+
return try scalar(query)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
11
27
|
class TransactionSQLDAO: TransactionRepository {
|
|
12
28
|
enum NotesTableStructure {
|
|
13
29
|
static let transactionID = Expression<Int>("tx")
|
|
@@ -16,14 +32,12 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
16
32
|
|
|
17
33
|
let dbProvider: ConnectionProvider
|
|
18
34
|
|
|
19
|
-
private let blockDao: BlockSQLDAO
|
|
20
35
|
private let transactionsView = View("v_transactions")
|
|
21
36
|
private let txOutputsView = View("v_tx_outputs")
|
|
22
37
|
private let traceClosure: ((String) -> Void)?
|
|
23
38
|
|
|
24
39
|
init(dbProvider: ConnectionProvider, traceClosure: ((String) -> Void)? = nil) {
|
|
25
40
|
self.dbProvider = dbProvider
|
|
26
|
-
self.blockDao = BlockSQLDAO(dbProvider: dbProvider)
|
|
27
41
|
self.traceClosure = traceClosure
|
|
28
42
|
}
|
|
29
43
|
|
|
@@ -37,25 +51,13 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
37
51
|
dbProvider.close()
|
|
38
52
|
}
|
|
39
53
|
|
|
40
|
-
func blockForHeight(_ height: BlockHeight) async throws -> Block? {
|
|
41
|
-
try blockDao.block(at: height)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
func lastScannedHeight() async throws -> BlockHeight {
|
|
45
|
-
try blockDao.latestBlockHeight()
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
func lastScannedBlock() async throws -> Block? {
|
|
49
|
-
try blockDao.latestBlock()
|
|
50
|
-
}
|
|
51
|
-
|
|
52
54
|
func isInitialized() async throws -> Bool {
|
|
53
55
|
true
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
func countAll() async throws -> Int {
|
|
57
59
|
do {
|
|
58
|
-
return try connection().
|
|
60
|
+
return try connection().scalarLocked(transactionsView.count)
|
|
59
61
|
} catch {
|
|
60
62
|
throw ZcashError.transactionRepositoryCountAll(error)
|
|
61
63
|
}
|
|
@@ -63,20 +65,12 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
63
65
|
|
|
64
66
|
func countUnmined() async throws -> Int {
|
|
65
67
|
do {
|
|
66
|
-
return try connection().
|
|
68
|
+
return try connection().scalarLocked(transactionsView.filter(ZcashTransaction.Overview.Column.minedHeight == nil).count)
|
|
67
69
|
} catch {
|
|
68
70
|
throw ZcashError.transactionRepositoryCountUnmined(error)
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
func find(id: Int) async throws -> ZcashTransaction.Overview {
|
|
73
|
-
let query = transactionsView
|
|
74
|
-
.filter(ZcashTransaction.Overview.Column.id == id)
|
|
75
|
-
.limit(1)
|
|
76
|
-
|
|
77
|
-
return try execute(query) { try ZcashTransaction.Overview(row: $0) }
|
|
78
|
-
}
|
|
79
|
-
|
|
80
74
|
func find(rawID: Data) async throws -> ZcashTransaction.Overview {
|
|
81
75
|
let query = transactionsView
|
|
82
76
|
.filter(ZcashTransaction.Overview.Column.rawID == Blob(bytes: rawID.bytes))
|
|
@@ -87,7 +81,7 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
87
81
|
|
|
88
82
|
func find(offset: Int, limit: Int, kind: TransactionKind) async throws -> [ZcashTransaction.Overview] {
|
|
89
83
|
let query = transactionsView
|
|
90
|
-
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc
|
|
84
|
+
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc)
|
|
91
85
|
.filterQueryFor(kind: kind)
|
|
92
86
|
.limit(limit, offset: offset)
|
|
93
87
|
|
|
@@ -96,7 +90,7 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
96
90
|
|
|
97
91
|
func find(in range: CompactBlockRange, limit: Int, kind: TransactionKind) async throws -> [ZcashTransaction.Overview] {
|
|
98
92
|
let query = transactionsView
|
|
99
|
-
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc
|
|
93
|
+
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc)
|
|
100
94
|
.filter(
|
|
101
95
|
ZcashTransaction.Overview.Column.minedHeight >= BlockHeight(range.lowerBound) &&
|
|
102
96
|
ZcashTransaction.Overview.Column.minedHeight <= BlockHeight(range.upperBound)
|
|
@@ -109,17 +103,18 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
109
103
|
|
|
110
104
|
func find(from transaction: ZcashTransaction.Overview, limit: Int, kind: TransactionKind) async throws -> [ZcashTransaction.Overview] {
|
|
111
105
|
guard
|
|
112
|
-
let
|
|
113
|
-
let transactionBlockTime = transaction.blockTime
|
|
106
|
+
let transactionBlockHeight = transaction.minedHeight
|
|
114
107
|
else { throw ZcashError.transactionRepositoryTransactionMissingRequiredFields }
|
|
115
108
|
|
|
109
|
+
let transactionIndex = transaction.index ?? Int.max
|
|
116
110
|
let query = transactionsView
|
|
117
|
-
.order(
|
|
118
|
-
(ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc, ZcashTransaction.Overview.Column.id.desc
|
|
119
|
-
)
|
|
111
|
+
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc)
|
|
120
112
|
.filter(
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
transactionBlockHeight > ZcashTransaction.Overview.Column.minedHeight
|
|
114
|
+
|| (
|
|
115
|
+
transactionBlockHeight == ZcashTransaction.Overview.Column.minedHeight &&
|
|
116
|
+
transactionIndex > (ZcashTransaction.Overview.Column.index ?? -1)
|
|
117
|
+
)
|
|
123
118
|
)
|
|
124
119
|
.filterQueryFor(kind: kind)
|
|
125
120
|
.limit(limit)
|
|
@@ -130,7 +125,7 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
130
125
|
func findReceived(offset: Int, limit: Int) async throws -> [ZcashTransaction.Overview] {
|
|
131
126
|
let query = transactionsView
|
|
132
127
|
.filterQueryFor(kind: .received)
|
|
133
|
-
.order(
|
|
128
|
+
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc)
|
|
134
129
|
.limit(limit, offset: offset)
|
|
135
130
|
|
|
136
131
|
return try execute(query) { try ZcashTransaction.Overview(row: $0) }
|
|
@@ -139,7 +134,7 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
139
134
|
func findSent(offset: Int, limit: Int) async throws -> [ZcashTransaction.Overview] {
|
|
140
135
|
let query = transactionsView
|
|
141
136
|
.filterQueryFor(kind: .sent)
|
|
142
|
-
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc
|
|
137
|
+
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc)
|
|
143
138
|
.limit(limit, offset: offset)
|
|
144
139
|
|
|
145
140
|
return try execute(query) { try ZcashTransaction.Overview(row: $0) }
|
|
@@ -148,7 +143,7 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
148
143
|
func findPendingTransactions(latestHeight: BlockHeight, offset: Int, limit: Int) async throws -> [ZcashTransaction.Overview] {
|
|
149
144
|
let query = transactionsView
|
|
150
145
|
.filterPendingFrom(latestHeight)
|
|
151
|
-
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc
|
|
146
|
+
.order((ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc)
|
|
152
147
|
.limit(limit, offset: offset)
|
|
153
148
|
|
|
154
149
|
return try execute(query) { try ZcashTransaction.Overview(row: $0) }
|
|
@@ -156,22 +151,22 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
156
151
|
|
|
157
152
|
func findMemos(for transaction: ZcashTransaction.Overview) async throws -> [Memo] {
|
|
158
153
|
do {
|
|
159
|
-
return try await getTransactionOutputs(for: transaction.
|
|
154
|
+
return try await getTransactionOutputs(for: transaction.rawID)
|
|
160
155
|
.compactMap { $0.memo }
|
|
161
156
|
} catch {
|
|
162
157
|
throw ZcashError.transactionRepositoryFindMemos(error)
|
|
163
158
|
}
|
|
164
159
|
}
|
|
165
160
|
|
|
166
|
-
func getTransactionOutputs(for
|
|
161
|
+
func getTransactionOutputs(for rawID: Data) async throws -> [ZcashTransaction.Output] {
|
|
167
162
|
let query = self.txOutputsView
|
|
168
|
-
.filter(ZcashTransaction.Output.Column.
|
|
163
|
+
.filter(ZcashTransaction.Output.Column.rawID == Blob(bytes: rawID.bytes))
|
|
169
164
|
|
|
170
165
|
return try execute(query) { try ZcashTransaction.Output(row: $0) }
|
|
171
166
|
}
|
|
172
167
|
|
|
173
|
-
func getRecipients(for
|
|
174
|
-
try await getTransactionOutputs(for:
|
|
168
|
+
func getRecipients(for rawID: Data) async throws -> [TransactionRecipient] {
|
|
169
|
+
try await getTransactionOutputs(for: rawID).map { $0.recipient }
|
|
175
170
|
}
|
|
176
171
|
|
|
177
172
|
private func execute<Entity>(_ query: View, createEntity: (Row) throws -> Entity) throws -> Entity {
|
|
@@ -181,11 +176,14 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
181
176
|
}
|
|
182
177
|
|
|
183
178
|
private func execute<Entity>(_ query: View, createEntity: (Row) throws -> Entity) throws -> [Entity] {
|
|
179
|
+
globalDBLock.lock()
|
|
180
|
+
defer { globalDBLock.unlock() }
|
|
181
|
+
|
|
184
182
|
do {
|
|
185
183
|
let entities = try connection()
|
|
186
184
|
.prepare(query)
|
|
187
185
|
.map(createEntity)
|
|
188
|
-
|
|
186
|
+
|
|
189
187
|
return entities
|
|
190
188
|
} catch {
|
|
191
189
|
if let error = error as? ZcashError {
|
|
@@ -109,6 +109,9 @@ class UnspentTransactionOutputSQLDAO: UnspentTransactionOutputRepository {
|
|
|
109
109
|
)
|
|
110
110
|
"""
|
|
111
111
|
do {
|
|
112
|
+
globalDBLock.lock()
|
|
113
|
+
defer { globalDBLock.unlock() }
|
|
114
|
+
|
|
112
115
|
try dbProvider.connection().run(stringStatement)
|
|
113
116
|
} catch {
|
|
114
117
|
throw ZcashError.unspentTransactionOutputDAOCreateTable(error)
|
|
@@ -118,8 +121,11 @@ class UnspentTransactionOutputSQLDAO: UnspentTransactionOutputRepository {
|
|
|
118
121
|
/// - Throws: `unspentTransactionOutputDAOStore` if sqlite query fails.
|
|
119
122
|
func store(utxos: [UnspentTransactionOutputEntity]) async throws {
|
|
120
123
|
do {
|
|
124
|
+
globalDBLock.lock()
|
|
125
|
+
defer { globalDBLock.unlock() }
|
|
126
|
+
|
|
121
127
|
let db = try dbProvider.connection()
|
|
122
|
-
try
|
|
128
|
+
try db.transaction {
|
|
123
129
|
for utxo in utxos.map({ $0 as? UTXO ?? $0.asUTXO() }) {
|
|
124
130
|
try db.run(table.insert(utxo))
|
|
125
131
|
}
|
|
@@ -132,6 +138,9 @@ class UnspentTransactionOutputSQLDAO: UnspentTransactionOutputRepository {
|
|
|
132
138
|
/// - Throws: `unspentTransactionOutputDAOClearAll` if sqlite query fails.
|
|
133
139
|
func clearAll(address: String?) async throws {
|
|
134
140
|
do {
|
|
141
|
+
globalDBLock.lock()
|
|
142
|
+
defer { globalDBLock.unlock() }
|
|
143
|
+
|
|
135
144
|
if let tAddr = address {
|
|
136
145
|
try dbProvider.connection().run(table.filter(TableColumns.address == tAddr).delete())
|
|
137
146
|
} else {
|
|
@@ -178,16 +187,16 @@ class UnspentTransactionOutputSQLDAO: UnspentTransactionOutputRepository {
|
|
|
178
187
|
/// - Throws: `unspentTransactionOutputDAOBalance` if sqlite query fails.
|
|
179
188
|
func balance(address: String, latestHeight: BlockHeight) async throws -> WalletBalance {
|
|
180
189
|
do {
|
|
181
|
-
let verified = try dbProvider.connection().
|
|
190
|
+
let verified = try dbProvider.connection().scalarLocked(
|
|
182
191
|
table.select(TableColumns.valueZat.sum)
|
|
183
192
|
.filter(TableColumns.address == address)
|
|
184
193
|
.filter(TableColumns.height <= latestHeight - ZcashSDK.defaultStaleTolerance)
|
|
185
194
|
) ?? 0
|
|
186
|
-
let total = try dbProvider.connection().
|
|
195
|
+
let total = try dbProvider.connection().scalarLocked(
|
|
187
196
|
table.select(TableColumns.valueZat.sum)
|
|
188
197
|
.filter(TableColumns.address == address)
|
|
189
198
|
) ?? 0
|
|
190
|
-
|
|
199
|
+
|
|
191
200
|
return WalletBalance(
|
|
192
201
|
verified: Zatoshi(Int64(verified)),
|
|
193
202
|
total: Zatoshi(Int64(total))
|
|
@@ -66,6 +66,9 @@ class AccountSQDAO: AccountRepository {
|
|
|
66
66
|
/// - `accountDAOGetAll` if sqlite query fetching account data failed.
|
|
67
67
|
func getAll() throws -> [AccountEntity] {
|
|
68
68
|
do {
|
|
69
|
+
globalDBLock.lock()
|
|
70
|
+
defer { globalDBLock.unlock() }
|
|
71
|
+
|
|
69
72
|
return try dbProvider.connection()
|
|
70
73
|
.prepare(table)
|
|
71
74
|
.map { row -> DbAccount in
|
|
@@ -90,6 +93,9 @@ class AccountSQDAO: AccountRepository {
|
|
|
90
93
|
func findBy(account: Int) throws -> AccountEntity? {
|
|
91
94
|
let query = table.filter(TableColums.account == account).limit(1)
|
|
92
95
|
do {
|
|
96
|
+
globalDBLock.lock()
|
|
97
|
+
defer { globalDBLock.unlock() }
|
|
98
|
+
|
|
93
99
|
return try dbProvider.connection()
|
|
94
100
|
.prepare(query)
|
|
95
101
|
.map {
|
|
@@ -119,6 +125,9 @@ class AccountSQDAO: AccountRepository {
|
|
|
119
125
|
|
|
120
126
|
let updatedRows: Int
|
|
121
127
|
do {
|
|
128
|
+
globalDBLock.lock()
|
|
129
|
+
defer { globalDBLock.unlock() }
|
|
130
|
+
|
|
122
131
|
updatedRows = try dbProvider.connection().run(table.filter(TableColums.account == acc.account).update(acc))
|
|
123
132
|
} catch {
|
|
124
133
|
throw ZcashError.accountDAOUpdate(error)
|
|
@@ -25,9 +25,9 @@ public enum ZcashTransaction {
|
|
|
25
25
|
init(
|
|
26
26
|
currentHeight: BlockHeight,
|
|
27
27
|
minedHeight: BlockHeight?,
|
|
28
|
-
expiredUnmined: Bool
|
|
28
|
+
expiredUnmined: Bool?
|
|
29
29
|
) {
|
|
30
|
-
guard !expiredUnmined else {
|
|
30
|
+
guard let expiredUnmined, !expiredUnmined else {
|
|
31
31
|
self = .expired
|
|
32
32
|
return
|
|
33
33
|
}
|
|
@@ -48,7 +48,6 @@ public enum ZcashTransaction {
|
|
|
48
48
|
public let blockTime: TimeInterval?
|
|
49
49
|
public let expiryHeight: BlockHeight?
|
|
50
50
|
public let fee: Zatoshi?
|
|
51
|
-
public let id: Int
|
|
52
51
|
public let index: Int?
|
|
53
52
|
public var isSentTransaction: Bool { value < Zatoshi(0) }
|
|
54
53
|
public let hasChange: Bool
|
|
@@ -59,7 +58,7 @@ public enum ZcashTransaction {
|
|
|
59
58
|
public let receivedNoteCount: Int
|
|
60
59
|
public let sentNoteCount: Int
|
|
61
60
|
public let value: Zatoshi
|
|
62
|
-
public let isExpiredUmined: Bool
|
|
61
|
+
public let isExpiredUmined: Bool?
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
public struct Output {
|
|
@@ -79,7 +78,7 @@ public enum ZcashTransaction {
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
public let
|
|
81
|
+
public let rawID: Data
|
|
83
82
|
public let pool: Pool
|
|
84
83
|
public let index: Int
|
|
85
84
|
public let fromAccount: Int?
|
|
@@ -99,7 +98,7 @@ public enum ZcashTransaction {
|
|
|
99
98
|
|
|
100
99
|
extension ZcashTransaction.Output {
|
|
101
100
|
enum Column {
|
|
102
|
-
static let
|
|
101
|
+
static let rawID = Expression<Blob>("txid")
|
|
103
102
|
static let pool = Expression<Int>("output_pool")
|
|
104
103
|
static let index = Expression<Int>("output_index")
|
|
105
104
|
static let toAccount = Expression<Int?>("to_account")
|
|
@@ -112,7 +111,7 @@ extension ZcashTransaction.Output {
|
|
|
112
111
|
|
|
113
112
|
init(row: Row) throws {
|
|
114
113
|
do {
|
|
115
|
-
|
|
114
|
+
rawID = Data(blob: try row.get(Column.rawID))
|
|
116
115
|
pool = .init(rawValue: try row.get(Column.pool))
|
|
117
116
|
index = try row.get(Column.index)
|
|
118
117
|
fromAccount = try row.get(Column.fromAccount)
|
|
@@ -144,7 +143,6 @@ extension ZcashTransaction.Output {
|
|
|
144
143
|
extension ZcashTransaction.Overview {
|
|
145
144
|
enum Column {
|
|
146
145
|
static let accountId = Expression<Int>("account_id")
|
|
147
|
-
static let id = Expression<Int>("id_tx")
|
|
148
146
|
static let minedHeight = Expression<BlockHeight?>("mined_height")
|
|
149
147
|
static let index = Expression<Int?>("tx_index")
|
|
150
148
|
static let rawID = Expression<Blob>("txid")
|
|
@@ -157,14 +155,13 @@ extension ZcashTransaction.Overview {
|
|
|
157
155
|
static let receivedNoteCount = Expression<Int>("received_note_count")
|
|
158
156
|
static let memoCount = Expression<Int>("memo_count")
|
|
159
157
|
static let blockTime = Expression<Int64?>("block_time")
|
|
160
|
-
static let expiredUnmined = Expression<Bool
|
|
158
|
+
static let expiredUnmined = Expression<Bool?>("expired_unmined")
|
|
161
159
|
}
|
|
162
160
|
|
|
163
161
|
init(row: Row) throws {
|
|
164
162
|
do {
|
|
165
163
|
self.accountId = try row.get(Column.accountId)
|
|
166
164
|
self.expiryHeight = try row.get(Column.expiryHeight)
|
|
167
|
-
self.id = try row.get(Column.id)
|
|
168
165
|
self.index = try row.get(Column.index)
|
|
169
166
|
self.hasChange = try row.get(Column.hasChange)
|
|
170
167
|
self.memoCount = try row.get(Column.memoCount)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated using Sourcery 2.0.
|
|
1
|
+
// Generated using Sourcery 2.0.3 — https://github.com/krzysztofzablocki/Sourcery
|
|
2
2
|
// DO NOT EDIT
|
|
3
3
|
|
|
4
4
|
/*
|
|
@@ -11,8 +11,9 @@ error originates. And it can help with debugging.
|
|
|
11
11
|
import Foundation
|
|
12
12
|
|
|
13
13
|
public enum ZcashError: Equatable, Error {
|
|
14
|
-
/// Some error happened that is not handled as `ZcashError`.
|
|
15
|
-
///
|
|
14
|
+
/// Some error happened that is not handled as `ZcashError`. All errors in the SDK are (should be) `ZcashError`.
|
|
15
|
+
/// This case is ideally not contructed directly or thrown by any SDK function, rather it's a wrapper for case clients expect ZcashErrot and want to pass it to a function/enum.
|
|
16
|
+
/// If this is the case, use `toZcashError()` extension of Error. This helper avoids to end up with Optional handling.
|
|
16
17
|
/// ZUNKWN0001
|
|
17
18
|
case unknown(_ error: Error)
|
|
18
19
|
/// Updating of paths in `Initilizer` according to alias failed.
|
|
@@ -21,6 +22,15 @@ public enum ZcashError: Equatable, Error {
|
|
|
21
22
|
/// Alias used to create this instance of the `SDKSynchronizer` is already used by other instance.
|
|
22
23
|
/// ZINIT0002
|
|
23
24
|
case initializerAliasAlreadyInUse(_ alias: ZcashSynchronizerAlias)
|
|
25
|
+
/// Object on disk at `generalStorageURL` path exists. But it file not directory.
|
|
26
|
+
/// ZINIT0003
|
|
27
|
+
case initializerGeneralStorageExistsButIsFile(_ generalStorageURL: URL)
|
|
28
|
+
/// Can't create directory at `generalStorageURL` path.
|
|
29
|
+
/// ZINIT0004
|
|
30
|
+
case initializerGeneralStorageCantCreate(_ generalStorageURL: URL, _ error: Error)
|
|
31
|
+
/// Can't set `isExcludedFromBackup` flag to `generalStorageURL`.
|
|
32
|
+
/// ZINIT0005
|
|
33
|
+
case initializerCantSetNoBackupFlagToGeneralStorageURL(_ generalStorageURL: URL, _ error: Error)
|
|
24
34
|
/// Unknown GRPC Service error
|
|
25
35
|
/// ZSRVC0001
|
|
26
36
|
case serviceUnknownError(_ error: Error)
|
|
@@ -48,6 +58,9 @@ public enum ZcashError: Equatable, Error {
|
|
|
48
58
|
/// LightWalletService.blockStream failed.
|
|
49
59
|
/// ZSRVC0000
|
|
50
60
|
case serviceBlockStreamFailed(_ error: LightWalletServiceError)
|
|
61
|
+
/// LightWalletService.getSubtreeRoots failed.
|
|
62
|
+
/// ZSRVC0009
|
|
63
|
+
case serviceSubtreeRootsStreamFailed(_ error: LightWalletServiceError)
|
|
51
64
|
/// SimpleConnectionProvider init of Connection failed.
|
|
52
65
|
/// ZSCPC0001
|
|
53
66
|
case simpleConnectionProvider(_ error: Error)
|
|
@@ -84,10 +97,18 @@ public enum ZcashError: Equatable, Error {
|
|
|
84
97
|
/// - `sqliteError` is error produced by SQLite library.
|
|
85
98
|
/// ZBDAO0004
|
|
86
99
|
case blockDAOLatestBlock(_ sqliteError: Error)
|
|
87
|
-
/// Fetched
|
|
100
|
+
/// Fetched latest block information from DB but can't decode them.
|
|
88
101
|
/// - `error` is decoding error.
|
|
89
102
|
/// ZBDAO0005
|
|
90
103
|
case blockDAOLatestBlockCantDecode(_ error: Error)
|
|
104
|
+
/// SQLite query failed when fetching the first unenhanced block from the database.
|
|
105
|
+
/// - `sqliteError` is error produced by SQLite library.
|
|
106
|
+
/// ZBDAO0006
|
|
107
|
+
case blockDAOFirstUnenhancedHeight(_ sqliteError: Error)
|
|
108
|
+
/// Fetched unenhanced block information from DB but can't decode them.
|
|
109
|
+
/// - `error` is decoding error.
|
|
110
|
+
/// ZBDAO0007
|
|
111
|
+
case blockDAOFirstUnenhancedCantDecode(_ error: Error)
|
|
91
112
|
/// Error from rust layer when calling ZcashRustBackend.createAccount
|
|
92
113
|
/// - `rustError` contains error generated by the rust layer.
|
|
93
114
|
/// ZRUST0001
|
|
@@ -202,10 +223,6 @@ public enum ZcashError: Equatable, Error {
|
|
|
202
223
|
/// - `rustError` contains error generated by the rust layer.
|
|
203
224
|
/// ZRUST0030
|
|
204
225
|
case rustValidateCombinedChainValidationFailed(_ rustError: String)
|
|
205
|
-
/// Error from rust layer which means that combined chain isn't valid.
|
|
206
|
-
/// - `upperBound` is the height of the highest invalid block (on the assumption that the highest block in the cache database is correct).
|
|
207
|
-
/// ZRUST0031
|
|
208
|
-
case rustValidateCombinedChainInvalidChain(_ upperBound: Int32)
|
|
209
226
|
/// Error from rust layer when calling ZcashRustBackend.rewindToHeight
|
|
210
227
|
/// - `rustError` contains error generated by the rust layer.
|
|
211
228
|
/// ZRUST0032
|
|
@@ -258,6 +275,48 @@ public enum ZcashError: Equatable, Error {
|
|
|
258
275
|
/// Transparent receiver generated by rust layer is invalid when calling ZcashRustBackend.getTransparentReceiver
|
|
259
276
|
/// ZRUST0045
|
|
260
277
|
case rustGetTransparentReceiverInvalidReceiver
|
|
278
|
+
/// Unable to allocate memory required to write blocks when calling ZcashRustBackend.putSaplingSubtreeRoots
|
|
279
|
+
/// sourcery: code="ZRUST0046"
|
|
280
|
+
/// ZRUST0046
|
|
281
|
+
case rustPutSaplingSubtreeRootsAllocationProblem
|
|
282
|
+
/// Error from rust layer when calling ZcashRustBackend.putSaplingSubtreeRoots
|
|
283
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
284
|
+
/// sourcery: code="ZRUST0047"
|
|
285
|
+
/// ZRUST0047
|
|
286
|
+
case rustPutSaplingSubtreeRoots(_ rustError: String)
|
|
287
|
+
/// Error from rust layer when calling ZcashRustBackend.updateChainTip
|
|
288
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
289
|
+
/// sourcery: code="ZRUST0048"
|
|
290
|
+
/// ZRUST0048
|
|
291
|
+
case rustUpdateChainTip(_ rustError: String)
|
|
292
|
+
/// Error from rust layer when calling ZcashRustBackend.suggestScanRanges
|
|
293
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
294
|
+
/// sourcery: code="ZRUST0049"
|
|
295
|
+
/// ZRUST0049
|
|
296
|
+
case rustSuggestScanRanges(_ rustError: String)
|
|
297
|
+
/// Invalid transaction ID length when calling ZcashRustBackend.getMemo. txId must be 32 bytes.
|
|
298
|
+
/// ZRUST0050
|
|
299
|
+
case rustGetMemoInvalidTxIdLength
|
|
300
|
+
/// Error from rust layer when calling ZcashRustBackend.getScanProgress
|
|
301
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
302
|
+
/// ZRUST0051
|
|
303
|
+
case rustGetScanProgress(_ rustError: String)
|
|
304
|
+
/// Error from rust layer when calling ZcashRustBackend.fullyScannedHeight
|
|
305
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
306
|
+
/// ZRUST0052
|
|
307
|
+
case rustFullyScannedHeight(_ rustError: String)
|
|
308
|
+
/// Error from rust layer when calling ZcashRustBackend.maxScannedHeight
|
|
309
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
310
|
+
/// ZRUST0053
|
|
311
|
+
case rustMaxScannedHeight(_ rustError: String)
|
|
312
|
+
/// Error from rust layer when calling ZcashRustBackend.latestCachedBlockHeight
|
|
313
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
314
|
+
/// ZRUST0054
|
|
315
|
+
case rustLatestCachedBlockHeight(_ rustError: String)
|
|
316
|
+
/// Rust layer's call ZcashRustBackend.getScanProgress returned values that after computation are outside of allowed range 0-100%.
|
|
317
|
+
/// - `progress` value reported
|
|
318
|
+
/// ZRUST0055
|
|
319
|
+
case rustScanProgressOutOfRange(_ progress: String)
|
|
261
320
|
/// SQLite query failed when fetching all accounts from the database.
|
|
262
321
|
/// - `sqliteError` is error produced by SQLite library.
|
|
263
322
|
/// ZADAO0001
|
|
@@ -491,6 +550,18 @@ public enum ZcashError: Equatable, Error {
|
|
|
491
550
|
/// Consensus BranchIDs don't match this is probably an API or programming error.
|
|
492
551
|
/// ZCBPEO0017
|
|
493
552
|
case compactBlockProcessorConsensusBranchID
|
|
553
|
+
/// Rewind of DownloadBlockAction failed as no action is possible to unwrapp.
|
|
554
|
+
/// ZCBPEO0018
|
|
555
|
+
case compactBlockProcessorDownloadBlockActionRewind
|
|
556
|
+
/// Put sapling subtree roots to the DB failed.
|
|
557
|
+
/// ZCBPEO0019
|
|
558
|
+
case compactBlockProcessorPutSaplingSubtreeRoots(_ error: Error)
|
|
559
|
+
/// Getting the `lastScannedHeight` failed but it's supposed to always provide some value.
|
|
560
|
+
/// ZCBPEO0020
|
|
561
|
+
case compactBlockProcessorLastScannedHeight
|
|
562
|
+
/// Getting the `supportedSyncAlgorithm` failed but it's supposed to always provide some value.
|
|
563
|
+
/// ZCBPEO0021
|
|
564
|
+
case compactBlockProcessorSupportedSyncAlgorithm
|
|
494
565
|
/// The synchronizer is unprepared.
|
|
495
566
|
/// ZSYNCO0001
|
|
496
567
|
case synchronizerNotPrepared
|
|
@@ -512,9 +583,12 @@ public enum ZcashError: Equatable, Error {
|
|
|
512
583
|
|
|
513
584
|
public var message: String {
|
|
514
585
|
switch self {
|
|
515
|
-
case .unknown: return "Some error happened that is not handled as `ZcashError`."
|
|
586
|
+
case .unknown: return "Some error happened that is not handled as `ZcashError`. All errors in the SDK are (should be) `ZcashError`."
|
|
516
587
|
case .initializerCantUpdateURLWithAlias: return "Updating of paths in `Initilizer` according to alias failed."
|
|
517
588
|
case .initializerAliasAlreadyInUse: return "Alias used to create this instance of the `SDKSynchronizer` is already used by other instance."
|
|
589
|
+
case .initializerGeneralStorageExistsButIsFile: return "Object on disk at `generalStorageURL` path exists. But it file not directory."
|
|
590
|
+
case .initializerGeneralStorageCantCreate: return "Can't create directory at `generalStorageURL` path."
|
|
591
|
+
case .initializerCantSetNoBackupFlagToGeneralStorageURL: return "Can't set `isExcludedFromBackup` flag to `generalStorageURL`."
|
|
518
592
|
case .serviceUnknownError: return "Unknown GRPC Service error"
|
|
519
593
|
case .serviceGetInfoFailed: return "LightWalletService.getInfo failed."
|
|
520
594
|
case .serviceLatestBlockFailed: return "LightWalletService.latestBlock failed."
|
|
@@ -524,6 +598,7 @@ public enum ZcashError: Equatable, Error {
|
|
|
524
598
|
case .serviceFetchTransactionFailed: return "LightWalletService.fetchTransaction failed."
|
|
525
599
|
case .serviceFetchUTXOsFailed: return "LightWalletService.fetchUTXOs failed."
|
|
526
600
|
case .serviceBlockStreamFailed: return "LightWalletService.blockStream failed."
|
|
601
|
+
case .serviceSubtreeRootsStreamFailed: return "LightWalletService.getSubtreeRoots failed."
|
|
527
602
|
case .simpleConnectionProvider: return "SimpleConnectionProvider init of Connection failed."
|
|
528
603
|
case .saplingParamsInvalidSpendParams: return "Downloaded file with sapling spending parameters isn't valid."
|
|
529
604
|
case .saplingParamsInvalidOutputParams: return "Downloaded file with sapling output parameters isn't valid."
|
|
@@ -533,7 +608,9 @@ public enum ZcashError: Equatable, Error {
|
|
|
533
608
|
case .blockDAOCantDecode: return "Fetched block information from DB but can't decode them."
|
|
534
609
|
case .blockDAOLatestBlockHeight: return "SQLite query failed when fetching height of the latest block from the database."
|
|
535
610
|
case .blockDAOLatestBlock: return "SQLite query failed when fetching the latest block from the database."
|
|
536
|
-
case .blockDAOLatestBlockCantDecode: return "Fetched
|
|
611
|
+
case .blockDAOLatestBlockCantDecode: return "Fetched latest block information from DB but can't decode them."
|
|
612
|
+
case .blockDAOFirstUnenhancedHeight: return "SQLite query failed when fetching the first unenhanced block from the database."
|
|
613
|
+
case .blockDAOFirstUnenhancedCantDecode: return "Fetched unenhanced block information from DB but can't decode them."
|
|
537
614
|
case .rustCreateAccount: return "Error from rust layer when calling ZcashRustBackend.createAccount"
|
|
538
615
|
case .rustCreateToAddress: return "Error from rust layer when calling ZcashRustBackend.createToAddress"
|
|
539
616
|
case .rustDecryptAndStoreTransaction: return "Error from rust layer when calling ZcashRustBackend.decryptAndStoreTransaction"
|
|
@@ -564,7 +641,6 @@ public enum ZcashError: Equatable, Error {
|
|
|
564
641
|
case .rustListTransparentReceiversInvalidAddress: return "Transparent receiver generated by rust layer is invalid when calling ZcashRustBackend.listTransparentReceivers"
|
|
565
642
|
case .rustPutUnspentTransparentOutput: return "Error from rust layer when calling ZcashRustBackend.putUnspentTransparentOutput"
|
|
566
643
|
case .rustValidateCombinedChainValidationFailed: return "Error unrelated to chain validity from rust layer when calling ZcashRustBackend.validateCombinedChain"
|
|
567
|
-
case .rustValidateCombinedChainInvalidChain: return "Error from rust layer which means that combined chain isn't valid."
|
|
568
644
|
case .rustRewindToHeight: return "Error from rust layer when calling ZcashRustBackend.rewindToHeight"
|
|
569
645
|
case .rustRewindCacheToHeight: return "Error from rust layer when calling ZcashRustBackend.rewindCacheToHeight"
|
|
570
646
|
case .rustScanBlocks: return "Error from rust layer when calling ZcashRustBackend.scanBlocks"
|
|
@@ -579,6 +655,16 @@ public enum ZcashError: Equatable, Error {
|
|
|
579
655
|
case .rustGetSaplingReceiverInvalidReceiver: return "Sapling receiver generated by rust layer is invalid when calling ZcashRustBackend.getSaplingReceiver"
|
|
580
656
|
case .rustGetTransparentReceiverInvalidAddress: return "Error from rust layer when calling ZcashRustBackend.getTransparentReceiver"
|
|
581
657
|
case .rustGetTransparentReceiverInvalidReceiver: return "Transparent receiver generated by rust layer is invalid when calling ZcashRustBackend.getTransparentReceiver"
|
|
658
|
+
case .rustPutSaplingSubtreeRootsAllocationProblem: return "Unable to allocate memory required to write blocks when calling ZcashRustBackend.putSaplingSubtreeRoots"
|
|
659
|
+
case .rustPutSaplingSubtreeRoots: return "Error from rust layer when calling ZcashRustBackend.putSaplingSubtreeRoots"
|
|
660
|
+
case .rustUpdateChainTip: return "Error from rust layer when calling ZcashRustBackend.updateChainTip"
|
|
661
|
+
case .rustSuggestScanRanges: return "Error from rust layer when calling ZcashRustBackend.suggestScanRanges"
|
|
662
|
+
case .rustGetMemoInvalidTxIdLength: return "Invalid transaction ID length when calling ZcashRustBackend.getMemo. txId must be 32 bytes."
|
|
663
|
+
case .rustGetScanProgress: return "Error from rust layer when calling ZcashRustBackend.getScanProgress"
|
|
664
|
+
case .rustFullyScannedHeight: return "Error from rust layer when calling ZcashRustBackend.fullyScannedHeight"
|
|
665
|
+
case .rustMaxScannedHeight: return "Error from rust layer when calling ZcashRustBackend.maxScannedHeight"
|
|
666
|
+
case .rustLatestCachedBlockHeight: return "Error from rust layer when calling ZcashRustBackend.latestCachedBlockHeight"
|
|
667
|
+
case .rustScanProgressOutOfRange: return "Rust layer's call ZcashRustBackend.getScanProgress returned values that after computation are outside of allowed range 0-100%."
|
|
582
668
|
case .accountDAOGetAll: return "SQLite query failed when fetching all accounts from the database."
|
|
583
669
|
case .accountDAOGetAllCantDecode: return "Fetched accounts from SQLite but can't decode them."
|
|
584
670
|
case .accountDAOFindBy: return "SQLite query failed when seaching for accounts in the database."
|
|
@@ -653,6 +739,10 @@ public enum ZcashError: Equatable, Error {
|
|
|
653
739
|
case .compactBlockProcessorCacheDbMigrationFailedToDeleteLegacyDb: return "Deletion of readable file at the provided URL failed."
|
|
654
740
|
case .compactBlockProcessorChainName: return "Chain name does not match. Expected either 'test' or 'main'. This is probably an API or programming error."
|
|
655
741
|
case .compactBlockProcessorConsensusBranchID: return "Consensus BranchIDs don't match this is probably an API or programming error."
|
|
742
|
+
case .compactBlockProcessorDownloadBlockActionRewind: return "Rewind of DownloadBlockAction failed as no action is possible to unwrapp."
|
|
743
|
+
case .compactBlockProcessorPutSaplingSubtreeRoots: return "Put sapling subtree roots to the DB failed."
|
|
744
|
+
case .compactBlockProcessorLastScannedHeight: return "Getting the `lastScannedHeight` failed but it's supposed to always provide some value."
|
|
745
|
+
case .compactBlockProcessorSupportedSyncAlgorithm: return "Getting the `supportedSyncAlgorithm` failed but it's supposed to always provide some value."
|
|
656
746
|
case .synchronizerNotPrepared: return "The synchronizer is unprepared."
|
|
657
747
|
case .synchronizerSendMemoToTransparentAddress: return "Memos can't be sent to transparent addresses."
|
|
658
748
|
case .synchronizerShieldFundsInsuficientTransparentFunds: return "There is not enough transparent funds to cover fee for the shielding."
|
|
@@ -667,6 +757,9 @@ public enum ZcashError: Equatable, Error {
|
|
|
667
757
|
case .unknown: return .unknown
|
|
668
758
|
case .initializerCantUpdateURLWithAlias: return .initializerCantUpdateURLWithAlias
|
|
669
759
|
case .initializerAliasAlreadyInUse: return .initializerAliasAlreadyInUse
|
|
760
|
+
case .initializerGeneralStorageExistsButIsFile: return .initializerGeneralStorageExistsButIsFile
|
|
761
|
+
case .initializerGeneralStorageCantCreate: return .initializerGeneralStorageCantCreate
|
|
762
|
+
case .initializerCantSetNoBackupFlagToGeneralStorageURL: return .initializerCantSetNoBackupFlagToGeneralStorageURL
|
|
670
763
|
case .serviceUnknownError: return .serviceUnknownError
|
|
671
764
|
case .serviceGetInfoFailed: return .serviceGetInfoFailed
|
|
672
765
|
case .serviceLatestBlockFailed: return .serviceLatestBlockFailed
|
|
@@ -676,6 +769,7 @@ public enum ZcashError: Equatable, Error {
|
|
|
676
769
|
case .serviceFetchTransactionFailed: return .serviceFetchTransactionFailed
|
|
677
770
|
case .serviceFetchUTXOsFailed: return .serviceFetchUTXOsFailed
|
|
678
771
|
case .serviceBlockStreamFailed: return .serviceBlockStreamFailed
|
|
772
|
+
case .serviceSubtreeRootsStreamFailed: return .serviceSubtreeRootsStreamFailed
|
|
679
773
|
case .simpleConnectionProvider: return .simpleConnectionProvider
|
|
680
774
|
case .saplingParamsInvalidSpendParams: return .saplingParamsInvalidSpendParams
|
|
681
775
|
case .saplingParamsInvalidOutputParams: return .saplingParamsInvalidOutputParams
|
|
@@ -686,6 +780,8 @@ public enum ZcashError: Equatable, Error {
|
|
|
686
780
|
case .blockDAOLatestBlockHeight: return .blockDAOLatestBlockHeight
|
|
687
781
|
case .blockDAOLatestBlock: return .blockDAOLatestBlock
|
|
688
782
|
case .blockDAOLatestBlockCantDecode: return .blockDAOLatestBlockCantDecode
|
|
783
|
+
case .blockDAOFirstUnenhancedHeight: return .blockDAOFirstUnenhancedHeight
|
|
784
|
+
case .blockDAOFirstUnenhancedCantDecode: return .blockDAOFirstUnenhancedCantDecode
|
|
689
785
|
case .rustCreateAccount: return .rustCreateAccount
|
|
690
786
|
case .rustCreateToAddress: return .rustCreateToAddress
|
|
691
787
|
case .rustDecryptAndStoreTransaction: return .rustDecryptAndStoreTransaction
|
|
@@ -716,7 +812,6 @@ public enum ZcashError: Equatable, Error {
|
|
|
716
812
|
case .rustListTransparentReceiversInvalidAddress: return .rustListTransparentReceiversInvalidAddress
|
|
717
813
|
case .rustPutUnspentTransparentOutput: return .rustPutUnspentTransparentOutput
|
|
718
814
|
case .rustValidateCombinedChainValidationFailed: return .rustValidateCombinedChainValidationFailed
|
|
719
|
-
case .rustValidateCombinedChainInvalidChain: return .rustValidateCombinedChainInvalidChain
|
|
720
815
|
case .rustRewindToHeight: return .rustRewindToHeight
|
|
721
816
|
case .rustRewindCacheToHeight: return .rustRewindCacheToHeight
|
|
722
817
|
case .rustScanBlocks: return .rustScanBlocks
|
|
@@ -731,6 +826,16 @@ public enum ZcashError: Equatable, Error {
|
|
|
731
826
|
case .rustGetSaplingReceiverInvalidReceiver: return .rustGetSaplingReceiverInvalidReceiver
|
|
732
827
|
case .rustGetTransparentReceiverInvalidAddress: return .rustGetTransparentReceiverInvalidAddress
|
|
733
828
|
case .rustGetTransparentReceiverInvalidReceiver: return .rustGetTransparentReceiverInvalidReceiver
|
|
829
|
+
case .rustPutSaplingSubtreeRootsAllocationProblem: return .rustPutSaplingSubtreeRootsAllocationProblem
|
|
830
|
+
case .rustPutSaplingSubtreeRoots: return .rustPutSaplingSubtreeRoots
|
|
831
|
+
case .rustUpdateChainTip: return .rustUpdateChainTip
|
|
832
|
+
case .rustSuggestScanRanges: return .rustSuggestScanRanges
|
|
833
|
+
case .rustGetMemoInvalidTxIdLength: return .rustGetMemoInvalidTxIdLength
|
|
834
|
+
case .rustGetScanProgress: return .rustGetScanProgress
|
|
835
|
+
case .rustFullyScannedHeight: return .rustFullyScannedHeight
|
|
836
|
+
case .rustMaxScannedHeight: return .rustMaxScannedHeight
|
|
837
|
+
case .rustLatestCachedBlockHeight: return .rustLatestCachedBlockHeight
|
|
838
|
+
case .rustScanProgressOutOfRange: return .rustScanProgressOutOfRange
|
|
734
839
|
case .accountDAOGetAll: return .accountDAOGetAll
|
|
735
840
|
case .accountDAOGetAllCantDecode: return .accountDAOGetAllCantDecode
|
|
736
841
|
case .accountDAOFindBy: return .accountDAOFindBy
|
|
@@ -805,6 +910,10 @@ public enum ZcashError: Equatable, Error {
|
|
|
805
910
|
case .compactBlockProcessorCacheDbMigrationFailedToDeleteLegacyDb: return .compactBlockProcessorCacheDbMigrationFailedToDeleteLegacyDb
|
|
806
911
|
case .compactBlockProcessorChainName: return .compactBlockProcessorChainName
|
|
807
912
|
case .compactBlockProcessorConsensusBranchID: return .compactBlockProcessorConsensusBranchID
|
|
913
|
+
case .compactBlockProcessorDownloadBlockActionRewind: return .compactBlockProcessorDownloadBlockActionRewind
|
|
914
|
+
case .compactBlockProcessorPutSaplingSubtreeRoots: return .compactBlockProcessorPutSaplingSubtreeRoots
|
|
915
|
+
case .compactBlockProcessorLastScannedHeight: return .compactBlockProcessorLastScannedHeight
|
|
916
|
+
case .compactBlockProcessorSupportedSyncAlgorithm: return .compactBlockProcessorSupportedSyncAlgorithm
|
|
808
917
|
case .synchronizerNotPrepared: return .synchronizerNotPrepared
|
|
809
918
|
case .synchronizerSendMemoToTransparentAddress: return .synchronizerSendMemoToTransparentAddress
|
|
810
919
|
case .synchronizerShieldFundsInsuficientTransparentFunds: return .synchronizerShieldFundsInsuficientTransparentFunds
|