Skip to content

Commit

Permalink
hotfix:schema creation issue for polygon mainnet
Browse files Browse the repository at this point in the history
Signed-off-by: Tipu_Singh <[email protected]>
  • Loading branch information
tipusinghaw committed Oct 21, 2024
1 parent 3d38142 commit 9b245b9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions libs/common/src/common.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
14 changes: 8 additions & 6 deletions libs/common/src/common.utils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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];
};
9 changes: 9 additions & 0 deletions libs/prisma-service/prisma/data/credebl-master-table.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9b245b9

Please sign in to comment.