Public API isSeedRelevantToWallet
- New public API `isSeedRelevantToWallet` has been implemented - 2 swiftlint error have been resolved - Mocks generated
This commit is contained in:
parent
a5a0ef0ac1
commit
e1c600b8ff
|
@ -351,6 +351,11 @@ public protocol Synchronizer: AnyObject {
|
|||
/// - Throws: ZcashError when failures occur and related to `synchronizer.start(retry: Bool)`, it's the only throwing operation
|
||||
/// during the whole endpoint change.
|
||||
func switchTo(endpoint: LightWalletEndpoint) async throws
|
||||
|
||||
/// Checks whether the given seed is relevant to any of the accounts in the wallet.
|
||||
///
|
||||
/// - parameter seed: byte array of the seed
|
||||
func isSeedRelevantToWallet(seed: [UInt8]) async throws -> Bool
|
||||
}
|
||||
|
||||
public enum SyncStatus: Equatable {
|
||||
|
|
|
@ -303,8 +303,8 @@ public class SDKSynchronizer: Synchronizer {
|
|||
uri,
|
||||
accountIndex: accountIndex
|
||||
)
|
||||
} catch ZcashError.rustCreateToAddress(let e) {
|
||||
throw ZcashError.rustProposeTransferFromURI(e)
|
||||
} catch ZcashError.rustCreateToAddress(let error) {
|
||||
throw ZcashError.rustProposeTransferFromURI(error)
|
||||
} catch {
|
||||
throw error
|
||||
}
|
||||
|
@ -604,6 +604,10 @@ public class SDKSynchronizer: Synchronizer {
|
|||
return subject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
public func isSeedRelevantToWallet(seed: [UInt8]) async throws -> Bool {
|
||||
try await initializer.rustBackend.isSeedRelevantToWallet(seed: seed)
|
||||
}
|
||||
|
||||
// MARK: Server switch
|
||||
|
||||
public func switchTo(endpoint: LightWalletEndpoint) async throws {
|
||||
|
|
|
@ -315,6 +315,7 @@ class PaymentURIFulfillmentTests: ZcashTestCase {
|
|||
*/
|
||||
|
||||
let memo = "VGhpcyBpcyBhIHNpbXBsZSBtZW1vLg" // "This is a simple memo."
|
||||
// swiftlint:disable:next line_length
|
||||
let paymentURI = "zcash:zecIsGreat17mg40levjezevuhdp5pqrd52zere7r7vrjgdwn5sj4xsqtm20euwahv9anxmwr3y3kmwuz8k55a?amount=0.0002&memo=\(memo)&message=Thank%20you%20for%20your%20purchase&label=Your%20Purchase"
|
||||
|
||||
do {
|
||||
|
|
|
@ -1800,6 +1800,30 @@ class SynchronizerMock: Synchronizer {
|
|||
try await switchToEndpointClosure!(endpoint)
|
||||
}
|
||||
|
||||
// MARK: - isSeedRelevantToWallet
|
||||
|
||||
var isSeedRelevantToWalletSeedThrowableError: Error?
|
||||
var isSeedRelevantToWalletSeedCallsCount = 0
|
||||
var isSeedRelevantToWalletSeedCalled: Bool {
|
||||
return isSeedRelevantToWalletSeedCallsCount > 0
|
||||
}
|
||||
var isSeedRelevantToWalletSeedReceivedSeed: [UInt8]?
|
||||
var isSeedRelevantToWalletSeedReturnValue: Bool!
|
||||
var isSeedRelevantToWalletSeedClosure: (([UInt8]) async throws -> Bool)?
|
||||
|
||||
func isSeedRelevantToWallet(seed: [UInt8]) async throws -> Bool {
|
||||
if let error = isSeedRelevantToWalletSeedThrowableError {
|
||||
throw error
|
||||
}
|
||||
isSeedRelevantToWalletSeedCallsCount += 1
|
||||
isSeedRelevantToWalletSeedReceivedSeed = seed
|
||||
if let closure = isSeedRelevantToWalletSeedClosure {
|
||||
return try await closure(seed)
|
||||
} else {
|
||||
return isSeedRelevantToWalletSeedReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
class TransactionRepositoryMock: TransactionRepository {
|
||||
|
||||
|
|
Loading…
Reference in New Issue