From 0a218f1a49f5bfc4c368d102cb19e0044cb3e807 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 29 May 2024 02:57:39 +0200 Subject: [PATCH] Set up Pontus-X devnet and testnet --- .../components/LayerPicker/LayerDetails.tsx | 11 +++++-- src/app/components/Search/search-utils.ts | 9 +++++- src/app/hooks/useAccountMetadata.ts | 7 +++-- .../LearningMaterials.tsx | 30 +++++++++++++++---- src/app/utils/content.tsx | 3 +- src/app/utils/faucet-links.ts | 5 +++- src/app/utils/route-utils.ts | 2 ++ src/config.ts | 27 +++++++++++++++-- src/locales/en/translation.json | 26 +++++++++++++--- src/types/layers.ts | 5 ++-- 10 files changed, 102 insertions(+), 23 deletions(-) diff --git a/src/app/components/LayerPicker/LayerDetails.tsx b/src/app/components/LayerPicker/LayerDetails.tsx index 8bd7d9156..2a39206bc 100644 --- a/src/app/components/LayerPicker/LayerDetails.tsx +++ b/src/app/components/LayerPicker/LayerDetails.tsx @@ -68,13 +68,20 @@ const getDetails = (t: TFunction): Details => ({ chainDecimalId: '23295', docs: docs.sapphire, }, - [Layer.pontusx]: { - description: t('layerPicker.testnet.pontusx'), + [Layer.pontusxdev]: { + description: t('layerPicker.testnet.pontusxdev'), rpcHttp: 'https://pontusx.not.si:443', chainHexId: '0x7ec8', chainDecimalId: '32456', docs: docs.pontusx1, }, + [Layer.pontusx]: { + description: t('layerPicker.testnet.pontusxtest'), + rpcHttp: 'https://pontusx.not.si:443', + chainHexId: '0x7ec9', + chainDecimalId: '32457', + docs: docs.pontusx1, + }, }, }) diff --git a/src/app/components/Search/search-utils.ts b/src/app/components/Search/search-utils.ts index 6cc4fd520..bf8f12564 100644 --- a/src/app/components/Search/search-utils.ts +++ b/src/app/components/Search/search-utils.ts @@ -33,6 +33,7 @@ export const searchSuggestionTerms = { suggestedTokenFragment: 'mock', }, cipher: undefined, + pontusxdev: undefined, pontusx: undefined, consensus: undefined, }, @@ -50,12 +51,18 @@ export const searchSuggestionTerms = { suggestedTokenFragment: 'USD', }, cipher: undefined, - pontusx: { + pontusxdev: { suggestedBlock: '390632', suggestedTransaction: '0x244f71bcc67a0359c0d1e417b302ec3b358193769399e71f0112c58135f0fc82', suggestedAccount: '0xC09c6A1d5538E7ed135d6146241c8da11e92130B', suggestedTokenFragment: 'Ocean', }, + pontusx: { + suggestedBlock: '390632', // TODO + suggestedTransaction: '0x244f71bcc67a0359c0d1e417b302ec3b358193769399e71f0112c58135f0fc82', // TODO + suggestedAccount: '0xC09c6A1d5538E7ed135d6146241c8da11e92130B', // TODO + suggestedTokenFragment: 'Ocean', // TODO + }, consensus: undefined, }, } satisfies SpecifiedPerEnabledLayer diff --git a/src/app/hooks/useAccountMetadata.ts b/src/app/hooks/useAccountMetadata.ts index f101b5ec2..9ee2df82e 100644 --- a/src/app/hooks/useAccountMetadata.ts +++ b/src/app/hooks/useAccountMetadata.ts @@ -12,7 +12,7 @@ import { getOasisAddress } from '../utils/helpers' * since this function also includes caching. */ export const useAccountMetadata = (scope: SearchScope, address: string): AccountMetadataInfo => { - const isPontusX = scope.layer === Layer.pontusx + const isPontusX = scope.layer === Layer.pontusx || scope.layer === Layer.pontusxdev const pontusXData = usePontusXAccountMetadata(address, { enabled: isPontusX }) const oasisData = useOasisAccountMetadata(scope.network, scope.layer, getOasisAddress(address), { enabled: !isPontusX, @@ -24,11 +24,12 @@ export const useSearchForAccountsByName = ( scope: SearchScope, nameFragment = '', ): AccountNameSearchResults => { - const isValidPontusXSearch = scope.layer === Layer.pontusx && !!nameFragment + const isPontusX = scope.layer === Layer.pontusx || scope.layer === Layer.pontusxdev + const isValidPontusXSearch = isPontusX && !!nameFragment const pontusXResults = useSearchForPontusXAccountsByName(scope.network, nameFragment, { enabled: isValidPontusXSearch, }) - const isValidOasisSearch = scope.layer !== Layer.pontusx && !!nameFragment + const isValidOasisSearch = !isPontusX && !!nameFragment const oasisResults = useSearchForOasisAccountsByName(scope.network, scope.layer, nameFragment, { enabled: isValidOasisSearch, }) diff --git a/src/app/pages/ParatimeDashboardPage/LearningMaterials.tsx b/src/app/pages/ParatimeDashboardPage/LearningMaterials.tsx index 50c215be0..aa04be45f 100644 --- a/src/app/pages/ParatimeDashboardPage/LearningMaterials.tsx +++ b/src/app/pages/ParatimeDashboardPage/LearningMaterials.tsx @@ -62,6 +62,7 @@ const getContent = (t: TFunction) => { }, }, [Layer.cipher]: undefined, + [Layer.pontusxdev]: undefined, [Layer.pontusx]: undefined, }, [Network.testnet]: { @@ -100,20 +101,37 @@ const getContent = (t: TFunction) => { }, }, [Layer.cipher]: undefined, + [Layer.pontusxdev]: { + primary: { + description: t('learningMaterials.pontusxdevnet.1.description'), + header: t('learningMaterials.pontusxdevnet.1.header'), + url: docs.pontusx1, + }, + secondary: { + description: t('learningMaterials.pontusxdevnet.2.description'), + header: t('learningMaterials.pontusxdevnet.2.header'), + url: docs.pontusx2, + }, + tertiary: { + description: t('learningMaterials.pontusxdevnet.3.description'), + header: t('learningMaterials.pontusxdevnet.3.header'), + url: docs.pontusx3, + }, + }, [Layer.pontusx]: { primary: { - description: t('learningMaterials.pontusx.1.description'), - header: t('learningMaterials.pontusx.1.header'), + description: t('learningMaterials.pontusxtestnet.1.description'), + header: t('learningMaterials.pontusxtestnet.1.header'), url: docs.pontusx1, }, secondary: { - description: t('learningMaterials.pontusx.2.description'), - header: t('learningMaterials.pontusx.2.header'), + description: t('learningMaterials.pontusxtestnet.2.description'), + header: t('learningMaterials.pontusxtestnet.2.header'), url: docs.pontusx2, }, tertiary: { - description: t('learningMaterials.pontusx.2.description'), - header: t('learningMaterials.pontusx.3.header'), + description: t('learningMaterials.pontusxtestnet.3.description'), + header: t('learningMaterials.pontusxtestnet.3.header'), url: docs.pontusx3, }, }, diff --git a/src/app/utils/content.tsx b/src/app/utils/content.tsx index e71420998..bd7c3f026 100644 --- a/src/app/utils/content.tsx +++ b/src/app/utils/content.tsx @@ -9,7 +9,8 @@ export const getLayerLabels = (t: TFunction): Record => ({ [Layer.emerald]: t('common.emerald'), [Layer.sapphire]: t('common.sapphire'), [Layer.cipher]: t('common.cipher'), - [Layer.pontusx]: t('common.pontusx'), + [Layer.pontusxdev]: t('pontusx.devnet'), + [Layer.pontusx]: t('pontusx.testnet'), [Layer.consensus]: t('common.consensus'), }) diff --git a/src/app/utils/faucet-links.ts b/src/app/utils/faucet-links.ts index 65f954cf5..1bf0c5823 100644 --- a/src/app/utils/faucet-links.ts +++ b/src/app/utils/faucet-links.ts @@ -9,8 +9,11 @@ const faucetLinks: Partial = { [Layer.sapphire]: 2, [Layer.emerald]: 3, [Layer.cipher]: 4, - [Layer.pontusx]: 5, + [Layer.pontusxdev]: 5, + [Layer.pontusx]: 6, } -const hiddenLayers: Layer[] = [Layer.pontusx] +const hiddenLayers: Layer[] = [Layer.pontusxdev, Layer.pontusx] export const orderByLayer = (itemA: HasLayer, itemB: HasLayer): number => layerOrder[itemA.layer] - layerOrder[itemB.layer]