Skip to content

Commit

Permalink
Omni kit automations clean up (#3720)
Browse files Browse the repository at this point in the history
* Add getOmniAutomationSidebarButtonsStatus helper function

* Add getOmniAutomationSidebarPrimaryButtonActions helper function

* Better split OmniKit automation hooks
  • Loading branch information
marcinciarka authored Mar 26, 2024
1 parent 623e86f commit c21717a
Show file tree
Hide file tree
Showing 23 changed files with 605 additions and 395 deletions.
2 changes: 1 addition & 1 deletion features/omni-kit/automation/actions/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { OmniAutomationSimulationResponse } from 'features/omni-kit/contexts'
import type { OmniAutomationSimulationResponse } from 'features/omni-kit/types'

export const defaultAutomationActionPromise = Promise.resolve<
OmniAutomationSimulationResponse | undefined
Expand Down
2 changes: 1 addition & 1 deletion features/omni-kit/automation/actions/setupAutoBS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { defaultAutomationActionPromise } from 'features/omni-kit/automation/act
import type { OmniAutoBSAutomationTypes } from 'features/omni-kit/automation/components/auto-buy-sell/types'
import { autoBuySellConstants } from 'features/omni-kit/automation/constants'
import type { OmniAutomationCommonActionPayload } from 'features/omni-kit/automation/types'
import type { AutomationMetadataValues } from 'features/omni-kit/contexts'
import type { OmniAutomationAutoBSFormState } from 'features/omni-kit/state/automation/auto-bs'
import type { AutomationMetadataValues } from 'features/omni-kit/types'
import { setupAaveAutoBuy, setupAaveAutoSell } from 'helpers/triggers'
import { isBoolean } from 'lodash'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { lambdaPriceDenomination } from 'features/aave/constants'
import { defaultAutomationActionPromise } from 'features/omni-kit/automation/actions/common'
import type { OmniAutomationCommonActionPayload } from 'features/omni-kit/automation/types'
import type { AutomationMetadataValues } from 'features/omni-kit/contexts'
import type { OmniAutomationPartialTakeProfitFormState } from 'features/omni-kit/state/automation/partial-take-profit'
import type { AutomationMetadataValues } from 'features/omni-kit/types'
import { setupAaveLikePartialTakeProfit, TriggerAction } from 'helpers/triggers'
import { one } from 'helpers/zero'

Expand Down
2 changes: 1 addition & 1 deletion features/omni-kit/automation/actions/setupStopLoss.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { defaultAutomationActionPromise } from 'features/omni-kit/automation/actions/common'
import { resolveStopLossishAction } from 'features/omni-kit/automation/helpers'
import type { OmniAutomationCommonActionPayload } from 'features/omni-kit/automation/types'
import type { AutomationMetadataValues } from 'features/omni-kit/contexts'
import type { OmniAutomationStopLossFormState } from 'features/omni-kit/state/automation/stop-loss'
import type { AutomationMetadataValues } from 'features/omni-kit/types'
import { setupAaveLikeStopLoss } from 'helpers/triggers'

export const setupStopLoss = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import BigNumber from 'bignumber.js'
import { defaultAutomationActionPromise } from 'features/omni-kit/automation/actions/common'
import { resolveStopLossishAction } from 'features/omni-kit/automation/helpers'
import type { OmniAutomationCommonActionPayload } from 'features/omni-kit/automation/types'
import type { AutomationMetadataValues } from 'features/omni-kit/contexts'
import type { OmniAutomationTrailingStopLossFormState } from 'features/omni-kit/state/automation/trailing-stop-loss'
import type { AutomationMetadataValues } from 'features/omni-kit/types'
import { setupAaveLikeTrailingStopLoss } from 'helpers/triggers'

export const setupTrailingStopLoss = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
setupTrailingStopLoss,
} from 'features/omni-kit/automation/actions'
import type { OmniAutomationCommonActionPayload } from 'features/omni-kit/automation/types'
import type {
AutomationMetadataValues,
OmniAutomationSimulationResponse,
} from 'features/omni-kit/contexts'
import type { OmniAutomationAutoBSFormState } from 'features/omni-kit/state/automation/auto-bs'
import type { OmniAutomationPartialTakeProfitFormState } from 'features/omni-kit/state/automation/partial-take-profit'
import type { OmniAutomationStopLossFormState } from 'features/omni-kit/state/automation/stop-loss'
import type { OmniAutomationTrailingStopLossFormState } from 'features/omni-kit/state/automation/trailing-stop-loss'
import type {
AutomationMetadataValues,
OmniAutomationSimulationResponse,
} from 'features/omni-kit/types'
import type { SupportedLambdaProtocols } from 'helpers/triggers'
import type { LendingProtocol } from 'lendingProtocols'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import BigNumber from 'bignumber.js'
import { lambdaPriceDenomination } from 'features/aave/constants'
import { AutomationFeatures } from 'features/automation/common/types'
import type { OmniCardLtvAutomationData } from 'features/omni-kit/components/details-section'
import type { AutomationMetadataValues } from 'features/omni-kit/contexts'
import type { AutomationMetadataValues } from 'features/omni-kit/types'

export const getOmniCardLtvAutomationParams = ({
collateralAmount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { ethers } from 'ethers'
import { AutomationFeatures } from 'features/automation/common/types'
import type { OmniGetAutomationDataParams } from 'features/omni-kit/automation/helpers'
import { getOmniAutomationParameters } from 'features/omni-kit/automation/helpers'
import type { OmniAutomationSimulationResponse } from 'features/omni-kit/contexts'
import { useOmniGeneralContext, useOmniProductContext } from 'features/omni-kit/contexts'
import type { OmniTxData } from 'features/omni-kit/hooks'
import { estimateOmniGas$, sendOmniTransaction$ } from 'features/omni-kit/observables'
import type { OmniAutomationSimulationResponse } from 'features/omni-kit/types'
import { handleTransaction } from 'helpers/handleTransaction'
import { useObservable } from 'helpers/observableHook'
import { useDebouncedEffect } from 'helpers/useDebouncedEffect'
Expand Down
Loading

0 comments on commit c21717a

Please sign in to comment.