-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(hooks-store): use readable string as hook-dapp id (#5093)
Co-authored-by: Anxo Rodriguez <[email protected]>
- Loading branch information
Showing
3 changed files
with
41 additions
and
31 deletions.
There are no files selected for viewing
41 changes: 18 additions & 23 deletions
41
apps/cowswap-frontend/src/modules/hooksStore/hookRegistry.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
import { hookDappsRegistry } from '@cowprotocol/hook-dapp-lib' | ||
import { HookDappBase, hookDappsRegistry } from '@cowprotocol/hook-dapp-lib' | ||
|
||
import { AirdropHookApp } from './dapps/AirdropHookApp' | ||
import { BuildHookApp } from './dapps/BuildHookApp' | ||
import { ClaimGnoHookApp } from './dapps/ClaimGnoHookApp' | ||
import { PermitHookApp } from './dapps/PermitHookApp' | ||
import { HookDapp } from './types/hooks' | ||
import { HookDapp, HookDappInternal } from './types/hooks' | ||
|
||
export const ALL_HOOK_DAPPS = [ | ||
{ | ||
...hookDappsRegistry.BUILD_CUSTOM_HOOK, | ||
component: (props) => <BuildHookApp {...props} />, | ||
}, | ||
{ | ||
...hookDappsRegistry.CLAIM_GNO_FROM_VALIDATORS, | ||
component: (props) => <ClaimGnoHookApp {...props} />, | ||
}, | ||
{ | ||
...hookDappsRegistry.PERMIT_TOKEN, | ||
component: (props) => <PermitHookApp {...props} />, | ||
}, | ||
{ | ||
...hookDappsRegistry.CLAIM_COW_AIRDROP, | ||
component: (props) => <AirdropHookApp {...props} />, | ||
}, | ||
hookDappsRegistry.COW_AMM_WITHDRAW, | ||
hookDappsRegistry.CLAIM_LLAMAPAY_VESTING, | ||
hookDappsRegistry.CREATE_LLAMAPAY_VESTING | ||
] as HookDapp[] | ||
const HOOK_DAPPS_OVERRIDES: Record<string, Partial<HookDappInternal>> = { | ||
BUILD_CUSTOM_HOOK: { component: (props) => <BuildHookApp {...props} /> }, | ||
CLAIM_GNO_FROM_VALIDATORS: { component: (props) => <ClaimGnoHookApp {...props} /> }, | ||
PERMIT_TOKEN: { component: (props) => <PermitHookApp {...props} /> }, | ||
CLAIM_COW_AIRDROP: { component: (props) => <AirdropHookApp {...props} /> }, | ||
} | ||
|
||
export const ALL_HOOK_DAPPS = Object.keys(hookDappsRegistry).map((id) => { | ||
const item = (hookDappsRegistry as Record<string, Omit<HookDappBase, 'id'>>)[id] | ||
|
||
return { | ||
...item, | ||
...HOOK_DAPPS_OVERRIDES[id], | ||
id, | ||
} | ||
}) as HookDapp[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters