From 04003a2de0a9ba6ea2d5318b35ffbbfb60ed0ea4 Mon Sep 17 00:00:00 2001 From: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Date: Sat, 16 Nov 2024 19:06:43 +0100 Subject: [PATCH] Add westend (#246) * add westend * complete westend support --- .env.example | 2 ++ next.config.js | 4 ++-- .../Elements/Selectors/NetworkSelector/index.tsx | 16 ++++++---------- src/consts/index.ts | 4 ++-- src/utils/functions/timestamps.ts | 2 ++ src/utils/sale/index.ts | 3 ++- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.env.example b/.env.example index 36d6d8ee..622d9fbb 100644 --- a/.env.example +++ b/.env.example @@ -16,6 +16,7 @@ WS_REGIONX_PASEO_CHAIN="WSS endpoint of the regionx paseo chain" POLKADOT_CORETIME_INDEXER="Subquery indexer for Polkadot Coretime" KUSAMA_CORETIME_INDEXER="Subquery indexer for Kusama Coretime" PASEO_CORETIME_INDEXER="Subquery indexer for Paseo Coretime" +WESTEND_CORETIME_INDEXER="Subquery indexer for Westend Coretime" ROCOCO_CORETIME_INDEXER="Subquery indexer for Rococo Coretime" REGIONX_PASEO_INDEXER="Subquery indexer for RegionX Paseo" COCOS_INDEXER="Subquery indexer for RegionX Cocos" @@ -23,6 +24,7 @@ COCOS_INDEXER="Subquery indexer for RegionX Cocos" POLKADOT_CORETIME_DICT="Subquery dictionary for Polkadot Coretime" KUSAMA_CORETIME_DICT="Subquery dictionary for Kusama Coretime" PASEO_CORETIME_DICT="Subquery dictionary for Paseo Coretime" +WESTEND_CORETIME_DICT="Subquery dictionary for Westend Coretime" ROCOCO_CORETIME_DICT="Subquery dictionary for Rococo Coretime" EXPERIMENTAL=false diff --git a/next.config.js b/next.config.js index 311abe04..9fe72123 100644 --- a/next.config.js +++ b/next.config.js @@ -17,14 +17,14 @@ const nextConfig = { POLKADOT_CORETIME_INDEXER: process.env.POLKADOT_CORETIME_INDEXER || '', KUSAMA_CORETIME_INDEXER: process.env.KUSAMA_CORETIME_INDEXER || '', PASEO_CORETIME_INDEXER: process.env.PASEO_CORETIME_INDEXER || '', + WESTEND_CORETIME_INDEXER: process.env.WESTEND_CORETIME_INDEXER || '', ROCOCO_CORETIME_INDEXER: process.env.ROCOCO_CORETIME_INDEXER || '', - SUBSCAN_CORETIME_WESTEND_INDEXER: process.env.SUBSCAN_CORETIME_WESTEND_INDEXER || '', POLKADOT_CORETIME_DICT: process.env.POLKADOT_CORETIME_DICT || '', KUSAMA_CORETIME_DICT: process.env.KUSAMA_CORETIME_DICT || '', PASEO_CORETIME_DICT: process.env.PASEO_CORETIME_DICT || '', + WESTEND_CORETIME_DICT: process.env.WESTEND_CORETIME_DICT || '', ROCOCO_CORETIME_DICT: process.env.ROCOCO_CORETIME_DICT || '', - SUBSCAN_CORETIME_WESTEND_DICT: process.env.SUBSCAN_CORETIME_WESTEND_DICT || '', WS_REGIONX_COCOS_CHAIN: process.env.WS_REGIONX_COCOS_CHAIN || '', WS_REGIONX_PASEO_CHAIN: process.env.WS_REGIONX_PASEO_CHAIN || '', diff --git a/src/components/Elements/Selectors/NetworkSelector/index.tsx b/src/components/Elements/Selectors/NetworkSelector/index.tsx index e2d0191b..f2fb205e 100644 --- a/src/components/Elements/Selectors/NetworkSelector/index.tsx +++ b/src/components/Elements/Selectors/NetworkSelector/index.tsx @@ -6,6 +6,7 @@ import { Kusama as KusamaIcon, Paseo as PaseoIcon, Polkadot as PolkadotIcon, + Westend as WestendIcon, } from '@/assets/networks/relay'; import { useNetwork } from '@/contexts/network'; import { NetworkType } from '@/models'; @@ -41,16 +42,11 @@ export const NetworkSelector = () => { label: 'Paseo', icon: PaseoIcon, }, - // { - // value: NetworkType.ROCOCO, - // label: 'Rococo', - // icon: RococoIcon, - // }, - // { - // value: NetworkType.WESTEND, - // label: 'Westend', - // icon: WestendIcon, - // }, + { + value: NetworkType.WESTEND, + label: 'Westend', + icon: WestendIcon, + }, ]; return ( diff --git a/src/consts/index.ts b/src/consts/index.ts index 057081bc..c1b558bd 100644 --- a/src/consts/index.ts +++ b/src/consts/index.ts @@ -6,8 +6,8 @@ export const API_CORETIME_INDEXER = { [NetworkType.POLKADOT]: process.env.POLKADOT_CORETIME_INDEXER ?? '', [NetworkType.KUSAMA]: process.env.KUSAMA_CORETIME_INDEXER ?? '', [NetworkType.PASEO]: process.env.PASEO_CORETIME_INDEXER ?? '', + [NetworkType.WESTEND]: process.env.WESTEND_CORETIME_INDEXER ?? '', [NetworkType.ROCOCO]: process.env.ROCOCO_CORETIME_INDEXER ?? '', - [NetworkType.WESTEND]: process.env.SUBSCAN_CORETIME_WESTEND_INDEXER ?? '', [NetworkType.NONE]: '', }; @@ -15,8 +15,8 @@ export const API_CORETIME_DICT = { [NetworkType.POLKADOT]: process.env.POLKADOT_CORETIME_DICT ?? '', [NetworkType.KUSAMA]: process.env.KUSAMA_CORETIME_DICT ?? '', [NetworkType.PASEO]: process.env.PASEO_CORETIME_DICT ?? '', + [NetworkType.WESTEND]: process.env.WESTEND_CORETIME_DICT ?? '', [NetworkType.ROCOCO]: process.env.ROCOCO_CORETIME_DICT ?? '', - [NetworkType.WESTEND]: process.env.SUBSCAN_CORETIME_WESTEND_DICT ?? '', [NetworkType.NONE]: '', }; diff --git a/src/utils/functions/timestamps.ts b/src/utils/functions/timestamps.ts index 454db3e3..1dd042e6 100644 --- a/src/utils/functions/timestamps.ts +++ b/src/utils/functions/timestamps.ts @@ -59,6 +59,8 @@ export const getBlockTime = (network: NetworkType): number => { return 12 * 1000; case NetworkType.PASEO: return 12 * 1000; + case NetworkType.WESTEND: + return 6 * 1000; default: return 0; } diff --git a/src/utils/sale/index.ts b/src/utils/sale/index.ts index 689b25f9..de9e621b 100644 --- a/src/utils/sale/index.ts +++ b/src/utils/sale/index.ts @@ -33,6 +33,7 @@ export const isNewPricing = (now: number, network: NetworkType): boolean => { (network == NetworkType.KUSAMA && now >= 485639) || (network == NetworkType.ROCOCO && now >= 1796462) || network === NetworkType.POLKADOT || - network === NetworkType.PASEO + network === NetworkType.PASEO || + network === NetworkType.WESTEND ); };