Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: all activities with metadata are interpreted as smart contract calls #600

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,17 @@

$: expirationTime = getFormattedTimeStamp(activity.asyncData?.expirationDate)
$: claimedTime = getFormattedTimeStamp(activity.asyncData?.claimedDate)
$: hasStorageDeposit =
activity?.storageDeposit || (activity?.storageDeposit === 0 && activity.giftedStorageDeposit === 0)
$: gasLimit = activity?.parsedLayer2Metadata?.gasLimit
$: gasLimit = activity.parsedLayer2Metadata?.gasLimit

$: formattedTransactionTime = getFormattedTimeStamp(activity.time)
$: formattedTimelockDate = getFormattedTimeStamp(activity.asyncData?.timelockDate)
$: formattedStorageDeposit = formatTokenAmountPrecise(activity.storageDeposit ?? 0, getBaseToken())
$: formattedGiftedStorageDeposit = formatTokenAmountPrecise(activity.giftedStorageDeposit ?? 0, getBaseToken())
$: formattedSurplus = formatTokenAmountPrecise(activity.surplus ?? 0, getBaseToken())
$: formattedGasLimit = formatTokenAmountPrecise(Number(gasLimit ?? 0), getBaseToken())

$: explorerUrl = getDefaultExplorerUrl(activity.sourceNetworkId, ExplorerEndpoint.Transaction)
function onTransactionIdClick(): void {
if (explorerUrl) {
openUrlInBrowser(`${explorerUrl}/${activity?.asyncData?.claimingTransactionId}`)
openUrlInBrowser(`${explorerUrl}/${activity.asyncData?.claimingTransactionId}`)
return
}
}
Expand All @@ -35,58 +31,49 @@
items={[
{
key: localize('general.destinationNetwork'),
value: getNameFromNetworkId(activity?.destinationNetworkId),
value: getNameFromNetworkId(activity.destinationNetworkId),
},
{
key: localize('general.transactionTime'),
value: formattedTransactionTime,
},
{
key: localize('general.tag'),
value: activity?.tag,
tooltip: localize(`tooltips.transactionDetails.${activity?.direction}.tag`),
value: activity.tag,
tooltip: localize(`tooltips.transactionDetails.${activity.direction}.tag`),
},
{
key: localize('general.metadata'),
value: activity?.metadata,
tooltip: localize(`tooltips.transactionDetails.${activity?.direction}.metadata`),
value: !activity.parsedLayer2Metadata ? activity.metadata : undefined,
tooltip: localize(`tooltips.transactionDetails.${activity.direction}.metadata`),
},
{
key: localize('general.storageDeposit'),
value: hasStorageDeposit ? formattedStorageDeposit : undefined,
tooltip: localize(`tooltips.transactionDetails.${activity?.direction}.storageDeposit`),
},
{
key: localize('general.surplus'),
value: activity?.surplus ? formattedSurplus : undefined,
},
{
key: localize('general.giftedStorageDeposit'),
value: activity?.giftedStorageDeposit ? formattedGiftedStorageDeposit : undefined,
tooltip: localize(`tooltips.transactionDetails.${activity?.direction}.giftedStorageDeposit`),
value: activity.storageDeposit ? formattedStorageDeposit : undefined,
tooltip: localize(`tooltips.transactionDetails.${activity.direction}.storageDeposit`),
},
{
key: localize('general.gasLimit'),
value: gasLimit ? formattedGasLimit : undefined,
tooltip: localize(`tooltips.transactionDetails.${activity?.direction}.gasLimit`),
tooltip: localize(`tooltips.transactionDetails.${activity.direction}.gasLimit`),
},
{
key: localize('general.expirationTime'),
value: expirationTime,
tooltip: localize(`tooltips.transactionDetails.${activity?.direction}.expirationTime`),
tooltip: localize(`tooltips.transactionDetails.${activity.direction}.expirationTime`),
},
{
key: localize('general.timelockDate'),
value: activity?.asyncData?.timelockDate ? formattedTimelockDate : undefined,
tooltip: localize(`tooltips.transactionDetails.${activity?.direction}.timelockDate`),
value: activity.asyncData?.timelockDate ? formattedTimelockDate : undefined,
tooltip: localize(`tooltips.transactionDetails.${activity.direction}.timelockDate`),
},
{
key: localize('general.claimedTime'),
value: claimedTime,
},
{
key: localize(activity?.asyncData?.isClaiming ? 'general.claimingIn' : 'general.claimedIn'),
value: activity?.asyncData?.claimingTransactionId,
key: localize(activity.asyncData?.isClaiming ? 'general.claimingIn' : 'general.claimedIn'),
value: activity.asyncData?.claimingTransactionId,
copyable: true,
truncate: { firstCharCount: 12, endCharCount: 12 },
onClick: explorerUrl ? onTransactionIdClick : undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
getTagFromOutput,
} from './helper'
import { getNativeTokenFromOutput } from './outputs'
import { isStardustNetwork } from '@core/network/utils'

export function generateSingleBasicActivity(
account: IAccountState,
Expand Down Expand Up @@ -55,7 +56,9 @@ export function generateSingleBasicActivity(
const destinationNetworkId = getNetworkIdFromAddress(recipient?.address, sourceNetworkId)

const asyncData = getAsyncDataFromOutput(output, outputId, claimingData, account)
const parsedLayer2Metadata = parseLayer2Metadata(metadata)

const isToLayer2 = isStardustNetwork(sourceNetworkId) && sourceNetworkId !== destinationNetworkId
const parsedLayer2Metadata = isToLayer2 ? parseLayer2Metadata(metadata) : undefined

const gasLimit = Number(parsedLayer2Metadata?.gasLimit ?? '0')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getTagFromOutput,
} from './helper'
import { getNftId } from './outputs'
import { isStardustNetwork } from '@core/network/utils'

export function generateSingleNftActivity(
account: IAccountState,
Expand Down Expand Up @@ -48,7 +49,9 @@ export function generateSingleNftActivity(
const destinationNetworkId = getNetworkIdFromAddress(recipient?.address, sourceNetworkId)

const asyncData = getAsyncDataFromOutput(output, outputId, claimingData, account)
const parsedLayer2Metadata = parseLayer2Metadata(metadata)

const isToLayer2 = isStardustNetwork(sourceNetworkId) && sourceNetworkId !== destinationNetworkId
const parsedLayer2Metadata = isToLayer2 ? parseLayer2Metadata(metadata) : undefined

return {
type: ActivityType.Nft,
Expand Down
Loading