-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add mana details to Output page (#1016)
* feat: Add mana details to metadata section of Output page (stored with decay, potential, total) for spent and unspent outputs * feat: Bump SDK-nova commit. Fix OutputPage outputMetadata usage. * feat: Simplify buildManaDetailsForOutput call --------- Co-authored-by: Begoña Álvarez de la Cruz <[email protected]> Co-authored-by: Branko Bosnic <[email protected]>
- Loading branch information
1 parent
adc2050
commit 6cadacd
Showing
7 changed files
with
99 additions
and
19 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
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,27 @@ | ||
import { BasicOutput, Output, ProtocolParameters, Utils } from "@iota/sdk-wasm-nova/web"; | ||
|
||
export interface OutputManaDetails { | ||
storedMana: string; | ||
storedManaDecayed: string; | ||
potentialMana: string; | ||
totalMana: string; | ||
} | ||
|
||
export function buildManaDetailsForOutput( | ||
output: Output, | ||
createdSlotIndex: number, | ||
spentOrLatestSlotIndex: number, | ||
protocolParameters: ProtocolParameters, | ||
): OutputManaDetails { | ||
const decayedMana = Utils.outputManaWithDecay(output, createdSlotIndex, spentOrLatestSlotIndex, protocolParameters); | ||
const storedManaDecayed = BigInt(decayedMana.stored).toString(); | ||
const potentialMana = BigInt(decayedMana.potential).toString(); | ||
const totalMana = BigInt(decayedMana.stored) + BigInt(decayedMana.potential); | ||
|
||
return { | ||
storedMana: (output as BasicOutput).mana?.toString(), | ||
storedManaDecayed, | ||
potentialMana, | ||
totalMana: totalMana.toString(), | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
SDK_DIR="iota-sdk" | ||
TARGET_COMMIT="e8713d3b7d6b1f54055916b1a8f226b6cc2ce4c7" | ||
TARGET_COMMIT="08318f6e3f92af609b89c571462ea31b32e7c121" | ||
|
||
if [ ! -d "$SDK_DIR" ]; then | ||
git clone -b 2.0 [email protected]:iotaledger/iota-sdk.git | ||
|