Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
isunaslabs committed Dec 29, 2022
1 parent 6456732 commit d48e0e9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
21 changes: 21 additions & 0 deletions packages/app-types/src/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,25 @@ export interface Deposit {
canEarlyWithdraw: boolean;
isEarlyWithdrawn: boolean;
}

export interface Bond {
amount: BigNumber;
symbol: string;
isDeposit: boolean;
}

export interface Delegate {
id: string;
collator?: string;
previousReward?: string;
staked: BigNumber;
bondedTokens: Bond[];
isActive?: boolean;
isMigrated?: boolean;
isLoading?: boolean;
isUndelegating?: boolean;
canUndelegate?: boolean;
canChangeCollator?: boolean;
}

/*Staking types end here*/
2 changes: 1 addition & 1 deletion packages/app/src/components/StakingOverview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const StakingOverview = () => {
const totalSelectedRing = allSelectedItems.reduce((acc, deposit) => acc.plus(deposit.value), BigNumber(0));
const power = calculateExtraPower({
kton: BigNumber(0),
ring: BigNumber(formatToWei(totalSelectedRing.toString()).toString()),
ring: BigNumber(totalSelectedRing.toString()),
});
setPowerByDeposits(power);
setDepositsToStake(allSelectedItems);
Expand Down
21 changes: 1 addition & 20 deletions packages/app/src/components/StakingRecordsTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,10 @@ import minusIcon from "../../assets/images/minus-square.svg";
import helpIcon from "../../assets/images/help.svg";
import reloadIcon from "../../assets/images/reload.svg";
import { ChangeEvent, useEffect, useRef, useState } from "react";
import { Deposit } from "@darwinia/app-types";
import { Deposit, Delegate } from "@darwinia/app-types";
import { formatToWei, isValidNumber, prettifyNumber } from "@darwinia/app-utils";
import BigNumber from "bignumber.js";

interface Bond {
amount: BigNumber;
symbol: string;
isDeposit: boolean;
}

interface Delegate extends TableRow {
collator?: string;
previousReward?: string;
staked: BigNumber;
bondedTokens: Bond[];
isActive?: boolean;
isMigrated?: boolean;
isLoading?: boolean;
isUndelegating?: boolean;
canUndelegate?: boolean;
canChangeCollator?: boolean;
}

const StakingRecordsTable = () => {
const { t } = useAppTranslation();
const { selectedNetwork } = useWallet();
Expand Down

0 comments on commit d48e0e9

Please sign in to comment.