}
hasFeedback
- label={PNKTokenSymbol}
+ label={pnkTokenSymbol}
>
{form.getFieldDecorator("PNK", {
initialValue: fromWei(String(maxRecommendedStake)),
diff --git a/src/containers/convert-pnk/convert-pnk-card.js b/src/containers/convert-pnk/convert-pnk-card.js
index 12d998d..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 { getTokenSymbol } 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,8 +20,8 @@ export default function ConvertPnkCard() {
const originChainId = isSupportedMainChain(counterPartyChainId) ? currentChainId : counterPartyChainId;
const targetChainId = isSupportedMainChain(counterPartyChainId) ? counterPartyChainId : currentChainId;
- const tokenSymbolOriginChainId = getTokenSymbol(originChainId, "PNK");
- const tokenSymbolTargetChainId = getTokenSymbol(targetChainId, "PNK");
+ const pnkTokenSymbolOriginChainId = useMemo(() => getTokenSymbol(originChainId, "PNK"), [originChainId]);
+ const pnkTokenSymbolTargetChainId = useMemo(() => getTokenSymbol(targetChainId, "PNK"), [targetChainId]);
const { step, next, first } = useStep();
@@ -45,7 +45,7 @@ export default function ConvertPnkCard() {
- Send {tokenSymbolOriginChainId} to {chainIdToNetworkShortName[targetChainId]}
+ Send {pnkTokenSymbolOriginChainId} to {chainIdToNetworkShortName[targetChainId]}
>
}
>
@@ -54,7 +54,7 @@ export default function ConvertPnkCard() {
margin-top: -1rem;
`}
>
- Keep in mind that {tokenSymbolOriginChainId} that are staked or locked cannot be sent to{" "}
+ Keep in mind that {pnkTokenSymbolOriginChainId} that are staked or locked cannot be sent to{" "}
{chainIdToNetworkShortName[targetChainId]}. To just get xPNK, use the form below.
@@ -71,7 +71,8 @@ export default function ConvertPnkCard() {
🎉
{" "}
- You have successfully sent your {tokenSymbolOriginChainId} to {chainIdToNetworkShortName[targetChainId]}!{" "}
+ You have successfully sent your {pnkTokenSymbolOriginChainId} to{" "}
+ {chainIdToNetworkShortName[targetChainId]}!{" "}
🎉
@@ -83,7 +84,7 @@ export default function ConvertPnkCard() {
)}
steps={[
{
- title: <>Convert {tokenSymbolOriginChainId}>,
+ title: <>Convert {pnkTokenSymbolOriginChainId}>,
children() {
return isSupportedSideChain(currentChainId) ? (
@@ -99,7 +100,7 @@ export default function ConvertPnkCard() {
},
},
{
- title: <>Claim {tokenSymbolTargetChainId}>,
+ 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 7ae9e63..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,7 +7,7 @@ import Web3 from "web3";
import { useSideChainApi } from "../../api/side-chain";
import BalanceTable from "../../components/balance-table";
import MultiTransactionStatus from "../../components/multi-transaction-status";
-import { getTokenSymbol } 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";
@@ -101,24 +101,24 @@ function useWithdrawTokens(withdrawTokens) {
function PnkBalanceTable({ balance, locked, pendingStake, staked, available, error }) {
const chainId = useDrizzleState((ds) => ds.web3.networkId);
- const tokenSymbol = getTokenSymbol(chainId, "PNK");
+ const pnkTokenSymbol = useMemo(() => getTokenSymbol(chainId, "PNK"), [chainId]);
return (
<>
-
+
{pendingStake ? (
@@ -126,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}
@@ -135,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"
/>
@@ -154,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.