- {hasNoActiveStake ? 'No staking' : 'Total Staked'}
+ {showStakingDetails ? 'Total Locked' : 'No staking'}
- {!hasNoActiveStake && (
+ {showStakingDetails && (
<>
-
+
diff --git a/src/pages/AccountDetails/AccountStaking/components/DonutChart/helpers/prepareChartData.ts b/src/pages/AccountDetails/AccountStaking/components/DonutChart/helpers/prepareChartData.ts
index 39a84eaba..911b3500f 100644
--- a/src/pages/AccountDetails/AccountStaking/components/DonutChart/helpers/prepareChartData.ts
+++ b/src/pages/AccountDetails/AccountStaking/components/DonutChart/helpers/prepareChartData.ts
@@ -1,8 +1,8 @@
import BigNumber from 'bignumber.js';
+import { ZERO } from 'appConstants';
import { DECIMALS, DIGITS } from 'config';
import { formatAmount, truncateMiddle } from 'helpers';
-import { ProviderType } from 'types';
import { AccountStakingSliceType } from 'types/account.types';
interface DonutChartDataType {
@@ -13,53 +13,58 @@ interface DonutChartDataType {
}
export const prepareChartData = ({
- stakingDetails,
- providers
+ stakingDetails
}: {
stakingDetails: AccountStakingSliceType;
- providers: ProviderType[];
}): DonutChartDataType[] => {
const {
- accountStakingFetched,
+ showDelegation,
+ showValidatorStake,
+ showLegacyDelegation,
+
+ lockedLegacyDelegation,
+ lockedValidatorStake,
+
delegation,
- stake,
- delegationLegacy,
- showStake,
- showDelegationLegacy,
- totalLegacyDelegation,
- totalStaked
+ delegationProviders,
+
+ accountStakingFetched
} = stakingDetails;
const defaultData = [{ name: 'No Staking', value: 1, displayValue: 0 }];
if (accountStakingFetched) {
- const bNtotalLegacyDelegation = new BigNumber(totalLegacyDelegation);
- const bNtotalStaked = new BigNumber(totalStaked);
-
const chartData: DonutChartDataType[] = [];
- const displayDelegations = delegation
- ? delegation.filter(
- (delegation) =>
- delegation.userActiveStake !== '0' ||
- delegation.claimableRewards !== '0' ||
- (delegation.userUndelegatedList &&
- delegation.userUndelegatedList.length > 0)
- )
- : [];
- if (displayDelegations.length > 0) {
- displayDelegations.forEach((delegation) => {
- const provider = providers.find(
+
+ if (showDelegation && delegation && delegation.length > 0) {
+ delegation.forEach((delegation) => {
+ const provider = delegationProviders.find(
({ provider }) => delegation.contract === provider
);
if (provider) {
- const { userActiveStake, claimableRewards, userUnBondable } =
- delegation;
- const bNtotalLocked = new BigNumber(userActiveStake)
+ const {
+ userActiveStake,
+ claimableRewards,
+ userUnBondable,
+ userUndelegatedList
+ } = delegation;
+
+ const undelegatedAmounts =
+ userUndelegatedList && userUndelegatedList.length > 0
+ ? userUndelegatedList.map(({ amount }) => amount)
+ : [];
+ const bNtotalUserUnStakedValue = undelegatedAmounts.reduce(
+ (a, b) => new BigNumber(a).plus(b),
+ new BigNumber(ZERO)
+ );
+
+ const bNLocked = new BigNumber(userActiveStake)
.plus(claimableRewards)
- .plus(userUnBondable);
+ .plus(userUnBondable)
+ .plus(bNtotalUserUnStakedValue);
const amount = formatAmount({
- input: bNtotalLocked.toString(10),
+ input: bNLocked.toString(10),
decimals: DECIMALS,
digits: DIGITS,
showLastNonZeroDecimal: false
@@ -67,7 +72,7 @@ export const prepareChartData = ({
chartData.push({
name:
- provider?.identityDetails?.name ??
+ provider?.identityInfo?.name ??
truncateMiddle(provider.provider, 20),
identifier: provider?.identity ?? provider.provider,
value: Number(amount)
@@ -75,9 +80,9 @@ export const prepareChartData = ({
}
});
}
- if (showDelegationLegacy && delegationLegacy) {
+ if (showLegacyDelegation && lockedLegacyDelegation) {
const amount = formatAmount({
- input: bNtotalLegacyDelegation.toString(10),
+ input: lockedLegacyDelegation,
decimals: DECIMALS,
digits: DIGITS,
showLastNonZeroDecimal: false
@@ -88,9 +93,9 @@ export const prepareChartData = ({
value: Number(amount)
});
}
- if (showStake && stake) {
+ if (showValidatorStake && lockedValidatorStake) {
const amount = formatAmount({
- input: bNtotalStaked.toString(10),
+ input: lockedValidatorStake,
decimals: DECIMALS,
digits: DIGITS,
showLastNonZeroDecimal: false
diff --git a/src/pages/AccountDetails/AccountStaking/components/ProviderDetails/ProviderDetails.tsx b/src/pages/AccountDetails/AccountStaking/components/ProviderDetails/ProviderDetails.tsx
index 3bddd64c9..b22c14f5e 100644
--- a/src/pages/AccountDetails/AccountStaking/components/ProviderDetails/ProviderDetails.tsx
+++ b/src/pages/AccountDetails/AccountStaking/components/ProviderDetails/ProviderDetails.tsx
@@ -27,7 +27,7 @@ export const ProviderDetails = ({ provider }: { provider: ProviderType }) => {
}
const websiteLink = getValidLink({
- link: provider?.identityDetails?.website
+ link: provider?.identityInfo?.website
});
return provider ? (
@@ -35,8 +35,8 @@ export const ProviderDetails = ({ provider }: { provider: ProviderType }) => {
@@ -45,9 +45,9 @@ export const ProviderDetails = ({ provider }: { provider: ProviderType }) => {
to={urlBuilder.providerDetails(provider.provider)}
className='provider-title'
>
- {provider?.identityDetails?.name ? (
+ {provider?.identityInfo?.name ? (
- {provider.identityDetails.name}
+ {provider.identityInfo.name}
) : (
diff --git a/src/pages/AccountDetails/AccountVerifiedContract/AccountVerifiedContract.tsx b/src/pages/AccountDetails/AccountVerifiedContract/AccountVerifiedContract.tsx
index 49ddf21b3..e198cf370 100644
--- a/src/pages/AccountDetails/AccountVerifiedContract/AccountVerifiedContract.tsx
+++ b/src/pages/AccountDetails/AccountVerifiedContract/AccountVerifiedContract.tsx
@@ -6,11 +6,12 @@ import { TransactionsToastList } from '@multiversx/sdk-dapp/UI/TransactionsToast
import { DappProvider } from '@multiversx/sdk-dapp/wrappers/DappProvider/DappProvider';
import { ScExplorerContainer } from '@multiversx/sdk-dapp-sc-explorer/containers/ScExplorerContainer';
import { VerifiedContractTabsEnum } from '@multiversx/sdk-dapp-sc-explorer/types/base.types';
+import { VerifiedContractType } from '@multiversx/sdk-dapp-sc-explorer/types/verifiedContract.types';
import { useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import { Loader, PageState } from 'components';
-import { useAdapter, useNetworkRoute, useIsMainnet } from 'hooks';
+import { useNetworkRoute, useIsMainnet } from 'hooks';
import { faClone } from 'icons/regular';
import {
faAngleDown,
@@ -33,23 +34,30 @@ import {
} from 'icons/solid';
import { getHeaders } from 'interceptors';
import { accountSelector, activeNetworkSelector } from 'redux/selectors';
+import { WithClassnameType } from 'types';
+
import { getVerifiedContractSectionUrl } from './helpers';
import { useGetActiveSection, useGetEnvironment } from './hooks';
-export const AccountVerifiedContract = () => {
+export interface AccountVerifiedContractUIType extends WithClassnameType {
+ contract?: VerifiedContractType;
+ isDataReady?: boolean;
+}
+
+export const AccountVerifiedContract = ({
+ contract,
+ isDataReady
+}: AccountVerifiedContractUIType) => {
const networkRoute = useNetworkRoute();
const navigate = useNavigate();
const pathActiveSection = useGetActiveSection();
const isMainnet = useIsMainnet();
- const { getAccountContractVerification } = useAdapter();
const { account } = useSelector(accountSelector);
const { address, isVerified } = account;
const { apiAddress } = useSelector(activeNetworkSelector);
const environment = useGetEnvironment();
const extraRequestHeaders = getHeaders();
- const [contract, setContract] = useState();
- const [isDataReady, setIsDataReady] = useState
();
const [activeSection, setActiveSection] =
useState(pathActiveSection);
@@ -63,21 +71,6 @@ export const AccountVerifiedContract = () => {
}
}, [activeSection]);
- const fetchContractVerification = () => {
- getAccountContractVerification({ address }).then(({ success, data }) => {
- if (success && data) {
- setContract(data);
- }
- setIsDataReady(success);
- });
- };
-
- useEffect(() => {
- if (address && isVerified) {
- fetchContractVerification();
- }
- }, [address, isVerified]);
-
if (!isVerified || !environment) {
return null;
}
diff --git a/src/pages/CollectionDetails/CollectionNfts.tsx b/src/pages/CollectionDetails/CollectionNfts.tsx
index 9badb1f72..2399eeb26 100644
--- a/src/pages/CollectionDetails/CollectionNfts.tsx
+++ b/src/pages/CollectionDetails/CollectionNfts.tsx
@@ -116,7 +116,11 @@ export const CollectionNfts = () => {
{type !== NftTypeEnum.MetaESDT && (
-
+
)}
diff --git a/src/pages/Nfts/Nfts.tsx b/src/pages/Nfts/Nfts.tsx
index a0c6f4e45..3a5fd36d4 100644
--- a/src/pages/Nfts/Nfts.tsx
+++ b/src/pages/Nfts/Nfts.tsx
@@ -112,6 +112,7 @@ export const Nfts = () => {
diff --git a/src/pages/TransactionDetails/components/TransactionInfo/TransactionInfo.tsx b/src/pages/TransactionDetails/components/TransactionInfo/TransactionInfo.tsx
index 96c747f1e..3e8c859e5 100644
--- a/src/pages/TransactionDetails/components/TransactionInfo/TransactionInfo.tsx
+++ b/src/pages/TransactionDetails/components/TransactionInfo/TransactionInfo.tsx
@@ -135,8 +135,11 @@ export const TransactionInfo = ({
});
const visibleOperations = getVisibleOperations(transaction);
- const showLogs =
- transaction.logs || (transaction.results && transaction.results.length > 0);
+ const hasTxResultsLogs =
+ transaction.results &&
+ transaction.results.length > 0 &&
+ transaction.results.some((ressult) => ressult.logs);
+ const showLogs = transaction.logs || hasTxResultsLogs;
const totalTxTokenUsdValue = getTotalTxTokenUsdValue(transaction);
const showTotalTxTokenUsdValue =
diff --git a/src/redux/slices/accountStaking.ts b/src/redux/slices/accountStaking.ts
index 65fede146..6def557ef 100644
--- a/src/redux/slices/accountStaking.ts
+++ b/src/redux/slices/accountStaking.ts
@@ -1,21 +1,30 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
+import { ELLIPSIS } from 'appConstants';
import { AccountStakingSliceType } from 'types/account.types';
export const getInitialAccountStakingState = (): AccountStakingSliceType => {
return {
address: '',
+
showDelegation: false,
- showDelegationLegacy: false,
- showStake: false,
- totalStaked: '0',
- totalDelegation: '0',
- totalLegacyDelegation: '0',
- totalLocked: '0',
- totalClaimable: '0',
- totalActiveStake: '0',
- totalUnstakedValue: '0',
+ showLegacyDelegation: false,
+ showValidatorStake: false,
+ showStakingDetails: false,
+
+ activeValidatorStake: ELLIPSIS,
+ activeDelegation: ELLIPSIS,
+ activeLegacyDelegation: ELLIPSIS,
+
+ lockedValidatorStake: ELLIPSIS,
+ lockedDelegation: ELLIPSIS,
+ lockedLegacyDelegation: ELLIPSIS,
+
+ totalActiveStake: ELLIPSIS,
+ totalLocked: ELLIPSIS,
+ totalClaimable: ELLIPSIS,
+ totalUnstaked: ELLIPSIS,
+
providerDataReady: undefined,
- stakingDataReady: undefined,
delegationProviders: [],
delegationLegacyIdentity: undefined,
@@ -32,21 +41,30 @@ export const accountStakingSlice = createSlice({
action: PayloadAction
) => {
state.address = action.payload.address;
- state.totalStaked = action.payload.totalStaked;
- state.totalDelegation = action.payload.totalDelegation;
- state.totalLegacyDelegation = action.payload.totalLegacyDelegation;
+
+ state.showDelegation = action.payload.showDelegation;
+ state.showLegacyDelegation = action.payload.showLegacyDelegation;
+ state.showValidatorStake = action.payload.showValidatorStake;
+ state.showStakingDetails = action.payload.showStakingDetails;
+
+ state.activeValidatorStake = action.payload.activeValidatorStake;
+ state.activeDelegation = action.payload.activeDelegation;
+ state.activeLegacyDelegation = action.payload.activeLegacyDelegation;
+
+ state.lockedValidatorStake = action.payload.lockedValidatorStake;
+ state.lockedDelegation = action.payload.lockedDelegation;
+ state.lockedLegacyDelegation = action.payload.lockedLegacyDelegation;
+
+ state.totalActiveStake = action.payload.totalActiveStake;
state.totalLocked = action.payload.totalLocked;
state.totalClaimable = action.payload.totalClaimable;
- state.totalActiveStake = action.payload.totalActiveStake;
- state.totalUnstakedValue = action.payload.totalUnstakedValue;
+ state.totalUnstaked = action.payload.totalUnstaked;
+
state.stake = action.payload.stake;
- state.showStake = action.payload.showStake;
- state.delegationLegacy = action.payload.delegationLegacy;
- state.showDelegationLegacy = action.payload.showDelegationLegacy;
+ state.legacyDelegation = action.payload.legacyDelegation;
state.delegation = action.payload.delegation;
- state.showDelegation = action.payload.showDelegation;
+
state.providerDataReady = action.payload.providerDataReady;
- state.stakingDataReady = action.payload.stakingDataReady;
state.delegationProviders = action.payload.delegationProviders;
state.delegationLegacyIdentity = action.payload.delegationLegacyIdentity;
diff --git a/src/types/account.types.ts b/src/types/account.types.ts
index ea63842ba..60dfbcff6 100644
--- a/src/types/account.types.ts
+++ b/src/types/account.types.ts
@@ -45,26 +45,37 @@ export interface AccountSliceType extends SliceType {
}
export interface AccountStakingSliceType {
- accountStakingFetched: boolean;
-
address: string;
- totalStaked: string;
- totalDelegation: string;
- totalLegacyDelegation: string;
+
+ showDelegation: boolean;
+ showLegacyDelegation: boolean;
+ showValidatorStake: boolean;
+ showStakingDetails: boolean;
+
+ activeValidatorStake: string;
+ activeDelegation: string;
+ activeLegacyDelegation: string;
+
+ lockedValidatorStake: string;
+ lockedDelegation: string;
+ lockedLegacyDelegation: string;
+
+ totalActiveStake: string;
totalLocked: string;
totalClaimable: string;
- totalActiveStake: string;
- totalUnstakedValue: string;
+ totalUnstaked: string;
+
+ // details
stake?: AccountStakeType;
- showStake: boolean;
- delegationLegacy?: AccountDelegationLegacyType;
- showDelegationLegacy: boolean;
+ legacyDelegation?: AccountDelegationLegacyType;
delegation?: AccountDelegationType[];
- showDelegation: boolean;
+
+ // provider details
providerDataReady: undefined | boolean;
- stakingDataReady: undefined | boolean;
delegationProviders: ProviderType[];
delegationLegacyIdentity: IdentityType | undefined;
+
+ accountStakingFetched: boolean;
}
export interface AccountExtraSliceType extends SliceType {
diff --git a/src/types/collection.types.ts b/src/types/collection.types.ts
index 091926f84..1cc56b82f 100644
--- a/src/types/collection.types.ts
+++ b/src/types/collection.types.ts
@@ -1,5 +1,5 @@
import { RolesType, ScamInfoType, SliceType } from './general.types';
-import { NftTypeEnum } from './nft.types';
+import { NftTypeEnum, NftSubtypeEnum } from './nft.types';
import { TokenAssetType } from './token.types';
export interface CollectionType {
@@ -9,6 +9,7 @@ export interface CollectionType {
ticker: string;
timestamp: number;
owner: string;
+ subType?: NftSubtypeEnum;
decimals?: number;
assets?: TokenAssetType;
scamInfo?: ScamInfoType;
diff --git a/src/types/nft.types.ts b/src/types/nft.types.ts
index bab19f000..992a211a6 100644
--- a/src/types/nft.types.ts
+++ b/src/types/nft.types.ts
@@ -6,6 +6,14 @@ export enum NftTypeEnum {
SemiFungibleESDT = 'SemiFungibleESDT',
MetaESDT = 'MetaESDT'
}
+
+export enum NftSubtypeEnum {
+ NonFungibleESDTv2 = 'NonFungibleESDTv2',
+ DynamicNonFungibleESDT = 'DynamicNonFungibleESDT',
+ DynamicSemiFungibleESDT = 'DynamicSemiFungibleESDT',
+ DynamicMetaESDT = 'DynamicMetaESDT'
+}
+
export interface NftType {
identifier: string;
collection: string;
@@ -17,6 +25,7 @@ export interface NftType {
creator: string;
royalties: number;
balance: string;
+ subType?: NftSubtypeEnum;
ticker?: string;
uris?: string[];
url?: string;