react-native-zcash 0.8.1 → 0.9.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 +6 -0
- package/android/build.gradle +3 -3
- package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2650000.json +8 -0
- package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +15 -25
- package/ios/RNZcash.m +3 -5
- package/ios/RNZcash.swift +42 -23
- package/ios/ZCashLightClientKit/Block/Actions/Action.swift +1 -0
- package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +1 -1
- package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +1 -1
- package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +1 -1
- package/ios/ZCashLightClientKit/Block/Actions/TxResubmissionAction.swift +75 -0
- package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +1 -1
- package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +3 -1
- package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +14 -0
- package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +2 -2
- package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +54 -49
- package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointSource.swift +1 -6
- package/ios/ZCashLightClientKit/Checkpoint/CheckpointSourceFactory.swift +1 -1
- package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +3 -1
- package/ios/ZCashLightClientKit/CombineSynchronizer.swift +6 -2
- package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +15 -0
- package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +20 -4
- package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +27 -24
- package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +2 -2
- package/ios/ZCashLightClientKit/Error/ZcashError.swift +32 -1
- package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +11 -1
- package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +18 -0
- package/ios/ZCashLightClientKit/Initializer.swift +22 -14
- package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +0 -1
- package/ios/ZCashLightClientKit/Model/FiatCurrencyResult.swift +25 -0
- package/ios/ZCashLightClientKit/Model/Proposal.swift +1 -1
- package/ios/ZCashLightClientKit/Model/TransactionDataRequest.swift +26 -0
- package/ios/ZCashLightClientKit/Model/WalletTypes.swift +39 -1
- package/ios/ZCashLightClientKit/Model/Zatoshi.swift +1 -1
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +39 -2
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/service.proto +5 -4
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.grpc.swift +819 -3
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.pb.swift +2 -2
- package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +3 -1
- package/ios/ZCashLightClientKit/Providers/ResourceProvider.swift +10 -0
- package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +4 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2475000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2477500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2482500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2485000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2487500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2492500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2495000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2497500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2502500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2505000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2507500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2512500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2515000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2517500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2522500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2525000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2527500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2532500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2535000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2537500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2542500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2545000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2547500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2552500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2555000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2557500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2562500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2565000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2567500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2572500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2575000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2577500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2582500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2585000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2587500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2592500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2595000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2597500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2602500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2605000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2607500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2612500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2615000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2617500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2622500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2625000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2627500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2632500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2635000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2637500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2642500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2645000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2647500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2650000.json +8 -0
- package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackend.swift +4 -24
- package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackendWelding.swift +0 -15
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +133 -32
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +18 -1
- package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +4 -0
- package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +5 -1
- package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +53 -3
- package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +236 -7
- package/ios/ZCashLightClientKit/Synchronizer.swift +28 -0
- package/ios/ZCashLightClientKit/Tool/DerivationTool.swift +29 -5
- package/ios/ZCashLightClientKit/Tor/TorClient.swift +57 -0
- package/ios/ZCashLightClientKit/Utils/LoggingProxy.swift +4 -0
- package/ios/ZCashLightClientKit/Utils/OSLogger.swift +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/ios/zcashlc.h +287 -42
- package/lib/rnzcash.rn.js +8 -8
- package/lib/rnzcash.rn.js.map +1 -1
- package/lib/src/react-native.d.ts +3 -3
- package/lib/src/types.d.ts +4 -2
- package/package.json +1 -1
- package/src/react-native.ts +13 -18
- package/src/types.ts +5 -2
|
@@ -128,7 +128,9 @@ public protocol ClosureSynchronizer {
|
|
|
128
128
|
func refreshUTXOs(address: TransparentAddress, from height: BlockHeight, completion: @escaping (Result<RefreshedUTXOs, Error>) -> Void)
|
|
129
129
|
|
|
130
130
|
func getAccountBalance(accountIndex: Int, completion: @escaping (Result<AccountBalance?, Error>) -> Void)
|
|
131
|
-
|
|
131
|
+
|
|
132
|
+
func refreshExchangeRateUSD()
|
|
133
|
+
|
|
132
134
|
/*
|
|
133
135
|
It can be missleading that these two methods are returning Publisher even this protocol is closure based. Reason is that Synchronizer doesn't
|
|
134
136
|
provide different implementations for these two methods. So Combine it is even here.
|
|
@@ -97,7 +97,11 @@ public protocol CombineSynchronizer {
|
|
|
97
97
|
memo: Memo?
|
|
98
98
|
) -> SinglePublisher<ZcashTransaction.Overview, Error>
|
|
99
99
|
|
|
100
|
-
@available(
|
|
100
|
+
@available(
|
|
101
|
+
*,
|
|
102
|
+
deprecated,
|
|
103
|
+
message: "Upcoming SDK 2.1 will create multiple transactions at once for some recipients. use `proposeShielding:` instead"
|
|
104
|
+
)
|
|
101
105
|
func shieldFunds(
|
|
102
106
|
spendingKey: UnifiedSpendingKey,
|
|
103
107
|
memo: Memo,
|
|
@@ -125,7 +129,7 @@ public protocol CombineSynchronizer {
|
|
|
125
129
|
|
|
126
130
|
func refreshUTXOs(address: TransparentAddress, from height: BlockHeight) -> SinglePublisher<RefreshedUTXOs, Error>
|
|
127
131
|
|
|
128
|
-
func
|
|
132
|
+
func refreshExchangeRateUSD()
|
|
129
133
|
|
|
130
134
|
func rewind(_ policy: RewindPolicy) -> CompletablePublisher<Error>
|
|
131
135
|
func wipe() -> CompletablePublisher<Error>
|
|
@@ -124,6 +124,9 @@ public enum ZcashSDK {
|
|
|
124
124
|
/// Default Name for LibRustZcash data.db
|
|
125
125
|
public static let defaultDataDbName = "data.db"
|
|
126
126
|
|
|
127
|
+
/// Default Name for Tor data directory
|
|
128
|
+
public static let defaultTorDirName = "tor"
|
|
129
|
+
|
|
127
130
|
/// Default Name for Compact Block file system based db
|
|
128
131
|
public static let defaultFsCacheName = "fs_cache"
|
|
129
132
|
|
|
@@ -144,6 +147,9 @@ public enum ZcashSDK {
|
|
|
144
147
|
public static let outputParamFilename = "sapling-output.params"
|
|
145
148
|
// swiftlint:disable:next force_unwrapping
|
|
146
149
|
public static let outputParamFileURL = URL(string: cloudParameterURL)!.appendingPathComponent(outputParamFilename)
|
|
150
|
+
|
|
151
|
+
/// A constant that helps determine if a server’s chain tip is so far away from the estimated height that we consider the server out of sync
|
|
152
|
+
public static let syncedThresholdBlocks = UInt64(288)
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
public protocol NetworkConstants {
|
|
@@ -154,6 +160,9 @@ public protocol NetworkConstants {
|
|
|
154
160
|
/// Default Name for LibRustZcash data.db
|
|
155
161
|
static var defaultDataDbName: String { get }
|
|
156
162
|
|
|
163
|
+
/// Default Name for Tor data directory
|
|
164
|
+
static var defaultTorDirName: String { get }
|
|
165
|
+
|
|
157
166
|
static var defaultFsBlockDbRootName: String { get }
|
|
158
167
|
|
|
159
168
|
/// Default Name for Compact Block caches db
|
|
@@ -181,6 +190,9 @@ public enum ZcashSDKMainnetConstants: NetworkConstants {
|
|
|
181
190
|
/// Default Name for LibRustZcash data.db
|
|
182
191
|
public static let defaultDataDbName = "data.db"
|
|
183
192
|
|
|
193
|
+
/// Default Name for Tor data directory
|
|
194
|
+
public static let defaultTorDirName = "tor"
|
|
195
|
+
|
|
184
196
|
public static let defaultFsBlockDbRootName = "fs_cache"
|
|
185
197
|
|
|
186
198
|
/// Default Name for Compact Block caches db
|
|
@@ -197,6 +209,9 @@ public enum ZcashSDKTestnetConstants: NetworkConstants {
|
|
|
197
209
|
/// Default Name for LibRustZcash data.db
|
|
198
210
|
public static let defaultDataDbName = "data.db"
|
|
199
211
|
|
|
212
|
+
/// Default Name for Tor data directory
|
|
213
|
+
public static let defaultTorDirName = "tor"
|
|
214
|
+
|
|
200
215
|
/// Default Name for Compact Block caches db
|
|
201
216
|
public static let defaultCacheDbName = "caches.db"
|
|
202
217
|
|
|
@@ -10,8 +10,8 @@ import SQLite
|
|
|
10
10
|
|
|
11
11
|
class TransactionSQLDAO: TransactionRepository {
|
|
12
12
|
enum NotesTableStructure {
|
|
13
|
-
static let transactionID = Expression<Int>("tx")
|
|
14
|
-
static let memo = Expression<Blob>("memo")
|
|
13
|
+
static let transactionID = SQLite.Expression<Int>("tx")
|
|
14
|
+
static let memo = SQLite.Expression<Blob>("memo")
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
let dbProvider: ConnectionProvider
|
|
@@ -108,6 +108,18 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
108
108
|
return try await execute(query) { try ZcashTransaction.Overview(row: $0) }
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
func findForResubmission(upTo: BlockHeight) async throws -> [ZcashTransaction.Overview] {
|
|
112
|
+
let query = transactionsView
|
|
113
|
+
.filter(
|
|
114
|
+
ZcashTransaction.Overview.Column.minedHeight == nil &&
|
|
115
|
+
ZcashTransaction.Overview.Column.expiryHeight > upTo
|
|
116
|
+
)
|
|
117
|
+
.filterQueryFor(kind: .sent)
|
|
118
|
+
.limit(Int.max)
|
|
119
|
+
|
|
120
|
+
return try await execute(query) { try ZcashTransaction.Overview(row: $0) }
|
|
121
|
+
}
|
|
122
|
+
|
|
111
123
|
func findReceived(offset: Int, limit: Int) async throws -> [ZcashTransaction.Overview] {
|
|
112
124
|
let query = transactionsView
|
|
113
125
|
.filterQueryFor(kind: .received)
|
|
@@ -135,14 +147,18 @@ class TransactionSQLDAO: TransactionRepository {
|
|
|
135
147
|
return try await execute(query) { try ZcashTransaction.Overview(row: $0) }
|
|
136
148
|
}
|
|
137
149
|
|
|
138
|
-
func findMemos(for
|
|
150
|
+
func findMemos(for rawID: Data) async throws -> [Memo] {
|
|
139
151
|
do {
|
|
140
|
-
return try await getTransactionOutputs(for:
|
|
152
|
+
return try await getTransactionOutputs(for: rawID)
|
|
141
153
|
.compactMap { $0.memo }
|
|
142
154
|
} catch {
|
|
143
155
|
throw ZcashError.transactionRepositoryFindMemos(error)
|
|
144
156
|
}
|
|
145
157
|
}
|
|
158
|
+
|
|
159
|
+
func findMemos(for transaction: ZcashTransaction.Overview) async throws -> [Memo] {
|
|
160
|
+
try await findMemos(for: transaction.rawID)
|
|
161
|
+
}
|
|
146
162
|
|
|
147
163
|
func getTransactionOutputs(for rawID: Data) async throws -> [ZcashTransaction.Output] {
|
|
148
164
|
let query = self.txOutputsView
|
|
@@ -50,6 +50,7 @@ public enum ZcashTransaction {
|
|
|
50
50
|
public let fee: Zatoshi?
|
|
51
51
|
public let index: Int?
|
|
52
52
|
public var isSentTransaction: Bool { value < Zatoshi(0) }
|
|
53
|
+
public var isShielding: Bool
|
|
53
54
|
public let hasChange: Bool
|
|
54
55
|
public let memoCount: Int
|
|
55
56
|
public let minedHeight: BlockHeight?
|
|
@@ -94,22 +95,22 @@ public enum ZcashTransaction {
|
|
|
94
95
|
/// Used when fetching blocks from the lightwalletd
|
|
95
96
|
struct Fetched {
|
|
96
97
|
public let rawID: Data
|
|
97
|
-
public let minedHeight:
|
|
98
|
+
public let minedHeight: UInt32?
|
|
98
99
|
public let raw: Data
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
extension ZcashTransaction.Output {
|
|
103
104
|
enum Column {
|
|
104
|
-
static let rawID = Expression<Blob>("txid")
|
|
105
|
-
static let pool = Expression<Int>("output_pool")
|
|
106
|
-
static let index = Expression<Int>("output_index")
|
|
107
|
-
static let toAccount = Expression<Int?>("to_account_id")
|
|
108
|
-
static let fromAccount = Expression<Int?>("from_account_id")
|
|
109
|
-
static let toAddress = Expression<String?>("to_address")
|
|
110
|
-
static let value = Expression<Int64>("value")
|
|
111
|
-
static let isChange = Expression<Bool>("is_change")
|
|
112
|
-
static let memo = Expression<Blob?>("memo")
|
|
105
|
+
static let rawID = SQLite.Expression<Blob>("txid")
|
|
106
|
+
static let pool = SQLite.Expression<Int>("output_pool")
|
|
107
|
+
static let index = SQLite.Expression<Int>("output_index")
|
|
108
|
+
static let toAccount = SQLite.Expression<Int?>("to_account_id")
|
|
109
|
+
static let fromAccount = SQLite.Expression<Int?>("from_account_id")
|
|
110
|
+
static let toAddress = SQLite.Expression<String?>("to_address")
|
|
111
|
+
static let value = SQLite.Expression<Int64>("value")
|
|
112
|
+
static let isChange = SQLite.Expression<Bool>("is_change")
|
|
113
|
+
static let memo = SQLite.Expression<Blob?>("memo")
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
init(row: Row) throws {
|
|
@@ -145,20 +146,21 @@ extension ZcashTransaction.Output {
|
|
|
145
146
|
|
|
146
147
|
extension ZcashTransaction.Overview {
|
|
147
148
|
enum Column {
|
|
148
|
-
static let accountId = Expression<Int>("account_id")
|
|
149
|
-
static let minedHeight = Expression<BlockHeight?>("mined_height")
|
|
150
|
-
static let index = Expression<Int?>("tx_index")
|
|
151
|
-
static let rawID = Expression<Blob>("txid")
|
|
152
|
-
static let expiryHeight = Expression<BlockHeight?>("expiry_height")
|
|
153
|
-
static let raw = Expression<Blob?>("raw")
|
|
154
|
-
static let value = Expression<Int64>("account_balance_delta")
|
|
155
|
-
static let fee = Expression<Int64?>("fee_paid")
|
|
156
|
-
static let hasChange = Expression<Bool>("has_change")
|
|
157
|
-
static let sentNoteCount = Expression<Int>("sent_note_count")
|
|
158
|
-
static let receivedNoteCount = Expression<Int>("received_note_count")
|
|
159
|
-
static let
|
|
160
|
-
static let
|
|
161
|
-
static let
|
|
149
|
+
static let accountId = SQLite.Expression<Int>("account_id")
|
|
150
|
+
static let minedHeight = SQLite.Expression<BlockHeight?>("mined_height")
|
|
151
|
+
static let index = SQLite.Expression<Int?>("tx_index")
|
|
152
|
+
static let rawID = SQLite.Expression<Blob>("txid")
|
|
153
|
+
static let expiryHeight = SQLite.Expression<BlockHeight?>("expiry_height")
|
|
154
|
+
static let raw = SQLite.Expression<Blob?>("raw")
|
|
155
|
+
static let value = SQLite.Expression<Int64>("account_balance_delta")
|
|
156
|
+
static let fee = SQLite.Expression<Int64?>("fee_paid")
|
|
157
|
+
static let hasChange = SQLite.Expression<Bool>("has_change")
|
|
158
|
+
static let sentNoteCount = SQLite.Expression<Int>("sent_note_count")
|
|
159
|
+
static let receivedNoteCount = SQLite.Expression<Int>("received_note_count")
|
|
160
|
+
static let isShielding = SQLite.Expression<Bool>("is_shielding")
|
|
161
|
+
static let memoCount = SQLite.Expression<Int>("memo_count")
|
|
162
|
+
static let blockTime = SQLite.Expression<Int64?>("block_time")
|
|
163
|
+
static let expiredUnmined = SQLite.Expression<Bool?>("expired_unmined")
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
init(row: Row) throws {
|
|
@@ -171,6 +173,7 @@ extension ZcashTransaction.Overview {
|
|
|
171
173
|
self.minedHeight = try row.get(Column.minedHeight)
|
|
172
174
|
self.rawID = Data(blob: try row.get(Column.rawID))
|
|
173
175
|
self.receivedNoteCount = try row.get(Column.receivedNoteCount)
|
|
176
|
+
self.isShielding = try row.get(Column.isShielding)
|
|
174
177
|
self.sentNoteCount = try row.get(Column.sentNoteCount)
|
|
175
178
|
self.value = Zatoshi(try row.get(Column.value))
|
|
176
179
|
self.isExpiredUmined = try row.get(Column.expiredUnmined)
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
scriptDir=${0:a:h}
|
|
4
4
|
cd "${scriptDir}"
|
|
5
5
|
|
|
6
|
-
sourcery_version=2.
|
|
6
|
+
sourcery_version=2.2.5
|
|
7
7
|
|
|
8
8
|
if which sourcery >/dev/null; then
|
|
9
9
|
if [[ $(sourcery --version) != $sourcery_version ]]; then
|
|
10
|
-
echo "warning: Compatible
|
|
10
|
+
echo "warning: Compatible sourcery version not installed. Install sourcery $sourcery_version. Currently installed version is $(sourcery --version)"
|
|
11
11
|
exit 1
|
|
12
12
|
fi
|
|
13
13
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated using Sourcery 2.
|
|
1
|
+
// Generated using Sourcery 2.2.5 — https://github.com/krzysztofzablocki/Sourcery
|
|
2
2
|
// DO NOT EDIT
|
|
3
3
|
|
|
4
4
|
/*
|
|
@@ -61,6 +61,9 @@ public enum ZcashError: Equatable, Error {
|
|
|
61
61
|
/// LightWalletService.getSubtreeRoots failed.
|
|
62
62
|
/// ZSRVC0009
|
|
63
63
|
case serviceSubtreeRootsStreamFailed(_ error: LightWalletServiceError)
|
|
64
|
+
/// LightWalletService.getTaddressTxids failed.
|
|
65
|
+
/// ZSRVC0010
|
|
66
|
+
case serviceGetTaddressTxidsFailed(_ error: LightWalletServiceError)
|
|
64
67
|
/// SimpleConnectionProvider init of Connection failed.
|
|
65
68
|
/// ZSCPC0001
|
|
66
69
|
case simpleConnectionProvider(_ error: Error)
|
|
@@ -342,6 +345,21 @@ public enum ZcashError: Equatable, Error {
|
|
|
342
345
|
/// sourcery: code="ZRUST0061"
|
|
343
346
|
/// ZRUST0061
|
|
344
347
|
case rustPutOrchardSubtreeRoots(_ rustError: String)
|
|
348
|
+
/// Error from rust layer when calling TorClient.init
|
|
349
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
350
|
+
/// sourcery: code="ZRUST0062"
|
|
351
|
+
/// ZRUST0062
|
|
352
|
+
case rustTorClientInit(_ rustError: String)
|
|
353
|
+
/// Error from rust layer when calling TorClient.get
|
|
354
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
355
|
+
/// sourcery: code="ZRUST0063"
|
|
356
|
+
/// ZRUST0063
|
|
357
|
+
case rustTorClientGet(_ rustError: String)
|
|
358
|
+
/// Error from rust layer when calling ZcashRustBackend.transactionDataRequests
|
|
359
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
360
|
+
/// sourcery: code="ZRUST0064"
|
|
361
|
+
/// ZRUST0064
|
|
362
|
+
case rustTransactionDataRequests(_ rustError: String)
|
|
345
363
|
/// SQLite query failed when fetching all accounts from the database.
|
|
346
364
|
/// - `sqliteError` is error produced by SQLite library.
|
|
347
365
|
/// ZADAO0001
|
|
@@ -509,6 +527,9 @@ public enum ZcashError: Equatable, Error {
|
|
|
509
527
|
/// Can't create `Recipient` because input is invalid.
|
|
510
528
|
/// ZWLTP0007
|
|
511
529
|
case recipientInvalidInput
|
|
530
|
+
/// Can't create `TexAddress` because input is invalid.
|
|
531
|
+
/// ZWLTP0008
|
|
532
|
+
case texAddressInvalidInput
|
|
512
533
|
/// WalletTransactionEncoder wants to create transaction but files with sapling parameters are not present on disk.
|
|
513
534
|
/// ZWLTE0001
|
|
514
535
|
case walletTransEncoderCreateTransactionMissingSaplingParams
|
|
@@ -633,6 +654,7 @@ public enum ZcashError: Equatable, Error {
|
|
|
633
654
|
case .serviceFetchUTXOsFailed: return "LightWalletService.fetchUTXOs failed."
|
|
634
655
|
case .serviceBlockStreamFailed: return "LightWalletService.blockStream failed."
|
|
635
656
|
case .serviceSubtreeRootsStreamFailed: return "LightWalletService.getSubtreeRoots failed."
|
|
657
|
+
case .serviceGetTaddressTxidsFailed: return "LightWalletService.getTaddressTxids failed."
|
|
636
658
|
case .simpleConnectionProvider: return "SimpleConnectionProvider init of Connection failed."
|
|
637
659
|
case .saplingParamsInvalidSpendParams: return "Downloaded file with sapling spending parameters isn't valid."
|
|
638
660
|
case .saplingParamsInvalidOutputParams: return "Downloaded file with sapling output parameters isn't valid."
|
|
@@ -705,6 +727,9 @@ public enum ZcashError: Equatable, Error {
|
|
|
705
727
|
case .rustIsSeedRelevantToAnyDerivedAccount: return "Error from rust layer when calling ZcashRustBackend.rustIsSeedRelevantToAnyDerivedAccount"
|
|
706
728
|
case .rustPutOrchardSubtreeRootsAllocationProblem: return "Unable to allocate memory required to write blocks when calling ZcashRustBackend.putOrchardSubtreeRoots"
|
|
707
729
|
case .rustPutOrchardSubtreeRoots: return "Error from rust layer when calling ZcashRustBackend.putOrchardSubtreeRoots"
|
|
730
|
+
case .rustTorClientInit: return "Error from rust layer when calling TorClient.init"
|
|
731
|
+
case .rustTorClientGet: return "Error from rust layer when calling TorClient.get"
|
|
732
|
+
case .rustTransactionDataRequests: return "Error from rust layer when calling ZcashRustBackend.transactionDataRequests"
|
|
708
733
|
case .accountDAOGetAll: return "SQLite query failed when fetching all accounts from the database."
|
|
709
734
|
case .accountDAOGetAllCantDecode: return "Fetched accounts from SQLite but can't decode them."
|
|
710
735
|
case .accountDAOFindBy: return "SQLite query failed when seaching for accounts in the database."
|
|
@@ -757,6 +782,7 @@ public enum ZcashError: Equatable, Error {
|
|
|
757
782
|
case .saplingAddressInvalidInput: return "Can't create `SaplingAddress` because input is invalid."
|
|
758
783
|
case .unifiedAddressInvalidInput: return "Can't create `UnifiedAddress` because input is invalid."
|
|
759
784
|
case .recipientInvalidInput: return "Can't create `Recipient` because input is invalid."
|
|
785
|
+
case .texAddressInvalidInput: return "Can't create `TexAddress` because input is invalid."
|
|
760
786
|
case .walletTransEncoderCreateTransactionMissingSaplingParams: return "WalletTransactionEncoder wants to create transaction but files with sapling parameters are not present on disk."
|
|
761
787
|
case .walletTransEncoderShieldFundsMissingSaplingParams: return "WalletTransactionEncoder wants to shield funds but files with sapling parameters are not present on disk."
|
|
762
788
|
case .zatoshiDecode: return "Initiatilzation fo `Zatoshi` from a decoder failed."
|
|
@@ -813,6 +839,7 @@ public enum ZcashError: Equatable, Error {
|
|
|
813
839
|
case .serviceFetchUTXOsFailed: return .serviceFetchUTXOsFailed
|
|
814
840
|
case .serviceBlockStreamFailed: return .serviceBlockStreamFailed
|
|
815
841
|
case .serviceSubtreeRootsStreamFailed: return .serviceSubtreeRootsStreamFailed
|
|
842
|
+
case .serviceGetTaddressTxidsFailed: return .serviceGetTaddressTxidsFailed
|
|
816
843
|
case .simpleConnectionProvider: return .simpleConnectionProvider
|
|
817
844
|
case .saplingParamsInvalidSpendParams: return .saplingParamsInvalidSpendParams
|
|
818
845
|
case .saplingParamsInvalidOutputParams: return .saplingParamsInvalidOutputParams
|
|
@@ -885,6 +912,9 @@ public enum ZcashError: Equatable, Error {
|
|
|
885
912
|
case .rustIsSeedRelevantToAnyDerivedAccount: return .rustIsSeedRelevantToAnyDerivedAccount
|
|
886
913
|
case .rustPutOrchardSubtreeRootsAllocationProblem: return .rustPutOrchardSubtreeRootsAllocationProblem
|
|
887
914
|
case .rustPutOrchardSubtreeRoots: return .rustPutOrchardSubtreeRoots
|
|
915
|
+
case .rustTorClientInit: return .rustTorClientInit
|
|
916
|
+
case .rustTorClientGet: return .rustTorClientGet
|
|
917
|
+
case .rustTransactionDataRequests: return .rustTransactionDataRequests
|
|
888
918
|
case .accountDAOGetAll: return .accountDAOGetAll
|
|
889
919
|
case .accountDAOGetAllCantDecode: return .accountDAOGetAllCantDecode
|
|
890
920
|
case .accountDAOFindBy: return .accountDAOFindBy
|
|
@@ -937,6 +967,7 @@ public enum ZcashError: Equatable, Error {
|
|
|
937
967
|
case .saplingAddressInvalidInput: return .saplingAddressInvalidInput
|
|
938
968
|
case .unifiedAddressInvalidInput: return .unifiedAddressInvalidInput
|
|
939
969
|
case .recipientInvalidInput: return .recipientInvalidInput
|
|
970
|
+
case .texAddressInvalidInput: return .texAddressInvalidInput
|
|
940
971
|
case .walletTransEncoderCreateTransactionMissingSaplingParams: return .walletTransEncoderCreateTransactionMissingSaplingParams
|
|
941
972
|
case .walletTransEncoderShieldFundsMissingSaplingParams: return .walletTransEncoderShieldFundsMissingSaplingParams
|
|
942
973
|
case .zatoshiDecode: return .zatoshiDecode
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated using Sourcery 2.
|
|
1
|
+
// Generated using Sourcery 2.2.5 — https://github.com/krzysztofzablocki/Sourcery
|
|
2
2
|
// DO NOT EDIT
|
|
3
3
|
|
|
4
4
|
/*
|
|
@@ -41,6 +41,8 @@ public enum ZcashErrorCode: String {
|
|
|
41
41
|
case serviceBlockStreamFailed = "ZSRVC0000"
|
|
42
42
|
/// LightWalletService.getSubtreeRoots failed.
|
|
43
43
|
case serviceSubtreeRootsStreamFailed = "ZSRVC0009"
|
|
44
|
+
/// LightWalletService.getTaddressTxids failed.
|
|
45
|
+
case serviceGetTaddressTxidsFailed = "ZSRVC0010"
|
|
44
46
|
/// SimpleConnectionProvider init of Connection failed.
|
|
45
47
|
case simpleConnectionProvider = "ZSCPC0001"
|
|
46
48
|
/// Downloaded file with sapling spending parameters isn't valid.
|
|
@@ -185,6 +187,12 @@ public enum ZcashErrorCode: String {
|
|
|
185
187
|
case rustPutOrchardSubtreeRootsAllocationProblem = "ZRUST0060"
|
|
186
188
|
/// Error from rust layer when calling ZcashRustBackend.putOrchardSubtreeRoots
|
|
187
189
|
case rustPutOrchardSubtreeRoots = "ZRUST0061"
|
|
190
|
+
/// Error from rust layer when calling TorClient.init
|
|
191
|
+
case rustTorClientInit = "ZRUST0062"
|
|
192
|
+
/// Error from rust layer when calling TorClient.get
|
|
193
|
+
case rustTorClientGet = "ZRUST0063"
|
|
194
|
+
/// Error from rust layer when calling ZcashRustBackend.transactionDataRequests
|
|
195
|
+
case rustTransactionDataRequests = "ZRUST0064"
|
|
188
196
|
/// SQLite query failed when fetching all accounts from the database.
|
|
189
197
|
case accountDAOGetAll = "ZADAO0001"
|
|
190
198
|
/// Fetched accounts from SQLite but can't decode them.
|
|
@@ -289,6 +297,8 @@ public enum ZcashErrorCode: String {
|
|
|
289
297
|
case unifiedAddressInvalidInput = "ZWLTP0006"
|
|
290
298
|
/// Can't create `Recipient` because input is invalid.
|
|
291
299
|
case recipientInvalidInput = "ZWLTP0007"
|
|
300
|
+
/// Can't create `TexAddress` because input is invalid.
|
|
301
|
+
case texAddressInvalidInput = "ZWLTP0008"
|
|
292
302
|
/// WalletTransactionEncoder wants to create transaction but files with sapling parameters are not present on disk.
|
|
293
303
|
case walletTransEncoderCreateTransactionMissingSaplingParams = "ZWLTE0001"
|
|
294
304
|
/// WalletTransactionEncoder wants to shield funds but files with sapling parameters are not present on disk.
|
|
@@ -80,6 +80,9 @@ enum ZcashErrorDefinition {
|
|
|
80
80
|
/// LightWalletService.getSubtreeRoots failed.
|
|
81
81
|
// sourcery: code="ZSRVC0009"
|
|
82
82
|
case serviceSubtreeRootsStreamFailed(_ error: LightWalletServiceError)
|
|
83
|
+
/// LightWalletService.getTaddressTxids failed.
|
|
84
|
+
// sourcery: code="ZSRVC0010"
|
|
85
|
+
case serviceGetTaddressTxidsFailed(_ error: LightWalletServiceError)
|
|
83
86
|
|
|
84
87
|
// MARK: SQLite connection
|
|
85
88
|
|
|
@@ -367,6 +370,18 @@ enum ZcashErrorDefinition {
|
|
|
367
370
|
/// - `rustError` contains error generated by the rust layer.
|
|
368
371
|
/// sourcery: code="ZRUST0061"
|
|
369
372
|
case rustPutOrchardSubtreeRoots(_ rustError: String)
|
|
373
|
+
/// Error from rust layer when calling TorClient.init
|
|
374
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
375
|
+
/// sourcery: code="ZRUST0062"
|
|
376
|
+
case rustTorClientInit(_ rustError: String)
|
|
377
|
+
/// Error from rust layer when calling TorClient.get
|
|
378
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
379
|
+
/// sourcery: code="ZRUST0063"
|
|
380
|
+
case rustTorClientGet(_ rustError: String)
|
|
381
|
+
/// Error from rust layer when calling ZcashRustBackend.transactionDataRequests
|
|
382
|
+
/// - `rustError` contains error generated by the rust layer.
|
|
383
|
+
/// sourcery: code="ZRUST0064"
|
|
384
|
+
case rustTransactionDataRequests(_ rustError: String)
|
|
370
385
|
|
|
371
386
|
// MARK: - Account DAO
|
|
372
387
|
|
|
@@ -571,6 +586,9 @@ enum ZcashErrorDefinition {
|
|
|
571
586
|
/// Can't create `Recipient` because input is invalid.
|
|
572
587
|
// sourcery: code="ZWLTP0007"
|
|
573
588
|
case recipientInvalidInput
|
|
589
|
+
/// Can't create `TexAddress` because input is invalid.
|
|
590
|
+
// sourcery: code="ZWLTP0008"
|
|
591
|
+
case texAddressInvalidInput
|
|
574
592
|
|
|
575
593
|
// MARK: - WalletTransactionEncoder
|
|
576
594
|
|
|
@@ -90,6 +90,7 @@ public class Initializer {
|
|
|
90
90
|
struct URLs {
|
|
91
91
|
let fsBlockDbRoot: URL
|
|
92
92
|
let dataDbURL: URL
|
|
93
|
+
let torDirURL: URL
|
|
93
94
|
let generalStorageURL: URL
|
|
94
95
|
let spendParamsURL: URL
|
|
95
96
|
let outputParamsURL: URL
|
|
@@ -115,6 +116,7 @@ public class Initializer {
|
|
|
115
116
|
let fsBlockDbRoot: URL
|
|
116
117
|
let generalStorageURL: URL
|
|
117
118
|
let dataDbURL: URL
|
|
119
|
+
let torDirURL: URL
|
|
118
120
|
let spendParamsURL: URL
|
|
119
121
|
let outputParamsURL: URL
|
|
120
122
|
let saplingParamsSourceURL: SaplingParamsSourceURL
|
|
@@ -158,14 +160,14 @@ public class Initializer {
|
|
|
158
160
|
fsBlockDbRoot: URL,
|
|
159
161
|
generalStorageURL: URL,
|
|
160
162
|
dataDbURL: URL,
|
|
163
|
+
torDirURL: URL,
|
|
161
164
|
endpoint: LightWalletEndpoint,
|
|
162
165
|
network: ZcashNetwork,
|
|
163
166
|
spendParamsURL: URL,
|
|
164
167
|
outputParamsURL: URL,
|
|
165
168
|
saplingParamsSourceURL: SaplingParamsSourceURL,
|
|
166
169
|
alias: ZcashSynchronizerAlias = .default,
|
|
167
|
-
loggingPolicy: LoggingPolicy = .default(.debug)
|
|
168
|
-
enableBackendTracing: Bool = false
|
|
170
|
+
loggingPolicy: LoggingPolicy = .default(.debug)
|
|
169
171
|
) {
|
|
170
172
|
let container = DIContainer()
|
|
171
173
|
|
|
@@ -177,14 +179,14 @@ public class Initializer {
|
|
|
177
179
|
fsBlockDbRoot: fsBlockDbRoot,
|
|
178
180
|
generalStorageURL: generalStorageURL,
|
|
179
181
|
dataDbURL: dataDbURL,
|
|
182
|
+
torDirURL: torDirURL,
|
|
180
183
|
endpoint: endpoint,
|
|
181
184
|
network: network,
|
|
182
185
|
spendParamsURL: spendParamsURL,
|
|
183
186
|
outputParamsURL: outputParamsURL,
|
|
184
187
|
saplingParamsSourceURL: saplingParamsSourceURL,
|
|
185
188
|
alias: alias,
|
|
186
|
-
loggingPolicy: loggingPolicy
|
|
187
|
-
enableBackendTracing: enableBackendTracing
|
|
189
|
+
loggingPolicy: loggingPolicy
|
|
188
190
|
)
|
|
189
191
|
|
|
190
192
|
self.init(
|
|
@@ -207,14 +209,14 @@ public class Initializer {
|
|
|
207
209
|
fsBlockDbRoot: URL,
|
|
208
210
|
generalStorageURL: URL,
|
|
209
211
|
dataDbURL: URL,
|
|
212
|
+
torDirURL: URL,
|
|
210
213
|
endpoint: LightWalletEndpoint,
|
|
211
214
|
network: ZcashNetwork,
|
|
212
215
|
spendParamsURL: URL,
|
|
213
216
|
outputParamsURL: URL,
|
|
214
217
|
saplingParamsSourceURL: SaplingParamsSourceURL,
|
|
215
218
|
alias: ZcashSynchronizerAlias = .default,
|
|
216
|
-
loggingPolicy: LoggingPolicy = .default(.debug)
|
|
217
|
-
enableBackendTracing: Bool = false
|
|
219
|
+
loggingPolicy: LoggingPolicy = .default(.debug)
|
|
218
220
|
) {
|
|
219
221
|
// It's not possible to fail from constructor. Technically it's possible but it can be pain for the client apps to handle errors thrown
|
|
220
222
|
// from constructor. So `parsingError` is just stored in initializer and `SDKSynchronizer.prepare()` throw this error if it exists.
|
|
@@ -224,14 +226,14 @@ public class Initializer {
|
|
|
224
226
|
fsBlockDbRoot: fsBlockDbRoot,
|
|
225
227
|
generalStorageURL: generalStorageURL,
|
|
226
228
|
dataDbURL: dataDbURL,
|
|
229
|
+
torDirURL: torDirURL,
|
|
227
230
|
endpoint: endpoint,
|
|
228
231
|
network: network,
|
|
229
232
|
spendParamsURL: spendParamsURL,
|
|
230
233
|
outputParamsURL: outputParamsURL,
|
|
231
234
|
saplingParamsSourceURL: saplingParamsSourceURL,
|
|
232
235
|
alias: alias,
|
|
233
|
-
loggingPolicy: loggingPolicy
|
|
234
|
-
enableBackendTracing: enableBackendTracing
|
|
236
|
+
loggingPolicy: loggingPolicy
|
|
235
237
|
)
|
|
236
238
|
|
|
237
239
|
self.init(
|
|
@@ -264,6 +266,7 @@ public class Initializer {
|
|
|
264
266
|
self.fsBlockDbRoot = urls.fsBlockDbRoot
|
|
265
267
|
self.generalStorageURL = urls.generalStorageURL
|
|
266
268
|
self.dataDbURL = urls.dataDbURL
|
|
269
|
+
self.torDirURL = urls.torDirURL
|
|
267
270
|
self.endpoint = endpoint
|
|
268
271
|
self.spendParamsURL = urls.spendParamsURL
|
|
269
272
|
self.outputParamsURL = urls.outputParamsURL
|
|
@@ -286,18 +289,19 @@ public class Initializer {
|
|
|
286
289
|
fsBlockDbRoot: URL,
|
|
287
290
|
generalStorageURL: URL,
|
|
288
291
|
dataDbURL: URL,
|
|
292
|
+
torDirURL: URL,
|
|
289
293
|
endpoint: LightWalletEndpoint,
|
|
290
294
|
network: ZcashNetwork,
|
|
291
295
|
spendParamsURL: URL,
|
|
292
296
|
outputParamsURL: URL,
|
|
293
297
|
saplingParamsSourceURL: SaplingParamsSourceURL,
|
|
294
298
|
alias: ZcashSynchronizerAlias,
|
|
295
|
-
loggingPolicy: LoggingPolicy = .default(.debug)
|
|
296
|
-
enableBackendTracing: Bool = false
|
|
299
|
+
loggingPolicy: LoggingPolicy = .default(.debug)
|
|
297
300
|
) -> (URLs, ZcashError?) {
|
|
298
301
|
let urls = URLs(
|
|
299
302
|
fsBlockDbRoot: fsBlockDbRoot,
|
|
300
303
|
dataDbURL: dataDbURL,
|
|
304
|
+
torDirURL: torDirURL,
|
|
301
305
|
generalStorageURL: generalStorageURL,
|
|
302
306
|
spendParamsURL: spendParamsURL,
|
|
303
307
|
outputParamsURL: outputParamsURL
|
|
@@ -313,8 +317,7 @@ public class Initializer {
|
|
|
313
317
|
alias: alias,
|
|
314
318
|
networkType: network.networkType,
|
|
315
319
|
endpoint: endpoint,
|
|
316
|
-
loggingPolicy: loggingPolicy
|
|
317
|
-
enableBackendTracing: enableBackendTracing
|
|
320
|
+
loggingPolicy: loggingPolicy
|
|
318
321
|
)
|
|
319
322
|
|
|
320
323
|
return (updatedURLs, parsingError)
|
|
@@ -362,6 +365,10 @@ public class Initializer {
|
|
|
362
365
|
return .failure(.initializerCantUpdateURLWithAlias(urls.dataDbURL))
|
|
363
366
|
}
|
|
364
367
|
|
|
368
|
+
guard let updatedTorDirURL = urls.torDirURL.updateLastPathComponent(with: alias) else {
|
|
369
|
+
return .failure(.initializerCantUpdateURLWithAlias(urls.torDirURL))
|
|
370
|
+
}
|
|
371
|
+
|
|
365
372
|
guard let updatedSpendParamsURL = urls.spendParamsURL.updateLastPathComponent(with: alias) else {
|
|
366
373
|
return .failure(.initializerCantUpdateURLWithAlias(urls.spendParamsURL))
|
|
367
374
|
}
|
|
@@ -378,6 +385,7 @@ public class Initializer {
|
|
|
378
385
|
URLs(
|
|
379
386
|
fsBlockDbRoot: updatedFsBlockDbRoot,
|
|
380
387
|
dataDbURL: updatedDataDbURL,
|
|
388
|
+
torDirURL: updatedTorDirURL,
|
|
381
389
|
generalStorageURL: updatedGeneralStorageURL,
|
|
382
390
|
spendParamsURL: updatedSpendParamsURL,
|
|
383
391
|
outputParamsURL: updateOutputParamsURL
|
|
@@ -415,8 +423,8 @@ public class Initializer {
|
|
|
415
423
|
if let seed, try await rustBackend.listAccounts().isEmpty {
|
|
416
424
|
var chainTip: UInt32?
|
|
417
425
|
|
|
418
|
-
if walletMode == .restoreWallet {
|
|
419
|
-
chainTip = UInt32(
|
|
426
|
+
if walletMode == .restoreWallet, let latestBlockHeight = try? await lightWalletService.latestBlockHeight() {
|
|
427
|
+
chainTip = UInt32(latestBlockHeight)
|
|
420
428
|
}
|
|
421
429
|
|
|
422
430
|
_ = try await rustBackend.createAccount(
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FiatCurrencyResult.swift
|
|
3
|
+
//
|
|
4
|
+
//
|
|
5
|
+
// Created by Lukáš Korba on 31.07.2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
/// The model representing currency for ZEC-XXX conversion. Initial implementation
|
|
11
|
+
/// provides only USD value.
|
|
12
|
+
public struct FiatCurrencyResult: Equatable {
|
|
13
|
+
public enum State: Equatable {
|
|
14
|
+
/// Last fetch failed, cached value is returned instead.
|
|
15
|
+
case error
|
|
16
|
+
/// Refresh has been triggered, returning cached value but informing about request in flight.
|
|
17
|
+
case fetching
|
|
18
|
+
/// Fetch of the value ended up as success so new value in returned.
|
|
19
|
+
case success
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public let date: Date
|
|
23
|
+
public let rate: NSDecimalNumber
|
|
24
|
+
public var state: State
|
|
25
|
+
}
|
|
@@ -35,7 +35,7 @@ public extension Proposal {
|
|
|
35
35
|
/// passed to `Synchronizer.createProposedTransactions`. It should never be called in
|
|
36
36
|
/// production code.
|
|
37
37
|
static func testOnlyFakeProposal(totalFee: UInt64) -> Self {
|
|
38
|
-
|
|
38
|
+
let ffiProposal = FfiProposal()
|
|
39
39
|
var balance = FfiTransactionBalance()
|
|
40
40
|
|
|
41
41
|
balance.feeRequired = totalFee
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TransactionDataRequest.swift
|
|
3
|
+
//
|
|
4
|
+
//
|
|
5
|
+
// Created by Lukáš Korba on 08-15-2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
struct SpendsFromAddress: Equatable {
|
|
11
|
+
let address: String
|
|
12
|
+
let blockRangeStart: UInt32
|
|
13
|
+
let blockRangeEnd: UInt32?
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
enum TransactionDataRequest: Equatable {
|
|
17
|
+
case getStatus([UInt8])
|
|
18
|
+
case enhancement([UInt8])
|
|
19
|
+
case spendsFromAddress(SpendsFromAddress)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
enum TransactionStatus: Equatable {
|
|
23
|
+
case txidNotRecognized
|
|
24
|
+
case notInMainChain
|
|
25
|
+
case mined(BlockHeight)
|
|
26
|
+
}
|