Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client type #21

Open
wants to merge 3 commits into
base: xumm
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/queues/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/lib/txhandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ export class SologenicTxHandler extends EventEmitter {
{}
);

/**
* Type of client application using Sologenic Tx Handler
*/
protected clientType: string = '';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default should not be mobile. Leave it as an empty string

/**
* Constructor for an instance of sologenic tx handler.
*
Expand Down Expand Up @@ -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;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the proposed scenario you can just use:
if (typeof clientOptions.clientType !== 'undefined') {
this.clientType = sologenicOptions.clientType;
}


} catch (error) {
throw new SologenicError('1001', error);
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './queues';
export * from './txhandler';
export * from './utils';
export * from './xrpl';
export * from './txhandleroptions';
10 changes: 0 additions & 10 deletions src/types/queues.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ISologenicTxSigner } from "./txhandler";

export interface IQueue {
add(queue: string, data: MQTX, id?: string): Promise<MQTX>;
Expand All @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions src/types/txhandleroptions.ts
Original file line number Diff line number Diff line change
@@ -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;
}
1 change: 1 addition & 0 deletions src/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ export interface IFaucet {
account: IFaucetAccount;
balance: number;
}