-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #795 from novasamatech/develop
v6.7.3
- Loading branch information
Showing
98 changed files
with
2,324 additions
and
716 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import Foundation | ||
import IrohaCrypto | ||
import SoraKeystore | ||
|
||
class BaseSigner: SignatureCreatorProtocol, AuthorizationPresentable { | ||
let settingsManager: SettingsManagerProtocol | ||
|
||
init(settingsManager: SettingsManagerProtocol) { | ||
self.settingsManager = settingsManager | ||
} | ||
|
||
func sign(_ originalData: Data) throws -> IRSignatureProtocol { | ||
if settingsManager.pinConfirmationEnabled == true { | ||
let signingResult = signAfterAutorization(originalData) | ||
switch signingResult { | ||
case let .success(signature): | ||
return signature | ||
case let .failure(error): | ||
throw error | ||
} | ||
} else { | ||
return try signData(originalData) | ||
} | ||
} | ||
|
||
private func signAfterAutorization(_ originalData: Data) -> Result<IRSignatureProtocol, Error> { | ||
let semaphore = DispatchSemaphore(value: 0) | ||
var signResult: Result<IRSignatureProtocol, Error>? | ||
|
||
DispatchQueue.main.async { | ||
self.authorize(animated: true, cancellable: true) { [weak self] completed in | ||
defer { | ||
semaphore.signal() | ||
} | ||
guard let self = self else { | ||
return | ||
} | ||
if completed { | ||
do { | ||
let sign = try self.signData(originalData) | ||
signResult = .success(sign) | ||
} catch { | ||
signResult = .failure(error) | ||
} | ||
} | ||
} | ||
} | ||
|
||
semaphore.wait() | ||
|
||
return signResult ?? .failure(SigningWrapperError.pinCheckNotPassed) | ||
} | ||
|
||
func signData(_: Data) throws -> IRSignatureProtocol { | ||
fatalError("Must be overriden by subsclass") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Foundation | ||
import BigInt | ||
|
||
struct FeeOutputModel { | ||
let value: BigUInt | ||
let validationProvider: ExtrinsicValidationProviderProtocol? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
novawallet/Common/Network/Ethereum/EthereumReducedBlockObject.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Foundation | ||
import BigInt | ||
|
||
struct EthereumReducedBlockObject: Decodable { | ||
@OptionHexCodable var baseFeePerGas: BigUInt? | ||
} |
Oops, something went wrong.