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A,CACCxS,SAAU,CAAC,CAAC4B,GACZhC,KAAMgC,IAAS,mBACf/B,aAAcyT,EAAQzT,YAAY,CAClCE,UAAW,GAA4BuT,MAAAA,CAAzBA,EAAQvE,MAAM,CAACiB,MAAM,CAAC,KAAyB7M,MAAA,CAAtBmQ,EAAQpE,MAAM,CAACc,MAAM,EAC5D/P,WAAY2T,IAGd,GAAAtQ,EAAAC,GAAA,EAAC4O,EAAAA,CACCnS,SAAU,CAAC,CAAC4B,GACZ4D,WAAY8N,EAAQzT,YAAY,CAChCE,UAAW,GAA4BuT,MAAAA,CAAzBA,EAAQvE,MAAM,CAACiB,MAAM,CAAC,KAAyB7M,MAAA,CAAtBmQ,EAAQpE,MAAM,CAACc,MAAM,EAC5DhJ,cAAe,GACbA,EAAc,CACZqB,UAAWwL,EAAWxL,SAAS,CAC/BxC,SAAUqT,OAAOrF,EAAWhO,QAAQ,CACtC,YAGDjE,IAAS,QAEb,CA2BL5B,SAAUsT,IAAc,GAAdA,CAAAA,EAAAA,EAAQ6F,MAAM,GAAd7F,KAAAA,IAAAA,GAAAA,GAGhB","sources":["webpack://_N_E/./components/Button/ApproveOnChainBtn.tsx","webpack://_N_E/./components/Button/SignPayloadBtn.tsx","webpack://_N_E/./hooks/position/useFetchPositionTypedData.ts","webpack://_N_E/./node_modules/@wagmi/core/dist/esm/actions/signTypedData.js","webpack://_N_E/./node_modules/@wagmi/core/dist/esm/query/signTypedData.js","webpack://_N_E/./node_modules/wagmi/dist/esm/hooks/useSignTypedData.js","webpack://_N_E/./components/Button/SignPositionPermitBtn.tsx","webpack://_N_E/./helper/error/constants.ts","webpack://_N_E/./helper/error/index.ts","webpack://_N_E/./hooks/trigger/useStrategyError.ts","webpack://_N_E/./components/Notification/Strategy.tsx","webpack://_N_E/./helper/strategyHelper.ts","webpack://_N_E/./hooks/useFetch/useFetchStrategy.ts","webpack://_N_E/./hooks/useFetchPositionPermission.ts","webpack://_N_E/./views/PositionDetails/AutoCompoundWrapper.tsx","webpack://_N_E/<anon>"],"sourcesContent":["import { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport { useWaitForTransaction } from \"@/hooks/useWaitForTransaction\";\nimport { useSendTransactionWithGas } from \"@/hooks/wagmi/useSendTransactionWithGas\";\nimport { Button, Spinner } from \"@aperture/uikit\";\nimport {\n ICommonNonfungiblePositionManager__factory,\n getChainInfo,\n} from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { Color } from \"@ui/components/Button/types\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport styled from \"styled-components\";\nimport { useSnackbarV2 } from \"../SnackbarContext/SnackbarContextV2\";\n\nconst SpinnerWrapper = styled.div`\n margin: auto;\n`;\n\nconst StyledButton = styled(Button)`\n font-size: 16px;\n line-height: 20px;\n`;\n\nconst ApproveOnChainBtn: React.FC<{\n text: string;\n positionIdBN: bigint;\n color?: Color;\n tokenPair?: string;\n disabled?: boolean;\n onApproved: () => void;\n handleError?: (error: string) => void;\n}> = ({\n text,\n positionIdBN,\n color = \"primary\",\n tokenPair,\n disabled,\n onApproved,\n handleError,\n ...props\n}) => {\n const { ammEnum, networkId } = useNetwork();\n const { addSnackbar } = useSnackbarV2();\n const [txnHash, setTxnHash] = useState<any>(undefined);\n\n const approveRequest = useMemo(() => {\n const chainInfo = getChainInfo(networkId);\n return {\n to: chainInfo.amms[ammEnum].nonfungiblePositionManager,\n data: ICommonNonfungiblePositionManager__factory.createInterface().encodeFunctionData(\n \"approve\",\n [chainInfo.amms[ammEnum].apertureAutoman, positionIdBN]\n ),\n };\n }, [networkId, positionIdBN]);\n\n const {\n ready,\n data: txData,\n sendTransaction,\n error: txErrorMsg,\n isError: isTxError,\n isPending: isTxLoading,\n isSuccess: isTxSuccess,\n } = useSendTransactionWithGas(approveRequest);\n\n const {\n data: waitTxData,\n error: waitTxErrorMsg,\n isError: isWaitTxError,\n isLoading: isWaitTxLoading,\n isSuccess: isWaitTxSuccess,\n } = useWaitForTransaction({\n hash: txnHash,\n });\n\n const onError = useCallback(\n (err: string) => {\n handleError?.(err);\n addSnackbar({ info: \"Failed: \" + err, status: \"failed\" });\n },\n [addSnackbar, handleError]\n );\n\n useEffect(() => {\n if (isTxSuccess && txData) {\n setTxnHash(txData);\n }\n }, [isTxSuccess, txData]);\n\n useEffect(() => {\n if (isWaitTxSuccess && waitTxData) {\n onApproved();\n addSnackbar({\n info: `You have successfully set up on-chain approval for your ${\n tokenPair ?? positionIdBN.toString()\n } position.`,\n status: \"completed\",\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isWaitTxSuccess, waitTxData]);\n\n useEffect(() => {\n if (isTxError) {\n onError(txErrorMsg!.message);\n }\n }, [isTxError, onError, txErrorMsg]);\n\n useEffect(() => {\n if (isWaitTxError) {\n onError(waitTxErrorMsg!.message);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isWaitTxError, waitTxErrorMsg]);\n\n return (\n <StyledButton\n onClick={() => sendTransaction?.()}\n disabled={\n !ready ||\n isTxLoading ||\n isWaitTxLoading ||\n isTxSuccess ||\n isWaitTxSuccess ||\n disabled\n }\n variant=\"contained\"\n color={color}\n size=\"lg\"\n invalid={false}\n width=\"100%\"\n {...props}\n >\n {isTxLoading || isWaitTxLoading ? (\n <SpinnerWrapper>\n <Spinner />\n </SpinnerWrapper>\n ) : (\n text\n )}\n </StyledButton>\n );\n};\n\nexport default ApproveOnChainBtn;\n","import { AccessoryIcons } from \"@aperture/assetkit\";\nimport { Button, Spinner } from \"@aperture/uikit\";\nimport { Color } from \"@ui/components/Button/types\";\nimport stringify from \"json-stable-stringify\";\nimport { useEffect } from \"react\";\nimport styled from \"styled-components\";\nimport { useAccount, useSignMessage } from \"wagmi\";\nimport { useSnackbarV2 } from \"../SnackbarContext/SnackbarContextV2\";\n\nconst SpinnerWrapper = styled.div`\n margin: auto;\n`;\n\nconst SignPayloadBtn: React.FC<{\n isLoading?: boolean;\n text: string;\n payload: any;\n color?: Color;\n setSignedPayload: React.Dispatch<React.SetStateAction<any>>;\n handleError?: (error: string) => void;\n showStartIcon?: boolean;\n noFeeNotification?: React.ReactNode;\n width?: string;\n disabled?: boolean;\n}> = ({\n isLoading,\n text,\n payload,\n color = \"primary\",\n setSignedPayload,\n handleError,\n showStartIcon = false,\n noFeeNotification = <></>,\n width = \"100%\",\n disabled = false,\n ...props\n}) => {\n const { address } = useAccount();\n const { addSnackbar } = useSnackbarV2();\n const payloadInString = stringify(payload);\n const {\n data,\n error,\n isPending: isSignLoading,\n isSuccess,\n signMessage,\n isError,\n } = useSignMessage();\n\n useEffect(() => {\n if (isSuccess) {\n setSignedPayload(data);\n }\n }, [isSuccess]);\n\n useEffect(() => {\n if (isError && error) {\n handleError?.(error!.message);\n addSnackbar({ info: \"Failed: \" + error!.message, status: \"failed\" });\n }\n }, [isError]);\n\n const isLoadingStatus = isSignLoading || isLoading;\n\n return (\n <Button\n {...props}\n onClick={() =>\n !isLoadingStatus &&\n signMessage({ account: address, message: payloadInString })\n }\n disabled={isLoadingStatus || disabled}\n variant=\"contained\"\n color={color}\n size=\"lg\"\n invalid={false}\n width={width}\n startIcon={\n !isLoadingStatus &&\n showStartIcon && <AccessoryIcons.CheckMarkIcon width={16} height={16} />\n }\n >\n {isLoadingStatus ? (\n <SpinnerWrapper>\n <Spinner />\n </SpinnerWrapper>\n ) : (\n text\n )}\n {!isLoadingStatus && noFeeNotification}\n </Button>\n );\n};\n\nexport default SignPayloadBtn;\n","import { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport { getPositionDeadline } from \"@/helper/deadlineHelper\";\nimport { AmmEnum } from \"@aperture/uikit\";\nimport {\n ApertureSupportedChainId,\n viem,\n} from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport useSWR from \"swr\";\nimport { PublicClient } from \"viem\";\nimport { useAccount } from \"wagmi\";\n\nexport const useFetchPositionTypedData = (positionId: bigint) => {\n const { ammEnum, networkId, publicClient } = useNetwork();\n const { address: walletAddress, isConnected } = useAccount();\n\n const shouldFetch = walletAddress && isConnected && ammEnum && networkId;\n\n return useSWR(\n shouldFetch\n ? `position-typed-data-${positionId}-${ammEnum}-${networkId}`\n : null,\n () => getPositionTypedData(positionId, ammEnum, networkId, publicClient)\n );\n};\n\nasync function getPositionTypedData(\n positionId: bigint,\n amm: AmmEnum,\n chainId: ApertureSupportedChainId,\n client: PublicClient\n) {\n const deadline = BigInt(getPositionDeadline());\n return viem.generateTypedDataForPermit(\n chainId,\n amm,\n positionId,\n deadline,\n client\n );\n}\n","import { signTypedData as viem_signTypedData, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nimport { getConnectorClient, } from './getConnectorClient.js';\n/** https://wagmi.sh/core/api/actions/signTypedData */\nexport async function signTypedData(config, parameters) {\n const { account, connector, ...rest } = parameters;\n let client;\n if (typeof account === 'object' && account.type === 'local')\n client = config.getClient();\n else\n client = await getConnectorClient(config, { account, connector });\n const action = getAction(client, viem_signTypedData, 'signTypedData');\n return action({\n ...rest,\n ...(account ? { account } : {}),\n });\n}\n//# sourceMappingURL=signTypedData.js.map","import { signTypedData, } from '../actions/signTypedData.js';\nexport function signTypedDataMutationOptions(config) {\n return {\n mutationFn(variables) {\n return signTypedData(config, variables);\n },\n mutationKey: ['signTypedData'],\n };\n}\n//# sourceMappingURL=signTypedData.js.map","'use client';\nimport { useMutation } from '@tanstack/react-query';\nimport { signTypedDataMutationOptions, } from '@wagmi/core/query';\nimport { useConfig } from './useConfig.js';\n/** https://wagmi.sh/react/api/hooks/useSignTypedData */\nexport function useSignTypedData(parameters = {}) {\n const { mutation } = parameters;\n const config = useConfig(parameters);\n const mutationOptions = signTypedDataMutationOptions(config);\n const { mutate, mutateAsync, ...result } = useMutation({\n ...mutation,\n ...mutationOptions,\n });\n return {\n ...result,\n signTypedData: mutate,\n signTypedDataAsync: mutateAsync,\n };\n}\n//# sourceMappingURL=useSignTypedData.js.map","import { useFetchPositionTypedData } from \"@/hooks/position/useFetchPositionTypedData\";\nimport { useEventCallback } from \"@/hooks/useEventCallback\";\nimport { Button, Spinner } from \"@aperture/uikit\";\nimport { PermitInfo } from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { ButtonProps } from \"@ui/components/Button/types\";\nimport React, { useEffect } from \"react\";\nimport styled from \"styled-components\";\nimport { useSignTypedData } from \"wagmi\";\nimport { useSnackbarV2 } from \"../SnackbarContext/SnackbarContextV2\";\n\nconst SpinnerWrapper = styled.div`\n margin: auto;\n`;\n\nconst StyledButton = styled(Button)`\n font-size: 16px;\n line-height: 20px;\n`;\n\nexport const SignPositionPermitBtn: React.FC<\n ButtonProps & {\n positionId: bigint;\n tokenPair?: string;\n setPermitInfo: (permitInfo: PermitInfo) => void;\n handleError?: (error: string) => void;\n }\n> = ({\n positionId,\n tokenPair,\n disabled,\n setPermitInfo,\n handleError,\n ...props\n}) => {\n const { isPending, disabledSign, signPositionPermit } = useSignPositionPermit(\n {\n positionId,\n setPermitInfo,\n successTips: `You have successfully set up a single-use authorization for your ${\n tokenPair ?? positionId.toString()\n } position.`,\n onError: handleError,\n }\n );\n\n return (\n <PureSignPositionPermitBtn\n {...props}\n disabled={disabled || disabledSign}\n onClick={signPositionPermit}\n isLoading={isPending}\n />\n );\n};\n\nconst PureSignPositionPermitButtonComponent = (\n props: ButtonProps & {\n isLoading: boolean;\n }\n) => {\n const {\n color = \"primary\",\n isLoading,\n children = \"Sign Position Permit\",\n } = props;\n\n return (\n <StyledButton\n variant=\"contained\"\n size=\"lg\"\n color={color}\n invalid={false}\n width=\"100%\"\n {...props}\n >\n {isLoading ? (\n <SpinnerWrapper>\n <Spinner />\n </SpinnerWrapper>\n ) : (\n children\n )}\n </StyledButton>\n );\n};\n\nconst PureSignPositionPermitBtn = React.memo(\n PureSignPositionPermitButtonComponent\n);\n\ntype SignPositionPermitProps = {\n positionId: bigint;\n setPermitInfo: (permitInfo: PermitInfo) => void;\n onError?: (err: string) => void;\n successTips: string;\n};\n\nfunction useSignPositionPermit(props: SignPositionPermitProps) {\n const { positionId, setPermitInfo, successTips } = props;\n const { addSnackbar } = useSnackbarV2();\n\n const handleError = useEventCallback((err: string) => {\n props.onError?.(err);\n addSnackbar({ info: \"Failed: \" + err, status: \"failed\" });\n });\n\n const { data: signTypedDataConfig, error } =\n useFetchPositionTypedData(positionId);\n\n useEffect(() => {\n if (error) {\n handleError(error);\n }\n }, [error, handleError]);\n\n const { signTypedData, isPending, isSuccess } = useSignTypedData();\n\n const signPositionPermit = useEventCallback(() => {\n signTypedData(signTypedDataConfig as any, {\n onSuccess: (data) => {\n if (data) {\n setPermitInfo({\n signature: data,\n deadline: signTypedDataConfig?.message.deadline as string, // deadline is actually a bigint, should be fine here\n });\n addSnackbar({ info: successTips, status: \"completed\" });\n }\n },\n onError: (err) => handleError(err.message),\n });\n });\n\n return {\n signPositionPermit,\n isPending,\n disabledSign: !signTypedDataConfig || isPending || isSuccess,\n };\n}\n\nexport default SignPositionPermitBtn;\n","export const enum E_StrategyErrorCode {\n Success = 0,\n CommonError = 1,\n TriggerExpired = 101,\n TriggerDeleted = 102,\n LowLiquidity = 103,\n LowGasFeeCeiling = 104,\n LowSlippage = 105,\n AORevoked = 106,\n}\n","import { INotificationV2Props } from \"@aperture/uikit\";\nimport { E_StrategyErrorCode } from \"./constants\";\n\nexport function mapStrategyErrorCodeToNotificationProps(\n errorCode: E_StrategyErrorCode,\n errorMsg?: string\n): Pick<INotificationV2Props, \"title\" | \"icon\" | \"text\" | \"variant\"> {\n switch (errorCode) {\n case E_StrategyErrorCode.LowGasFeeCeiling:\n return {\n title: \"Rebalance Failed - Excessive Gas Cost\",\n text: \"Please adjust gas ceiling by editing the trigger or wait for gas prices to come down.\",\n variant: \"error\",\n };\n\n case E_StrategyErrorCode.AORevoked:\n return {\n title: \"Rebalance Failed - Operator Authorization Revoked\",\n text: \"Recurring Rebalance triggers have become invalid. You can re-enable or go to Dashboard > Authorize Operator to grant operator status.\",\n variant: \"error\",\n };\n case E_StrategyErrorCode.LowLiquidity:\n return {\n title: \"Rebalance Failed - Insufficient Liquidity\",\n text: \"Your position value is too low. Recurring Rebalance is paused. Please add liquidity to resume the strategy.\",\n variant: \"error\",\n };\n case E_StrategyErrorCode.LowSlippage:\n return {\n title: \"Rebalance Failed - Low Slippage\",\n text: \"Please adjust slippage setting to allow strategy to execute. Current slippage setting is too low.\",\n variant: \"error\",\n };\n default:\n return {\n title: \"Error\",\n text: errorMsg ?? \"Error Code: \" + errorCode,\n variant: \"warning\",\n };\n }\n}\n","import { E_StrategyErrorCode } from \"@/helper/error/constants\";\nimport { ApertureSupportedChainId } from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { useIfAuthorized } from \"../useFetchUserAuthentication\";\nimport { usePositionStrategy } from \"./usePositionTrigger\";\n\nexport const useStrategyError = (\n positionId: string,\n chainId: ApertureSupportedChainId\n) => {\n const trigger = usePositionStrategy(positionId, chainId);\n const { ifAuthorized } = useIfAuthorized();\n\n const res = {\n errorMsg: \"\",\n errorCode: E_StrategyErrorCode.Success,\n };\n\n if (!trigger) {\n return res;\n }\n\n if (!ifAuthorized) {\n return {\n errorMsg: \"\",\n errorCode: E_StrategyErrorCode.AORevoked,\n };\n }\n\n if (trigger.lastFailedMessage === \"Gas exceeds user-specified ceiling\") {\n return {\n errorMsg: \"\",\n errorCode: E_StrategyErrorCode.LowGasFeeCeiling,\n };\n }\n\n // TODO: check for E_StrategyErrorCode.LowLiquidity and E_StrategyErrorCode.LowSlippage\n\n // cannot specify error type\n if (trigger.lastFailedMessage) {\n return {\n errorMsg: trigger.lastFailedMessage,\n errorCode: E_StrategyErrorCode.CommonError,\n };\n }\n\n return res;\n};\n","import { mapStrategyErrorCodeToNotificationProps } from \"@/helper/error\";\nimport { E_StrategyErrorCode } from \"@/helper/error/constants\";\nimport { useStrategyError } from \"@/hooks/trigger/useStrategyError\";\nimport { useEventCallback } from \"@/hooks/useEventCallback\";\nimport { Button, NotificationV2, Spinner } from \"@aperture/uikit\";\nimport { ApertureSupportedChainId } from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { useCallback } from \"react\";\nimport styled from \"styled-components\";\nimport { useAOStore } from \"../GlobalStore\";\n\nconst buttonLabelMap = {\n [E_StrategyErrorCode.AORevoked]: \"Re-enable\",\n [E_StrategyErrorCode.LowLiquidity]: \"Add Liquidity\",\n};\n\nconst ErrorButton = styled(Button)<{ disabled: boolean }>`\n background: ${({ theme }) => theme.colors.global.error} !important;\n color: ${({ theme }) => theme.colors.grey.white};\n opacity: ${({ disabled }) => (disabled ? \"0.3\" : \"1\")};\n &:hover {\n color: ${({ theme }) => theme.colors.grey.white};\n background: ${({ theme }) => theme.colors.global.error} !important;\n opacity: ${({ disabled }) => (disabled ? \"0.3\" : \"0.8\")};\n }\n`;\n\nexport const StrategyNotification: React.FC<{\n positionId: string;\n chainId: ApertureSupportedChainId;\n}> = ({ positionId, chainId }) => {\n const { errorCode, errorMsg } = useStrategyError(positionId, chainId);\n const { isAOStatusLoading: isAOLoading, safeToggleAOStatus: enableAO } =\n useAOStore();\n\n const onClick = useEventCallback(() => {\n if (errorCode === E_StrategyErrorCode.AORevoked) {\n enableAO();\n // @ts-ignore\n } else if (errorCode === E_StrategyErrorCode.LowLiquidity) {\n // TODO: add liquidity\n }\n });\n\n const renderButton = useCallback(() => {\n const label = buttonLabelMap[errorCode] ?? \"\";\n if (!label) {\n return null;\n }\n return (\n <ErrorButton\n width=\"max-content\"\n color=\"secondary\"\n variant=\"contained\"\n size=\"sm\"\n minWidth=\"100px\"\n disabled={isAOLoading}\n onClick={onClick}\n >\n {isAOLoading ? <Spinner /> : label}\n </ErrorButton>\n );\n }, [errorCode, isAOLoading, onClick]);\n\n if (errorCode === E_StrategyErrorCode.Success) {\n return null;\n }\n\n return (\n <NotificationV2\n {...mapStrategyErrorCodeToNotificationProps(errorCode, errorMsg)}\n renderButton={renderButton}\n />\n );\n};\n","import { IPositionDetails } from \"@/config/position/positionConfig\";\nimport { getAutomanAPI } from \"@/utils/helper\";\nimport {\n AmmEnum,\n PriceBasedRebalanceValue,\n RatioBasedRebalanceValue,\n RebalanceActionTab,\n sqrtX96ToPrice,\n StrategyDetailCardProps,\n StrategyInfoCardProps,\n TriggerInfo,\n TriggerType,\n TriggerValue,\n} from \"@aperture/uikit\";\nimport {\n ActionTypeEnum,\n ApertureSupportedChainId,\n AutomanClient,\n ClientTypeEnum,\n ConditionTypeEnum,\n GetStrategyDetailRequest,\n GetStrategyDetailResponse,\n RecurringAction,\n RecurringCondition,\n RecurringPercentageAction,\n RecurringPercentageCondition,\n RecurringPriceAction,\n RecurringPriceCondition,\n RecurringRatioAction,\n RecurringRatioCondition,\n TriggerItem,\n} from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { getActionType } from \"@ui/components/TriggerList/getStrategyInfo\";\nimport bigDecimal from \"js-big-decimal\";\nimport { Address } from \"viem\";\nimport { offsetTickToPercentage } from \"./liquiditySelectorHelper\";\n\nexport type IStrategy = {\n position: IPositionDetails;\n trigger: TriggerItem;\n strategyDetail: GetStrategyDetailResponse;\n};\nexport type IStrategyProps = {\n strategyDetail: StrategyDetailCardProps;\n position: IPositionDetails;\n trigger: TriggerItem;\n};\n\nexport const getStrategyDetail = async (\n strategyId: string,\n walletAddress: Address,\n amm: AmmEnum,\n chainId: ApertureSupportedChainId\n) => {\n const autoClient = new AutomanClient(getAutomanAPI());\n const request: GetStrategyDetailRequest = {\n strategyId,\n ownerAddr: walletAddress,\n chainId,\n amm,\n clientType: ClientTypeEnum.enum.FRONTEND,\n };\n return autoClient.getStrategyDetail(request);\n};\n\nexport function formatTrigger(trigger: TriggerItem) {\n let triggerType: TriggerType = TriggerType.PRICE;\n let rebalanceType: RebalanceActionTab = RebalanceActionTab.TOKEN_TERMS;\n let triggerValue: TriggerValue = {\n above: \"0\",\n below: \"0\",\n baseToken: 0,\n };\n let rebalanceValue: PriceBasedRebalanceValue | RatioBasedRebalanceValue = {\n above: \"0\",\n below: \"0\",\n baseToken: 0,\n };\n if (!trigger || !trigger.condition || !trigger.action) {\n return {\n triggerType,\n triggerValue,\n rebalanceType,\n rebalanceValue,\n };\n }\n switch (trigger.condition.type) {\n case ConditionTypeEnum.Values.RecurringPrice:\n const priceTriggerCondition =\n trigger.condition as RecurringPriceCondition;\n triggerType = TriggerType.PRICE;\n triggerValue = {\n above: priceTriggerCondition.gtePriceOffset,\n below: priceTriggerCondition.ltePriceOffset,\n baseToken: priceTriggerCondition.baseToken,\n };\n break;\n case ConditionTypeEnum.Values.RecurringPercentage:\n const percentageTriggerCondition =\n trigger.condition as RecurringPercentageCondition;\n triggerType = TriggerType.PRICE_PERCENTAGE;\n triggerValue = {\n above:\n percentageTriggerCondition.gteTickOffset !== undefined &&\n offsetTickToPercentage(percentageTriggerCondition.gteTickOffset),\n below:\n percentageTriggerCondition.lteTickOffset !== undefined &&\n offsetTickToPercentage(percentageTriggerCondition.lteTickOffset),\n baseToken: 0,\n };\n break;\n case ConditionTypeEnum.Values.RecurringRatio:\n const ratioTriggerCondition =\n trigger.condition as RecurringRatioCondition;\n triggerType = TriggerType.RATIO;\n triggerValue = {\n above: ratioTriggerCondition.gteToken0ValueProportion,\n below: ratioTriggerCondition.lteToken0ValueProportion,\n baseToken: 0,\n };\n break;\n }\n switch (trigger.action.type) {\n case ActionTypeEnum.Values.RecurringPrice:\n const priceTriggerAction = trigger.action as RecurringPriceAction;\n rebalanceType = RebalanceActionTab.TOKEN_TERMS;\n rebalanceValue = {\n above: priceTriggerAction.priceUpperOffset,\n below: priceTriggerAction.priceLowerOffset,\n baseToken: priceTriggerAction.baseToken,\n };\n break;\n case ActionTypeEnum.Values.RecurringPercentage:\n const percentageTriggerAction =\n trigger.action as RecurringPercentageAction;\n rebalanceType = RebalanceActionTab.PERCENTAGES;\n rebalanceValue = {\n above: offsetTickToPercentage(percentageTriggerAction.tickUpperOffset),\n below: offsetTickToPercentage(percentageTriggerAction.tickLowerOffset),\n baseToken: 0,\n };\n break;\n case ActionTypeEnum.Values.RecurringRatio:\n const ratioTriggerAction = trigger.action as RecurringRatioAction;\n rebalanceType = RebalanceActionTab.RATIO;\n rebalanceValue = {\n percentageToken0: ratioTriggerAction.token0ValueProportion,\n percentageToken1: bigDecimal.subtract(\n 1,\n ratioTriggerAction.token0ValueProportion\n ),\n tickWidth: ratioTriggerAction.tickRangeWidth,\n baseToken: 0,\n };\n break;\n }\n return { triggerType, triggerValue, rebalanceType, rebalanceValue };\n}\n\nexport function getStrategyInfoCardProps(\n position: IPositionDetails,\n trigger: TriggerItem,\n strategyDetail: GetStrategyDetailResponse,\n tokenPrices?: [string, string]\n): StrategyInfoCardProps {\n const {\n feeCollectedToken0UsdValue: token0Usd = 0,\n feeCollectedToken1UsdValue: token1Usd = 0,\n feeCollectedToken0: token0Collected = 0,\n feeCollectedToken1: token1Collected = 0,\n } = strategyDetail?.feeCollected || {};\n const feeCollectedUsd = token0Usd + token1Usd;\n const totalFeesUsd = bigDecimal.add(\n position.feeAmount === \"-\" ? \"0\" : position.feeAmount,\n feeCollectedUsd\n );\n\n const token0FeeCollected = bigDecimal.add(\n position.tokenA.collectableAmount,\n token0Collected\n );\n const token1FeeCollected = bigDecimal.add(\n position.tokenB.collectableAmount,\n token1Collected\n );\n const token0UsdAmount = bigDecimal.add(\n bigDecimal.multiply(\n position.tokenA.collectableAmount,\n tokenPrices ? tokenPrices[0] : \"0\"\n ),\n token0Usd\n );\n const token1UsdAmount = bigDecimal.add(\n bigDecimal.multiply(\n position.tokenB.collectableAmount,\n tokenPrices ? tokenPrices[1] : \"0\"\n ),\n token1Usd\n );\n\n const triggerCondition = trigger?.condition as RecurringCondition;\n const triggerAction = trigger?.action as RecurringAction;\n const isDualAction =\n triggerAction?.type === ActionTypeEnum.Values.RecurringDualAction;\n\n let formattedTrigger: TriggerInfo[];\n if (triggerAction && isDualAction) {\n const { slippage, maxGasProportion, strategyId, lteAction, gteAction } =\n triggerAction;\n\n formattedTrigger = [lteAction, gteAction].map((a) => {\n const action = getActionType({\n ...a,\n strategyId,\n slippage,\n maxGasProportion,\n });\n return formatTrigger({ ...trigger, action });\n });\n } else {\n formattedTrigger = [formatTrigger(trigger)];\n }\n\n return {\n tokens: [\n { ticker: position?.tokenA.ticker, decimals: position?.tokenA.decimals },\n { ticker: position?.tokenB.ticker, decimals: position?.tokenB.decimals },\n ],\n conditionSpotPrice: sqrtX96ToPrice(\n // @ts-ignore\n strategyDetail?.current[0]?.condition?.sqrtPriceX96,\n position?.tokenA.decimals,\n position?.tokenB.decimals\n ),\n triggerInfo: formattedTrigger,\n rebalancesExecuted: `${strategyDetail?.executed || \"-\"}`,\n revenueEarned: {\n total: `${totalFeesUsd}`,\n token0: {\n amount: token0FeeCollected,\n usdAmount: token0UsdAmount,\n },\n token1: {\n amount: token1FeeCollected,\n usdAmount: token1UsdAmount,\n },\n },\n timeBuffer: triggerCondition?.durationSec\n ? `${triggerCondition?.durationSec / 3600}`\n : undefined,\n // TODO: frequency\n };\n}\n","import { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport { getStrategyDetail } from \"@/helper/strategyHelper\";\nimport useSWR from \"swr\";\nimport { useAccount } from \"wagmi\";\n\nexport const useFetchStrategy = (strategyId: string) => {\n const { ammEnum, networkId } = useNetwork();\n const { address } = useAccount();\n const noFetch = !strategyId || !networkId || !address;\n\n return useSWR(\n noFetch ? null : [\"strategy\", strategyId, address, networkId],\n () => getStrategyDetail(strategyId, address, ammEnum, networkId)\n );\n};\n","import { useAOStore } from \"@/components/GlobalStore\";\nimport { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport {\n checkPositionApproval,\n checkPositionPermission,\n} from \"@/helper/positionHelper/positionHelper\";\nimport { ApertureSupportedChainId } from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { AmmEnum } from \"@ui/utils\";\nimport { useUpdateEffect } from \"ahooks\";\nimport useSWR from \"swr/immutable\";\nimport { PublicClient } from \"viem\";\nimport { useAccount } from \"wagmi\";\nimport { useCurrentChainPositions } from \"./useCurrentChainPositions\";\nimport { useEventCallback } from \"./useEventCallback\";\nimport { useFetchAllChainsPositions } from \"./useFetchAllChainsPositions\";\nimport { useIsWalletContract } from \"./useIsWalletContract\";\n\nexport function useFetchPositionPermission(positionId: string) {\n const { address: walletAddress, isConnected } = useAccount();\n const { data: isWalletContract } = useIsWalletContract();\n const { ammEnum, networkId, publicClient, isChainSupported } = useNetwork();\n const { ifAuthorized, isAOStatusLoading } = useAOStore();\n const { data: allChainPositions } = useFetchAllChainsPositions(walletAddress);\n const { positionMap } = useCurrentChainPositions(walletAddress);\n const showFetch =\n isConnected &&\n walletAddress &&\n ammEnum &&\n isChainSupported &&\n allChainPositions &&\n !!positionMap?.[positionId];\n\n const { isLoading, mutate, data, ...ret } = useSWR(\n showFetch\n ? `position-permission-${ammEnum}-${networkId}-${positionId}`\n : null,\n () =>\n checkPermission(\n ammEnum,\n networkId,\n positionId,\n isWalletContract,\n publicClient\n )\n );\n\n const mutateOnAOStatusChange = useEventCallback(() => {\n if (!ifAuthorized && data) {\n mutate();\n }\n });\n\n useUpdateEffect(() => {\n if (isAOStatusLoading) return;\n mutateOnAOStatusChange();\n }, [isAOStatusLoading]);\n\n return {\n ...ret,\n mutate,\n data,\n isLoading: isLoading || isAOStatusLoading || ret.isValidating,\n };\n}\n\nasync function checkPermission(\n amm: AmmEnum,\n chainId: ApertureSupportedChainId,\n positionId: string,\n isWalletContract: boolean | undefined,\n client: PublicClient\n) {\n if (isWalletContract)\n return await checkPositionApproval(amm, chainId, positionId, client);\n return await checkPositionPermission(amm, chainId, positionId);\n}\n","import ApproveOnChainBtn from \"@/components/Button/ApproveOnChainBtn\";\nimport SignPayloadBtn from \"@/components/Button/SignPayloadBtn\";\nimport SignPositionPermitBtn from \"@/components/Button/SignPositionPermitBtn\";\nimport { UnstakePositionBtn } from \"@/components/Button/StakePositionBtn\";\nimport { useUnstakePositionContext } from \"@/components/Context/UnstakePositionContext\";\nimport { useAOStore, useGlobalSlippage } from \"@/components/GlobalStore\";\nimport { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport { useSnackbarV2 } from \"@/components/SnackbarContext/SnackbarContextV2\";\n\nimport { IPositionDetails } from \"@/config/position/positionConfig\";\nimport { getTriggerDeadline } from \"@/helper/deadlineHelper\";\nimport {\n createTrigger,\n deleteTrigger,\n getCreateTriggerFailure,\n updateTrigger,\n} from \"@/helper/triggerHelper\";\nimport { useFetchAllChainUserTriggers } from \"@/hooks/useFetchAllChainUserTriggers\";\nimport { useFetchPositionPermission } from \"@/hooks/useFetchPositionPermission\";\nimport { useFetchStakePositionsIds } from \"@/hooks/useFetchStakePositionsIds\";\nimport { useIsWalletContract } from \"@/hooks/useIsWalletContract\";\nimport {\n DEFAULT_APERTURE_FEE,\n DEFAULT_SLIPPAGE,\n WARNING_SLIPPAGE,\n gasCeilingButtonError,\n gasCeilingInputError,\n getGasCeiling,\n} from \"@/utils/helper\";\nimport {\n ApertureFeePopover,\n AutoCompound,\n IAutoCompoundFormProps,\n IAutoCompoundRef,\n} from \"@aperture/uikit\";\nimport {\n AccruedFeesCondition,\n CreateTriggerPayload,\n DeleteTriggerPayload,\n PermitInfo,\n ReinvestAction,\n TriggerItem,\n UpdateTriggerPayload,\n} from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport stringify from \"json-stable-stringify\";\nimport _ from \"lodash\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport styled from \"styled-components\";\nimport { useAccount, useSignMessage } from \"wagmi\";\n\nconst StyledSignPermitButton = styled(SignPositionPermitBtn)`\n height: 36px;\n font-size: 16px;\n padding: 6px 12px;\n margin-top: 16px;\n background: ${({ theme }) => theme.colors.global.primary};\n color: ${({ theme }) => theme.colors.global.textAlt.T1};\n &:hover {\n background: ${({ theme }) => theme.colors.global.primaryHover};\n }\n`;\nconst StyledApproveOnChainBtn = styled(ApproveOnChainBtn)`\n height: 36px;\n font-size: 16px;\n padding: 6px 12px;\n margin-top: 16px;\n background: ${({ theme }) => theme.colors.transparent.transparent};\n color: ${({ theme }) => theme.colors.primary.purple};\n border: 1.5px solid ${({ theme }) => theme.colors.primary.purple};\n &:hover {\n background: ${({ theme }) => theme.colors.transparent.transparent};\n }\n`;\nconst StyledSignBtn = styled(SignPayloadBtn)`\n margin-top: 16px;\n`;\nconst StyledUnstakePositionBtn = styled(UnstakePositionBtn)`\n margin-top: 16px;\n`;\n\nexport const AutoCompoundWrapper: React.FC<{\n details: IPositionDetails;\n autoCompound?: TriggerItem;\n}> = ({ details, autoCompound }) => {\n const { address } = useAccount();\n const { ammEnum, networkId } = useNetwork();\n const { addSnackbar } = useSnackbarV2();\n const { mutate: mutateUserTriggers } = useFetchAllChainUserTriggers();\n const { ifAuthorized } = useAOStore();\n const { data: isWalletContract } = useIsWalletContract();\n const {\n data: permitStatus,\n isLoading: isPermitLoading,\n mutate: mutatePositionPermit,\n } = useFetchPositionPermission(details.positionId);\n const [permitInfo, setPermitInfo] = useState<PermitInfo>(undefined);\n const [payload, setPayload] = useState<\n CreateTriggerPayload | UpdateTriggerPayload | undefined\n >(undefined);\n const [deletePayload, setDeletePayload] = useState<\n DeleteTriggerPayload | undefined\n >(undefined);\n const [signedPayload, setSignedPayload] = useState<`0x${string}` | undefined>(\n undefined\n );\n const [isRequesting, setIsLoading] = useState(false);\n const [isNotChanged, setIsDisabled] = useState(false);\n const [error, setError] = useState(\"\");\n const [slippageChecked, setSlippageChecked] = useState(false);\n const { globalSlippage, setGlobalSlippage } = useGlobalSlippage();\n const { mutate: mutateStakePositionIds } = useFetchStakePositionsIds();\n const { stakePool, staked, setStaked } = useUnstakePositionContext();\n\n const autoCompoundRef = useRef<IAutoCompoundRef>(null);\n const initForm: IAutoCompoundFormProps = useMemo(\n () => ({\n isSwitchBtnOn: !!autoCompound,\n minimumFees: {\n unit: \"%\",\n percentage:\n (autoCompound?.condition as AccruedFeesCondition)\n ?.feeToPrincipalRatioThreshold ?? 0.05,\n },\n maximumGasFee: {\n unit: \"$\",\n percentage:\n (autoCompound?.action as ReinvestAction)?.maxGasProportion ??\n getGasCeiling(networkId, details.liquidity),\n },\n slippage:\n (autoCompound?.action as ReinvestAction)?.slippage ??\n globalSlippage ??\n DEFAULT_SLIPPAGE,\n }),\n [autoCompound, networkId, details.liquidity]\n );\n const [autoCompoundForm, setAutoCompoundForm] =\n useState<IAutoCompoundFormProps>(initForm);\n\n const {\n data: signedDeletePayload,\n error: signError,\n isSuccess,\n signMessage,\n isError,\n } = useSignMessage();\n\n const handleDelete = () => {\n if (!autoCompound) return;\n setIsLoading(true);\n const deletePayload: DeleteTriggerPayload = {\n ownerAddr: address!,\n chainId: networkId,\n taskId: autoCompound.taskId,\n };\n setDeletePayload(deletePayload);\n const payloadInString = stringify(deletePayload);\n signMessage({ account: address, message: payloadInString });\n };\n\n useEffect(() => {\n if (isSuccess && deletePayload && signedDeletePayload) {\n deleteTrigger(deletePayload, signedDeletePayload)\n .then((res) => {\n addSnackbar({\n info: `Auto-compound for your ${details.tokenA.ticker}-${details.tokenB.ticker} position has been disabled.`,\n status: \"completed\",\n });\n mutateUserTriggers();\n setIsLoading(false);\n autoCompoundRef && autoCompoundRef.current?.onDropdownClose();\n })\n .catch((err) => {\n addSnackbar({\n info:\n \"Your auto-compound disable request has failed: \" + err!.message,\n status: \"failed\",\n });\n })\n .finally(() => {\n autoCompoundRef && autoCompoundRef.current?.onDropdownClose();\n setIsLoading(false);\n });\n }\n }, [isSuccess]);\n\n useEffect(() => {\n if (isError) {\n addSnackbar({ info: \"Failed: \" + signError!.message, status: \"failed\" });\n autoCompoundRef && autoCompoundRef.current?.onDropdownClose();\n setIsLoading(false);\n }\n }, [isError]);\n\n useEffect(() => {\n setPermitInfo(undefined);\n }, [details.positionId]);\n\n useEffect(() => {\n autoCompoundRef && autoCompoundRef.current?.resetForm();\n }, [initForm]);\n\n useEffect(() => {\n const gasCeilingErr = gasCeilingButtonError(\n networkId,\n autoCompoundForm.maximumGasFee.percentage,\n details.liquidity !== \"-\" ? details.liquidity : \"0\"\n );\n if (!!gasCeilingErr) {\n setError(gasCeilingErr);\n } else {\n setError(\"\");\n const payload = {\n ownerAddr: address!,\n chainId: networkId,\n action: {\n type: \"Reinvest\",\n slippage: autoCompoundForm.slippage,\n maxGasProportion: autoCompoundForm.maximumGasFee.percentage,\n },\n condition: {\n type: \"AccruedFees\",\n feeToPrincipalRatioThreshold: autoCompoundForm.minimumFees.percentage,\n },\n expiration: getTriggerDeadline(),\n };\n if (autoCompound) {\n const isActionEqual = _.isEqual(payload.action, autoCompound.action);\n const isConditionEqual = _.isEqual(\n payload.condition,\n autoCompound.condition\n );\n if (isActionEqual) {\n (payload as UpdateTriggerPayload).action = undefined;\n }\n if (isConditionEqual) {\n (payload as UpdateTriggerPayload).condition = undefined;\n }\n setIsDisabled(isActionEqual && isConditionEqual);\n setPayload({\n ...payload,\n taskId: autoCompound.taskId,\n } as UpdateTriggerPayload);\n } else {\n setPayload({\n ...payload,\n amm: ammEnum,\n nftId: details.positionId,\n } as CreateTriggerPayload);\n setIsDisabled(false);\n }\n }\n }, [autoCompoundForm]);\n\n useEffect(() => {\n if (signedPayload) {\n setIsLoading(true);\n if (autoCompound) {\n updateTrigger(payload as UpdateTriggerPayload, signedPayload)\n .then((res) => {\n mutatePositionPermit().then(() => {\n mutateUserTriggers();\n });\n addSnackbar({\n info: `You have successfully updated auto-compound for your ${details.tokenA.ticker}-${details.tokenB.ticker} position.`,\n status: \"completed\",\n });\n })\n .catch((err) => {\n addSnackbar({\n info: \"Your auto-compound update request has failed: \" + err,\n status: \"failed\",\n });\n })\n .finally(() => {\n autoCompoundRef && autoCompoundRef.current?.onDropdownClose();\n setIsLoading(false);\n });\n } else {\n createTrigger(\n payload as CreateTriggerPayload,\n signedPayload,\n permitInfo\n )\n .then((res) => {\n mutatePositionPermit().then(() => {\n mutateUserTriggers();\n });\n addSnackbar({\n info: `You have successfully enabled auto-compound for your ${details.tokenA.ticker}-${details.tokenB.ticker} position.`,\n status: \"completed\",\n });\n })\n .catch((err) => {\n addSnackbar({\n info:\n \"Your auto-compound request has failed: \" +\n getCreateTriggerFailure(err),\n status: \"failed\",\n });\n })\n .finally(() => {\n autoCompoundRef && autoCompoundRef.current?.onDropdownClose();\n setIsLoading(false);\n });\n }\n }\n }, [signedPayload]);\n\n const signBtnLoading = isRequesting || isPermitLoading;\n const signBtnDisabled =\n signBtnLoading ||\n !!error ||\n isNotChanged ||\n !autoCompoundForm.isSwitchBtnOn;\n\n return (\n <AutoCompound\n ref={autoCompoundRef}\n amount={details.liquidity}\n initForm={{\n ...initForm,\n slippage:\n (autoCompound?.action as ReinvestAction)?.slippage ??\n globalSlippage ??\n DEFAULT_SLIPPAGE,\n }}\n defaultSlippage={DEFAULT_SLIPPAGE}\n globalSlippage={globalSlippage}\n warningSlippage={WARNING_SLIPPAGE}\n applyGlobally={slippageChecked}\n onApplyGlobally={(checked) => {\n setSlippageChecked(checked);\n checked &&\n setGlobalSlippage((prev) => ({\n ...prev,\n [networkId]: autoCompoundForm.slippage,\n }));\n }}\n isOn={!!autoCompound}\n isLoading={isRequesting}\n onChange={(form) => {\n setAutoCompoundForm(form);\n }}\n onDelete={handleDelete}\n onGasCeilingError={(percentage) =>\n gasCeilingInputError(networkId, percentage, details.liquidity)\n }\n confirmBtn={\n stakePool && staked ? (\n <StyledUnstakePositionBtn\n key={details.positionId}\n atStake={staked}\n gaugeAddress={stakePool.gaugeAddress}\n positionId={details.positionIdBN}\n handleTxSuccess={() => {\n setStaked(false);\n mutateStakePositionIds();\n }}\n />\n ) : !(ifAuthorized || isPermitLoading || permitStatus || permitInfo) ? (\n isWalletContract ? (\n <StyledApproveOnChainBtn\n disabled={!!error}\n text={error || \"Approve on-chain\"}\n positionIdBN={details.positionIdBN}\n tokenPair={`${details.tokenA.ticker}-${details.tokenB.ticker}`}\n onApproved={mutatePositionPermit}\n />\n ) : (\n <StyledSignPermitButton\n disabled={!!error}\n positionId={details.positionIdBN}\n tokenPair={`${details.tokenA.ticker}-${details.tokenB.ticker}`}\n setPermitInfo={(permitInfo: PermitInfo) =>\n setPermitInfo({\n signature: permitInfo.signature,\n deadline: String(permitInfo.deadline),\n })\n }\n >\n {error || \"Sign\"}\n </StyledSignPermitButton>\n )\n ) : (\n <StyledSignBtn\n text={error || (isNotChanged ? \"Auto-Compound Set Up\" : \"Confirm\")} //@ts-ignore\n variant=\"contained\"\n color=\"primary\"\n size=\"md\"\n disabled={signBtnLoading || signBtnDisabled}\n showStartIcon={!error && isNotChanged}\n isLoading={signBtnLoading}\n noFeeNotification={\n error || isNotChanged || autoCompound ? (\n <></>\n ) : (\n <ApertureFeePopover\n hint={`${\n DEFAULT_APERTURE_FEE * 100\n }% of the compounded amount.`}\n fixColor={true}\n defaultPosition={{ right: -132, bottom: 30 }}\n />\n )\n }\n {...{ payload, setSignedPayload }}\n />\n )\n }\n disabled={details.closed ?? false}\n />\n );\n};\n"],"names":["SpinnerWrapper","styled","StyledButton","Button","ApproveOnChainBtn","text","positionIdBN","color","tokenPair","disabled","onApproved","handleError","props","param","ammEnum","networkId","useNetwork","addSnackbar","useSnackbarV2","txnHash","setTxnHash","useState","undefined","approveRequest","useMemo","chainInfo","getChainInfo","to","amms","nonfungiblePositionManager","data","ICommonNonfungiblePositionManager__factory","encodeFunctionData","apertureAutoman","ready","txData","sendTransaction","error","txErrorMsg","isError","isTxError","isPending","isTxLoading","isSuccess","isTxSuccess","useSendTransactionWithGas","waitTxData","waitTxErrorMsg","isWaitTxError","isLoading","isWaitTxLoading","isWaitTxSuccess","useWaitForTransaction","hash","onError","useCallback","err","info","status","useEffect","concat","toString","message","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__","jsx","onClick","variant","size","invalid","width","Spinner","__webpack_exports__","SignPayloadBtn","payload","setSignedPayload","showStartIcon","noFeeNotification","Fragment","address","useAccount","payloadInString","stringify","isSignLoading","signMessage","useSignMessage","isLoadingStatus","jsxs","account","startIcon","AccessoryIcons","height","useFetchPositionTypedData","publicClient","walletAddress","isConnected","useSWR","shouldFetch","positionId","getPositionTypedData","amm","chainId","client","deadline","BigInt","getPositionDeadline","viem","signTypedData_signTypedData","config","parameters","connector","rest","type","getClient","getConnectorClient","e","action","getAction","s","signTypedData","x","SignPositionPermitBtn","setPermitInfo","disabledSign","signPositionPermit","useSignPositionPermit","successTips","useEventCallback","signTypedDataConfig","useSignTypedData","mutation","useConfig","Z","mutate","mutateAsync","result","useMutation","D","mutationFn","variables","mutationKey","signTypedDataAsync","onSuccess","signature","jsx_runtime","PureSignPositionPermitBtn","PureSignPositionPermitButtonComponent","children","React","Button_SignPositionPermitBtn","E_StrategyErrorCode","Success","CommonError","TriggerExpired","TriggerDeleted","LowLiquidity","LowGasFeeCeiling","LowSlippage","AORevoked","useStrategyError","trigger","usePositionStrategy","ifAuthorized","useIfAuthorized","res","errorMsg","errorCode","lastFailedMessage","buttonLabelMap","ErrorButton","theme","colors","global","grey","white","StrategyNotification","isAOStatusLoading","isAOLoading","safeToggleAOStatus","enableAO","useAOStore","renderButton","label","minWidth","NotificationV2","mapStrategyErrorCodeToNotificationProps","title","getStrategyDetail","strategyId","autoClient","AutomanClient","getAutomanAPI","request","ownerAddr","clientType","ClientTypeEnum","formatTrigger","triggerType","TriggerType","rebalanceType","RebalanceActionTab","triggerValue","above","below","baseToken","rebalanceValue","condition","ConditionTypeEnum","priceTriggerCondition","gtePriceOffset","ltePriceOffset","percentageTriggerCondition","gteTickOffset","offsetTickToPercentage","lteTickOffset","ratioTriggerCondition","gteToken0ValueProportion","lteToken0ValueProportion","ActionTypeEnum","priceTriggerAction","priceUpperOffset","priceLowerOffset","percentageTriggerAction","tickUpperOffset","tickLowerOffset","ratioTriggerAction","percentageToken0","token0ValueProportion","percentageToken1","bigDecimal","tickWidth","tickRangeWidth","getStrategyInfoCardProps","position","strategyDetail","tokenPrices","formattedTrigger","feeCollectedToken0UsdValue","token0Usd","feeCollectedToken1UsdValue","token1Usd","feeCollectedToken0","token0Collected","feeCollectedToken1","token1Collected","feeCollected","totalFeesUsd","feeAmount","token0FeeCollected","tokenA","collectableAmount","token1FeeCollected","tokenB","token0UsdAmount","token1UsdAmount","triggerCondition","triggerAction","isDualAction","slippage","maxGasProportion","lteAction","gteAction","map","getActionType","a","tokens","ticker","decimals","conditionSpotPrice","sqrtX96ToPrice","current","sqrtPriceX96","triggerInfo","rebalancesExecuted","executed","revenueEarned","total","token0","amount","usdAmount","token1","timeBuffer","durationSec","useFetchStrategy","noFetch","useFetchPositionPermission","isWalletContract","useIsWalletContract","isChainSupported","allChainPositions","useFetchAllChainsPositions","positionMap","useCurrentChainPositions","showFetch","ret","checkPermission","mutateOnAOStatusChange","useUpdateEffect","isValidating","checkPositionApproval","checkPositionPermission","StyledSignPermitButton","primary","textAlt","T1","primaryHover","StyledApproveOnChainBtn","transparent","purple","StyledSignBtn","StyledUnstakePositionBtn","UnstakePositionBtn","AutoCompoundWrapper","_ref","_feeToPrincipalRatioThreshold","_maxGasProportion","_slippage","_ref1","_slippage1","_ref2","details","autoCompound","mutateUserTriggers","useFetchAllChainUserTriggers","permitStatus","isPermitLoading","mutatePositionPermit","permitInfo","setPayload","deletePayload","setDeletePayload","signedPayload","isRequesting","setIsLoading","isNotChanged","setIsDisabled","setError","slippageChecked","setSlippageChecked","globalSlippage","setGlobalSlippage","useGlobalSlippage","mutateStakePositionIds","useFetchStakePositionsIds","stakePool","staked","setStaked","useUnstakePositionContext","autoCompoundRef","useRef","initForm","_ref3","isSwitchBtnOn","minimumFees","unit","percentage","feeToPrincipalRatioThreshold","maximumGasFee","getGasCeiling","liquidity","DEFAULT_SLIPPAGE","autoCompoundForm","setAutoCompoundForm","signedDeletePayload","signError","handleDelete","taskId","deleteTrigger","then","onDropdownClose","catch","finally","resetForm","gasCeilingErr","gasCeilingButtonError","expiration","getTriggerDeadline","isActionEqual","_","isConditionEqual","nftId","updateTrigger","createTrigger","getCreateTriggerFailure","signBtnLoading","signBtnDisabled","AutoCompound","ref","defaultSlippage","warningSlippage","WARNING_SLIPPAGE","applyGlobally","onApplyGlobally","checked","prev","isOn","onChange","form","onDelete","onGasCeilingError","gasCeilingInputError","confirmBtn","atStake","gaugeAddress","handleTxSuccess","ApertureFeePopover","hint","DEFAULT_APERTURE_FEE","fixColor","defaultPosition","right","bottom","String","closed"],"sourceRoot":""}