-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into tooling/move-validator-logo
- Loading branch information
Showing
16 changed files
with
508 additions
and
379 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,48 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { LoadingIndicator } from '@iota/apps-ui-kit'; | ||
import { | ||
ArrowBottomLeft, | ||
ArrowTopRight, | ||
Info, | ||
IotaLogoMark, | ||
Migration, | ||
Person, | ||
Stake, | ||
Unstake, | ||
Vesting, | ||
} from '@iota/apps-ui-icons'; | ||
import { TransactionAction } from '../../interfaces'; | ||
|
||
const ICON_COLORS = { | ||
primary: 'text-primary-30', | ||
error: 'text-error-30', | ||
}; | ||
|
||
const icons = { | ||
Send: <ArrowTopRight className={ICON_COLORS.primary} />, | ||
Receive: <ArrowBottomLeft className={ICON_COLORS.primary} />, | ||
Transaction: <ArrowTopRight className={ICON_COLORS.primary} />, | ||
Staked: <Stake className={ICON_COLORS.primary} />, | ||
Unstaked: <Stake className={ICON_COLORS.primary} />, | ||
Rewards: <IotaLogoMark className={ICON_COLORS.primary} />, | ||
Failed: <Info className={ICON_COLORS.error} />, | ||
Loading: <LoadingIndicator />, | ||
PersonalMessage: <Person className={ICON_COLORS.primary} />, | ||
['Timelocked Staked']: <Stake className={ICON_COLORS.primary} />, | ||
['Timelocked Unstaked']: <Stake className={ICON_COLORS.primary} />, | ||
[TransactionAction.Send]: <ArrowTopRight className={ICON_COLORS.primary} />, | ||
[TransactionAction.Receive]: <ArrowBottomLeft className={ICON_COLORS.primary} />, | ||
[TransactionAction.Transaction]: <ArrowTopRight className={ICON_COLORS.primary} />, | ||
[TransactionAction.Staked]: <Stake className={ICON_COLORS.primary} />, | ||
[TransactionAction.Unstaked]: <Unstake className={ICON_COLORS.primary} />, | ||
[TransactionAction.Rewards]: <IotaLogoMark className={ICON_COLORS.primary} />, | ||
[TransactionAction.Failed]: <Info className={ICON_COLORS.error} />, | ||
[TransactionAction.PersonalMessage]: <Person className={ICON_COLORS.primary} />, | ||
[TransactionAction.TimelockedStaked]: <Stake className={ICON_COLORS.primary} />, | ||
[TransactionAction.TimelockedUnstaked]: <Unstake className={ICON_COLORS.primary} />, | ||
[TransactionAction.Migration]: <Migration className={ICON_COLORS.primary} />, | ||
[TransactionAction.TimelockedCollect]: <Vesting className={ICON_COLORS.primary} />, | ||
}; | ||
|
||
interface TransactionIconProps { | ||
txnFailed?: boolean; | ||
variant: keyof typeof icons; | ||
variant: TransactionAction; | ||
} | ||
|
||
export function TransactionIcon({ txnFailed, variant }: TransactionIconProps) { | ||
return <div className="[&_svg]:h-5 [&_svg]:w-5">{icons[txnFailed ? 'Failed' : variant]}</div>; | ||
return ( | ||
<div className="[&_svg]:h-5 [&_svg]:w-5"> | ||
{icons[txnFailed ? TransactionAction.Failed : variant]} | ||
</div> | ||
); | ||
} |
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,5 +1,6 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export const TIMELOCK_IOTA_TYPE = '0x2::timelock::TimeLock<0x2::balance::Balance<0x2::iota::IOTA>>'; | ||
export const TIMELOCK_STAKED_TYPE = '0x3::timelocked_staking::TimelockedStakedIota'; | ||
export const TIMELOCK_MODULE = 'timelock'; | ||
export const TIMELOCK_IOTA_TYPE = `0x2::${TIMELOCK_MODULE}::TimeLock<0x2::balance::Balance<0x2::iota::IOTA>>`; | ||
export const TIMELOCK_STAKED_TYPE = `0x3::timelocked_staking::TimelockedStakedIota`; |
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,29 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import type { | ||
IotaTransaction, | ||
IotaTransactionBlockResponse, | ||
MoveCallIotaTransaction, | ||
} from '@iota/iota-sdk/client'; | ||
import { STARDUST_PACKAGE_ID } from '../../constants'; | ||
|
||
export function isMigrationTransaction( | ||
transaction: IotaTransactionBlockResponse['transaction'], | ||
): boolean { | ||
if (!transaction || transaction.data.transaction.kind !== 'ProgrammableTransaction') | ||
return false; | ||
const moveCallTxs = transaction.data.transaction.transactions.filter(isMoveCall); | ||
const isMigration = moveCallTxs.some( | ||
(tx) => | ||
tx.MoveCall.package === STARDUST_PACKAGE_ID && | ||
tx.MoveCall.function === 'extract_assets', | ||
); | ||
return isMigration; | ||
} | ||
|
||
function isMoveCall( | ||
transaction: IotaTransaction, | ||
): transaction is { MoveCall: MoveCallIotaTransaction } { | ||
return 'MoveCall' in transaction; | ||
} |
28 changes: 28 additions & 0 deletions
28
apps/core/src/utils/transaction/isUnlockTimelockedObjectTransaction.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,28 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import type { | ||
IotaTransaction, | ||
IotaTransactionBlockResponse, | ||
MoveCallIotaTransaction, | ||
} from '@iota/iota-sdk/client'; | ||
import { TIMELOCK_MODULE } from '../..'; | ||
|
||
export function isUnlockTimelockedObjectTransaction( | ||
transaction: IotaTransactionBlockResponse['transaction'], | ||
): boolean { | ||
if (!transaction || transaction.data.transaction.kind !== 'ProgrammableTransaction') | ||
return false; | ||
const moveCallTxs = transaction.data.transaction.transactions | ||
.filter(isMoveCall) | ||
.filter((tx) => tx.MoveCall.module === TIMELOCK_MODULE); | ||
const isUnlockTimelockedObject = | ||
moveCallTxs.length > 0 && moveCallTxs.every((tx) => tx.MoveCall.function === 'unlock'); | ||
return isUnlockTimelockedObject; | ||
} | ||
|
||
function isMoveCall( | ||
transaction: IotaTransaction, | ||
): transaction is { MoveCall: MoveCallIotaTransaction } { | ||
return 'MoveCall' in transaction; | ||
} |
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,4 +1,4 @@ | ||
# `@iota/ui-icons` | ||
# `@iota/apps-ui-icons` | ||
|
||
## Exporting Icons | ||
|
||
|
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
29 changes: 0 additions & 29 deletions
29
apps/wallet-dashboard/lib/interfaces/transactions.interfaces.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.