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

[ABW-3827] Resource view Pre-Authorization states #1377

Merged
merged 96 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
2fcd3fb
WIP
matiasbzurovski Oct 16, 2024
ab48dba
wip
matiasbzurovski Oct 16, 2024
4811e0c
WIP
matiasbzurovski Oct 17, 2024
24e8819
WIP
matiasbzurovski Oct 17, 2024
b30f519
merge main
matiasbzurovski Oct 17, 2024
3778a7f
WIP
matiasbzurovski Oct 21, 2024
957b8a3
WIP
matiasbzurovski Oct 21, 2024
bf90c75
WIP
matiasbzurovski Oct 21, 2024
6cdea3c
WIP
matiasbzurovski Oct 21, 2024
4dd4d35
move more stuff to common
matiasbzurovski Oct 21, 2024
69af0a6
WIP
matiasbzurovski Oct 21, 2024
c001881
Accounts and Proofs are now using ObservableState
matiasbzurovski Oct 21, 2024
a7711f8
add sections and clean a bit the UI
matiasbzurovski Oct 21, 2024
c1ef09d
move more models under common
matiasbzurovski Oct 21, 2024
78924ad
rename to InteractionReview
matiasbzurovski Oct 21, 2024
a24e6ae
move ValidatorsView
matiasbzurovski Oct 21, 2024
c49662f
move ExpandableHeadingView and UnknownDappsComponents
matiasbzurovski Oct 21, 2024
58af003
move the last one
matiasbzurovski Oct 21, 2024
68fec2b
show on Home
matiasbzurovski Oct 21, 2024
4287c70
InteractionReviewDapps use ObservableState
matiasbzurovski Oct 22, 2024
349c7dc
wip middle sections
matiasbzurovski Oct 22, 2024
f406c97
more changes
matiasbzurovski Oct 22, 2024
1656031
move deposit and settings to sections
matiasbzurovski Oct 22, 2024
76b65f4
implement for validators in Section as well
matiasbzurovski Oct 22, 2024
650637e
clean up TransactionReview
matiasbzurovski Oct 22, 2024
c67c60f
FungibleTokenDetails use ObservableState
matiasbzurovski Oct 22, 2024
6b89519
Non Fungible Details as well
matiasbzurovski Oct 22, 2024
955c46f
more changes
matiasbzurovski Oct 22, 2024
5e5af4a
migrate PreAuthorizationReview & Sections to old way
matiasbzurovski Oct 23, 2024
7fe96f2
fix for HideResourceView warning
matiasbzurovski Oct 23, 2024
5a50a88
show Proofs inside Sections when neccessary
matiasbzurovski Oct 23, 2024
8de0e95
load dynamic summary
matiasbzurovski Oct 23, 2024
9082805
move tests from Home to DappInteractionFlow
matiasbzurovski Oct 23, 2024
e93cad5
use real dApp Metadata
matiasbzurovski Oct 23, 2024
c26ebef
set up for TransactionSummary
matiasbzurovski Oct 23, 2024
72f3042
wip
danvleju-rdx Oct 24, 2024
6ce9605
hide raw button until reviewed preAuth available
matiasbzurovski Oct 25, 2024
4ef9e88
fix HeadingView to always have the same frame
matiasbzurovski Oct 25, 2024
38f4fd1
possible dApp calls
matiasbzurovski Oct 25, 2024
617c6eb
add InfoLink support
matiasbzurovski Oct 25, 2024
2af392c
set lineSpacing of feesInfo
matiasbzurovski Oct 25, 2024
5e63a95
wip
danvleju-rdx Oct 28, 2024
ad311d9
Merge branch 'main' into ABW-3821-pre-auth-ui
matiasbzurovski Oct 28, 2024
f594f53
handle preAuhtorization request
matiasbzurovski Oct 25, 2024
4ab916d
temporary fix until Strings merged
matiasbzurovski Oct 28, 2024
0901430
local Sargon
matiasbzurovski Oct 28, 2024
8c8e5ec
use real models
matiasbzurovski Oct 28, 2024
aa3cdd5
handle failure
matiasbzurovski Oct 28, 2024
0cb5347
move raw alert to parent views
matiasbzurovski Oct 29, 2024
3b2f76e
add button to create sample PreAuthorization from Account Dev Prefere…
matiasbzurovski Oct 29, 2024
7852725
delete ReviewRawTransactionView
matiasbzurovski Oct 29, 2024
d65e57d
update to RawManifest view
matiasbzurovski Oct 29, 2024
dbba2c7
Merge branch 'main' into ABW-3821-pre-auth-ui
matiasbzurovski Oct 30, 2024
d692742
Merge branch 'main' into ABW-3821-pre-auth-ui
matiasbzurovski Oct 30, 2024
6ccdbdf
update with latest Sargon version
matiasbzurovski Oct 30, 2024
c785117
localise new views
matiasbzurovski Oct 30, 2024
7ccad4b
use new Localization strings on common views
matiasbzurovski Oct 30, 2024
b671c5f
show possible dApp calls only for open manifests
matiasbzurovski Oct 30, 2024
0a57abe
remove ReviewPreAuthorization and PreAuthorizationToReview, and inste…
matiasbzurovski Oct 30, 2024
37143e0
wip
danvleju-rdx Oct 31, 2024
dac222a
Merge branch 'ABW-3821-pre-auth-ui' into ABW-3827-extend-resource-vie…
danvleju-rdx Oct 31, 2024
6c3fef0
wip
danvleju-rdx Oct 31, 2024
934974c
pool units fix
danvleju-rdx Oct 31, 2024
95ab08b
wip
danvleju-rdx Oct 31, 2024
567943a
handle fungible unknown states
danvleju-rdx Nov 1, 2024
e9b81fc
add amount for nfts
danvleju-rdx Nov 1, 2024
c950cc0
add dAppsUsed + proofs
danvleju-rdx Nov 1, 2024
06599e5
open unknown nfts details
danvleju-rdx Nov 4, 2024
5776e0b
fix info link
matiasbzurovski Nov 4, 2024
50f640c
integrate sargon updates
danvleju-rdx Nov 4, 2024
29b100b
test directly with dApp
matiasbzurovski Nov 4, 2024
9cdf6db
updates
matiasbzurovski Nov 4, 2024
0be24a3
VisibleHeaderView
matiasbzurovski Nov 4, 2024
7b4deac
Revert "VisibleHeaderView"
matiasbzurovski Nov 4, 2024
de06242
wip
danvleju-rdx Nov 5, 2024
3b86b48
wip
danvleju-rdx Nov 5, 2024
30ced3d
Merge branch 'ABW-3821-pre-auth-ui' into ABW-3827-extend-resource-vie…
danvleju-rdx Nov 5, 2024
1c13e0b
wip
danvleju-rdx Nov 5, 2024
ee7d68c
updates
matiasbzurovski Nov 5, 2024
eb3b78a
rename DappInteractionModels
matiasbzurovski Nov 5, 2024
85b7b55
add TimeFormatter tests
matiasbzurovski Nov 5, 2024
2917eb1
wip
danvleju-rdx Nov 5, 2024
dd60106
formatter
matiasbzurovski Nov 5, 2024
bfec7d1
updates to time formatter
matiasbzurovski Nov 6, 2024
7fc86e7
Merge branch 'ABW-3821-pre-auth-ui' into ABW-3827-extend-resource-vie…
danvleju-rdx Nov 6, 2024
f5c60a5
Merge branch 'main' into ABW-3827-extend-resource-view-with-new-states
danvleju-rdx Nov 6, 2024
09d4db2
Merge branch 'main' into ABW-3827-extend-resource-view-with-new-states
danvleju-rdx Nov 6, 2024
f2ddf2b
fix
danvleju-rdx Nov 6, 2024
1a80281
wip
danvleju-rdx Nov 6, 2024
433f6a5
fixes
danvleju-rdx Nov 6, 2024
d054493
fix tests
danvleju-rdx Nov 7, 2024
30a7536
address feedback
danvleju-rdx Nov 7, 2024
9ad60a0
split fungibleResourceBalance
danvleju-rdx Nov 7, 2024
7717550
lint
danvleju-rdx Nov 7, 2024
bfd22fe
address feedback
danvleju-rdx Nov 7, 2024
a8fb7ed
fixes
danvleju-rdx Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RadixWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9195,7 +9195,7 @@
repositoryURL = "https://github.com/radixdlt/sargon/";
requirement = {
kind = exactVersion;
version = 1.1.42;
version = 1.1.44;
};
};
5B4E1D1D2CB7FE8E002FAC2E /* XCRemoteSwiftPackageReference "sargon" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/radixdlt/sargon/",
"state" : {
"revision" : "83e13eb11037733a9edfe2c2c70d1efeb63e0831",
"version" : "1.1.42"
"revision" : "719ad87a7fd693418752c76024325b46f4b1bb4f",
"version" : "1.1.44"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ extension AccountPortfoliosClient.State {

// MARK: - Stake and Pool details handling
extension AccountPortfoliosClient.State {
func calculateWorth(_ gateway: Gateway) -> (ResourceAddress, ResourceAmount) -> FiatWorth? {
func calculateWorth(_ gateway: Gateway) -> (ResourceAddress, ExactResourceAmount) -> FiatWorth? {
{ resourceAddress, amount in
let worth: FiatWorth.Worth? = {
guard case let .success(tokenPrices) = self.tokenPrices else {
Expand Down Expand Up @@ -247,62 +247,91 @@ private extension AccountPortfoliosClient.AccountPortfolio {
}
}

mutating func updateFiatWorth(_ change: (ResourceAddress, ResourceAmount) -> FiatWorth?) {
mutating func updateFiatWorth(_ change: (ResourceAddress, ExactResourceAmount) -> FiatWorth?) {
account.fungibleResources.updateFiatWorth(change)
stakeUnitDetails.mutateValue { $0.updateFiatWorth(change) }
poolUnitDetails.mutateValue { $0.updateFiatWorth(change) }
}
}

extension ResourceAmount {
mutating func updateFiatWorth(
resourceAddress: ResourceAddress,
change: (ResourceAddress, ExactResourceAmount) -> FiatWorth?
) {
switch self {
case var .exact(exactAmount):
exactAmount.fiatWorth = change(resourceAddress, exactAmount)
self = .exact(exactAmount)
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)
self = .between(minimum: minExactAmount, maximum: maxExactAmount)
case var .predicted(predicted, guaranteed):
predicted.fiatWorth = change(resourceAddress, predicted)
guaranteed.fiatWorth = change(resourceAddress, guaranteed)
self = .predicted(predicted: predicted, guaranteed: guaranteed)
case .unknown:
return
}
}
}

private extension OnLedgerEntity.OwnedFungibleResources {
mutating func updateFiatWorth(_ change: (ResourceAddress, ResourceAmount) -> FiatWorth?) {
mutating func updateFiatWorth(_ change: (ResourceAddress, ExactResourceAmount) -> FiatWorth?) {
xrdResource.mutate { resource in
resource.amount.fiatWorth = change(.mainnetXRD, resource.amount)
resource.amount.updateFiatWorth(resourceAddress: .mainnetXRD, change: change)
}

nonXrdResources.mutateAll { resource in
resource.amount.fiatWorth = change(resource.resourceAddress, resource.amount)
resource.amount.updateFiatWorth(resourceAddress: resource.resourceAddress, change: change)
}

nonXrdResources.sort(by: <)
}
}

private extension MutableCollection where Element == OnLedgerEntitiesClient.OwnedResourcePoolDetails {
mutating func updateFiatWorth(_ change: (ResourceAddress, ResourceAmount) -> FiatWorth?) {
mutating func updateFiatWorth(_ change: (ResourceAddress, ExactResourceAmount) -> FiatWorth?) {
mutateAll { detail in
detail.xrdResource?.redemptionValue.mutate { amount in
amount.fiatWorth = change(.mainnetXRD, amount)
amount.updateFiatWorth(resourceAddress: .mainnetXRD, change: change)
}

detail.nonXrdResources.mutateAll { resource in
let address = resource.resource.resourceAddress
resource.redemptionValue.mutate { amount in
amount.fiatWorth = change(address, amount)
amount.updateFiatWorth(resourceAddress: address, change: change)
}
}
}
}
}

private extension MutableCollection where Element == OnLedgerEntitiesClient.OwnedStakeDetails {
mutating func updateFiatWorth(_ change: (ResourceAddress, ResourceAmount) -> FiatWorth?) {
mutating func updateFiatWorth(_ change: (ResourceAddress, ExactResourceAmount) -> FiatWorth?) {
mutateAll { detail in
let xrdRedemptionValue = detail.xrdRedemptionValue
detail.stakeUnitResource.mutate {
$0.amount.fiatWorth = change(
.mainnetXRD,
.init(
nominalAmount: xrdRedemptionValue,
fiatWorth: $0.amount.fiatWorth
var stakeUnitResource = detail.stakeUnitResource
stakeUnitResource.mutate {
$0.amount.updateFiatWorth(resourceAddress: .mainnetXRD, change: {
change(
$0,
detail.xrdRedemptionValue(exactAmount: $1)
)
)
})
}
detail.stakeClaimTokens.mutate {
$0.stakeClaims.mutateAll { token in
token.claimAmount.fiatWorth = change(.mainnetXRD, token.claimAmount)
}
}
detail.stakeUnitResource = stakeUnitResource
}
}
}
Expand All @@ -320,16 +349,16 @@ extension AccountPortfoliosClient.AccountPortfolio {

private extension OnLedgerEntity.OwnedFungibleResources {
var fiatWorth: FiatWorth.Worth {
let xrdFiatWorth = xrdResource?.amount.fiatWorth?.worth ?? .zero
let nonXrdFiatWorth = nonXrdResources.compactMap(\.amount.fiatWorth?.worth).reduce(.zero, +)
let xrdFiatWorth = xrdResource?.amount.exactAmount?.fiatWorth?.worth ?? .zero
let nonXrdFiatWorth = nonXrdResources.compactMap(\.amount.exactAmount?.fiatWorth?.worth).reduce(.zero, +)
return xrdFiatWorth + nonXrdFiatWorth
}
}

private extension Collection<OnLedgerEntitiesClient.OwnedStakeDetails> {
var fiatWorth: FiatWorth.Worth {
reduce(.zero) { partialResult, stakeUnitDetail in
let stakeUnitFiatWorth = stakeUnitDetail.stakeUnitResource?.amount.fiatWorth?.worth ?? .zero
let stakeUnitFiatWorth = stakeUnitDetail.stakeUnitResource?.amount.exactAmount?.fiatWorth?.worth ?? .zero
let stakeClaimsFiatWorth = stakeUnitDetail
.stakeClaimTokens?
.stakeClaims
Expand All @@ -343,8 +372,8 @@ private extension Collection<OnLedgerEntitiesClient.OwnedStakeDetails> {
private extension Collection<OnLedgerEntitiesClient.OwnedResourcePoolDetails> {
var fiatWorth: FiatWorth.Worth {
reduce(.zero) { partialResult, poolUnitDetail in
let xrdFiatWorth = poolUnitDetail.xrdResource?.redemptionValue?.fiatWorth?.worth ?? .zero
let nonXrdFiatWorth = poolUnitDetail.nonXrdResources.compactMap(\.redemptionValue?.fiatWorth?.worth).reduce(.zero, +)
let xrdFiatWorth = poolUnitDetail.xrdResource?.redemptionValue?.exactAmount?.fiatWorth?.worth ?? .zero
let nonXrdFiatWorth = poolUnitDetail.nonXrdResources.compactMap(\.redemptionValue?.exactAmount?.fiatWorth?.worth).reduce(.zero, +)
return partialResult + xrdFiatWorth + nonXrdFiatWorth
}
}
Expand Down
Loading
Loading