}
hasFeedback
- label={}
+ label={pnkTokenSymbol}
>
{form.getFieldDecorator("PNK", {
initialValue: fromWei(String(maxRecommendedStake)),
diff --git a/src/containers/cases.js b/src/containers/cases.js
index d11eb8b..8ed2281 100644
--- a/src/containers/cases.js
+++ b/src/containers/cases.js
@@ -52,8 +52,7 @@ export default function Cases() {
if (dispute.period === "1") {
const vote = call("KlerosLiquid", "getVote", d.disputeID, d.appeal, d.voteID);
- const isVoteCommitted =
- vote?.commit !== "0x0000000000000000000000000000000000000000000000000000000000000000";
+ const isVoteCommitted = parseInt(vote?.commit, 16) !== 0;
acc[vote?.voted ? "active" : "votePending"].push({
ID: d.disputeID,
draws: numberOfVotes,
diff --git a/src/containers/convert-pnk/convert-pnk-card.js b/src/containers/convert-pnk/convert-pnk-card.js
index 39aef7c..3f66e4a 100644
--- a/src/containers/convert-pnk/convert-pnk-card.js
+++ b/src/containers/convert-pnk/convert-pnk-card.js
@@ -1,9 +1,9 @@
-import React from "react";
+import React, { useMemo } from "react";
import styled from "styled-components";
import { Link, useHistory, useLocation } from "react-router-dom";
import { Card, Divider } from "antd";
import { ButtonLink } from "../../adapters/antd";
-import TokenSymbol from "../../components/token-symbol";
+import { getTokenSymbol } from "../../helpers/get-token-symbol";
import SteppedContent from "../../components/stepped-content";
import { getCounterPartyChainId, isSupportedMainChain, isSupportedSideChain } from "../../api/side-chain";
import { chainIdToNetworkShortName } from "../../helpers/networks";
@@ -20,6 +20,9 @@ export default function ConvertPnkCard() {
const originChainId = isSupportedMainChain(counterPartyChainId) ? currentChainId : counterPartyChainId;
const targetChainId = isSupportedMainChain(counterPartyChainId) ? counterPartyChainId : currentChainId;
+ const pnkTokenSymbolOriginChainId = useMemo(() => getTokenSymbol(originChainId, "PNK"), [originChainId]);
+ const pnkTokenSymbolTargetChainId = useMemo(() => getTokenSymbol(targetChainId, "PNK"), [targetChainId]);
+
const { step, next, first } = useStep();
const handleFormDone = React.useCallback(() => {
@@ -42,7 +45,7 @@ export default function ConvertPnkCard() {
- Send to {chainIdToNetworkShortName[targetChainId]}
+ Send {pnkTokenSymbolOriginChainId} to {chainIdToNetworkShortName[targetChainId]}
>
}
>
@@ -51,8 +54,8 @@ export default function ConvertPnkCard() {
margin-top: -1rem;
`}
>
- Keep in mind that that are staked or locked cannot be sent
- to {chainIdToNetworkShortName[targetChainId]}. To just get xPNK, use the form below.
+ Keep in mind that {pnkTokenSymbolOriginChainId} that are staked or locked cannot be sent to{" "}
+ {chainIdToNetworkShortName[targetChainId]}. To just get xPNK, use the form below.
🎉
{" "}
- You have successfully sent your to{" "}
+ You have successfully sent your {pnkTokenSymbolOriginChainId} to{" "}
{chainIdToNetworkShortName[targetChainId]}!{" "}
🎉
@@ -81,11 +84,7 @@ export default function ConvertPnkCard() {
)}
steps={[
{
- title: (
- <>
- Convert
- >
- ),
+ title: <>Convert {pnkTokenSymbolOriginChainId}>,
children() {
return isSupportedSideChain(currentChainId) ? (
@@ -101,11 +100,7 @@ export default function ConvertPnkCard() {
},
},
{
- title: (
- <>
- Claim
- >
- ),
+ title: <>Claim {pnkTokenSymbolTargetChainId}>,
children() {
return ;
},
diff --git a/src/containers/convert-pnk/convert-pnk-form.js b/src/containers/convert-pnk/convert-pnk-form.js
index 2201aa5..09c1902 100644
--- a/src/containers/convert-pnk/convert-pnk-form.js
+++ b/src/containers/convert-pnk/convert-pnk-form.js
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useMemo } from "react";
import t from "prop-types";
import styled from "styled-components/macro";
import { Alert, Button, Col, Form, Icon, InputNumber, Row, Skeleton } from "antd";
@@ -7,11 +7,14 @@ import Web3 from "web3";
import { useSideChainApi } from "../../api/side-chain";
import BalanceTable from "../../components/balance-table";
import MultiTransactionStatus from "../../components/multi-transaction-status";
-import TokenSymbol, { AutoDetectedTokenSymbol } from "../../components/token-symbol";
+import { getTokenSymbol } from "../../helpers/get-token-symbol";
import { chainIdToNetworkShortName } from "../../helpers/networks";
import useAccount from "../../hooks/use-account";
import { useAsyncGenerator } from "../../hooks/use-generators";
import usePromise from "../../hooks/use-promise";
+import { drizzleReactHooks } from "@drizzle/react-plugin";
+
+const { useDrizzleState } = drizzleReactHooks;
const { fromWei, toWei, toBN } = Web3.utils;
@@ -97,24 +100,25 @@ function useWithdrawTokens(withdrawTokens) {
}
function PnkBalanceTable({ balance, locked, pendingStake, staked, available, error }) {
- const tokenSymbol = ;
+ const chainId = useDrizzleState((ds) => ds.web3.networkId);
+ const pnkTokenSymbol = useMemo(() => getTokenSymbol(chainId, "PNK"), [chainId]);
return (
<>
-
+
{pendingStake ? (
@@ -122,7 +126,7 @@ function PnkBalanceTable({ balance, locked, pendingStake, staked, available, err
description="Pending stake*:"
value={pendingStake}
error={error}
- tokenSymbol={tokenSymbol}
+ tokenSymbol={pnkTokenSymbol}
variant="warning"
/>
) : null}
@@ -131,7 +135,7 @@ function PnkBalanceTable({ balance, locked, pendingStake, staked, available, err
description="Available to convert:"
value={available}
error={error}
- tokenSymbol={tokenSymbol}
+ tokenSymbol={pnkTokenSymbol}
variant="primary"
/>
@@ -150,9 +154,9 @@ function PnkBalanceTable({ balance, locked, pendingStake, staked, available, err
your stake changes to be processed.
- This means that if you have just unstaked, you will not be able to convert those {tokenSymbol} right
- now. On the other hand, if you just staked, you can convert those {tokenSymbol} now, but the pending
- stake changes will be discarded.
+ This means that if you have just unstaked, you will not be able to convert those {pnkTokenSymbol}{" "}
+ right now. On the other hand, if you just staked, you can convert those {pnkTokenSymbol} now, but the
+ pending stake changes will be discarded.
>
}
@@ -177,6 +181,9 @@ const ConvertPnkForm = Form.create()(({ form, maxAvailable, isSubmitting, disabl
const { chainId, destinationChainId } = sideChainApi;
+ const pnkTokenSymbol = useMemo(() => getTokenSymbol(chainId, "PNK"), [chainId]);
+ const pnkDestinationTokenSymbol = useMemo(() => getTokenSymbol(destinationChainId, "PNK"), [destinationChainId]);
+
const feeRatio = usePromise(React.useCallback(() => sideChainApi.getFeeRatio(), [sideChainApi]));
const { validateFieldsAndScroll, getFieldDecorator, getFieldsError, setFieldsValue } = form;
@@ -266,7 +273,7 @@ const ConvertPnkForm = Form.create()(({ form, maxAvailable, isSubmitting, disabl
hasFeedback
label={
-
+ {pnkTokenSymbol}
use max.
}
@@ -286,7 +293,7 @@ const ConvertPnkForm = Form.create()(({ form, maxAvailable, isSubmitting, disabl
- }>
+
{destinationDecorator(
getTokenSymbol(originChainId, "PNK"), [originChainId]);
+ const targetChainTokenSymbol = useMemo(() => getTokenSymbol(targetChainId, "PNK"), [targetChainId]);
+
return (
<>
- Send your to get{" "}
- back on {chainIdToNetworkName[targetChainId]}
+ Send your {originChainTokenSymbol} to get {targetChainTokenSymbol} back on{" "}
+ {chainIdToNetworkName[targetChainId]}
>
}
/>
diff --git a/src/containers/convert-pnk/wihdraw-stpnk-card.js b/src/containers/convert-pnk/wihdraw-stpnk-card.js
index 7bb801f..9aa1a45 100644
--- a/src/containers/convert-pnk/wihdraw-stpnk-card.js
+++ b/src/containers/convert-pnk/wihdraw-stpnk-card.js
@@ -1,10 +1,10 @@
-import React from "react";
+import React, { useMemo } from "react";
import styled from "styled-components";
import Web3 from "web3";
import { useSideChainApi } from "../../api/side-chain";
import { Card, Button, Form, Input } from "antd";
import stPNKAbi from "../../assets/contracts/wrapped-pinakion.json";
-import TokenSymbol from "../../components/token-symbol";
+import { getTokenSymbol } from "../../helpers/get-token-symbol";
import { drizzleReactHooks } from "@drizzle/react-plugin";
import { VIEW_ONLY_ADDRESS } from "../../bootstrap/dataloader";
import usePromise from "../../hooks/use-promise";
@@ -112,6 +112,7 @@ const WithdrawStPnkForm = Form.create()(({ form, maxAvailable, isSubmitting, dis
account: drizzleState.accounts[0] || VIEW_ONLY_ADDRESS,
}));
const { validateFieldsAndScroll, getFieldDecorator, setFieldsValue, getFieldsError } = form;
+ const pnkTokenSymbol = useMemo(() => getTokenSymbol(chainId, "PNK"), [chainId]);
const amountDecorator = getFieldDecorator("amount", {
rules: [
@@ -149,7 +150,7 @@ const WithdrawStPnkForm = Form.create()(({ form, maxAvailable, isSubmitting, dis
}
});
},
- [validateFieldsAndScroll, account, drizzle.web3.eth.Contract]
+ [validateFieldsAndScroll, account, drizzle.web3.eth.Contract, chainId]
);
return (
@@ -160,14 +161,12 @@ const WithdrawStPnkForm = Form.create()(({ form, maxAvailable, isSubmitting, dis
hasFeedback
label={
-
+ {pnkTokenSymbol}
use max.
}
>
- {amountDecorator(
-
- )}
+ {amountDecorator()}
- Select courts and stake
- >
- }
+ description={<>Select courts and stake PNK>}
extra={
-
- Claim
-
+ Claim PNK
- The more you stake, the higher your chances of being drawn as a juror.
- >
+ <>The more PNK you stake, the higher your chances of being drawn as a juror.>
)}
}
@@ -96,9 +93,7 @@ export default function Tokens() {
) : hasOldKlerosAtStake ? (
"Looks like you have some PNK locked in the old Kleros. Come back later when the periods have passed to withdraw."
) : (
- <>
- The more you stake, the higher your chances of being drawn as a juror.
- >
+ <>The more PNK you stake, the higher your chances of being drawn as a juror.>
)}
}
diff --git a/src/components/token-symbol.js b/src/helpers/get-token-symbol.js
similarity index 55%
rename from src/components/token-symbol.js
rename to src/helpers/get-token-symbol.js
index 489c833..16de6ff 100644
--- a/src/components/token-symbol.js
+++ b/src/helpers/get-token-symbol.js
@@ -1,10 +1,6 @@
-import React from "react";
-import t from "prop-types";
-import { drizzleReactHooks } from "@drizzle/react-plugin";
+import t, { PropTypes } from "prop-types";
-const { useDrizzleState } = drizzleReactHooks;
-
-export default function TokenSymbol({ chainId, token }) {
+export function getTokenSymbol(chainId, token) {
if (token) {
return chainIdToTokenSuffix[chainId] && chainIdToTokenSuffix[chainId][token]
? chainIdToTokenSuffix[chainId][token]
@@ -15,17 +11,8 @@ export default function TokenSymbol({ chainId, token }) {
return suffix;
}
-TokenSymbol.propTypes = {
- token: t.string,
-};
-
-export function AutoDetectedTokenSymbol({ token }) {
- const chainId = useDrizzleState((ds) => ds.web3.networkId);
-
- return ;
-}
-
-AutoDetectedTokenSymbol.propTypes = {
+getTokenSymbol.propTypes = {
+ chainId: PropTypes.number.isRequired,
token: t.string,
};