Skip to content

Commit

Permalink
Merge pull request hashgraph#2141 from hashgraph/feature/2100
Browse files Browse the repository at this point in the history
Feature/2100
  • Loading branch information
simvalery authored May 15, 2023
2 parents 414ec91 + b076628 commit 51f71d2
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions auth-service/src/api/account-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
MessageResponse,
MessageError,
Logger,
DataBaseHelper, NatsService, Singleton
DataBaseHelper, NatsService, Singleton,
SecretManager
} from '@guardian/common';
import {
AuthEvents, UserRole,
Expand All @@ -27,7 +28,6 @@ import {
IStandardRegistryUserResponse,
IGetUsersByAccountMessage, GenerateUUIDv4
} from '@guardian/interfaces';
import { SecretManager } from '@guardian/common/dist/secret-manager';

/**
* Account service
Expand Down
5 changes: 2 additions & 3 deletions auth-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ import {
DataBaseHelper,
Migration,
COMMON_CONNECTION_CONFIG,
LargePayloadContainer
LargePayloadContainer,
SecretManager, OldSecretManager
} from '@guardian/common';
import { ApplicationStates } from '@guardian/interfaces';
import { MikroORM } from '@mikro-orm/core';
import { MongoDriver } from '@mikro-orm/mongodb';
import { InitializeVault } from './vaults';
import { ImportKeysFromDatabase } from '@helpers/import-keys-from-database';
import process from 'process';
import { SecretManager } from '@guardian/common/dist/secret-manager';
import { OldSecretManager } from '@guardian/common/dist/secret-manager/old-style/old-secret-manager';
import { startMetricsServer } from './utils/metrics';

Promise.all([
Expand Down
3 changes: 2 additions & 1 deletion common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export * from './interfaces';
export * from './entity';
export * from './document-loader';
export * from './hedera-modules';
export * from './database-modules'
export * from './database-modules';
export * from './secret-manager';
export const entities = Object.values(ent);
3 changes: 2 additions & 1 deletion common/src/secret-manager/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './secret-manager-base';
export * from './secret-manager-config-base';
export * from './secret-manager';
export * from './secret-manager-config';
export * from './secret-manager-config';
export * from './old-style/old-secret-manager'
4 changes: 2 additions & 2 deletions guardian-service/src/api/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
Topic,
Settings,
Environment,
Workers
Workers,
SecretManager
} from '@guardian/common';
import { MessageAPI, CommonSettings } from '@guardian/interfaces';
import { AccountId, PrivateKey } from '@hashgraph/sdk';
import { SecretManager } from '@guardian/common/dist/secret-manager';

/**
* Connecting to the message broker methods of working with root address book.
Expand Down
4 changes: 2 additions & 2 deletions guardian-service/src/api/demo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
Policy,
Settings,
DatabaseServer,
Workers
Workers,
SecretManager
} from '@guardian/common';
import { MessageAPI, WorkerTaskType } from '@guardian/interfaces';
import { emptyNotifier, initNotifier, INotifier } from '@helpers/notifier';
import { SecretManager } from '@guardian/common/dist/secret-manager';

/**
* Demo key
Expand Down
5 changes: 2 additions & 3 deletions guardian-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import {
TopicMemo,
TransactionLogger,
TransactionLogLvl,
Workers, LargePayloadContainer
Workers, LargePayloadContainer,
SecretManager, OldSecretManager
} from '@guardian/common';
import { ApplicationStates, WorkerTaskType } from '@guardian/interfaces';
import { AccountId, PrivateKey, TopicId } from '@hashgraph/sdk';
Expand All @@ -53,8 +54,6 @@ import { GridFSBucket } from 'mongodb';
import { tagsAPI } from '@api/tag.service';
import { setDefaultSchema } from '@api/helpers/schema-helper';
import { demoAPI } from '@api/demo.service';
import { SecretManager } from '@guardian/common/dist/secret-manager';
import { OldSecretManager } from '@guardian/common/dist/secret-manager/old-style/old-secret-manager';
import { themeAPI } from '@api/theme.service';
import { startMetricsServer } from './utils/metrics';

Expand Down
2 changes: 1 addition & 1 deletion policy-service/src/api/policy-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Workers,
IPFS,
DatabaseServer, LargePayloadContainer,
OldSecretManager
} from '@guardian/common';
import { MikroORM } from '@mikro-orm/core';
import { MongoDriver } from '@mikro-orm/mongodb';
Expand All @@ -21,7 +22,6 @@ import process from 'process';
import { CommonVariables } from '@helpers/common-variables';
import { PolicyEvents } from '@guardian/interfaces';
import { GridFSBucket } from 'mongodb';
import { OldSecretManager } from '@guardian/common/dist/secret-manager/old-style/old-secret-manager';
import { SynchronizationService } from '@policy-engine/multi-policy-service';

const {
Expand Down
1 change: 1 addition & 0 deletions worker-service/configs/.env.worker
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ IPFS_STORAGE_API_KEY="..."
IPFS_NODE_ADDRESS="http://localhost:5002"
MAX_HEDERA_TIMEOUT="600"
MQ_MAX_PAYLOAD="1048576"
#HEDERA_MAX_CHUNKS="20"
#LOG_LEVEL="2"
#MAX_TRANSACTION_FEE="10"
#MQ_MESSAGE_CHUNK=5000000
1 change: 1 addition & 0 deletions worker-service/configs/.env.worker.develop
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ IPFS_STORAGE_API_KEY="..."
IPFS_NODE_ADDRESS="http://localhost:5002"
MAX_HEDERA_TIMEOUT="600"
MQ_MAX_PAYLOAD="1048576"
#HEDERA_MAX_CHUNKS="20"
#LOG_LEVEL="2"
#MAX_TRANSACTION_FEE="10"
#MQ_MESSAGE_CHUNK=5000000
1 change: 1 addition & 0 deletions worker-service/configs/.env.worker.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ IPFS_STORAGE_API_KEY="..."
IPFS_NODE_ADDRESS="http://localhost:5002"
MAX_HEDERA_TIMEOUT=""
MQ_MAX_PAYLOAD=""
#HEDERA_MAX_CHUNKS="20"
#LOG_LEVEL="2"
#MAX_TRANSACTION_FEE="10"
#MQ_MESSAGE_CHUNK=5000000
4 changes: 4 additions & 0 deletions worker-service/src/api/helpers/hedera-sdk-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,8 @@ export class HederaSDKHelper {
* @param topicId Topic identifier
* @param message Message to publish
*
* @param privateKey
* @param transactionMemo
* @returns Message timestamp
*/
@timeout(HederaSDKHelper.MAX_TIMEOUT)
Expand All @@ -878,9 +880,11 @@ export class HederaSDKHelper {
): Promise<string> {
const client = this.client;

const maxChunks = (process.env.HEDERA_MAX_CHUNKS) ? parseInt(process.env.HEDERA_MAX_CHUNKS, 10) : 20;
let messageTransaction: Transaction = new TopicMessageSubmitTransaction({
topicId,
message,
maxChunks
}).setMaxTransactionFee(MAX_FEE);

if (transactionMemo) {
Expand Down
4 changes: 2 additions & 2 deletions worker-service/src/api/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
MessageBrokerChannel,
MessageResponse,
NatsService,
ValidateConfiguration
ValidateConfiguration,
SecretManager
} from '@guardian/common';
import {
ExternalMessageEvents, GenerateUUIDv4,
Expand All @@ -19,7 +20,6 @@ import { AccountId, ContractFunctionParameters, PrivateKey, TokenId } from '@has
import { HederaUtils } from './helpers/utils';
import axios from 'axios';
import process from 'process';
import { SecretManager } from '@guardian/common/dist/secret-manager';

/**
* Sleep helper
Expand Down
5 changes: 2 additions & 3 deletions worker-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import {
ApplicationState, LargePayloadContainer,
Logger,
MessageBrokerChannel,
ValidateConfiguration
ValidateConfiguration,
SecretManager, OldSecretManager
} from '@guardian/common';
import { Worker } from './api/worker';
import { HederaSDKHelper } from './api/helpers/hedera-sdk-helper';
import { ApplicationStates } from '@guardian/interfaces';
import { decode } from 'jsonwebtoken';
import * as process from 'process';
import { OldSecretManager } from '@guardian/common/dist/secret-manager/old-style/old-secret-manager';
import { SecretManager } from '@guardian/common/dist/secret-manager';

Promise.all([
MessageBrokerChannel.connect('WORKERS_SERVICE')
Expand Down

0 comments on commit 51f71d2

Please sign in to comment.