Skip to content

Commit 5fa49b4

Browse files
committed
fix linting
1 parent 854376f commit 5fa49b4

File tree

24 files changed

+72
-217
lines changed

24 files changed

+72
-217
lines changed

nym-wallet/nym-wallet-types/src/network/qa.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) const STAKE_DENOM: DenomDetails = DenomDetails::new("unyx", "nyx", 6)
1212
// -- Contract addresses --
1313

1414
pub(crate) const MIXNET_CONTRACT_ADDRESS: &str =
15-
"n1khq8f8vhah0gtljahrnsr3utl5lrhlf0xafs6pkvetnyumv7vt4qxh2ckx";
15+
"n1hm4y6fzgxgu688jgf7ek66px6xkrtmn3gyk8fax3eawhp68c2d5qujz296";
1616
pub(crate) const VESTING_CONTRACT_ADDRESS: &str =
1717
"n1jlzdxnyces4hrhqz68dqk28mrw5jgwtcfq0c2funcwrmw0dx9l9s8nnnvj";
1818
pub(crate) const ECASH_CONTRACT_ADDRESS: &str =
@@ -28,7 +28,7 @@ pub(crate) const COCONUT_DKG_CONTRACT_ADDRESS: &str =
2828

2929
pub(crate) fn validators() -> Vec<ValidatorDetails> {
3030
vec![ValidatorDetails::new(
31-
"https://benny-validator.qa.nymte.ch/",
31+
"https://qa-validator.qa.nymte.ch/",
3232
Some("https://qa-nym-api.qa.nymte.ch/api"),
3333
Some("wss://qa-validator.qa.nymte.ch/websocket"),
3434
)]

nym-wallet/src/components/Bonding/BondUpdateCard.tsx

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
import React from 'react';
22
import { Box, Button, Stack, Tooltip, Typography } from '@mui/material';
3-
import { Network } from 'src/types';
43
import { NymCard } from 'src/components';
5-
import { TBondedMixnode } from 'src/requests/mixnodeDetails';
64

7-
export const BondUpdateCard = ({
8-
setSuccesfullUpdate,
9-
}: {
10-
mixnode: TBondedMixnode;
11-
network?: Network;
12-
setSuccesfullUpdate: (staus: boolean) => void;
13-
}) => (
5+
export const BondUpdateCard = ({ setSuccesfullUpdate }: { setSuccesfullUpdate: (staus: boolean) => void }) => (
146
<Stack gap={2}>
157
<NymCard
168
borderless
@@ -47,7 +39,6 @@ export const BondUpdateCard = ({
4739
</Tooltip>
4840
</Box>
4941
}
50-
children={undefined}
5142
/>
5243
</Stack>
5344
);

nym-wallet/src/components/Bonding/BondedNymNode.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export const BondedNymNode = ({
7777
operatorRewards,
7878
operatorCost,
7979
delegators,
80-
role,
8180
identityKey,
8281
host,
8382
} = nymnode;

nym-wallet/src/components/Bonding/NodeStats.tsx

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
2-
import { Stack, Typography, Box, useTheme, Grid, LinearProgress, LinearProgressProps, Button } from '@mui/material';
3-
import { useNavigate } from 'react-router-dom';
2+
import { Stack, Typography, Box, useTheme, Grid, LinearProgress, LinearProgressProps } from '@mui/material';
43
import { Cell, Pie, PieChart, Legend, ResponsiveContainer } from 'recharts';
54
import { SelectionChance } from '@nymproject/types';
65
import { TBondedMixnode } from 'src/requests/mixnodeDetails';
@@ -50,7 +49,6 @@ const StatRow = ({
5049
export const NodeStats = ({ mixnode }: { mixnode: TBondedMixnode }) => {
5150
const { activeSetProbability, routingScore } = mixnode;
5251
const theme = useTheme();
53-
const navigate = useNavigate();
5452

5553
// clamp routing score to [0-100]
5654
const score = Math.min(Math.max(routingScore || 0, 0), 100);
@@ -74,10 +72,6 @@ export const NodeStats = ({ mixnode }: { mixnode: TBondedMixnode }) => {
7472
}
7573
};
7674

77-
const handleGoToTestNode = () => {
78-
navigate('/bonding/node-settings', { state: 'test-node' });
79-
};
80-
8175
const renderLegend = () => (
8276
<Stack
8377
alignItems="center"

nym-wallet/src/components/Bonding/forms/legacyForms/BondGatewayForm.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { Box } from '@mui/material';
33
import { NodeTypeSelector } from 'src/components';
44
import { CurrencyDenom, TNodeType } from '@nymproject/types';
5-
import { GatewayAmount, GatewayData, Signature } from 'src/pages/bonding/types';
5+
import { GatewayAmount, GatewayData } from 'src/pages/bonding/types';
66
import GatewayInitForm from './GatewayInitForm';
77
import GatewayAmountForm from './GatewayAmountForm';
88

@@ -15,7 +15,6 @@ export const BondGatewayForm = ({
1515
onSelectNodeType,
1616
onValidateGatewayData,
1717
onValidateAmountData,
18-
onValidateSignature,
1918
}: {
2019
step: 1 | 2 | 3 | 4;
2120
gatewayData: GatewayData;
@@ -25,7 +24,6 @@ export const BondGatewayForm = ({
2524
onSelectNodeType: (nodeType: TNodeType) => void;
2625
onValidateGatewayData: (data: GatewayData) => void;
2726
onValidateAmountData: (data: GatewayAmount) => Promise<void>;
28-
onValidateSignature: (signature: Signature) => void;
2927
}) => (
3028
<>
3129
{step === 1 && (

nym-wallet/src/components/Bonding/forms/nym-node/FormContext.tsx

+31-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createContext, useContext, useState } from 'react';
1+
import React, { createContext, useContext, useMemo, useState } from 'react';
22
import { CurrencyDenom } from '@nymproject/types';
33
import { TBondNymNodeArgs, TBondMixNodeArgs } from 'src/types';
44

@@ -44,7 +44,7 @@ const FormContext = createContext<FormContextType>({
4444
signature: undefined,
4545
setSignature: () => {},
4646

47-
onError: (e: string) => {},
47+
onError: () => {},
4848
});
4949

5050
const FormContextProvider = ({ children }: { children: React.ReactNode }) => {
@@ -61,25 +61,36 @@ const FormContextProvider = ({ children }: { children: React.ReactNode }) => {
6161
console.error(e);
6262
};
6363

64-
return (
65-
<FormContext.Provider
66-
value={{
67-
step,
68-
setStep,
69-
nymNodeData,
70-
setNymNodeData,
71-
costParams,
72-
setCostParams,
73-
amountData,
74-
setAmountData,
75-
signature,
76-
setSignature,
77-
onError,
78-
}}
79-
>
80-
{children}
81-
</FormContext.Provider>
64+
const value = useMemo(
65+
() => ({
66+
step,
67+
setStep,
68+
nymNodeData,
69+
setNymNodeData,
70+
costParams,
71+
setCostParams,
72+
amountData,
73+
setAmountData,
74+
signature,
75+
setSignature,
76+
onError,
77+
}),
78+
[
79+
step,
80+
setStep,
81+
nymNodeData,
82+
setNymNodeData,
83+
costParams,
84+
setCostParams,
85+
amountData,
86+
setAmountData,
87+
signature,
88+
setSignature,
89+
onError,
90+
],
8291
);
92+
93+
return <FormContext.Provider value={value}>{children}</FormContext.Provider>;
8394
};
8495

8596
export const useFormContext = () => useContext(FormContext);

nym-wallet/src/components/Bonding/forms/nym-node/NymNodeAmount.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import React from 'react';
12
import { Stack, TextField, Box, FormHelperText } from '@mui/material';
23
import { useForm } from 'react-hook-form';
34
import { TBondNymNodeArgs } from 'src/types';
45
import { yupResolver } from '@hookform/resolvers/yup';
56
import { SimpleModal } from 'src/components/Modals/SimpleModal';
6-
import { nymNodeAmountSchema } from './amountValidationSchema';
77
import { CurrencyFormField } from '@nymproject/react/currency/CurrencyFormField';
88
import { checkHasEnoughFunds } from 'src/utils';
9+
import { nymNodeAmountSchema } from './amountValidationSchema';
910

1011
const defaultNymNodeCostParamValues: TBondNymNodeArgs['costParams'] = {
1112
profit_margin_percent: '10',

nym-wallet/src/components/Bonding/forms/nym-node/NymNodeData.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Stack, TextField, FormControlLabel, Checkbox } from '@mui/material';
33
import { useForm } from 'react-hook-form';
44
import { IdentityKeyFormField } from '@nymproject/react/mixnodes/IdentityKeyFormField';
55
import { TBondNymNodeArgs } from 'src/types';
6-
import { useFormContext } from './FormContext';
76
import { yupResolver } from '@hookform/resolvers/yup';
87
import * as yup from 'yup';
98
import { isValidHostname, validateRawPort } from 'src/utils';
@@ -21,9 +20,7 @@ const yupValidationSchema = yup.object().shape({
2120
.string()
2221
.required('A host is required')
2322
.test('no-whitespace', 'Host cannot contain whitespace', (value) => !/\s/.test(value || ''))
24-
.test('valid-host', 'A valid host is required', (value) => {
25-
return value ? isValidHostname(value) : false;
26-
}),
23+
.test('valid-host', 'A valid host is required', (value) => (value ? isValidHostname(value) : false)),
2724

2825
custom_http_port: yup
2926
.number()

nym-wallet/src/components/Bonding/forms/nym-node/NymNodeSignature.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ const NymNodeSignature = ({
3131

3232
const {
3333
register,
34-
handleSubmit,
3534
formState: { errors },
3635
} = useForm<Signature>();
3736

3837
const generateMessage = async () => {
3938
try {
40-
const message = await generateNymNodeMsgPayload({
39+
const msg = await generateNymNodeMsgPayload({
4140
nymNode,
4241
pledge,
4342
costParams,
4443
});
4544

46-
if (message) {
47-
setMessage(message);
45+
if (msg) {
46+
setMessage(msg);
4847
}
4948
} catch (e) {
5049
console.error(e);

nym-wallet/src/components/Bonding/modals/BondGatewayModal.tsx

+3-36
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ import { CurrencyDenom, TNodeType } from '@nymproject/types';
44
import { ConfirmTx } from 'src/components/ConfirmTX';
55
import { ModalListItem } from 'src/components/Modals/ModalListItem';
66
import { SimpleModal } from 'src/components/Modals/SimpleModal';
7-
import { TPoolOption } from 'src/components/TokenPoolSelector';
87
import { useGetFee } from 'src/hooks/useGetFee';
9-
import { GatewayAmount, GatewayData, Signature } from 'src/pages/bonding/types';
10-
import { simulateBondGateway, simulateVestingBondGateway } from 'src/requests';
11-
import { TBondGatewayArgs } from 'src/types';
8+
import { GatewayAmount, GatewayData } from 'src/pages/bonding/types';
129
import { BalanceWarning } from 'src/components/FeeWarning';
1310
import { AppContext } from 'src/context';
14-
import { gatewayToTauri } from '../utils';
1511
import { BondGatewayForm } from '../forms/legacyForms/BondGatewayForm';
1612

1713
const defaultGatewayValues: GatewayData = {
@@ -34,24 +30,21 @@ const defaultAmountValues = (denom: CurrencyDenom) => ({
3430
export const BondGatewayModal = ({
3531
denom,
3632
hasVestingTokens,
37-
onBondGateway,
3833
onSelectNodeType,
3934
onClose,
4035
onError,
4136
}: {
4237
denom: CurrencyDenom;
4338
hasVestingTokens: boolean;
44-
onBondGateway: (data: TBondGatewayArgs, tokenPool: TPoolOption) => void;
4539
onSelectNodeType: (type: TNodeType) => void;
4640
onClose: () => void;
4741
onError: (e: string) => void;
4842
}) => {
4943
const [step, setStep] = useState<1 | 2 | 3>(1);
5044
const [gatewayData, setGatewayData] = useState<GatewayData>(defaultGatewayValues);
5145
const [amountData, setAmountData] = useState<GatewayAmount>(defaultAmountValues(denom));
52-
const [signature, setSignature] = useState<string>();
5346

54-
const { fee, getFee, resetFeeState, feeError } = useGetFee();
47+
const { fee, resetFeeState, feeError } = useGetFee();
5548
const { userBalance } = useContext(AppContext);
5649

5750
useEffect(() => {
@@ -83,32 +76,7 @@ export const BondGatewayModal = ({
8376
setStep(3);
8477
};
8578

86-
const handleUpdateSignature = async (data: Signature) => {
87-
setSignature(data.signature);
88-
89-
const payload = {
90-
pledge: amountData.amount,
91-
msgSignature: data.signature,
92-
gateway: gatewayToTauri(gatewayData),
93-
};
94-
95-
if (amountData.tokenPool === 'balance') {
96-
await getFee<TBondGatewayArgs>(simulateBondGateway, payload);
97-
} else {
98-
await getFee<TBondGatewayArgs>(simulateVestingBondGateway, payload);
99-
}
100-
};
101-
102-
const handleConfirm = async () => {
103-
await onBondGateway(
104-
{
105-
pledge: amountData.amount,
106-
msgSignature: signature as string,
107-
gateway: gatewayToTauri(gatewayData),
108-
},
109-
amountData.tokenPool as TPoolOption,
110-
);
111-
};
79+
const handleConfirm = async () => {};
11280

11381
if (fee) {
11482
return (
@@ -154,7 +122,6 @@ export const BondGatewayModal = ({
154122
hasVestingTokens={hasVestingTokens}
155123
onValidateGatewayData={handleUpdateGatwayData}
156124
onValidateAmountData={handleUpdateAmountData}
157-
onValidateSignature={handleUpdateSignature}
158125
onSelectNodeType={onSelectNodeType}
159126
/>
160127
</Box>

nym-wallet/src/components/Bonding/modals/BondNymNodeModal.tsx

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { useContext, useEffect } from 'react';
1+
import React, { useContext, useEffect } from 'react';
22
import { ConfirmTx } from 'src/components/ConfirmTX';
33
import { ModalListItem } from 'src/components/Modals/ModalListItem';
44
import { useGetFee } from 'src/hooks/useGetFee';
5-
import { MixnodeAmount, Signature } from 'src/pages/bonding/types';
5+
import { Signature } from 'src/pages/bonding/types';
66
import { BalanceWarning } from 'src/components/FeeWarning';
77
import { AppContext } from 'src/context';
88
import FormContextProvider, { useFormContext } from '../forms/nym-node/FormContext';
@@ -11,7 +11,7 @@ import NymNodeAmount from '../forms/nym-node/NymNodeAmount';
1111
import NymNodeSignature from '../forms/nym-node/NymNodeSignature';
1212

1313
export const BondNymNodeModal = ({ onClose }: { onClose: () => void }) => {
14-
const { fee, getFee, resetFeeState, feeError } = useGetFee();
14+
const { fee, resetFeeState, feeError } = useGetFee();
1515
const { userBalance } = useContext(AppContext);
1616
const { setStep, step, onError, setSignature, amountData, costParams, nymNodeData } = useFormContext();
1717

@@ -21,18 +21,10 @@ export const BondNymNodeModal = ({ onClose }: { onClose: () => void }) => {
2121
}
2222
}, [feeError]);
2323

24-
const handleBack = () => {
25-
setStep(step);
26-
};
27-
2824
const handleUpdateMixnodeData = async () => {
2925
setStep(2);
3026
};
3127

32-
const handleUpdateAmountData = async (data: MixnodeAmount) => {
33-
setStep(3);
34-
};
35-
3628
const handleUpdateSignature = async (data: Signature) => {
3729
setSignature(data.signature);
3830
};

0 commit comments

Comments
 (0)