diff --git a/nym-wallet/src/components/IdentityKey.tsx b/nym-wallet/src/components/IdentityKey.tsx
new file mode 100644
index 0000000000..bca08ab68c
--- /dev/null
+++ b/nym-wallet/src/components/IdentityKey.tsx
@@ -0,0 +1,13 @@
+import React from 'react';
+import { Stack, Typography } from '@mui/material';
+import { CopyToClipboard } from '@nymproject/react/clipboard/CopyToClipboard';
+import { splice } from 'src/utils';
+
+export const IdentityKey = ({ identityKey }: { identityKey: string }) => (
+
+
+ {splice(6, identityKey)}
+
+
+
+);
diff --git a/nym-wallet/src/context/bonding.tsx b/nym-wallet/src/context/bonding.tsx
index feb2abf0da..e187883ef8 100644
--- a/nym-wallet/src/context/bonding.tsx
+++ b/nym-wallet/src/context/bonding.tsx
@@ -162,18 +162,14 @@ export const BondingContextProvider = ({
const [error, setError] = useState();
const [bondedMixnode, setBondedMixnode] = useState(null);
const [bondedGateway, setBondedGateway] = useState(null);
- const { fee, resetFeeState, feeError, isFeeLoading } = useGetFee();
- const { ownership, checkOwnership } = useCheckOwnership();
+
const { userBalance } = useContext(AppContext);
+ const { ownership, checkOwnership } = useCheckOwnership();
+ const { fee, resetFeeState, feeError, isFeeLoading } = useGetFee();
const isVesting = Boolean(ownership.vestingPledge);
- useEffect(() => {
- const init = async () => {
- await checkOwnership();
- };
- init();
- }, [checkOwnership]);
+ console.log(ownership);
useEffect(() => {
if (feeError) {
@@ -188,26 +184,13 @@ export const BondingContextProvider = ({
setBondedMixnode(null);
};
- const fetchMixnodeStatus = useCallback(async () => {
- setLoading(true);
- if (bondedMixnode) {
- try {
- const { status } = await getMixnodeStatus(bondedMixnode.identityKey);
- setBondedMixnode({ ...bondedMixnode, status });
- } catch (e: any) {
- setError(`While fetching mixnode status, an error occurred: ${e}`);
- } finally {
- setLoading(false);
- }
- }
- }, [bondedMixnode]);
-
const refresh = useCallback(async () => {
+ let data, status;
setLoading(true);
if (ownership.hasOwnership && ownership.nodeType === 'mixnode') {
- let data;
try {
data = await getMixnodeBondDetails();
+ status = data ? await getMixnodeStatus(data?.mix_node.identity_key) : undefined;
} catch (e: any) {
setError(`While fetching current bond state, an error occurred: ${e}`);
}
@@ -215,9 +198,9 @@ export const BondingContextProvider = ({
setBondedMixnode(bounded);
}
if (ownership.hasOwnership && ownership.nodeType === 'gateway') {
- let data;
try {
data = await getGatewayBondDetails();
+ status = data ? await getMixnodeStatus(data?.gateway.identity_key) : undefined;
} catch (e: any) {
setError(`While fetching current bond state, an error occurred: ${e}`);
}
@@ -232,12 +215,6 @@ export const BondingContextProvider = ({
refresh();
}, [network, ownership]);
- useEffect(() => {
- if (bondedMixnode) {
- fetchMixnodeStatus();
- }
- }, [bondedMixnode]);
-
const bondMixnode = async (data: Omit, tokenPool: TokenPool) => {
let tx: TransactionExecuteResult | undefined;
const payload = {
diff --git a/nym-wallet/src/pages/bonding/bonding/AmountModal.tsx b/nym-wallet/src/pages/bonding/bonding/AmountModal.tsx
index 406584c918..ecc807eff9 100644
--- a/nym-wallet/src/pages/bonding/bonding/AmountModal.tsx
+++ b/nym-wallet/src/pages/bonding/bonding/AmountModal.tsx
@@ -92,7 +92,7 @@ const AmountModal = ({ open, onClose, onSubmit, nodeType }: Props) => {
- Est. fee for this transaction will be cauculated in the next page
+ Est. fee for this transaction will be calculated in the next page
);
diff --git a/nym-wallet/src/pages/bonding/components/BondedNodeCard.tsx b/nym-wallet/src/pages/bonding/components/BondedNodeCard.tsx
deleted file mode 100644
index 11675b5152..0000000000
--- a/nym-wallet/src/pages/bonding/components/BondedNodeCard.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import * as React from 'react';
-import { Card, CardContent, CardHeader, Stack, Typography } from '@mui/material';
-import { MixnodeStatus } from '@nymproject/types';
-import { CheckCircleOutline, CircleOutlined, PauseCircleOutlined } from '@mui/icons-material';
-import { CopyToClipboard } from '../../../components';
-import { splice } from '../../../utils';
-
-interface Props {
- children?: React.ReactNode;
- title: string;
- identityKey: string;
- status?: MixnodeStatus;
- action?: React.ReactNode;
-}
-
-const IdentityKey = ({ identityKey }: { identityKey: string }) => (
-
- {splice(6, identityKey)}
-
-
-);
-
-export const getNodeStatus = ({ status }: { status: MixnodeStatus }) => {
- switch (status) {
- case 'active':
- return (
-
- Active
-
- );
- case 'standby':
- return (
-
- Standby
-
- );
- case 'inactive':
- return (
-
- Inactive
-
- );
- case 'not_found':
- return (
-
- Not found
-
- );
- default:
- return null;
- }
-};
-
-const BondedNodeCard = (props: Props) => {
- const { title: rawTitle, identityKey, status: rawStatus, action, children } = props;
- let Title: string | React.ReactNode = (
-
- {rawTitle}
-
- );
- if (rawStatus) {
- Title = (
-
- {getNodeStatus({ status: rawStatus })}
-
- {rawTitle}
-
-
- );
- }
-
- return (
-
- }
- action={action}
- disableTypography
- sx={{ pb: 0 }}
- />
- {children}
-
- );
-};
-
-export default BondedNodeCard;
diff --git a/nym-wallet/src/pages/bonding/components/index.ts b/nym-wallet/src/pages/bonding/components/index.ts
index 9cb5d09031..a6e891fc8a 100644
--- a/nym-wallet/src/pages/bonding/components/index.ts
+++ b/nym-wallet/src/pages/bonding/components/index.ts
@@ -1,4 +1,3 @@
-export { default as BondedNodeCard } from './BondedNodeCard';
export { default as NodeTable } from './NodeTable';
export { default as CheckboxInput } from './CheckboxInput';
export { default as RadioInput } from './RadioInput';
diff --git a/nym-wallet/src/pages/bonding/gateway/GatewayCard.tsx b/nym-wallet/src/pages/bonding/gateway/GatewayCard.tsx
index 84af001f0b..441a39261e 100644
--- a/nym-wallet/src/pages/bonding/gateway/GatewayCard.tsx
+++ b/nym-wallet/src/pages/bonding/gateway/GatewayCard.tsx
@@ -2,9 +2,12 @@ import React, { useMemo, useState } from 'react';
import { useTheme } from '@mui/material/styles';
import EditIcon from '@mui/icons-material/Edit';
import { BondedGateway } from '../../../context';
-import { NodeTable, BondedNodeCard, Cell, Header, NodeMenu } from '../components';
+import { NodeTable, Cell, Header, NodeMenu } from '../components';
import { GatewayFlow } from './types';
import Unbond from '../unbond';
+import { NymCard } from 'src/components';
+import { Stack, Typography } from '@mui/material';
+import { IdentityKey } from 'src/components/IdentityKey';
const headers: Header[] = [
{
@@ -57,10 +60,17 @@ const GatewayCard = ({ gateway }: { gateway: BondedGateway }) => {
[gateway, theme, nodeMenuOpen],
);
return (
-
+
+ Valhalla gateway
+
+
+ }
+ >
setFlow(null)} />
-
+
);
};
diff --git a/nym-wallet/src/pages/bonding/index.tsx b/nym-wallet/src/pages/bonding/index.tsx
index cbb73a061a..a580bedab5 100644
--- a/nym-wallet/src/pages/bonding/index.tsx
+++ b/nym-wallet/src/pages/bonding/index.tsx
@@ -13,11 +13,9 @@ const Bonding = () => {
// TODO display a special UI on loading state
return (
-
- {!bondedMixnode && !bondedGateway && }
- {bondedMixnode && }
- {bondedGateway && }
-
+ {!bondedMixnode && !bondedGateway && }
+ {bondedMixnode && }
+ {bondedGateway && }
);
};
diff --git a/nym-wallet/src/pages/bonding/mixnode/MixnodeCard.tsx b/nym-wallet/src/pages/bonding/mixnode/MixnodeCard.tsx
index 0033b3fbc2..ffb9802420 100644
--- a/nym-wallet/src/pages/bonding/mixnode/MixnodeCard.tsx
+++ b/nym-wallet/src/pages/bonding/mixnode/MixnodeCard.tsx
@@ -1,17 +1,20 @@
-import React, { useMemo, useState } from 'react';
-import { Button, Typography } from '@mui/material';
+import { useMemo, useState } from 'react';
+import { Button, Stack, Typography } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import { Link } from '@nymproject/react/link/Link';
+import { NymCard } from 'src/components';
+import { IdentityKey } from 'src/components/IdentityKey';
+import { NodeStatus } from 'src/components/NodeStatus';
import { BondedMixnode } from '../../../context';
-import { Node as NodeIcon } from '../../../svg-icons/node';
-import { NodeTable, BondedNodeCard, Cell, Header, NodeMenu } from '../components';
-import NodeSettings from './node-settings';
-import BondMore from './bond-more';
-import { MixnodeFlow } from './types';
-import RedeemRewards from './redeem';
-import Unbond from '../unbond';
-import CompoundRewards from './compound';
import { Bond as BondIcon, Unbond as UnbondIcon } from '../../../svg-icons';
+import { Node as NodeIcon } from '../../../svg-icons/node';
+import { Cell, Header, NodeMenu, NodeTable } from '../components';
+import Unbond from '../unbond';
+import BondMore from './bond-more';
+import CompoundRewards from './compound';
+import NodeSettings from './node-settings';
+import RedeemRewards from './redeem';
+import { MixnodeFlow } from './types';
const headers: Header[] = [
{
@@ -126,23 +129,16 @@ const MixnodeCard = ({ mixnode }: { mixnode: BondedMixnode }) => {
[mixnode, theme, nodeMenuOpen],
);
return (
- setFlow('nodeSettings')}
- sx={{
- fontWeight: 500,
- '& .MuiSvgIcon-root': {
- fontSize: 14,
- },
- }}
- startIcon={}
- >
+
+
+ Monster node
+
+
+ }
+ Action={
+
}
@@ -159,7 +155,7 @@ const MixnodeCard = ({ mixnode }: { mixnode: BondedMixnode }) => {
setFlow(null)} />
setFlow(null)} />
setFlow(null)} />
-
+
);
};
diff --git a/nym-wallet/src/pages/bonding/mixnode/bond-more/BondModal.tsx b/nym-wallet/src/pages/bonding/mixnode/bond-more/BondModal.tsx
index 89493bc5f8..3dc373bea5 100644
--- a/nym-wallet/src/pages/bonding/mixnode/bond-more/BondModal.tsx
+++ b/nym-wallet/src/pages/bonding/mixnode/bond-more/BondModal.tsx
@@ -90,7 +90,7 @@ const BondModal = ({ open, onClose, onConfirm, currentBond }: Props) => {
{`${currentBond.amount} ${currentBond.denom}`}
- Est. fee for this transaction will be cauculated in the next page
+ Est. fee for this transaction will be calculated in the next page
);
diff --git a/nym-wallet/src/pages/bonding/mixnode/node-settings/NodeSettings.tsx b/nym-wallet/src/pages/bonding/mixnode/node-settings/NodeSettings.tsx
index 9dd6e74b74..9be3693456 100644
--- a/nym-wallet/src/pages/bonding/mixnode/node-settings/NodeSettings.tsx
+++ b/nym-wallet/src/pages/bonding/mixnode/node-settings/NodeSettings.tsx
@@ -27,20 +27,6 @@ const NodeSettings = ({ mixnode, show, onClose }: Props) => {
const { network } = useContext(AppContext);
const { updateMixnode, error, fee, getFee } = useBondingContext();
- useEffect(() => {
- if (error) {
- setStatus('error');
- }
- }, [error]);
-
- const fetchFee = async () => {
- await getFee('updateMixnode', {});
- };
-
- useEffect(() => {
- fetchFee();
- }, []);
-
const submit = async () => {
const txResult = await updateMixnode(profitMargin as number);
if (txResult) {
diff --git a/nym-wallet/src/pages/bonding/mixnode/node-settings/ProfitMarginModal.tsx b/nym-wallet/src/pages/bonding/mixnode/node-settings/ProfitMarginModal.tsx
index 68744724d8..69f4e01fdb 100644
--- a/nym-wallet/src/pages/bonding/mixnode/node-settings/ProfitMarginModal.tsx
+++ b/nym-wallet/src/pages/bonding/mixnode/node-settings/ProfitMarginModal.tsx
@@ -75,7 +75,7 @@ const NodeSettingsModal = ({ open, onClose, onConfirm, estimatedOpReward, curren
{`~${estimatedOpReward.amount} ${estimatedOpReward.denom}`}
- Est. fee for this transaction will be cauculated in the next page
+ Est. fee for this transaction will be calculated in the next page
);
diff --git a/nym-wallet/src/pages/bonding/unbond/Unbond.tsx b/nym-wallet/src/pages/bonding/unbond/Unbond.tsx
index 64fe73538a..23b3e6450d 100644
--- a/nym-wallet/src/pages/bonding/unbond/Unbond.tsx
+++ b/nym-wallet/src/pages/bonding/unbond/Unbond.tsx
@@ -34,7 +34,7 @@ const Unbond = ({ node, show, onClose }: Props) => {
}, [error, feeError]);
useEffect(() => {
- if ('profitMarfin' in node) {
+ if ('profitMargin' in node) {
setNodeType('mixnode');
} else {
setNodeType('gateway');