Fix Errors introduced by Merge-Commit
This commit is contained in:
parent
9b930391a4
commit
0282d81584
|
@ -87,7 +87,7 @@
|
|||
"repositoryURL": "https://github.com/zcash-hackworks/zcash-light-client-ffi",
|
||||
"state": {
|
||||
"branch": "bin/librustzcash_0_7",
|
||||
"revision": "823f864a7952073fb9718cf75610691756e34d59",
|
||||
"revision": "61534023777235cc5b76d4ec44e27edc1658eea6",
|
||||
"version": null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ public protocol Synchronizer {
|
|||
|
||||
/// reflects current connection state to LightwalletEndpoint
|
||||
var connectionState: ConnectionState { get }
|
||||
|
||||
|
||||
/// prepares this initializer to operate. Initializes the internal state with the given
|
||||
/// Extended Viewing Keys and a wallet birthday found in the initializer object
|
||||
|
@ -90,13 +89,11 @@ public protocol Synchronizer {
|
|||
|
||||
/// Stop this synchronizer. Implementations should ensure that calling this method cancels all jobs that were created by this instance.
|
||||
func stop() throws
|
||||
|
||||
|
||||
/// Gets the sapling shielded address for the given account.
|
||||
/// - Parameter accountIndex: the optional accountId whose address is of interest. By default, the first account is used.
|
||||
/// - Returns the address or nil if account index is incorrect
|
||||
func getSaplingAddress(accountIndex: Int) -> SaplingAddress?
|
||||
|
||||
|
||||
/// Gets the unified address for the given account.
|
||||
/// - Parameter accountIndex: the optional accountId whose address is of interest. By default, the first account is used.
|
||||
|
@ -108,36 +105,18 @@ public protocol Synchronizer {
|
|||
/// - Returns the address or nil if account index is incorrect
|
||||
func getTransparentAddress(accountIndex: Int) -> TransparentAddress?
|
||||
|
||||
/// Sends zatoshi.
|
||||
/// - Parameter spendingKey: the key that allows spends to occur.
|
||||
/// - Parameter zatoshi: the amount of zatoshi to send.
|
||||
/// - Parameter toAddress: the recipient's address.
|
||||
/// - Parameter memo: the optional memo to include as part of the transaction.
|
||||
/// - Parameter accountIndex: the optional account id to use. By default, the first account is used.
|
||||
@available(*, deprecated, message: "This function will be removed soon, use the one reveiving a `Zatoshi` value instead")
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func sendToAddress(
|
||||
spendingKey: String,
|
||||
zatoshi: Int64,
|
||||
toAddress: String,
|
||||
memo: String?,
|
||||
from accountIndex: Int,
|
||||
resultBlock: @escaping (_ result: Result<PendingTransactionEntity, Error>) -> Void
|
||||
)
|
||||
|
||||
|
||||
/// Sends zatoshi.
|
||||
/// - Parameter spendingKey: the key that allows spends to occur.
|
||||
/// - Parameter zatoshi: the amount to send in Zatoshi.
|
||||
/// - Parameter toAddress: the recipient's address.
|
||||
/// - Parameter memo: the optional memo to include as part of the transaction.
|
||||
/// - Parameter memo: the memo to include as part of the transaction.
|
||||
/// - Parameter accountIndex: the optional account id to use. By default, the first account is used.
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func sendToAddress(
|
||||
spendingKey: SaplingExtendedSpendingKey,
|
||||
zatoshi: Zatoshi,
|
||||
toAddress: Recipient,
|
||||
memo: String?,
|
||||
memo: Memo,
|
||||
from accountIndex: Int,
|
||||
resultBlock: @escaping (_ result: Result<PendingTransactionEntity, Error>) -> Void
|
||||
)
|
||||
|
@ -148,7 +127,7 @@ public protocol Synchronizer {
|
|||
/// - Parameter accountIndex: the optional account id that will be used to shield your funds to. By default, the first account is used.
|
||||
func shieldFunds(
|
||||
transparentAccountPrivateKey: TransparentAccountPrivKey,
|
||||
memo: String?,
|
||||
memo: Memo,
|
||||
from accountIndex: Int,
|
||||
resultBlock: @escaping (Result<PendingTransactionEntity, Error>) -> Void
|
||||
)
|
||||
|
@ -194,14 +173,12 @@ public protocol Synchronizer {
|
|||
/// Returns the latest block height from the provided Lightwallet endpoint
|
||||
/// Blocking
|
||||
func latestHeight() throws -> BlockHeight
|
||||
|
||||
|
||||
/// Returns the latests UTXOs for the given address from the specified height on
|
||||
func refreshUTXOs(address: String, from height: BlockHeight, result: @escaping (Result<RefreshedUTXOs, Error>) -> Void)
|
||||
|
||||
/// Returns the last stored transparent balance
|
||||
func getTransparentBalance(accountIndex: Int) throws -> WalletBalance
|
||||
|
||||
|
||||
/// Returns the shielded total balance (includes verified and unverified balance)
|
||||
@available(*, deprecated, message: "This function will be removed soon, use the one returning a `Zatoshi` value instead")
|
||||
|
@ -237,23 +214,19 @@ public enum SyncStatus: Equatable {
|
|||
/// Indicates that this Synchronizer is actively downloading new blocks from the server.
|
||||
case downloading(_ status: BlockProgress)
|
||||
|
||||
|
||||
/// Indicates that this Synchronizer is actively validating new blocks that were downloaded
|
||||
/// from the server. Blocks need to be verified before they are scanned. This confirms that
|
||||
/// each block is chain-sequential, thereby detecting missing blocks and reorgs.
|
||||
case validating
|
||||
|
||||
|
||||
/// Indicates that this Synchronizer is actively scanning new valid blocks that were
|
||||
/// downloaded from the server.
|
||||
case scanning(_ progress: BlockProgress)
|
||||
|
||||
|
||||
/// Indicates that this Synchronizer is actively enhancing newly scanned blocks
|
||||
/// with additional transaction details, fetched from the server.
|
||||
case enhancing(_ progress: EnhancementProgress)
|
||||
|
||||
|
||||
/// fetches the transparent balance and stores it locally
|
||||
case fetching
|
||||
|
||||
|
@ -261,11 +234,9 @@ public enum SyncStatus: Equatable {
|
|||
/// When set, a UI element may want to turn green.
|
||||
case synced
|
||||
|
||||
|
||||
/// Indicates that [stop] has been called on this Synchronizer and it will no longer be used.
|
||||
case stopped
|
||||
|
||||
|
||||
/// Indicates that this Synchronizer is disconnected from its lightwalletd server.
|
||||
/// When set, a UI element may want to turn red.
|
||||
case disconnected
|
||||
|
@ -289,7 +260,6 @@ public enum SyncStatus: Equatable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// Kind of transactions handled by a Synchronizer
|
||||
public enum TransactionKind {
|
||||
case sent
|
||||
|
@ -297,7 +267,6 @@ public enum TransactionKind {
|
|||
case all
|
||||
}
|
||||
|
||||
|
||||
/// Type of rewind available
|
||||
/// -birthday: rewinds the local state to this wallet's birthday
|
||||
/// -height: rewinds to the nearest blockheight to the one given as argument.
|
||||
|
|
|
@ -458,58 +458,11 @@ public class SDKSynchronizer: Synchronizer {
|
|||
|
||||
// MARK: Synchronizer methods
|
||||
|
||||
@available(*, deprecated, message: "This function will be removed soon, use the one receiving a `Zatoshi` value instead")
|
||||
public func sendToAddress(
|
||||
spendingKey: String,
|
||||
zatoshi: Int64,
|
||||
toAddress: String,
|
||||
memo: String?,
|
||||
from accountIndex: Int,
|
||||
resultBlock: @escaping (Result<PendingTransactionEntity, Error>) -> Void
|
||||
) {
|
||||
do {
|
||||
sendToAddress(
|
||||
spendingKey: try SaplingExtendedSpendingKey(encoding: spendingKey, network: network.networkType),
|
||||
zatoshi: Zatoshi(zatoshi),
|
||||
toAddress: try Recipient(toAddress, network: network.networkType),
|
||||
memo: memo,
|
||||
from: accountIndex,
|
||||
resultBlock: resultBlock
|
||||
)
|
||||
} catch {
|
||||
resultBlock(.failure(SynchronizerError.invalidAccount))
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
@available(*, deprecated, message: "use Memo type instead of Optional<String>")
|
||||
public func sendToAddress(
|
||||
spendingKey: SaplingExtendedSpendingKey,
|
||||
zatoshi: Zatoshi,
|
||||
toAddress: Recipient,
|
||||
memo: String?,
|
||||
from accountIndex: Int,
|
||||
resultBlock: @escaping (Result<PendingTransactionEntity, Error>) -> Void
|
||||
) {
|
||||
do {
|
||||
self.sendToAddress(
|
||||
spendingKey: spendingKey,
|
||||
zatoshi: zatoshi,
|
||||
toAddress: toAddress,
|
||||
memo: try memo.intoMemo(),
|
||||
from: accountIndex,
|
||||
resultBlock: resultBlock
|
||||
)
|
||||
} catch {
|
||||
resultBlock(.failure(SynchronizerError.uncategorized(underlyingError: error)))
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
public func sendToAddress(
|
||||
spendingKey: String,
|
||||
zatoshi: Zatoshi,
|
||||
toAddress: String,
|
||||
memo: Memo,
|
||||
from accountIndex: Int,
|
||||
resultBlock: @escaping (Result<PendingTransactionEntity, Error>) -> Void
|
||||
|
@ -534,7 +487,7 @@ public class SDKSynchronizer: Synchronizer {
|
|||
}
|
||||
|
||||
public func shieldFunds(
|
||||
transparentSecretKey: String,
|
||||
transparentAccountPrivateKey: TransparentAccountPrivKey,
|
||||
memo: Memo,
|
||||
from accountIndex: Int,
|
||||
resultBlock: @escaping (Result<PendingTransactionEntity, Error>) -> Void
|
||||
|
@ -560,7 +513,7 @@ public class SDKSynchronizer: Synchronizer {
|
|||
return
|
||||
}
|
||||
|
||||
let shieldingSpend = try transactionManager.initSpend(zatoshi: tBalance.verified, toAddress: uAddr.stringEncoded, memo: memo, from: accountIndex)
|
||||
let shieldingSpend = try transactionManager.initSpend(zatoshi: tBalance.verified, toAddress: uAddr.stringEncoded, memo: try memo.asMemoBytes(), from: accountIndex)
|
||||
|
||||
transactionManager.encodeShieldingTransaction(
|
||||
xprv: transparentAccountPrivateKey,
|
||||
|
@ -582,7 +535,7 @@ public class SDKSynchronizer: Synchronizer {
|
|||
}
|
||||
|
||||
case .failure(let error):
|
||||
resultBlock(.failure(error))
|
||||
resultBlock(.failure(SynchronizerError.uncategorized(underlyingError: error)))
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
|
@ -590,25 +543,6 @@ public class SDKSynchronizer: Synchronizer {
|
|||
}
|
||||
}
|
||||
|
||||
@available(*, deprecated, message: "use shieldFunds with a Memo type")
|
||||
public func shieldFunds(
|
||||
transparentSecretKey: String,
|
||||
memo: String?,
|
||||
from accountIndex: Int,
|
||||
resultBlock: @escaping (Result<PendingTransactionEntity, Error>) -> Void
|
||||
) {
|
||||
do {
|
||||
shieldFunds(
|
||||
transparentSecretKey: transparentSecretKey,
|
||||
memo: try memo.intoMemo(),
|
||||
from: accountIndex,
|
||||
resultBlock: resultBlock
|
||||
)
|
||||
} catch {
|
||||
resultBlock(.failure(SynchronizerError.uncategorized(underlyingError: error)))
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func createToAddress(
|
||||
spendingKey: SaplingExtendedSpendingKey,
|
||||
|
@ -642,7 +576,7 @@ public class SDKSynchronizer: Synchronizer {
|
|||
}
|
||||
|
||||
case .failure(let error):
|
||||
resultBlock(.failure(error))
|
||||
resultBlock(.failure(SynchronizerError.uncategorized(underlyingError: error)))
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
|
|
|
@ -50,7 +50,7 @@ protocol TransactionEncoder {
|
|||
/// - Parameter spendingKey: a `SaplingExtendedSpendingKey` containing the spending key
|
||||
/// - Parameter zatoshi: the amount to send in `Zatoshi`
|
||||
/// - Parameter to: string containing the recipient address
|
||||
/// - Parameter memo: string containing the memo (optional)
|
||||
/// - Parameter MemoBytes: string containing the memo (optional)
|
||||
/// - Parameter accountIndex: index of the account that will be used to send the funds
|
||||
/// - Parameter result: a non escaping closure that receives a Result containing either an EncodedTransaction or a /// TransactionEncoderError
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
|
@ -58,7 +58,7 @@ protocol TransactionEncoder {
|
|||
spendingKey: SaplingExtendedSpendingKey,
|
||||
zatoshi: Zatoshi,
|
||||
to address: String,
|
||||
memo: String?,
|
||||
memoBytes: MemoBytes,
|
||||
from accountIndex: Int,
|
||||
result: @escaping TransactionEncoderResultBlock
|
||||
)
|
||||
|
@ -69,54 +69,12 @@ protocol TransactionEncoder {
|
|||
|
||||
- Parameters:
|
||||
- Parameter tAccountPrivateKey: transparent account private key to spend the UTXOs
|
||||
- Parameter memo: string containing the memo (optional)
|
||||
- Parameter memoBytes: containing the memo (optional)
|
||||
- Parameter accountIndex: index of the account that will be used to send the funds
|
||||
|
||||
- Throws: a TransactionEncoderError
|
||||
*/
|
||||
func createShieldingTransaction(
|
||||
tAccountPrivateKey: TransparentAccountPrivKey,
|
||||
memo: String?,
|
||||
from accountIndex: Int
|
||||
) throws -> EncodedTransaction
|
||||
|
||||
/// Creates a transaction, throwing an exception whenever things are missing. When the provided ///wallet implementation
|
||||
/// doesn't throw an exception, we wrap the issue into a descriptive exception ourselves (rather ///than using
|
||||
/// double-bangs for things).
|
||||
/// Non-blocking
|
||||
|
||||
/// - Parameters:
|
||||
/// - Parameter spendingKey: a string containing the spending key
|
||||
/// - Parameter zatoshi: the amount to send in zatoshis
|
||||
/// - Parameter to: string containing the recipient address
|
||||
/// - Parameter memoBytes: MemoBytes for this transaction
|
||||
/// - Parameter accountIndex: index of the account that will be used to send the funds
|
||||
/// - Parameter result: a non escaping closure that receives a Result containing either an ///EncodedTransaction or a TransactionEncoderError
|
||||
func createTransaction(
|
||||
spendingKey: String,
|
||||
zatoshi: Int,
|
||||
to address: String,
|
||||
memoBytes: MemoBytes,
|
||||
from accountIndex: Int,
|
||||
result: @escaping TransactionEncoderResultBlock
|
||||
)// swiftlint:disable function_parameter_count
|
||||
|
||||
/// Creates a transaction that will attempt to shield transparent funds that are present on the cacheDB.
|
||||
/// Throwing an exception whenever things are missing. When the provided wallet implementation
|
||||
/// doesn't throw an exception, we wrap the issue into a descriptive exception ourselves (rather than using double-bangs for things).
|
||||
///
|
||||
/// Blocking
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - Parameter spendingKey: a string containing the spending key
|
||||
/// - Parameter tSecretKey: transparent secret key to spend the UTXOs
|
||||
/// - Parameter Parameter memoBytes: MemoBytes for this transaction
|
||||
/// - Parameter accountIndex: index of the account that will be used to send the funds
|
||||
///
|
||||
/// - Throws: a TransactionEncoderError
|
||||
func createShieldingTransaction(
|
||||
spendingKey: String,
|
||||
tSecretKey: String,
|
||||
memoBytes: MemoBytes,
|
||||
from accountIndex: Int
|
||||
) throws -> EncodedTransaction
|
||||
|
|
|
@ -83,7 +83,7 @@ class BalanceTests: XCTestCase {
|
|||
spendingKey: spendingKey,
|
||||
zatoshi: maxBalance,
|
||||
toAddress: try Recipient(testRecipientAddress, network: self.network.networkType),
|
||||
try Memo(string: "this is a test"),
|
||||
memo: try Memo(string: "this is a test"),
|
||||
from: 0,
|
||||
resultBlock: { result in
|
||||
switch result {
|
||||
|
@ -510,7 +510,7 @@ class BalanceTests: XCTestCase {
|
|||
coordinator.synchronizer.sendToAddress(
|
||||
spendingKey: spendingKey,
|
||||
zatoshi: sendAmount,
|
||||
toAddress: testRecipientAddress,
|
||||
toAddress: try Recipient(testRecipientAddress, network: self.network.networkType),
|
||||
memo: try Memo(string: "this is a test"),
|
||||
from: 0,
|
||||
resultBlock: { result in
|
||||
|
|
|
@ -271,7 +271,7 @@ class RewindRescanTests: XCTestCase {
|
|||
spendingKey: spendingKey,
|
||||
zatoshi: maxBalance,
|
||||
toAddress: try Recipient(testRecipientAddress, network: self.network.networkType),
|
||||
memo: try Memo("test send \(self.description) \(Date().description)"),
|
||||
memo: try Memo(string: "test send \(self.description) \(Date().description)"),
|
||||
from: 0
|
||||
) { result in
|
||||
switch result {
|
||||
|
|
|
@ -77,6 +77,22 @@ extension LightWalletServiceMockResponse {
|
|||
}
|
||||
|
||||
class MockRustBackend: ZcashRustBackendWelding {
|
||||
static func getReceivedMemo(dbData: URL, idNote: Int64, networkType: ZcashLightClientKit.NetworkType) -> ZcashLightClientKit.Memo? {
|
||||
nil
|
||||
}
|
||||
|
||||
static func getSentMemo(dbData: URL, idNote: Int64, networkType: ZcashLightClientKit.NetworkType) -> ZcashLightClientKit.Memo? {
|
||||
nil
|
||||
}
|
||||
|
||||
static func createToAddress(dbData: URL, account: Int32, extsk: String, to address: String, value: Int64, memo: ZcashLightClientKit.MemoBytes, spendParamsPath: String, outputParamsPath: String, networkType: ZcashLightClientKit.NetworkType) -> Int64 {
|
||||
-1
|
||||
}
|
||||
|
||||
static func shieldFunds(dbCache: URL, dbData: URL, account: Int32, xprv: String, memo: ZcashLightClientKit.MemoBytes, spendParamsPath: String, outputParamsPath: String, networkType: ZcashLightClientKit.NetworkType) -> Int64 {
|
||||
-1
|
||||
}
|
||||
|
||||
|
||||
static func initDataDb(dbData: URL, seed: [UInt8]?, networkType: ZcashLightClientKit.NetworkType) throws -> ZcashLightClientKit.DbInitResult {
|
||||
.seedRequired
|
||||
|
|
Loading…
Reference in New Issue