Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.11.4 hotfixes #1433

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion Aux/Config/Common.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// MARK: - Custom flags

/// Application version shared across all targets and flavours
APP_VERSION = 1.11.0
APP_VERSION = 1.11.3

/// App Icon base name
APP_ICON = AppIcon
Expand Down
33 changes: 24 additions & 9 deletions RadixWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@
83377A052B9DDB5C00D8AA36 /* NPSSurveyClient+Live.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83377A042B9DDB5C00D8AA36 /* NPSSurveyClient+Live.swift */; };
8338B9E52AFAB20700D1D8EA /* TransactionFee.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8338B9E42AFAB20700D1D8EA /* TransactionFee.swift */; };
834B651F2B972E5100B7E1E8 /* NPSSurvey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 834B651E2B972E5100B7E1E8 /* NPSSurvey.swift */; };
835DFF932D19855A00229DB0 /* Sargon in Frameworks */ = {isa = PBXBuildFile; productRef = 835DFF922D19855A00229DB0 /* Sargon */; };
835F196D2B3581C300E0B71D /* UnknownDappComponents+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 835F196C2B3581C300E0B71D /* UnknownDappComponents+View.swift */; };
8370FC5C2B99C780007AD882 /* NPSSurveyClient+Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8370FC5B2B99C780007AD882 /* NPSSurveyClient+Interface.swift */; };
8381C8B02BBD2CD400A470B4 /* TokenPriceCientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8381C8AF2BBD2CD400A470B4 /* TokenPriceCientTests.swift */; };
Expand All @@ -843,6 +844,7 @@
839B6C542B21D28400402651 /* ExpandableTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 839B6C532B21D28400402651 /* ExpandableTextView.swift */; };
83AAAC6D2B483D1B00222B64 /* StakeSummaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83AAAC6B2B483D1B00222B64 /* StakeSummaryView.swift */; };
83B783562C1764AE00AA7930 /* Sargon in Frameworks */ = {isa = PBXBuildFile; productRef = 83B783552C1764AE00AA7930 /* Sargon */; };
83D3F3C32D15C9CA00CA976D /* Sargon in Frameworks */ = {isa = PBXBuildFile; productRef = 83D3F3C22D15C9CA00CA976D /* Sargon */; };
83D663B02B271D0100D1AB9E /* TruncationMask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83D663AF2B271D0100D1AB9E /* TruncationMask.swift */; };
83D908AD2C931A7100822CC4 /* SargonSecureStorageDriver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83D908AC2C931A7100822CC4 /* SargonSecureStorageDriver.swift */; };
83DFAF2E2B4E8A51008B70CE /* View+Extra.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83DFAF2D2B4E8A51008B70CE /* View+Extra.swift */; };
Expand Down Expand Up @@ -2568,6 +2570,7 @@
48FFFAAB2ADC1FE900B2B213 /* DependenciesAdditions in Frameworks */,
48FFFAA22ADC1F5D00B2B213 /* Algorithms in Frameworks */,
48FFFAC12ADC20C400B2B213 /* JSONPreview in Frameworks */,
83D3F3C32D15C9CA00CA976D /* Sargon in Frameworks */,
48FFFADB2ADC21E400B2B213 /* SwiftLogConsoleColors in Frameworks */,
48FFFADE2ADC21F500B2B213 /* FileLogging in Frameworks */,
48FFFACF2ADC216400B2B213 /* CollectionConcurrencyKit in Frameworks */,
Expand All @@ -2585,6 +2588,7 @@
5B1C4FD52BBB0B0C00B9436F /* AppsFlyerLib-Strict in Frameworks */,
48FFFB032ADC6F8100B2B213 /* Builders in Frameworks */,
48FFFAB72ADC207B00B2B213 /* NavigationTransitions in Frameworks */,
835DFF932D19855A00229DB0 /* Sargon in Frameworks */,
5B634A942C91D2A0004B2FBC /* ScreenshotPreventing in Frameworks */,
48FFFA992ADC1EEC00B2B213 /* AsyncExtensions in Frameworks */,
83B783562C1764AE00AA7930 /* Sargon in Frameworks */,
Expand Down Expand Up @@ -7107,6 +7111,8 @@
5B634A932C91D2A0004B2FBC /* ScreenshotPreventing */,
5B447E0A2CAAFC2D0063AE39 /* Sargon */,
5B4E1D1E2CB7FE8E002FAC2E /* Sargon */,
83D3F3C22D15C9CA00CA976D /* Sargon */,
835DFF922D19855A00229DB0 /* Sargon */,
);
productName = RadixWallet;
productReference = 48CFBC4F2ADC106300E77A5C /* Radix Wallet Dev.app */;
Expand Down Expand Up @@ -7177,7 +7183,7 @@
8318BB172BC8403800057BCB /* XCRemoteSwiftPackageReference "swift-custom-dump" */,
E6A0B0492BF23C7000617DAC /* XCRemoteSwiftPackageReference "swift-identified-collections" */,
5B634A922C91D2A0004B2FBC /* XCRemoteSwiftPackageReference "ScreenshotPreventing-iOS" */,
E775A1BC2CFA04B100E72DB9 /* XCRemoteSwiftPackageReference "sargon" */,
835DFF912D19855A00229DB0 /* XCRemoteSwiftPackageReference "sargon" */,
);
productRefGroup = 48CFBC502ADC106300E77A5C /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -9266,6 +9272,14 @@
version = 1.3.0;
};
};
835DFF912D19855A00229DB0 /* XCRemoteSwiftPackageReference "sargon" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/radixdlt/sargon";
requirement = {
kind = exactVersion;
version = 1.1.96;
};
};
A415574E2B757C5E0040AD4E /* XCRemoteSwiftPackageReference "swift-composable-architecture" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture";
Expand All @@ -9290,14 +9304,6 @@
version = 1.0.2;
};
};
E775A1BC2CFA04B100E72DB9 /* XCRemoteSwiftPackageReference "sargon" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/radixdlt/sargon";
requirement = {
kind = exactVersion;
version = 1.1.71;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down Expand Up @@ -9506,10 +9512,19 @@
isa = XCSwiftPackageProductDependency;
productName = Sargon;
};
835DFF922D19855A00229DB0 /* Sargon */ = {
isa = XCSwiftPackageProductDependency;
package = 835DFF912D19855A00229DB0 /* XCRemoteSwiftPackageReference "sargon" */;
productName = Sargon;
};
83B783552C1764AE00AA7930 /* Sargon */ = {
isa = XCSwiftPackageProductDependency;
productName = Sargon;
};
83D3F3C22D15C9CA00CA976D /* Sargon */ = {
isa = XCSwiftPackageProductDependency;
productName = Sargon;
};
A415574F2B757C5E0040AD4E /* ComposableArchitecture */ = {
isa = XCSwiftPackageProductDependency;
package = A415574E2B757C5E0040AD4E /* XCRemoteSwiftPackageReference "swift-composable-architecture" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "7d3590b225945abb1bc0ab6c684b005c28c64bdc204afcc2d34c3e379ef8a3c8",
"originHash" : "4eb650ade57061cd1cf989ce8f615547774e9303f591ff57a76f3f2c04cdbd07",
"pins" : [
{
"identity" : "anycodable",
Expand Down Expand Up @@ -114,8 +114,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/radixdlt/sargon",
"state" : {
"revision" : "df3c55dc134a9f87848ef0470f1702b304739719",
"version" : "1.1.71"
"revision" : "2f610dafec01e66542d6902f02aeffda83dbc7cd",
"version" : "1.1.96"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ extension AccountPortfoliosClient {

return modified
}

/// Returns if the original account (which doesn't remove the hidden resources) contains any asset
var containsAnyAsset: Bool {
originalAccount.containsAnyAsset
}
}

/// Internal state that holds all loaded portfolios.
Expand Down Expand Up @@ -266,9 +271,6 @@ extension ResourceAmount {
case var .atLeast(exactAmount):
exactAmount.fiatWorth = change(resourceAddress, exactAmount)
self = .atLeast(exactAmount)
case var .atMost(exactAmount):
exactAmount.fiatWorth = change(resourceAddress, exactAmount)
self = .atMost(exactAmount)
case var .between(minExactAmount, maxExactAmount):
minExactAmount.fiatWorth = change(resourceAddress, minExactAmount)
maxExactAmount.fiatWorth = change(resourceAddress, maxExactAmount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ extension CloudBackupClient {
guard shouldBackUp || timeToCheckIfClaimed else { return }

let shouldReclaim: Bool
if let backedUpID = backedUpHeader?.lastUsedOnDevice.id, await !profileStore.isThisDevice(deviceID: backedUpID) {
if let backedUpID = backedUpHeader?.lastUsedOnDevice.id, SargonOS.shared.hostId().id != backedUpID {
let action = await overlayWindowClient.scheduleFullScreen(.init(root: .claimWallet(.init())))
switch action {
case .claimWallet(.transferBack):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,7 @@ extension DeviceFactorSourceClient {

switch signerEntity.securityState {
case let .unsecured(control):
let factorInstance = switch purpose {
case .signAuth:
control.authenticationSigning ?? control.transactionSigning
case .signTransaction, .signPreAuthorization:
control.transactionSigning
}
let factorInstance = control.transactionSigning

guard
let deviceFactorSource = try await factorSourcesClient.getDeviceFactorSource(of: factorInstance)
Expand Down Expand Up @@ -180,12 +175,7 @@ extension DeviceFactorSourceClient {
switch entity.securityState {
case let .unsecured(unsecuredControl):

let factorInstance = switch purpose {
case .signAuth:
unsecuredControl.authenticationSigning ?? unsecuredControl.transactionSigning
case .signTransaction, .signPreAuthorization:
unsecuredControl.transactionSigning
}
let factorInstance = unsecuredControl.transactionSigning

let derivationPath = factorInstance.derivationPath

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,7 @@ func signingFactors(
switch entity.securityState {
case let .unsecured(unsecuredEntityControl):

let factorInstance = switch signingPurpose {
case .signAuth:
unsecuredEntityControl.authenticationSigning ?? unsecuredEntityControl.transactionSigning
case .signTransaction, .signPreAuthorization:
unsecuredEntityControl.transactionSigning
}
let factorInstance = unsecuredEntityControl.transactionSigning

let id = factorInstance.factorSourceID
guard let factorSource = allFactorSources[id: id.asGeneral] else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ extension OnLedgerEntitiesClient {
struct OwnedResourcePoolDetails: Hashable, Sendable {
let address: PoolAddress
let dAppName: String?
let poolUnitResource: ResourceWithVaultAmount
var poolUnitResource: ResourceWithVaultAmount
var xrdResource: ResourceWithRedemptionValue?
var nonXrdResources: [ResourceWithRedemptionValue]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension PreAuthorizationClient: DependencyKey {
notaryPublicKey: Sargon.PublicKey.ed25519(request.notaryPublicKey.intoSargon())
)
} catch {
throw PreAuthorizationFailure.failedToGetPreview(.failedToAnalyse(error))
throw TransactionFailure.fromCommonError(error as? CommonError)
}
}

Expand Down
11 changes: 1 addition & 10 deletions RadixWallet/Clients/ProfileStore/ProfileStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extension ProfileStore {

extension ProfileStore {
func createNewProfile() async throws {
try? await SargonOS.shared.deleteWallet()
try await SargonOS.shared.newWallet(shouldPreDeriveInstances: false)
}

Expand All @@ -60,16 +61,6 @@ extension ProfileStore {
}
}

extension ProfileStore {
func isThisDevice(deviceID: DeviceID) async -> Bool {
guard let hostId = try? await SargonOS.shared.resolveHostId().id else {
return false
}

return hostId == deviceID
}
}

// MARK: Public
extension ProfileStore {
/// Mutates the in-memory copy of the Profile usung `transform`, and saves a
Expand Down
18 changes: 13 additions & 5 deletions RadixWallet/Clients/TransactionClient/TransactionClient+Live.swift
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,20 @@ extension TransactionFailure {
case .FailedToExtractTransactionReceiptBytes:
.failedToPrepareTXReview(.failedToExtractTXReceiptBytes)

case let .ExecutionSummaryFail(underlying):
.failedToPrepareTXReview(.failedTXPreview(underlying))

case let .FailedToGenerateManifestSummary(underlying):
.failedToPrepareTXReview(.failedTXPreview(underlying))

case let .InvalidInstructionsString(underlying):
.failedToPrepareTXReview(.failedTXPreview(underlying))

case let .some(err):
.failedToPrepareTXReview(.failedTXPreview(errorMessageFromError(error: err)))

default:
if let code = commonError?.errorCode {
.failedToPrepareTXReview(.failedTXPreview("Unknown reason, code: \(code)"))
} else {
.failedToPrepareTXReview(.failedTXPreview("Unknown reason"))
}
.failedToPrepareTXReview(.failedTXPreview("Unknown reason"))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ extension TransportProfileClient: DependencyKey {
return Self(
importProfile: { profile, factorSourceIDs, skippedMainBdfs, containsP2PLinks in
do {
try await profileStore.importProfile(profile, skippedMainBdfs: skippedMainBdfs)
let profile = await profileStore.profile()
if profile.appPreferences.security.isCloudProfileSyncEnabled {
try? await cloudBackupClient.claimProfileOnICloud(profile)
}
try await profileStore.importProfile(profile, skippedMainBdfs: skippedMainBdfs)
userDefaults.setShowRelinkConnectorsAfterProfileRestore(containsP2PLinks)
} catch {
// Revert the saved mnemonic
Expand Down
27 changes: 20 additions & 7 deletions RadixWallet/Core/SharedModels/Assets/ResourceAmount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Sargon
enum ResourceAmount: Sendable, Hashable, Codable {
case exact(ExactResourceAmount)
case atLeast(ExactResourceAmount)
case atMost(ExactResourceAmount)
case between(minimum: ExactResourceAmount, maximum: ExactResourceAmount)
case predicted(predicted: ExactResourceAmount, guaranteed: ExactResourceAmount)
case unknown
Expand All @@ -15,13 +14,14 @@ enum ResourceAmount: Sendable, Hashable, Codable {
self = .exact(amount)
case let .atLeast(amount):
self = .atLeast(.init(nominalAmount: amount))
case let .atMost(amount):
self = .atMost(.init(nominalAmount: amount))
case let .between(minAmount, maxAmount):
self = .between(
minimum: .init(nominalAmount: minAmount),
maximum: .init(nominalAmount: maxAmount)
)
case .atMost:
// AtMost is consider unknown in the Wallet UI as per https://radixdlt.atlassian.net/browse/ABW-4040
self = .unknown
case .unknownAmount:
self = .unknown
}
Expand Down Expand Up @@ -59,14 +59,21 @@ extension ResourceAmount {
}
}

var guaranteedAmount: ExactResourceAmount? {
switch self {
case let .predicted(_, amount):
amount
default:
nil
}
}

func adjustedNominalAmount(_ adjust: (Decimal192) -> Decimal192) -> Self {
switch self {
case let .exact(amount):
return .exact(adjust(amount.nominalAmount))
case let .atLeast(amount):
return .atLeast(.init(nominalAmount: adjust(amount.nominalAmount)))
case let .atMost(amount):
return .atMost(.init(nominalAmount: adjust(amount.nominalAmount)))
case let .between(minAmount, maxAmount):
let min = adjust(minAmount.nominalAmount)
let max = adjust(maxAmount.nominalAmount)
Expand All @@ -85,6 +92,14 @@ extension ResourceAmount {
return .unknown
}
}

mutating func setGuaranteedAmount(_ newGuaranteed: Decimal192) {
guard case let .predicted(predicted, _) = self else {
return
}

self = .predicted(predicted: predicted, guaranteed: .init(nominalAmount: newGuaranteed))
}
}

// MARK: CustomDebugStringConvertible
Expand All @@ -95,8 +110,6 @@ extension ResourceAmount: CustomDebugStringConvertible {
amount.nominalAmount.formatted()
case let .atLeast(amount):
"At least \(amount.nominalAmount.formatted())"
case let .atMost(amount):
"No more than \(amount.nominalAmount.formatted())"
case let .between(minAmount, maxAmount):
"Min: \(minAmount.nominalAmount.formatted()); Max: \(maxAmount.nominalAmount.formatted())"
case let .predicted(predicted, guaranteed):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct DeleteAccountConfirmation: Sendable, FeatureReducer {

@CasePathable
enum InternalAction: Sendable, Equatable {
case fetchAccountPortfolioResult(TaskResult<OnLedgerEntity.OnLedgerAccount>)
case fetchAccountPortfolioResult(TaskResult<AccountPortfoliosClient.AccountPortfolio>)
case fetchReceivingAccounts
case fetchReceivingAccountsResult(TaskResult<[State.ReceivingAccountCandidate]>)
}
Expand Down Expand Up @@ -44,7 +44,7 @@ struct DeleteAccountConfirmation: Sendable, FeatureReducer {
state.footerButtonState = .loading(.local)
return .run { [address = state.account.address] send in
let result = await TaskResult {
try await accountPortfoliosClient.fetchAccountPortfolio(address, true).account
try await accountPortfoliosClient.fetchAccountPortfolio(address, true)
}
await send(.internal(.fetchAccountPortfolioResult(result)))
}
Expand All @@ -53,9 +53,9 @@ struct DeleteAccountConfirmation: Sendable, FeatureReducer {

func reduce(into state: inout State, internalAction: InternalAction) -> Effect<Action> {
switch internalAction {
case let .fetchAccountPortfolioResult(.success(account)):
case let .fetchAccountPortfolioResult(.success(portfolio)):
state.footerButtonState = .enabled
return account.containsAnyAsset ? .send(.internal(.fetchReceivingAccounts)) : .send(.delegate(.deleteAccount))
return portfolio.containsAnyAsset ? .send(.internal(.fetchReceivingAccounts)) : .send(.delegate(.deleteAccount))

case .fetchReceivingAccounts:
return .run { send in
Expand Down
Loading