diff --git a/libs/common/src/common.constant.ts b/libs/common/src/common.constant.ts index fab631e47..09e50534d 100644 --- a/libs/common/src/common.constant.ts +++ b/libs/common/src/common.constant.ts @@ -160,6 +160,9 @@ export enum CommonConstants { // EVENTS EVENT_AUDIT = 'audit_event', + // POLYGON KEYWORDS + POLYGON = 'polygon', + // DOMAIN EVENTS DOMAIN_EVENT_SCHEMA_CREATED = 'Schema Created', DOMAIN_EVENT_CRED_DEF_CREATED = 'Cred-Def Created', diff --git a/libs/common/src/common.utils.ts b/libs/common/src/common.utils.ts index 51a2f8345..ed84515c3 100644 --- a/libs/common/src/common.utils.ts +++ b/libs/common/src/common.utils.ts @@ -1,6 +1,7 @@ import { NotFoundException } from '@nestjs/common'; import * as dotenv from 'dotenv'; import { ResponseMessages } from './response-messages'; +import { CommonConstants } from './common.constant'; dotenv.config(); /* eslint-disable camelcase */ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type @@ -59,13 +60,14 @@ export function convertUrlToDeepLinkUrl(url: string): string { return deepLinkUrl; } -export const networkNamespace = (did):string => { +export const networkNamespace = (did: string): string => { // Split the DID into segments using the colon as a delimiter const segments = did.split(':'); - const containsTestnet = segments.some(segment => segment.includes('polygon')); - if (containsTestnet) { - return `${segments[1]}:${segments[2]}`; - } else { - return segments[1]; + const hasPolygon = segments.some(segment => segment.includes(CommonConstants.POLYGON)); + const hasTestnet = segments.some(segment => segment.includes(CommonConstants.TESTNET)); + if (hasPolygon) { + return hasTestnet ? `${segments[1]}:${segments[2]}` : `${segments[1]}:${CommonConstants.MAINNET}`; } + + return segments[1]; }; \ No newline at end of file diff --git a/libs/prisma-service/prisma/data/credebl-master-table.json b/libs/prisma-service/prisma/data/credebl-master-table.json index 9e0fd86b0..f974f7304 100644 --- a/libs/prisma-service/prisma/data/credebl-master-table.json +++ b/libs/prisma-service/prisma/data/credebl-master-table.json @@ -135,6 +135,15 @@ "nymTxnEndpoint": "", "indyNamespace": "polygon:testnet" }, + { + "name": "Polygon Mainnet", + "networkType": "mainnet", + "poolConfig": "", + "isActive": true, + "networkString": "mainnet", + "nymTxnEndpoint": "", + "indyNamespace": "polygon:mainnet" + }, { "name": "NA", "networkType": "NA",