Skip to content

Commit

Permalink
Add westend (#246)
Browse files Browse the repository at this point in the history
* add westend

* complete westend support
  • Loading branch information
Szegoo authored Nov 16, 2024
1 parent 7bf255f commit 04003a2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ 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"

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
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '',
Expand Down
16 changes: 6 additions & 10 deletions src/components/Elements/Selectors/NetworkSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions src/consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ 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]: '',
};

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]: '',
};

Expand Down
2 changes: 2 additions & 0 deletions src/utils/functions/timestamps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/sale/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
};

0 comments on commit 04003a2

Please sign in to comment.