Skip to content

Commit

Permalink
fix: review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Dec 2, 2020
1 parent ae4ee9e commit 7157802
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/pages/stacking/step/choose-amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ErrorText } from '@components/error-text';
import { validateDecimalPrecision } from '@utils/form/validate-decimals';
import { microStxToStx, stxToMicroStx, toHumanReadableStx } from '@utils/unit-convert';

interface ChooseCycleStepProps {
interface ChooseAmountStepProps {
id: string;
balance: BigNumber;
step?: number;
Expand All @@ -27,7 +27,7 @@ interface ChooseCycleStepProps {

const BigNumberFloorRound = BigNumber.clone({ ROUNDING_MODE: BigNumber.ROUND_FLOOR });

export const ChooseAmountStep: FC<ChooseCycleStepProps> = props => {
export const ChooseAmountStep: FC<ChooseAmountStepProps> = props => {
const { isComplete, step, id, value, balance, minimumAmountToStack, onEdit, onComplete } = props;

const stxAmountForm = useFormik({
Expand Down Expand Up @@ -65,7 +65,7 @@ export const ChooseAmountStep: FC<ChooseCycleStepProps> = props => {
const updatedAmount = new BigNumberFloorRound(microStxToStx(balance.toString())).decimalPlaces(
0
);
stxAmountForm.setValues({ stxAmount: updatedAmount.toString() });
void stxAmountForm.setValues({ stxAmount: updatedAmount.toString() });
}, [balance, stxAmountForm]);

const currentValue =
Expand Down
4 changes: 4 additions & 0 deletions app/utils/form/validate-decimals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import BigNumber from 'bignumber.js';

/**
* @description Returns a fn that validates a number is within the specified decimal precision
* Useful in conjunction with a form validation schema
*/
export function validateDecimalPrecision(allowedPrecision: number) {
return (value: any) => {
if (value === null || value === undefined) return false;
Expand Down
2 changes: 1 addition & 1 deletion app/utils/stacking/pox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test.skip('making a lock-stx transaction', async () => {
});
await waitForTxConfirm(`0x${lockTxid}`);
const stackerInfo = await client.getStackerInfo(address);
if ('error' in stackerInfo) return;
if ('error' in stackerInfo) throw new Error('Contains an error response');
console.log('Stacker Info:');
console.log('Amount Locked:', stackerInfo.amountMicroStx);
console.log('Lock Period:', stackerInfo.lockPeriod);
Expand Down

0 comments on commit 7157802

Please sign in to comment.