diff --git a/src/app.tsx b/src/app.tsx index fe05026..16290a8 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -21,6 +21,7 @@ import { AddNetwork } from './pages/settings/add-network'; import { Network } from './pages/settings/network/network'; import { SignIn } from './pages/sign-in/sign-in'; import { DirectStackingInfo } from './pages/stacking/direct-stacking-info/direct-stacking-info'; +import { GenerateSignerKeySignature } from './pages/stacking/generate-signature/signer-key-signature'; import { DelegateStackExtend } from './pages/stacking/pool-admin/delegate-stack-extend/delegate-stack-extend'; import { DelegateStackIncrease } from './pages/stacking/pool-admin/delegate-stack-increase/delegate-stack-increase'; import { DelegateStackStx } from './pages/stacking/pool-admin/delegate-stack-stx/delegate-stack-stx'; @@ -32,7 +33,6 @@ import { StackExtend } from './pages/stacking/stack-extend/stack-extend'; import { StackIncrease } from './pages/stacking/stack-increase/stack-increase'; import { StartDirectStacking } from './pages/stacking/start-direct-stacking/start-direct-stacking'; import { StartPooledStacking } from './pages/stacking/start-pooled-stacking/start-pooled-stacking'; -import { GenerateSignerKeySignature } from './pages/stacking/generate-signature/signer-key-signature'; const queryClient = new QueryClient(); function Root() { diff --git a/src/hooks/use-generate-signature.ts b/src/hooks/use-generate-signature.ts index 0aa068e..dd9790f 100644 --- a/src/hooks/use-generate-signature.ts +++ b/src/hooks/use-generate-signature.ts @@ -1,13 +1,16 @@ -import { openStructuredDataSignatureRequestPopup, SignatureData } from '@stacks/connect'; import { useCallback, useState } from 'react'; -import { useStacksNetwork } from './use-stacks-network'; -import { useStackingClient } from '@components/stacking-client-provider/stacking-client-provider'; + +import { SignatureData, openStructuredDataSignatureRequestPopup } from '@stacks/connect'; import { Pox4SignatureTopic, pox4SignatureMessage, verifyPox4SignatureHash, } from '@stacks/stacking'; +import { useStackingClient } from '@components/stacking-client-provider/stacking-client-provider'; + +import { useStacksNetwork } from './use-stacks-network'; + export interface GenerateSignatureOptions { rewardCycle: number; poxAddress: string; diff --git a/src/pages/stacking/generate-signature/components/auth-id.tsx b/src/pages/stacking/generate-signature/components/auth-id.tsx index 7b5709d..bc6650d 100644 --- a/src/pages/stacking/generate-signature/components/auth-id.tsx +++ b/src/pages/stacking/generate-signature/components/auth-id.tsx @@ -1,10 +1,13 @@ -import { useField } from 'formik'; -import { Description, Step } from '../../components/stacking-form-step'; -import { Box, Button, Input, Text } from '@stacks/ui'; import React from 'react'; + +import { Box, Button, Input, Text } from '@stacks/ui'; +import { useField } from 'formik'; + import { ErrorLabel } from '@components/error-label'; import { ErrorText } from '@components/error-text'; +import { Description, Step } from '../../components/stacking-form-step'; + export function AuthId() { const [field, meta, helpers] = useField('authId'); // const form = useFormikContext<{ topic: string }>(); diff --git a/src/pages/stacking/generate-signature/components/generate-signature-layout.tsx b/src/pages/stacking/generate-signature/components/generate-signature-layout.tsx index 6079443..279f437 100644 --- a/src/pages/stacking/generate-signature/components/generate-signature-layout.tsx +++ b/src/pages/stacking/generate-signature/components/generate-signature-layout.tsx @@ -1,5 +1,10 @@ import React from 'react'; + +import { SignatureData } from '@stacks/connect'; import { Box, Flex, Text, useClipboard } from '@stacks/ui'; +import { IconCopy } from '@tabler/icons-react'; +import { useFormikContext } from 'formik'; + import { Hr } from '@components/hr'; import { InfoCardGroup as Group, @@ -9,22 +14,20 @@ import { InfoCardSection as Section, InfoCardValue as Value, } from '@components/info-card'; -import { PoxAddress } from '../../start-direct-stacking/components/pox-address/pox-address'; import { Screen } from '@components/screen'; -import { StackingFormContainer } from '../../components/stacking-form-container'; -import { RewardCycle } from '../../pool-admin/components/choose-reward-cycle'; +import { useGetPoxInfoQuery } from '@components/stacking-client-provider/stacking-client-provider'; +import { truncateMiddle } from '@utils/tx-utils'; + import { ConfirmAndSubmit } from '../../components/confirm-and-submit'; -import { Topic } from './topic'; -import { Duration } from '../../pool-admin/components/choose-duration'; -import { SignatureData } from '@stacks/connect'; +import { StackingFormContainer } from '../../components/stacking-form-container'; import { StackingFormInfoPanel } from '../../components/stacking-form-info-panel'; +import { Duration } from '../../pool-admin/components/choose-duration'; +import { RewardCycle } from '../../pool-admin/components/choose-reward-cycle'; +import { PoxAddress } from '../../start-direct-stacking/components/pox-address/pox-address'; import { GenerateSignatureFields, MAX_U128 } from '../types'; -import { truncateMiddle } from '@utils/tx-utils'; -import { useGetPoxInfoQuery } from '@components/stacking-client-provider/stacking-client-provider'; -import { IconCopy } from '@tabler/icons-react'; -import { MaxAmount } from './max-amount'; import { AuthId } from './auth-id'; -import { useFormikContext } from 'formik'; +import { MaxAmount } from './max-amount'; +import { Topic } from './topic'; export function GenerateSignatureLayout({ signatureData, diff --git a/src/pages/stacking/generate-signature/components/max-amount.tsx b/src/pages/stacking/generate-signature/components/max-amount.tsx index 663788a..adedb81 100644 --- a/src/pages/stacking/generate-signature/components/max-amount.tsx +++ b/src/pages/stacking/generate-signature/components/max-amount.tsx @@ -1,11 +1,14 @@ -import { useField } from 'formik'; -import { Description, Step } from '../../components/stacking-form-step'; -import { Box, Button, Input, Text } from '@stacks/ui'; import React from 'react'; -import { MAX_U128 } from '../types'; + +import { Box, Button, Input, Text } from '@stacks/ui'; +import { useField } from 'formik'; + import { ErrorLabel } from '@components/error-label'; import { ErrorText } from '@components/error-text'; +import { Description, Step } from '../../components/stacking-form-step'; +import { MAX_U128 } from '../types'; + export function MaxAmount() { const [field, meta, helpers] = useField('maxAmount'); // const form = useFormikContext<{ topic: string }>(); diff --git a/src/pages/stacking/generate-signature/components/topic.tsx b/src/pages/stacking/generate-signature/components/topic.tsx index 169daf2..6285239 100644 --- a/src/pages/stacking/generate-signature/components/topic.tsx +++ b/src/pages/stacking/generate-signature/components/topic.tsx @@ -1,6 +1,7 @@ +import { Box, Text } from '@stacks/ui'; import { useField } from 'formik'; + import { Description, Step } from '../../components/stacking-form-step'; -import { Box, Text } from '@stacks/ui'; export function Topic() { const [field, _meta] = useField('topic'); diff --git a/src/pages/stacking/generate-signature/signer-key-signature.tsx b/src/pages/stacking/generate-signature/signer-key-signature.tsx index 820d141..1147a0e 100644 --- a/src/pages/stacking/generate-signature/signer-key-signature.tsx +++ b/src/pages/stacking/generate-signature/signer-key-signature.tsx @@ -1,18 +1,21 @@ import React, { createContext, useMemo } from 'react'; -import { Form, Formik } from 'formik'; +import { useParams } from 'react-router-dom'; + +import { SignatureData } from '@stacks/connect'; import { Pox4SignatureTopic } from '@stacks/stacking'; +import { Form, Formik } from 'formik'; + import { useAuth } from '@components/auth-provider/auth-provider'; -import { GenerateSignatureLayout } from './components/generate-signature-layout'; -import { useGenerateStackingSignature } from '../../../hooks/use-generate-signature'; -import { useParams } from 'react-router-dom'; -import { GenerateSignatureFields, MAX_U128 } from './types'; +import { CenteredErrorAlert } from '@components/centered-error-alert'; import { CenteredSpinner } from '@components/centered-spinner'; import { useGetPoxInfoQuery } from '@components/stacking-client-provider/stacking-client-provider'; -import { CenteredErrorAlert } from '@components/centered-error-alert'; -import { SignatureData } from '@stacks/connect'; -import { createValidationSchema } from './utils'; import { useStacksNetwork } from '@hooks/use-stacks-network'; +import { useGenerateStackingSignature } from '../../../hooks/use-generate-signature'; +import { GenerateSignatureLayout } from './components/generate-signature-layout'; +import { GenerateSignatureFields, MAX_U128 } from './types'; +import { createValidationSchema } from './utils'; + const initialFormValues: GenerateSignatureFields = { topic: Pox4SignatureTopic.StackStx, period: 1, diff --git a/src/pages/stacking/generate-signature/utils.ts b/src/pages/stacking/generate-signature/utils.ts index f2508e5..0657130 100644 --- a/src/pages/stacking/generate-signature/utils.ts +++ b/src/pages/stacking/generate-signature/utils.ts @@ -1,7 +1,9 @@ -import { createBtcAddressSchema } from '@utils/validators/btc-address-validator'; import * as yup from 'yup'; -import { MAX_U128 } from './types'; + import { validateDecimalPrecision } from '@utils/form/validate-decimals'; +import { createBtcAddressSchema } from '@utils/validators/btc-address-validator'; + +import { MAX_U128 } from './types'; export function createValidationSchema({ network }: { network: string }) { return yup.object().shape({