Skip to content

Commit

Permalink
update txnHash Var
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratap2018 committed Aug 8, 2024
1 parent 5f99793 commit 8280549
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
27 changes: 12 additions & 15 deletions src/schema/services/schema.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,13 @@ export class SchemaService {
schemaId: signedSchema.id,
appId: appDetail.appId,
authorDid: author,
transactionHash: registeredSchema['transactionHash']
? registeredSchema['transactionHash']
: '',
transactionHash: '',
});
Logger.log('create() method: ends', 'SchemaService');

return {
schemaId: signedSchema.id,
transactionHash: registeredSchema['transactionHash']
? registeredSchema['transactionHash']
: '',
transactionHash: '',
};
} catch (error) {
Logger.error(
Expand Down Expand Up @@ -206,7 +202,7 @@ export class SchemaService {
async registerSchema(
registerSchemaDto: RegisterSchemaDto,
appDetail,
): Promise<{ transactionHash: string }> {
): Promise<any> {
Logger.log('registerSchema() method: starts....', 'SchemaService');

const { edvId, kmsId } = appDetail;
Expand All @@ -227,32 +223,33 @@ export class SchemaService {
}

const appMenemonic = await getAppMenemonic(kmsId);
const namespace = Namespace.testnet;
// const namespace = Namespace.testnet;
Logger.log('registerSchema() method: initialising hypersignSchema');

const hypersignSchema = await this.schemaSSIservice.initiateHypersignSchema(
appMenemonic,
namespace,
);
const registeredSchema = {} as { transactionHash: string };
// const hypersignSchema = await this.schemaSSIservice.initiateHypersignSchema(
// appMenemonic,
// namespace,
// );
schemaDocument['proof'] = schemaProof;
Logger.log('registerSchema() method: registering schema on the blockchain');
try {
// registeredSchema = await hypersignSchema.register({
// schema: schemaDocument,
// });

await this.txnService.sendSchemaTxn(
const ack = await this.txnService.sendSchemaTxn(
registerSchemaDto.schemaDocument,
registerSchemaDto.schemaProof,
appMenemonic,
);
if (ack == true) {
}
} catch (e) {
Logger.error('registerSchema() method: Error while registering schema');
throw new BadRequestException([e.message]);
}
Logger.log('registerSchema() method: ends....', 'SchemaService');

return { transactionHash: registeredSchema?.transactionHash };
return { status: 'Transaction sent' };
}
}
2 changes: 1 addition & 1 deletion src/tx-send-module/tx-send-module.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,6 @@ export class TxSendModuleService {
);

await this.invokeTxnController(address, granteeMnemonic);
console.log(sendToQueue1);
return sendToQueue1;
}
}

0 comments on commit 8280549

Please sign in to comment.