From 140cc3f769c73804b97138fd8ca63f9fd23ef6d0 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Mon, 13 Dec 2021 21:11:12 +0000 Subject: [PATCH] correct profitPercent variable name --- nym-wallet/src/requests/index.ts | 8 +++++--- nym-wallet/src/routes/bond/BondForm.tsx | 20 ++++++++++--------- .../src/routes/bond/validationSchema.ts | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/nym-wallet/src/requests/index.ts b/nym-wallet/src/requests/index.ts index 3ab1128366..821dbf3fe1 100644 --- a/nym-wallet/src/requests/index.ts +++ b/nym-wallet/src/requests/index.ts @@ -52,12 +52,14 @@ export const checkGatewayOwnership = async (): Promise => await invoke( export const bond = async ({ type, data, - amount, + pledge, + ownerSignature, }: { type: EnumNodeType data: MixNode | Gateway - amount: Coin -}): Promise => await invoke(`bond_${type}`, { [type]: data, pledge: amount }) + pledge: Coin + ownerSignature: string +}): Promise => await invoke(`bond_${type}`, { [type]: data, ownerSignature, pledge }) export const unbond = async (type: EnumNodeType) => await invoke(`unbond_${type}`) diff --git a/nym-wallet/src/routes/bond/BondForm.tsx b/nym-wallet/src/routes/bond/BondForm.tsx index cdace5a29f..7960cef484 100644 --- a/nym-wallet/src/routes/bond/BondForm.tsx +++ b/nym-wallet/src/routes/bond/BondForm.tsx @@ -27,7 +27,7 @@ type TBondFormFields = { ownerSignature: string identityKey: string sphinxKey: string - profitPercentage: number + profitMarginPercent: number amount: string host: string version: string @@ -43,10 +43,11 @@ const defaultValues = { nodeType: EnumNodeType.mixnode, identityKey: '', sphinxKey: '', + ownerSignature: '', amount: '', host: '', version: '', - profitPercentage: 0, + profitMarginPercent: 10, location: undefined, mixPort: 1789, verlocPort: 1790, @@ -61,6 +62,7 @@ const formatData = (data: TBondFormFields) => { host: data.host, version: data.version, mix_port: data.mixPort, + profit_margin_percent: data.profitMarginPercent, } if (data.nodeType === EnumNodeType.mixnode) { @@ -109,9 +111,9 @@ export const BondForm = ({ } const formattedData = formatData(data) - const amount = await majorToMinor(data.amount) + const pledge = await majorToMinor(data.amount) - await bond({ type: data.nodeType, data: formattedData, amount }) + await bond({ type: data.nodeType, ownerSignature: data.ownerSignature, data: formattedData, pledge }) .then(() => { userBalance.fetchBalance() onSuccess({ address: data.identityKey, amount: data.amount }) @@ -201,15 +203,15 @@ export const BondForm = ({ diff --git a/nym-wallet/src/routes/bond/validationSchema.ts b/nym-wallet/src/routes/bond/validationSchema.ts index 45488b3cea..0c2576aed9 100644 --- a/nym-wallet/src/routes/bond/validationSchema.ts +++ b/nym-wallet/src/routes/bond/validationSchema.ts @@ -25,7 +25,7 @@ export const validationSchema = Yup.object().shape({ .test('valid-signature', 'A valid signature is required', function (value) { return validateKey(value || '', 64) }), - profitPercentage: Yup.string().required('Profit Percentage is required').min(1).max(100), + profitMarginPercent: Yup.number().required('Profit Percentage is required').min(1).max(100), amount: Yup.string() .required('An amount is required') .test('valid-amount', `A valid amount is required (min 100 ${MAJOR_CURRENCY})`, function (value) {