-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1750 from iotaledger/tooling-wallet-dashboard/ref…
…actor-vesting refactor: separate vesting from timelock
- Loading branch information
Showing
7 changed files
with
68 additions
and
62 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
38 changes: 38 additions & 0 deletions
38
apps/wallet-dashboard/lib/interfaces/timelock.interface.ts
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,38 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export interface UID { | ||
id: string; | ||
} | ||
|
||
export interface Balance { | ||
value: number; | ||
} | ||
|
||
export interface TimelockedObject { | ||
id: UID; | ||
locked: Balance; // TODO: extend to support other types of locked assets | ||
expirationTimestampMs: number; | ||
label?: string; | ||
} | ||
|
||
export interface TimelockedIotaResponse { | ||
id: UID; | ||
locked: string; | ||
expiration_timestamp_ms: string; | ||
label?: string; | ||
} | ||
|
||
export interface StakedIota { | ||
id: UID; | ||
poolId: string; | ||
stakeActivationEpoch: number; | ||
principal: Balance; | ||
} | ||
|
||
export interface TimelockedStakedIota { | ||
id: UID; | ||
stakedIota: StakedIota; | ||
expirationTimestampMs: number; | ||
label?: string | null | undefined; | ||
} |
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,21 +1,18 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { SUPPLY_INCREASE_VESTING_LABEL } from '../constants'; | ||
import { Timelocked, TimelockedStakedIota } from '../interfaces'; | ||
import { TimelockedObject, TimelockedStakedIota } from '../interfaces'; | ||
|
||
export function isTimelockedStakedIota( | ||
obj: Timelocked | TimelockedStakedIota, | ||
obj: TimelockedObject | TimelockedStakedIota, | ||
): obj is TimelockedStakedIota { | ||
const referenceProperty: keyof TimelockedStakedIota = 'stakedIota'; | ||
return referenceProperty in obj; | ||
} | ||
|
||
export function isTimelocked(obj: Timelocked | TimelockedStakedIota): obj is Timelocked { | ||
const referenceProperty: keyof Timelocked = 'locked'; | ||
export function isTimelockedObject( | ||
obj: TimelockedObject | TimelockedStakedIota, | ||
): obj is TimelockedObject { | ||
const referenceProperty: keyof TimelockedObject = 'locked'; | ||
return referenceProperty in obj; | ||
} | ||
|
||
export function isVesting(obj: Timelocked | TimelockedStakedIota): boolean { | ||
return obj.label === SUPPLY_INCREASE_VESTING_LABEL; | ||
} |
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