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

fix: not visible surplus #5968

Merged
merged 16 commits into from Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -63,6 +63,7 @@
} = get(newTransactionDetails)

let storageDeposit = 0
let visibleSurplus = 0
let preparedOutput: Output
let outputOptions: OutputOptions
let expirationTimePicker: ExpirationTimePicker
Expand All @@ -86,6 +87,7 @@
subject: recipient,
isInternal,
giftedStorageDeposit: 0,
surplus: visibleSurplus,
type: ActivityType.Basic,
direction: ActivityDirection.Outgoing,
inclusionState: InclusionState.Pending,
Expand Down Expand Up @@ -148,6 +150,10 @@
const { storageDeposit: _storageDeposit, giftedStorageDeposit: _giftedStorageDeposit } =
getStorageDepositFromOutput(preparedOutput)

if (surplus > _storageDeposit) {
visibleSurplus = Number(surplus)
}

if (giftStorageDeposit) {
// Only giftedStorageDeposit needs adjusting, since that is derived
// from the amount property instead of the unlock condition
Expand Down
Expand Up @@ -24,6 +24,7 @@
$: baseToken = BASE_TOKEN[$activeProfile?.networkProtocol]
$: formattedStorageDeposit = formatTokenAmountPrecise(activity.storageDeposit ?? 0, baseToken)
$: formattedGiftedStorageDeposit = formatTokenAmountPrecise(activity.giftedStorageDeposit ?? 0, baseToken)
$: formattedSurplus = formatTokenAmountPrecise(activity.surplus ?? 0, baseToken)
$: formattedGasBudget = formatTokenAmountPrecise(Number(gasBudget ?? 0), baseToken)

let transactionDetailsList: IKeyValueBoxList
Expand All @@ -43,6 +44,9 @@
...(hasStorageDeposit && {
storageDeposit: { data: formattedStorageDeposit, isTooltipVisible: true },
}),
...(activity?.surplus && {
surplus: { data: formattedSurplus },
}),
...(activity?.giftedStorageDeposit && {
giftedStorageDeposit: { data: formattedGiftedStorageDeposit, isTooltipVisible: true },
}),
Expand Down
Expand Up @@ -16,6 +16,7 @@ export type BaseActivity = {
isInternal: boolean
storageDeposit: number
giftedStorageDeposit: number
surplus?: number
subject: Subject
metadata?: string
tag?: string
Expand Down