diff --git a/src/lib/queues/index.ts b/src/lib/queues/index.ts index f30695c..f1b6ef4 100644 --- a/src/lib/queues/index.ts +++ b/src/lib/queues/index.ts @@ -3,8 +3,8 @@ import { IQueue, QUEUE_TYPE_STXMQ_REDIS, QUEUE_TYPE_STXMQ_HASH, - TransactionHandlerOptions } from '../../types/queues'; +import { TransactionHandlerOptions } from '../../types/txhandleroptions'; /** * Import redis queue implementation diff --git a/src/lib/txhandler.ts b/src/lib/txhandler.ts index abd0a7c..bf5cc98 100644 --- a/src/lib/txhandler.ts +++ b/src/lib/txhandler.ts @@ -97,6 +97,11 @@ export class SologenicTxHandler extends EventEmitter { {} ); + /** + * Type of client application using Sologenic Tx Handler + */ + protected clientType: string = ''; + /** * Constructor for an instance of sologenic tx handler. * @@ -187,6 +192,14 @@ export class SologenicTxHandler extends EventEmitter { if (typeof sologenicOptions.signingMechanism !== 'undefined') this.signingMechanism = sologenicOptions.signingMechanism; + + /** + * Initialize client type + */ + + if (typeof sologenicOptions.clientType !== 'undefined') { + this.clientType = sologenicOptions.clientType; + } } catch (error) { throw new SologenicError('1001', error); diff --git a/src/types/index.ts b/src/types/index.ts index 252f65c..dcb4244 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -3,3 +3,4 @@ export * from './queues'; export * from './txhandler'; export * from './utils'; export * from './xrpl'; +export * from './txhandleroptions'; \ No newline at end of file diff --git a/src/types/queues.ts b/src/types/queues.ts index 4e1f21f..7f27a32 100644 --- a/src/types/queues.ts +++ b/src/types/queues.ts @@ -1,4 +1,3 @@ -import { ISologenicTxSigner } from "./txhandler"; export interface IQueue { add(queue: string, data: MQTX, id?: string): Promise; @@ -22,15 +21,6 @@ export interface RedisTransactionHandlerOptions { db?: number; } -export interface TransactionHandlerOptions { - queueType?: string; - clearCache?: boolean; - redis?: RedisTransactionHandlerOptions - hash?: HashTransactionHandlerOptions - maximumTimeToLive?: number; - signingMechanism?: ISologenicTxSigner; -} - export interface MQTX { id: string; data: any; diff --git a/src/types/txhandleroptions.ts b/src/types/txhandleroptions.ts new file mode 100644 index 0000000..cade2ff --- /dev/null +++ b/src/types/txhandleroptions.ts @@ -0,0 +1,12 @@ +import { ISologenicTxSigner } from "./txhandler"; +import { RedisTransactionHandlerOptions, HashTransactionHandlerOptions } from "./queues"; + +export interface TransactionHandlerOptions { + queueType?: string; + clearCache?: boolean; + redis?: RedisTransactionHandlerOptions; + hash?: HashTransactionHandlerOptions; + maximumTimeToLive?: number; + signingMechanism?: ISologenicTxSigner; + clientType?: string; +} \ No newline at end of file diff --git a/src/types/utils.ts b/src/types/utils.ts index 333de55..4cf0063 100644 --- a/src/types/utils.ts +++ b/src/types/utils.ts @@ -17,3 +17,4 @@ export interface IFaucet { account: IFaucetAccount; balance: number; } +