diff --git a/packages/shared/components/atoms/tiles/tileContents/NftActivityTileContent.svelte b/packages/shared/components/atoms/tiles/tileContents/NftActivityTileContent.svelte index 0bfe59f7eff..938d46a4a52 100644 --- a/packages/shared/components/atoms/tiles/tileContents/NftActivityTileContent.svelte +++ b/packages/shared/components/atoms/tiles/tileContents/NftActivityTileContent.svelte @@ -4,6 +4,8 @@ import { truncateString } from '@core/utils' import { Text, FontWeight, NftMediaContainer, NftMediaSize } from 'shared/components' import { networkHrp } from '@core/network' + import { getNftByIdFromAllAccountNfts } from '@core/nfts' + import { selectedAccountIndex } from '@core/account' export let activity: NftActivity @@ -11,10 +13,15 @@ $: title = getTitle(activity) $: subjectLocale = getSubjectLocale(activity.subject) + $: nft = getNftByIdFromAllAccountNfts($selectedAccountIndex, activity.nftId) + function getTitle(_activity: NftActivity): string { const { isInternal, direction, inclusionState } = _activity const isConfirmed = inclusionState === InclusionState.Confirmed + if (direction === ActivityDirection.Minting) { + return isConfirmed ? 'general.mintedNft' : 'general.mintingNft' + } if (isInternal) { return isConfirmed ? 'general.transferNft' : 'general.transferringNft' } @@ -53,11 +60,15 @@ -
- - {localize(isIncoming ? 'general.fromAddress' : 'general.toAddress', { - values: { account: subjectLocale }, - })} +
+ + {#if activity.direction === ActivityDirection.Minting} + {nft?.name} + {:else} + {localize(isIncoming ? 'general.fromAddress' : 'general.toAddress', { + values: { account: subjectLocale }, + })} + {/if}
diff --git a/packages/shared/lib/core/wallet/enums/activity-direction.enum.ts b/packages/shared/lib/core/wallet/enums/activity-direction.enum.ts index 8add64ff165..4075b060e58 100644 --- a/packages/shared/lib/core/wallet/enums/activity-direction.enum.ts +++ b/packages/shared/lib/core/wallet/enums/activity-direction.enum.ts @@ -1,4 +1,5 @@ export enum ActivityDirection { Incoming = 'incoming', + Minting = 'minting', Outgoing = 'outgoing', } diff --git a/packages/shared/lib/core/wallet/utils/generateActivity/generateNftActivity.ts b/packages/shared/lib/core/wallet/utils/generateActivity/generateNftActivity.ts index f16644c7f07..d43c25b6132 100644 --- a/packages/shared/lib/core/wallet/utils/generateActivity/generateNftActivity.ts +++ b/packages/shared/lib/core/wallet/utils/generateActivity/generateNftActivity.ts @@ -1,12 +1,13 @@ import { IProcessedTransaction } from '../../interfaces' import { outputContainsValue, getNftOutputFromTransaction } from '..' -import { ActivityType } from '@core/wallet/enums' +import { ActivityDirection, ActivityType } from '@core/wallet/enums' import { IAccountState } from '@core/account' import type { INftOutput } from '@iota/types' import { getAsyncDataFromOutput } from '../generateActivity/helper/getAsyncDataFromOutput' import { NftActivity } from '@core/wallet/types' import { getMetadataFromOutput, getSendingInformation, getTagFromOutput } from './helper' import { getNftId } from '../outputs/getNftId' +import { EMPTY_HEX_ID } from '@core/wallet/constants' export function generateNftActivity(processedTransaction: IProcessedTransaction, account: IAccountState): NftActivity { const { outputs, claimingData, transactionInputs, time, inclusionState, transactionId } = processedTransaction @@ -28,6 +29,10 @@ export function generateNftActivity(processedTransaction: IProcessedTransaction, const tag = getTagFromOutput(output) const sendingInfo = getSendingInformation(processedTransaction, output, account) + const { subject, isInternal, isSelfTransaction } = sendingInfo + let { direction } = sendingInfo + + direction = output.nftId === EMPTY_HEX_ID ? ActivityDirection.Minting : direction const asyncData = getAsyncDataFromOutput(output, transactionId, claimingData, account) return { @@ -47,6 +52,9 @@ export function generateNftActivity(processedTransaction: IProcessedTransaction, metadata, tag, asyncData, - ...sendingInfo, + subject, + isInternal, + direction, + isSelfTransaction, } } diff --git a/packages/shared/locales/en.json b/packages/shared/locales/en.json index 3bd7d6497aa..ecb8adfb756 100644 --- a/packages/shared/locales/en.json +++ b/packages/shared/locales/en.json @@ -1160,6 +1160,8 @@ "transferring": "Transferring", "transferNft": "Transfer NFT", "transferringNft": "Transferring NFT", + "mintedNft": "Minted NFT", + "mintingNft": "Minting NFT", "shimmerClaimed": "Claimed", "shimmerClaiming": "Claiming", "shimmerGenesis": "Shimmer Genesis", @@ -1725,6 +1727,14 @@ }, "optionalInput": "This optional data will be public on the explorer and viewable by everyone.", "transactionDetails": { + "minting": { + "storageDeposit": "A refundable token deposit needed to store your transaction on the Tangle.", + "giftedStorageDeposit": "The storage deposit for this transaction was gifted to you. You do not need to refund the deposit.", + "expirationTime": "Claim these funds before the expiration time or they will be returned to the sender.", + "timelockDate": "The sender set a timelock on these funds. You will be able to spend them once the timelock expires.", + "metadata": "An optional data field for storing data persistently on the Tangle.", + "tag": "A short optional data field. Tagging groups of transactions can make them easier to search for." + }, "incoming": { "storageDeposit": "A refundable token deposit needed to store your transaction on the Tangle.", "giftedStorageDeposit": "The storage deposit for this transaction was gifted to you. You do not need to refund the deposit.", @@ -1839,6 +1849,11 @@ "Pending": "transferring to", "Confirmed": "transferred to", "Conflicting": "failed to transfer" + }, + "minting": { + "Pending": "minting", + "Confirmed": "minted", + "Conflicting": "failed to mint" } }, "external": {