From a263b08e382fc38f990e7a3cc98600dfc09dd466 Mon Sep 17 00:00:00 2001 From: Philip De Smedt Date: Sun, 11 Feb 2024 18:33:46 +0000 Subject: [PATCH] wip: fix types --- .../components/confirm-and-stack.tsx | 2 -- .../components/liquid-stacking-terms.tsx | 2 +- .../components/preset-protocols.tsx | 4 ---- .../start-liquid-stacking.tsx | 19 ++++++------------- .../stacking/start-liquid-stacking/types.ts | 2 +- .../utils-delegate-stx.ts | 12 +++--------- .../stacking/start-liquid-stacking/utils.ts | 15 ++------------- 7 files changed, 13 insertions(+), 43 deletions(-) diff --git a/src/pages/stacking/start-liquid-stacking/components/confirm-and-stack.tsx b/src/pages/stacking/start-liquid-stacking/components/confirm-and-stack.tsx index 7f73d1a8..6f8816fb 100644 --- a/src/pages/stacking/start-liquid-stacking/components/confirm-and-stack.tsx +++ b/src/pages/stacking/start-liquid-stacking/components/confirm-and-stack.tsx @@ -4,7 +4,6 @@ import { useFormikContext } from 'formik'; import { Action, Step } from '../../components/stacking-form-step'; import { StackingUserConfirm } from '../../components/stacking-user-confirm'; -import { EditingFormValues } from '../types'; import { LiquidStackingTerms } from './liquid-stacking-terms'; interface Props { @@ -18,7 +17,6 @@ export function ConfirmAndSubmit({ allowContractCallerTxId, }: Props) { const [hasUserConfirmed, setHasUserConfirmed] = useState(false); - const f = useFormikContext(); return ( diff --git a/src/pages/stacking/start-liquid-stacking/components/liquid-stacking-terms.tsx b/src/pages/stacking/start-liquid-stacking/components/liquid-stacking-terms.tsx index fba833b3..cd7cfb85 100644 --- a/src/pages/stacking/start-liquid-stacking/components/liquid-stacking-terms.tsx +++ b/src/pages/stacking/start-liquid-stacking/components/liquid-stacking-terms.tsx @@ -7,7 +7,7 @@ import { pseudoBorderLeft } from '@components/styles/pseudo-border-left'; import { StackingTermItem } from '../../components/stacking-term'; -export function LiquidStackingTerms({ ...rest }: StacksProps) { +export function LiquidStackingTerms({ ...rest }: StackProps) { return ( {}; - if (getSecondsUntilNextCycleQuery.isLoading) return ; if ( @@ -139,7 +132,7 @@ function StartLiquidStackingLayout({ <>
- + {}} /> { delegationDurationType: 'indefinite'; diff --git a/src/pages/stacking/start-liquid-stacking/utils-delegate-stx.ts b/src/pages/stacking/start-liquid-stacking/utils-delegate-stx.ts index b39a1965..15b4a873 100644 --- a/src/pages/stacking/start-liquid-stacking/utils-delegate-stx.ts +++ b/src/pages/stacking/start-liquid-stacking/utils-delegate-stx.ts @@ -2,8 +2,8 @@ import { Dispatch, SetStateAction } from 'react'; import { NavigateFunction } from 'react-router-dom'; import { ContractCallRegularOptions, openContractCall } from '@stacks/connect'; -import { StacksNetwork, StacksNetworkName } from '@stacks/network'; -import { PoxInfo, StackingClient, poxAddressToTuple } from '@stacks/stacking'; +import { StacksNetwork } from '@stacks/network'; +import { PoxInfo, StackingClient } from '@stacks/stacking'; import { FungibleConditionCode, contractPrincipalCV, @@ -11,13 +11,10 @@ import { noneCV, uintCV, } from '@stacks/transactions'; -import { principalCV } from '@stacks/transactions/dist/clarity/types/principalCV'; import * as yup from 'yup'; import { UI_IMPOSED_MAX_STACKING_AMOUNT_USTX } from '@constants/app'; -import { cyclesToBurnChainHeight } from '@utils/calculate-burn-height'; import { stxToMicroStx, toHumanReadableStx } from '@utils/unit-convert'; -import { stxPrincipalSchema } from '@utils/validators/stx-address-validator'; import { stxAmountSchema } from '@utils/validators/stx-amount-validator'; import { protocols } from './components/preset-protocols'; @@ -25,10 +22,7 @@ import { EditingFormValues } from './types'; import { PoxContractName, ProtocolName } from './types-preset-protocols'; import { getNetworkInstance, getPoxContractAddressAndName } from './utils-preset-protocols'; -interface Args { - networkName: StacksNetworkName; -} -export function createValidationSchema({ networkName }: Args) { +export function createValidationSchema() { return yup.object().shape({ amount: stxAmountSchema() .test({ diff --git a/src/pages/stacking/start-liquid-stacking/utils.ts b/src/pages/stacking/start-liquid-stacking/utils.ts index cad5edca..968fe6be 100644 --- a/src/pages/stacking/start-liquid-stacking/utils.ts +++ b/src/pages/stacking/start-liquid-stacking/utils.ts @@ -1,22 +1,11 @@ -import { StacksNetwork } from '@stacks/network'; - import { EditingFormValues } from './types'; -import { getNetworkInstance, getPoxWrapperContract } from './utils-preset-protocols'; interface CreateHandleSubmitArgs { handleStackStxSubmit: (val: EditingFormValues) => Promise; - network: StacksNetwork; } -export function createHandleSubmit({ handleStackStxSubmit, network }: CreateHandleSubmitArgs) { +export function createHandleSubmit({ handleStackStxSubmit }: CreateHandleSubmitArgs) { return async function handleSubmit(values: EditingFormValues) { - if (values.protocolName) { - const poxWrapperContract = getPoxWrapperContract(values.protocolName, network); - const networkInstance = getNetworkInstance(network); - handleStackStxSubmit(values); - } else { - handleStackStxSubmit(values); - return; - } + handleStackStxSubmit(values); }; }