Skip to content

Commit

Permalink
EVM Staking - Remove minimum stake column from validator tables (#1847)
Browse files Browse the repository at this point in the history
  • Loading branch information
devpavan04 authored Nov 23, 2023
1 parent 6913366 commit 704ab0b
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<li><a href="#contribute">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#help">Need help?</a></li>
</ul>
</ul>
</details>

<h2 id="start"> Getting Started </h2>
Expand Down
10 changes: 3 additions & 7 deletions apps/tangle-dapp/components/ValidatorTable/ValidatorTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const columnHelper = createColumnHelper<Validator>();

const columns = [
columnHelper.accessor('address', {
header: () => <HeaderCell title="Indentity" className="justify-start" />,
header: () => <HeaderCell title="Identity" className="justify-start" />,
cell: (props) => {
const address = props.getValue();
const identity = props.row.original.identity;
Expand Down Expand Up @@ -58,13 +58,9 @@ const columns = [
cell: (props) => <StringCell value={props.getValue()} />,
}),
columnHelper.accessor('delegations', {
header: () => <HeaderCell title="Delegations" className="justify-start" />,
cell: (props) => <StringCell value={props.getValue()} />,
}),
columnHelper.accessor('minimumStake', {
header: () => <HeaderCell title="Minimum stake" className="justify-end" />,
header: () => <HeaderCell title="Delegations" className="justify-center" />,
cell: (props) => (
<StringCell value={`${props.getValue()} tTNT`} className="text-right" />
<StringCell value={props.getValue()} className="text-center" />
),
}),
];
Expand Down
15 changes: 0 additions & 15 deletions apps/tangle-dapp/constants/polkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,6 @@ export const formatTokenBalance = async (
}
};

export const getMinimumStake = async (): Promise<number | undefined> => {
try {
const api = await getPolkadotApiPromise();

if (!api) return NaN;

const minimumStakeDetails = await api.query.staking.minimumActiveStake();
const minimumStake = await formatTokenBalance(minimumStakeDetails);

return Number(minimumStake);
} catch (error) {
throw new Error('Failed to get minimum stake required');
}
};

export const getTotalNumberOfNominators = async (
validatorAddress: string
): Promise<number | undefined> => {
Expand Down
6 changes: 0 additions & 6 deletions apps/tangle-dapp/data/ValidatorTables/getActiveValidators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
formatTokenBalance,
getMinimumStake,
getPolkadotApiPromise,
getTotalNumberOfNominators,
getValidatorIdentity,
Expand All @@ -13,10 +12,6 @@ export const getActiveValidators = async (): Promise<Validator[]> => {
if (!api) return [] as Validator[];

try {
// Minimum Stake Amount Required
const minimumStakeAmount = await getMinimumStake();
const minimumStake = minimumStakeAmount?.toString();

const [validators, currentEra] = await Promise.all([
api.query.session.validators(),
api.query.staking.currentEra(),
Expand Down Expand Up @@ -54,7 +49,6 @@ export const getActiveValidators = async (): Promise<Validator[]> => {
selfStaked: selfStaked ?? '',
effectiveAmountStaked: effectiveAmountStaked ?? '',
delegations: delegations ?? '',
minimumStake: minimumStake ?? '',
};
})
);
Expand Down
6 changes: 0 additions & 6 deletions apps/tangle-dapp/data/ValidatorTables/getWaitingValidators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
formatTokenBalance,
getMinimumStake,
getPolkadotApiPromise,
getTotalNumberOfNominators,
getValidatorIdentity,
Expand All @@ -13,10 +12,6 @@ export const getWaitingValidators = async (): Promise<Validator[]> => {
if (!api) return [] as Validator[];

try {
// Minimum Stake Amount Required
const minimumStakeAmount = await getMinimumStake();
const minimumStake = minimumStakeAmount?.toString();

const waitingValidatorsDetails = await api.derive.staking.waitingInfo();

const waitingValidators = await Promise.all(
Expand Down Expand Up @@ -57,7 +52,6 @@ export const getWaitingValidators = async (): Promise<Validator[]> => {
selfStaked: selfStaked ?? '',
effectiveAmountStaked: effectiveAmountStaked ?? '',
delegations: delegations ?? '',
minimumStake: minimumStake ?? '',
};
})
);
Expand Down
1 change: 0 additions & 1 deletion apps/tangle-dapp/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ export type Validator = {
selfStaked: string;
effectiveAmountStaked: string;
delegations: string;
minimumStake: string;
};

0 comments on commit 704ab0b

Please sign in to comment.