Skip to content

Commit b1c0f29

Browse files
authored
fix: mana accuracy in transaction details (#8504)
1 parent 6334d14 commit b1c0f29

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/shared/lib/core/api/interfaces/api.interface.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type {
1313
ProtocolParameters,
1414
DecayedMana,
1515
DelegationId,
16+
SlotIndex,
1617
} from '@iota/sdk/out/types'
1718
import { IWallet } from '@core/profile/interfaces'
1819

@@ -48,4 +49,5 @@ export interface IApi {
4849
computeOutputId(id: TransactionId, index: number): OutputId
4950
computeDelegationId(outputId: OutputId): DelegationId
5051
outputHexBytes(output: Output): HexEncodedString
52+
computeSlotIndex(requestId: HexEncodedString): SlotIndex
5153
}

packages/shared/lib/core/network/utils/getPassiveManaForOutput.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ export function getPassiveManaForOutput(output: OutputData, slotIndex?: number):
2020
: _nodeInfo.status?.latestConfirmedBlockSlot ?? undefined
2121
}
2222
if (slotIndex === undefined) return
23+
24+
const includedSlot = api.computeSlotIndex(output.metadata.included.transactionId)
2325
const decayedMana = api.outputManaWithDecay(
2426
output.output,
25-
output.metadata.included.slot,
27+
includedSlot,
2628
slotIndex,
2729
_nodeInfo.protocolParameters[0].parameters
2830
)

0 commit comments

Comments
 (0)