Skip to content

Commit

Permalink
update: api crosschain (#2233)
Browse files Browse the repository at this point in the history
* improve save ack ann

* update api domain

* update state
  • Loading branch information
nguyenhoaidanh authored Sep 14, 2023
1 parent 72e35a9 commit 5434fd7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/components/Announcement/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useNavigate } from 'react-router-dom'
import AnnouncementApi from 'services/announcement'

import { AnnouncementTemplatePopup, PopupContentAnnouncement, PopupItemType } from 'components/Announcement/type'
import { TIMES_IN_SECS } from 'constants/index'
import { useActiveWeb3React } from 'hooks'
import { useChangeNetwork } from 'hooks/web3/useChangeNetwork'
import { useAppDispatch } from 'state/hooks'
Expand All @@ -13,11 +14,15 @@ export const getAnnouncementsAckMap = () => JSON.parse(localStorage[LsKey] || '{

export const ackAnnouncementPopup = (id: string | number) => {
const announcementsMap = getAnnouncementsAckMap()
const entries = Object.entries(announcementsMap).filter(
// keep only ids that was added in the last 30 days
([_, value]) => typeof value === 'number' && Date.now() - value < TIMES_IN_SECS.ONE_DAY * 30 * 1000,
)
localStorage.setItem(
LsKey,
JSON.stringify({
...announcementsMap,
[id]: '1',
...Object.fromEntries(entries),
[id]: Date.now(),
}),
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/constants/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,6 @@ export const MOCK_ACCOUNT_SOLANA = mock[1] ?? ''
const isSupportTestNet = ENV_LEVEL < ENV_TYPE.PROD && new URLSearchParams(window.location.search).get('test')
export const CROSS_CHAIN_CONFIG = {
AXELAR_SCAN_URL: isSupportTestNet ? 'https://testnet.axelarscan.io/gmp/' : 'https://axelarscan.io/gmp/',
API_DOMAIN: isSupportTestNet ? 'https://testnet.api.0xsquid.com' : 'https://api.0xsquid.com',
API_DOMAIN: isSupportTestNet ? 'https://testnet.api.0xsquid.com' : 'https://api.squidrouter.com',
INTEGRATOR_ID: 'kyberswap-api',
}
2 changes: 1 addition & 1 deletion src/hooks/useChainsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export enum ChainState {
NEW = 'new',
ACTIVE = 'active',
INACTIVE = 'inactive',
MAINTENANCE = 'maintainain',
MAINTENANCE = 'maintained',
}

export type ChainStateMap = { [chain in ChainId]: ChainState }
Expand Down

0 comments on commit 5434fd7

Please sign in to comment.