;
masterPubKey: any;
status: string;
- whitelist: Array<{address: string, alias: string}>;
+ whitelist: Array<{ address: string; alias: string }>;
walletClient: MeritWalletClient;
-
}
diff --git a/packages/lightwallet/common/pipes/address-error-message.pipe.ts b/packages/lightwallet/common/pipes/address-error-message.pipe.ts
index 8062bedcbb..ce83c08902 100644
--- a/packages/lightwallet/common/pipes/address-error-message.pipe.ts
+++ b/packages/lightwallet/common/pipes/address-error-message.pipe.ts
@@ -1,23 +1,19 @@
import { Pipe } from '@angular/core';
@Pipe({
- name: 'addressErrorMessage'
+ name: 'addressErrorMessage',
})
export class AddressErrorMessagePipe {
transform(value: any) {
if (!value) return;
- if (value.required)
- return 'Address or alias is required';
+ if (value.required) return 'Address or alias is required';
- if (value.minlength)
- return 'Address or alias must be at least 3 characters long';
+ if (value.minlength) return 'Address or alias must be at least 3 characters long';
- if (value.InvalidFormat)
- return 'Invalid address format';
+ if (value.InvalidFormat) return 'Invalid address format';
- if (value.AddressNotFound)
- return 'Address or alias not found';
+ if (value.AddressNotFound) return 'Address or alias not found';
console.error('Unhandled address error: ', value);
return 'Unknown error';
diff --git a/packages/lightwallet/common/pipes/address.pipe.spec.ts b/packages/lightwallet/common/pipes/address.pipe.spec.ts
index 18376cab6e..867ab29fe2 100644
--- a/packages/lightwallet/common/pipes/address.pipe.spec.ts
+++ b/packages/lightwallet/common/pipes/address.pipe.spec.ts
@@ -12,27 +12,27 @@ const ALIAS = 'ibby-demo-mac';
{{ 'mNAxzEYp7HcQCdMqstzftS548SSYx5PvWd' | address:5:true }}
{{ 'ibby-demo-mac' | address }}
{{ '@ibby-demo-mac' | address }}
- `
+ `,
})
class TestComponent {
- @ViewChild('test1') test1: ElementRef;
- @ViewChild('test2') test2: ElementRef;
- @ViewChild('test3') test3: ElementRef;
- @ViewChild('test4') test4: ElementRef;
- @ViewChild('test5') test5: ElementRef;
+ @ViewChild('test1')
+ test1: ElementRef;
+ @ViewChild('test2')
+ test2: ElementRef;
+ @ViewChild('test3')
+ test3: ElementRef;
+ @ViewChild('test4')
+ test4: ElementRef;
+ @ViewChild('test5')
+ test5: ElementRef;
}
describe('Pipes.Address', () => {
-
- let comp: TestComponent,
- instance: ComponentFixture;
+ let comp: TestComponent, instance: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [
- AddressPipe,
- TestComponent
- ]
+ declarations: [AddressPipe, TestComponent],
}).compileComponents();
instance = TestBed.createComponent(TestComponent);
comp = instance.componentInstance;
diff --git a/packages/lightwallet/common/pipes/address.pipe.ts b/packages/lightwallet/common/pipes/address.pipe.ts
index 8d2c48ff0f..c50232d6c7 100644
--- a/packages/lightwallet/common/pipes/address.pipe.ts
+++ b/packages/lightwallet/common/pipes/address.pipe.ts
@@ -2,7 +2,7 @@ import { Pipe } from '@angular/core';
import { cleanAddress, isAddress, isAlias } from '@merit/common/utils/addresses';
@Pipe({
- name: 'address'
+ name: 'address',
})
export class AddressPipe {
transform(value: string, maxAddressLength?: number, showEllipsis?: boolean) {
diff --git a/packages/lightwallet/common/pipes/alias-error-message.pipe.ts b/packages/lightwallet/common/pipes/alias-error-message.pipe.ts
index ff7a8d76c6..8cfbcfeb1b 100644
--- a/packages/lightwallet/common/pipes/alias-error-message.pipe.ts
+++ b/packages/lightwallet/common/pipes/alias-error-message.pipe.ts
@@ -1,23 +1,19 @@
import { Pipe } from '@angular/core';
@Pipe({
- name: 'aliasErrorMessage'
+ name: 'aliasErrorMessage',
})
export class AliasErrorMessagePipe {
transform(value: any) {
if (!value) return;
- if (value.required)
- return 'Alias is required';
+ if (value.required) return 'Alias is required';
- if (value.minlength)
- return 'Alias must be at least 3 characters long';
+ if (value.minlength) return 'Alias must be at least 3 characters long';
- if (value.InvalidFormat)
- return 'Invalid alias format';
+ if (value.InvalidFormat) return 'Invalid alias format';
- if (value.AliasInUse)
- return 'Alias is already in use';
+ if (value.AliasInUse) return 'Alias is already in use';
console.error('Unhandled alias error: ', value);
return 'Unknown error';
diff --git a/packages/lightwallet/common/pipes/chunks.pipe.ts b/packages/lightwallet/common/pipes/chunks.pipe.ts
index 884ce9a04a..55fe4b9451 100644
--- a/packages/lightwallet/common/pipes/chunks.pipe.ts
+++ b/packages/lightwallet/common/pipes/chunks.pipe.ts
@@ -3,6 +3,9 @@ import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'chunks' })
export class ChunksPipe implements PipeTransform {
transform(arr: any, chunkSize: number) {
- return arr.reduce((prev, cur, index) => (index % chunkSize) ? prev : prev.concat([arr.slice(index, index + chunkSize)]), []);
+ return arr.reduce(
+ (prev, cur, index) => (index % chunkSize ? prev : prev.concat([arr.slice(index, index + chunkSize)])),
+ [],
+ );
}
}
diff --git a/packages/lightwallet/common/pipes/to-fiat.pipe.ts b/packages/lightwallet/common/pipes/to-fiat.pipe.ts
index 707ceb63bf..9b51ebbbd6 100644
--- a/packages/lightwallet/common/pipes/to-fiat.pipe.ts
+++ b/packages/lightwallet/common/pipes/to-fiat.pipe.ts
@@ -3,11 +3,7 @@ import { TxFormatService } from '@merit/common/services/tx-format.service';
@Pipe({ name: 'toFiat' })
export class ToFiatPipe implements PipeTransform {
-
- constructor(
- private txFormatProvider: TxFormatService
- ) {
- }
+ constructor(private txFormatProvider: TxFormatService) {}
transform(value: string, micros: number): string {
return this.txFormatProvider.formatAlternativeStr(micros);
diff --git a/packages/lightwallet/common/pipes/to-mrt.pipe.spec.ts b/packages/lightwallet/common/pipes/to-mrt.pipe.spec.ts
index 053478cace..5ce50f1292 100644
--- a/packages/lightwallet/common/pipes/to-mrt.pipe.spec.ts
+++ b/packages/lightwallet/common/pipes/to-mrt.pipe.spec.ts
@@ -9,27 +9,26 @@ import { RateService } from '@merit/common/services/rate.service';
{{ 123e6 | toMRT:null:true }}
{{ 123e6 | toMRT:1 }}
{{ 123e6 | toMRT:2 }}
- `
+ `,
})
class TestComponent {
- @ViewChild('test1') test1: ElementRef;
- @ViewChild('test2') test2: ElementRef;
- @ViewChild('test3') test3: ElementRef;
- @ViewChild('test4') test4: ElementRef;
+ @ViewChild('test1')
+ test1: ElementRef;
+ @ViewChild('test2')
+ test2: ElementRef;
+ @ViewChild('test3')
+ test3: ElementRef;
+ @ViewChild('test4')
+ test4: ElementRef;
}
describe('Pipes.ToMRT', () => {
-
- let comp: TestComponent,
- instance: ComponentFixture;
+ let comp: TestComponent, instance: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [
- ToMrtPipe,
- TestComponent
- ],
- providers: [RateService]
+ declarations: [ToMrtPipe, TestComponent],
+ providers: [RateService],
}).compileComponents();
instance = TestBed.createComponent(TestComponent);
comp = instance.componentInstance;
diff --git a/packages/lightwallet/common/pipes/to-mrt.pipe.ts b/packages/lightwallet/common/pipes/to-mrt.pipe.ts
index 31e75f5a99..0886335956 100644
--- a/packages/lightwallet/common/pipes/to-mrt.pipe.ts
+++ b/packages/lightwallet/common/pipes/to-mrt.pipe.ts
@@ -6,17 +6,15 @@ export class ToMrtPipe implements PipeTransform {
constructor(private rateService: RateService) {}
transform(micros: number, digitsLimit?: number, hideUnit?: boolean): string {
-
- const unitStr = (hideUnit? '' : ' MRT');
+ const unitStr = hideUnit ? '' : ' MRT';
let mrt = this.rateService.microsToMrt(micros) || 0;
- if (!digitsLimit) return mrt+unitStr;
+ if (!digitsLimit) return mrt + unitStr;
const intLength = mrt.toFixed(0).length;
- let floatLength = (digitsLimit - intLength) >= 0 ? (digitsLimit - intLength) : 0;
-
- return Number(mrt.toFixed(floatLength))+unitStr;
+ let floatLength = digitsLimit - intLength >= 0 ? digitsLimit - intLength : 0;
+ return Number(mrt.toFixed(floatLength)) + unitStr;
}
}
diff --git a/packages/lightwallet/common/pipes/to-unit.pipe.spec.ts b/packages/lightwallet/common/pipes/to-unit.pipe.spec.ts
index b28149f9a0..2e7fcbec5e 100644
--- a/packages/lightwallet/common/pipes/to-unit.pipe.spec.ts
+++ b/packages/lightwallet/common/pipes/to-unit.pipe.spec.ts
@@ -9,28 +9,24 @@ import { EventsMock, StorageMock } from 'ionic-mocks-jest';
@Component({
template: `
{{ 1e8 | toUnit }}
- `
+ `,
})
class TestComponent {
- @ViewChild('test1') test1: ElementRef;
+ @ViewChild('test1')
+ test1: ElementRef;
}
describe('Pipes.ToUnit', () => {
-
- let comp: TestComponent,
- instance: ComponentFixture;
+ let comp: TestComponent, instance: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [
- ToUnitPipe,
- TestComponent
- ],
+ declarations: [ToUnitPipe, TestComponent],
imports: [CommonProvidersModule.forRoot()],
providers: [
{ provide: Storage, useFactory: () => StorageMock.instance() },
- { provide: Events, useFactory: () => EventsMock.instance() }
- ]
+ { provide: Events, useFactory: () => EventsMock.instance() },
+ ],
}).compileComponents();
instance = TestBed.createComponent(TestComponent);
comp = instance.componentInstance;
diff --git a/packages/lightwallet/common/pipes/to-unit.pipe.ts b/packages/lightwallet/common/pipes/to-unit.pipe.ts
index f3a13ae7ea..1f4efe2157 100644
--- a/packages/lightwallet/common/pipes/to-unit.pipe.ts
+++ b/packages/lightwallet/common/pipes/to-unit.pipe.ts
@@ -6,8 +6,7 @@ import { TxFormatService } from '@merit/common/services/tx-format.service';
export class ToUnitPipe implements PipeTransform {
private unitCode: string;
- constructor(private configProvider: ConfigService,
- private txFormatProvider: TxFormatService) {
+ constructor(private configProvider: ConfigService, private txFormatProvider: TxFormatService) {
this.unitCode = this.configProvider.get().wallet.settings.unitCode;
}
diff --git a/packages/lightwallet/common/pipes/unescape.pipe.spec.ts b/packages/lightwallet/common/pipes/unescape.pipe.spec.ts
index cbbe7e3863..4712e192c9 100644
--- a/packages/lightwallet/common/pipes/unescape.pipe.spec.ts
+++ b/packages/lightwallet/common/pipes/unescape.pipe.spec.ts
@@ -5,23 +5,19 @@ import { UnescapePipe } from '@merit/common/pipes/unescape.pipe';
@Component({
template: `
{{ '%40' | unescape }}
- `
+ `,
})
class TestComponent {
- @ViewChild('test1') test1: ElementRef;
+ @ViewChild('test1')
+ test1: ElementRef;
}
describe('Pipes.Unescape', () => {
-
- let comp: TestComponent,
- instance: ComponentFixture;
+ let comp: TestComponent, instance: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [
- UnescapePipe,
- TestComponent
- ]
+ declarations: [UnescapePipe, TestComponent],
}).compileComponents();
instance = TestBed.createComponent(TestComponent);
comp = instance.componentInstance;
diff --git a/packages/lightwallet/common/pipes/unescape.pipe.ts b/packages/lightwallet/common/pipes/unescape.pipe.ts
index dbb3409790..681e51bc93 100644
--- a/packages/lightwallet/common/pipes/unescape.pipe.ts
+++ b/packages/lightwallet/common/pipes/unescape.pipe.ts
@@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core';
export class UnescapePipe implements PipeTransform {
transform(value: any, args?: any): any {
const unescapedStr = decodeURIComponent(value); //Belt-and-suspenders check for an "@" at the beginning of the alias
- if (unescapedStr.length > 0 && unescapedStr.charAt(0) != ('@')) {
+ if (unescapedStr.length > 0 && unescapedStr.charAt(0) != '@') {
return '@'.concat(unescapedStr);
}
return unescapedStr;
diff --git a/packages/lightwallet/common/reducers/app.reducer.ts b/packages/lightwallet/common/reducers/app.reducer.ts
index c2ffe781d1..9c42ca84ad 100644
--- a/packages/lightwallet/common/reducers/app.reducer.ts
+++ b/packages/lightwallet/common/reducers/app.reducer.ts
@@ -8,11 +8,11 @@ export interface IAppState {
const INITIAL_STATE: IAppState = {
loading: true,
- authorized: false
+ authorized: false,
};
export enum AppReducerActionType {
- UPDATE = '[App] Update'
+ UPDATE = '[App] Update',
}
export class UpdateAppAction implements Action {
@@ -27,10 +27,11 @@ export function appReducer(state: IAppState = INITIAL_STATE, action: AppReducerA
case AppReducerActionType.UPDATE:
return {
...state,
- ...action.payload
+ ...action.payload,
};
- default: return state;
+ default:
+ return state;
}
}
diff --git a/packages/lightwallet/common/reducers/notifications.reducer.ts b/packages/lightwallet/common/reducers/notifications.reducer.ts
index a80a8c1680..45720f3e8e 100644
--- a/packages/lightwallet/common/reducers/notifications.reducer.ts
+++ b/packages/lightwallet/common/reducers/notifications.reducer.ts
@@ -31,7 +31,7 @@ export enum NotificationsActionType {
Clear = '[Notifications] Clear',
Load = '[Notifications] Load',
Save = '[Notifications] Save',
- MarkAllAsRead = '[Notifications] Mark all as read'
+ MarkAllAsRead = '[Notifications] Mark all as read',
}
export class LoadNotificationsAction implements Action {
@@ -51,8 +51,7 @@ export class SaveNotificationsAction implements Action {
export class UpdateNotificationsAction implements Action {
type = NotificationsActionType.Update;
- constructor(public notifications: INotification[]) {
- }
+ constructor(public notifications: INotification[]) {}
}
/**
@@ -74,8 +73,7 @@ export class AddNotificationAction implements Action {
export class MarkNotificationAsReadAction implements Action {
type = NotificationsActionType.MarkAsRead;
- constructor(public notificationId: string) {
- }
+ constructor(public notificationId: string) {}
}
/**
@@ -84,8 +82,7 @@ export class MarkNotificationAsReadAction implements Action {
export class DeleteNotificationAction implements Action {
type = NotificationsActionType.Delete;
- constructor(public notificationId: string) {
- }
+ constructor(public notificationId: string) {}
}
/**
@@ -99,26 +96,18 @@ export class MarkAllNotificationsAsReadAction implements Action {
type = NotificationsActionType.MarkAllAsRead;
}
-export type NotificationAction =
- UpdateNotificationsAction
- & AddNotificationAction
- & MarkNotificationAsReadAction
- & DeleteNotificationAction
- & ClearNotificationsAction;
+export type NotificationAction = UpdateNotificationsAction &
+ AddNotificationAction &
+ MarkNotificationAsReadAction &
+ DeleteNotificationAction &
+ ClearNotificationsAction;
export function calculateUnreadNotifications(notifications: INotification[]): number {
return notifications.reduce((total: number, notification: INotification) => total + Number(!notification.read), 0);
}
export function processNotifications(notifications: INotification[]): INotification[] {
- return sortBy(
- uniq(
- compact(
- notifications.map(formatNotification)
- )
- ),
- 'timestamp'
- ).reverse();
+ return sortBy(uniq(compact(notifications.map(formatNotification))), 'timestamp').reverse();
}
export function formatNotification(notification: INotification): INotification {
@@ -126,7 +115,10 @@ export function formatNotification(notification: INotification): INotification {
switch (notification.type) {
case 'IncomingTx':
notification.title = 'New payment received';
- notification.message = `A payment of ${ formatAmount(notification.amount, 'mrt') }MRT has been received into your wallet.`;
+ notification.message = `A payment of ${formatAmount(
+ notification.amount,
+ 'mrt',
+ )}MRT has been received into your wallet.`;
break;
case 'IncomingInvite':
@@ -141,7 +133,10 @@ export function formatNotification(notification: INotification): INotification {
case 'IncomingCoinbase':
notification.title = 'Mining reward received';
- notification.message = `Congratulations! You received a mining reward of ${ formatAmount(notification.amount, 'mrt') }MRT.`;
+ notification.message = `Congratulations! You received a mining reward of ${formatAmount(
+ notification.amount,
+ 'mrt',
+ )}MRT.`;
break;
case 'IncomingInviteRequest':
@@ -164,29 +159,32 @@ export function formatNotification(notification: INotification): INotification {
return notification;
}
-export function notificationsReducer(state: INotificationsState = {
- notifications: [],
- totalUnread: 0
-}, action: NotificationAction): INotificationsState {
+export function notificationsReducer(
+ state: INotificationsState = {
+ notifications: [],
+ totalUnread: 0,
+ },
+ action: NotificationAction,
+): INotificationsState {
switch (action.type) {
case NotificationsActionType.Update:
return {
notifications: processNotifications(action.notifications),
- totalUnread: calculateUnreadNotifications(action.notifications)
+ totalUnread: calculateUnreadNotifications(action.notifications),
};
case NotificationsActionType.Add:
state.notifications.push(action.notification);
return {
notifications: processNotifications(state.notifications),
- totalUnread: state.totalUnread + Number(!action.notification.read)
+ totalUnread: state.totalUnread + Number(!action.notification.read),
};
case NotificationsActionType.MarkAsRead:
state.notifications.find((notification: INotification) => notification.id === action.notificationId).read = true;
return {
notifications: state.notifications,
- totalUnread: state.totalUnread - 1
+ totalUnread: state.totalUnread - 1,
};
case NotificationsActionType.MarkAllAsRead:
@@ -195,20 +193,22 @@ export function notificationsReducer(state: INotificationsState = {
notification.read = true;
return notification;
}),
- totalUnread: 0
+ totalUnread: 0,
};
case NotificationsActionType.Delete:
- state.notifications = state.notifications.filter((notification: INotification) => notification.id !== action.notificationId);
+ state.notifications = state.notifications.filter(
+ (notification: INotification) => notification.id !== action.notificationId,
+ );
return {
notifications: state.notifications,
- totalUnread: calculateUnreadNotifications(state.notifications)
+ totalUnread: calculateUnreadNotifications(state.notifications),
};
case NotificationsActionType.Clear:
return {
notifications: [],
- totalUnread: 0
+ totalUnread: 0,
};
default:
diff --git a/packages/lightwallet/common/reducers/transactions.reducer.ts b/packages/lightwallet/common/reducers/transactions.reducer.ts
index 64ac4f7d32..ddb5b855c9 100644
--- a/packages/lightwallet/common/reducers/transactions.reducer.ts
+++ b/packages/lightwallet/common/reducers/transactions.reducer.ts
@@ -11,7 +11,7 @@ export enum TransactionActionType {
Update = '[Transactions] Update',
UpdateOne = '[Transactions] Update one',
Refresh = '[Transactions] Refresh',
- RefreshOne = '[Transactions] Refresh one'
+ RefreshOne = '[Transactions] Refresh one',
}
export class RefreshTransactionsAction implements Action {
@@ -30,8 +30,7 @@ export class UpdateTransactionsAction implements Action {
this.transactions.forEach((transaction: IDisplayTransaction) => {
walletId = transaction.wallet.id;
- if (!this.transactionsByWallet[walletId])
- this.transactionsByWallet[walletId] = [];
+ if (!this.transactionsByWallet[walletId]) this.transactionsByWallet[walletId] = [];
this.transactionsByWallet[walletId].push(transaction);
});
@@ -41,56 +40,58 @@ export class UpdateTransactionsAction implements Action {
export class UpdateOneWalletTransactions implements Action {
type = TransactionActionType.UpdateOne;
- constructor(public walletId: string, public transactions: IDisplayTransaction[]) { }
+ constructor(public walletId: string, public transactions: IDisplayTransaction[]) {}
}
export class RefreshOneWalletTransactions implements Action {
type = TransactionActionType.RefreshOne;
- constructor(public walletId: string) {
- }
+ constructor(public walletId: string) {}
}
-export type TransactionsReducerAction =
- RefreshTransactionsAction
- & UpdateTransactionsAction
- & UpdateOneWalletTransactions
- & RefreshOneWalletTransactions;
+export type TransactionsReducerAction = RefreshTransactionsAction &
+ UpdateTransactionsAction &
+ UpdateOneWalletTransactions &
+ RefreshOneWalletTransactions;
const DEFAULT_STATE: ITransactionsState = {
transactions: [],
- loading: true
+ loading: true,
};
-export function transactionsReducer(state: ITransactionsState = DEFAULT_STATE, action: TransactionsReducerAction): ITransactionsState {
+export function transactionsReducer(
+ state: ITransactionsState = DEFAULT_STATE,
+ action: TransactionsReducerAction,
+): ITransactionsState {
switch (action.type) {
case TransactionActionType.Refresh:
return {
...state,
- loading: true
+ loading: true,
};
case TransactionActionType.Update:
return {
transactions: action.transactions,
- loading: false
+ loading: false,
};
case TransactionActionType.UpdateOne:
return {
transactions: sortBy(uniqBy(action.transactions.concat(state.transactions), 'txid'), 'time').reverse(),
- loading: false
+ loading: false,
};
default:
return state;
}
-
-
}
export const selectTransactionsState = createFeatureSelector('transactions');
export const selectTransactionsLoading = createSelector(selectTransactionsState, state => state.loading);
export const selectTransactions = createSelector(selectTransactionsState, state => state.transactions);
-export const selectSentInvites = createSelector(selectTransactions, (transactions: IDisplayTransaction[]) => transactions.filter(transaction => transaction.action === TransactionAction.SENT && transaction.isInvite));
-export const selectTransactionsByWalletId = (id: string) => createSelector(selectTransactionsState, state => state.transactions.filter(tx => tx.walletId === id));
+export const selectSentInvites = createSelector(selectTransactions, (transactions: IDisplayTransaction[]) =>
+ transactions.filter(transaction => transaction.action === TransactionAction.SENT && transaction.isInvite),
+);
+export const selectTransactionsByWalletId = (id: string) =>
+ createSelector(selectTransactionsState, state => state.transactions.filter(tx => tx.walletId === id));
diff --git a/packages/lightwallet/common/reducers/wallets.reducer.ts b/packages/lightwallet/common/reducers/wallets.reducer.ts
index ef6fec5606..5b88f5c0de 100644
--- a/packages/lightwallet/common/reducers/wallets.reducer.ts
+++ b/packages/lightwallet/common/reducers/wallets.reducer.ts
@@ -4,7 +4,7 @@ import { Action, createFeatureSelector, createSelector } from '@ngrx/store';
export interface IWalletsState {
wallets: DisplayWallet[];
- walletsMap: { [walletId: string]: DisplayWallet; };
+ walletsMap: { [walletId: string]: DisplayWallet };
loading: boolean;
totals: IWalletTotals;
totalsLoading: boolean;
@@ -33,11 +33,11 @@ const DEFAULT_STATE: IWalletsState = {
totalWalletsBalanceFiat: '0.00',
allBalancesHidden: false,
totalCommunitySize: 0,
- invites: 0
+ invites: 0,
},
loading: true,
totalsLoading: true,
- inviteRequests: []
+ inviteRequests: [],
};
export enum WalletsActionType {
@@ -51,14 +51,13 @@ export enum WalletsActionType {
UpdateInviteRequests = '[Wallets] Update Invite Wait List',
DeleteWallet = '[Wallets] Delete wallet',
DeleteWalletCompleted = '[Wallets] Delete wallet completed',
- IgnoreInviteRequest = '[Wallets] Ignore invite request'
+ IgnoreInviteRequest = '[Wallets] Ignore invite request',
}
export class AddWalletAction implements Action {
type = WalletsActionType.Add;
- constructor(public wallet: DisplayWallet) {
- }
+ constructor(public wallet: DisplayWallet) {}
}
export class UpdateWalletsAction implements Action {
@@ -67,7 +66,7 @@ export class UpdateWalletsAction implements Action {
walletsMap: any = {};
constructor(public payload: DisplayWallet[]) {
- payload.forEach(w => this.walletsMap[w.id] = w);
+ payload.forEach(w => (this.walletsMap[w.id] = w));
}
}
@@ -114,17 +113,16 @@ export class IgnoreInviteRequestAction implements Action {
constructor(public address: string) {}
}
-export type WalletsAction =
- AddWalletAction
- & UpdateWalletsAction
- & RefreshWalletsAction
- & UpdateOneWalletAction
- & RefreshOneWalletAction
- & UpdateWalletTotalsAction
- & UpdateInviteRequestsAction
- & DeleteWalletAction
- & DeleteWalletCompletedAction
- & IgnoreInviteRequestAction;
+export type WalletsAction = AddWalletAction &
+ UpdateWalletsAction &
+ RefreshWalletsAction &
+ UpdateOneWalletAction &
+ RefreshOneWalletAction &
+ UpdateWalletTotalsAction &
+ UpdateInviteRequestsAction &
+ DeleteWalletAction &
+ DeleteWalletCompletedAction &
+ IgnoreInviteRequestAction;
export function walletsReducer(state: IWalletsState = DEFAULT_STATE, action: WalletsAction) {
switch (action.type) {
@@ -135,19 +133,16 @@ export function walletsReducer(state: IWalletsState = DEFAULT_STATE, action: Wal
loading: false,
walletsMap: {
...state.walletsMap,
- [newWallet.id]: newWallet
+ [newWallet.id]: newWallet,
},
- wallets: [
- ...state.wallets,
- newWallet
- ],
- totalsLoading: true
+ wallets: [...state.wallets, newWallet],
+ totalsLoading: true,
};
case WalletsActionType.Refresh:
return {
...state,
- loading: true
+ loading: true,
};
case WalletsActionType.Update:
@@ -155,7 +150,7 @@ export function walletsReducer(state: IWalletsState = DEFAULT_STATE, action: Wal
...state,
loading: false,
wallets: action.payload,
- walletsMap: action.walletsMap
+ walletsMap: action.walletsMap,
};
case WalletsActionType.UpdateOne:
@@ -163,33 +158,31 @@ export function walletsReducer(state: IWalletsState = DEFAULT_STATE, action: Wal
state.wallets[index] = action.wallet;
return {
...state,
- wallets: [
- ...state.wallets
- ],
+ wallets: [...state.wallets],
loading: false,
walletsMap: {
...state.walletsMap,
- [action.wallet.id]: action.wallet
- }
+ [action.wallet.id]: action.wallet,
+ },
};
case WalletsActionType.RefreshTotals:
return {
...state,
- totalsLoading: true
+ totalsLoading: true,
};
case WalletsActionType.UpdateTotals:
return {
...state,
totalsLoading: false,
- totals: action.totals
+ totals: action.totals,
};
case WalletsActionType.UpdateInviteRequests:
return {
...state,
- inviteRequests: action.inviteRequests
+ inviteRequests: action.inviteRequests,
};
case WalletsActionType.DeleteWalletCompleted:
@@ -198,8 +191,8 @@ export function walletsReducer(state: IWalletsState = DEFAULT_STATE, action: Wal
wallets: state.wallets.filter(wallet => wallet.id !== action.walletId),
walletsMap: {
...state.walletsMap,
- [action.walletId]: undefined
- }
+ [action.walletId]: undefined,
+ },
};
default:
@@ -210,11 +203,15 @@ export function walletsReducer(state: IWalletsState = DEFAULT_STATE, action: Wal
export const selectWalletsState = createFeatureSelector('wallets');
export const selectWalletsLoading = createSelector(selectWalletsState, state => state.loading);
export const selectWallets = createSelector(selectWalletsState, state => state.wallets);
-export const selectConfirmedWallets = createSelector(selectWallets, wallets => wallets.filter((w: DisplayWallet) => w.client.confirmed));
+export const selectConfirmedWallets = createSelector(selectWallets, wallets =>
+ wallets.filter((w: DisplayWallet) => w.client.confirmed),
+);
export const selectWalletTotals = createSelector(selectWalletsState, state => state.totals);
export const selectWalletTotalsLoading = createSelector(selectWalletsState, state => state.totalsLoading);
export const selectWalletById = (id: string) => createSelector(selectWalletsState, state => state.walletsMap[id]);
-export const selectWalletsWithInvites = createSelector(selectWallets, (wallets: DisplayWallet[]) => wallets.filter(wallet => wallet.availableInvites > 0));
+export const selectWalletsWithInvites = createSelector(selectWallets, (wallets: DisplayWallet[]) =>
+ wallets.filter(wallet => wallet.availableInvites > 0),
+);
export const selectInvites = createSelector(selectWalletTotals, totals => totals.invites);
export const selectInviteRequests = createSelector(selectWalletsState, state => state.inviteRequests);
export const selectNumberOfInviteRequests = createSelector(selectInviteRequests, inviteRequests => {
diff --git a/packages/lightwallet/common/services/address.service.ts b/packages/lightwallet/common/services/address.service.ts
index e3c988eb7a..55762a0acc 100644
--- a/packages/lightwallet/common/services/address.service.ts
+++ b/packages/lightwallet/common/services/address.service.ts
@@ -19,7 +19,7 @@ export class AddressService {
private config: ConfigService,
private persistenceService: PersistenceService,
private logger: LoggerService,
- mwcService: MWCService
+ mwcService: MWCService,
) {
this.client = mwcService.getClient(null);
}
@@ -60,7 +60,6 @@ export class AddressService {
const info = await this.getAddressInfo(addr);
return info.isValid && info.isBeaconed;
-
}
async getValidAddress(input: string): Promise {
diff --git a/packages/lightwallet/common/services/app-settings.service.ts b/packages/lightwallet/common/services/app-settings.service.ts
index d7f484e807..4ca9dcce45 100644
--- a/packages/lightwallet/common/services/app-settings.service.ts
+++ b/packages/lightwallet/common/services/app-settings.service.ts
@@ -43,10 +43,12 @@ export class AppSettingsService {
public info: AppSettings;
private jsonPath: string = 'assets/appConfig.json';
- constructor(public http: HttpClient,
- private logger: LoggerService,
- private language: LanguageService,
- private config: ConfigService) {
+ constructor(
+ public http: HttpClient,
+ private logger: LoggerService,
+ private language: LanguageService,
+ private config: ConfigService,
+ ) {
this.logger.info('AppService initialized.');
}
diff --git a/packages/lightwallet/common/services/config.service.ts b/packages/lightwallet/common/services/config.service.ts
index 5e54178e1a..ec03c3858f 100644
--- a/packages/lightwallet/common/services/config.service.ts
+++ b/packages/lightwallet/common/services/config.service.ts
@@ -34,7 +34,7 @@ export interface IAppConfig {
};
copay: {
url: string;
- }
+ };
};
rateApp: {
@@ -45,7 +45,6 @@ export interface IAppConfig {
};
};
-
recentTransactions: {
enabled: boolean;
};
@@ -63,8 +62,8 @@ export interface IAppConfig {
};
help: {
- url: string
- },
+ url: string;
+ };
pushNotificationsEnabled: boolean;
@@ -84,14 +83,13 @@ export interface IAppConfig {
// Custom Aliases
// Stored like: aliasFor[WalletId] = "Full Wallet"
aliasFor?: object;
-
}
const configDefault: IAppConfig = {
// wallet limits
limits: {
totalCopayers: 6,
- mPlusN: 100
+ mPlusN: 100,
},
// wallet default config
@@ -109,83 +107,82 @@ const configDefault: IAppConfig = {
alternativeName: 'US Dollar',
alternativeIsoCode: 'USD',
defaultLanguage: '',
- feeLevel: 'normal'
- }
+ feeLevel: 'normal',
+ },
},
download: {
bitpay: {
- url: 'https://merit.me/wallet'
+ url: 'https://merit.me/wallet',
},
copay: {
- url: 'https://merit.me/#download'
- }
+ url: 'https://merit.me/#download',
+ },
},
rateApp: {
lightwallet: {
ios: 'http://coming.soon',
android: 'http://coming.soon',
- wp: ''
- }
+ wp: '',
+ },
},
// External services
recentTransactions: {
- enabled: true
+ enabled: true,
},
hideNextSteps: {
- enabled: false
+ enabled: false,
},
rates: {
- url: 'https://insight.merit.me:443/api/rates'
+ url: 'https://insight.merit.me:443/api/rates',
},
release: {
- url: 'https://api.github.com/repos/meritlabs/lightwallet-stack/releases/latest'
+ url: 'https://api.github.com/repos/meritlabs/lightwallet-stack/releases/latest',
},
help: {
- url: 'https://help.merit.me'
+ url: 'https://help.merit.me',
},
pushNotificationsEnabled: true,
confirmedTxsNotifications: {
- enabled: true
+ enabled: true,
},
emailNotifications: {
enabled: false,
- emailAddress: ''
+ emailAddress: '',
},
log: {
- filter: 'debug'
- }
-
+ filter: 'debug',
+ },
};
@Injectable()
export class ConfigService {
private configCache: IAppConfig = _.clone(configDefault);
- constructor(private logger: LoggerService,
- private persistence: PersistenceService) {
+ constructor(private logger: LoggerService, private persistence: PersistenceService) {
this.load()
.then(() => {
this.logger.debug('ConfigService initialized.');
- }).catch(err => {
- this.logger.warn('ConfigService could not load default config');
- });
+ })
+ .catch(err => {
+ this.logger.warn('ConfigService could not load default config');
+ });
}
async load(): Promise {
try {
const config: any = await this.persistence.getConfig();
- this.configCache = _.clone(_.isEmpty(config)? configDefault : config);
+ this.configCache = _.clone(_.isEmpty(config) ? configDefault : config);
} catch (err) {
this.logger.error(err);
throw err;
@@ -215,5 +212,4 @@ export class ConfigService {
getDefaults(): IAppConfig {
return configDefault;
}
-
}
diff --git a/packages/lightwallet/common/services/contacts.service.ts b/packages/lightwallet/common/services/contacts.service.ts
index 25606ad8d6..87c0920cad 100644
--- a/packages/lightwallet/common/services/contacts.service.ts
+++ b/packages/lightwallet/common/services/contacts.service.ts
@@ -8,7 +8,6 @@ import { createMeritContact } from '@merit/common/utils/contacts';
@Injectable()
export class ContactsService {
-
// TODO cache contacts & re-use instead of retrieving them again
protected contacts: MeritContact[];
protected addressBook: IAddressBook;
@@ -29,7 +28,7 @@ export class ContactsService {
contact.meritAddresses.forEach(({ address, alias }) => {
if (address) this.addressBook[address] = contact;
if (alias) this.addressBook[alias] = contact;
- })
+ }),
);
await this.persistenceService.setAddressbook(ENV.network, this.addressBook);
@@ -37,17 +36,16 @@ export class ContactsService {
}
list(network: string = ENV.network): Promise {
- return this.getAddressbook(network)
- .catch((err) => {
- return Promise.reject(new Error('Error listing addressBook: ' + err));
- });
- };
+ return this.getAddressbook(network).catch(err => {
+ return Promise.reject(new Error('Error listing addressBook: ' + err));
+ });
+ }
async add(entry: MeritContact, address: string, network: string = ENV.network): Promise {
this.addressBook[address] = entry;
await this.persistenceService.setAddressbook(network, this.addressBook);
return this.addressBook;
- };
+ }
async bindAddressToContact(contact: MeritContact, address: string, alias?: string) {
const addressBook: IAddressBook = await this.getAddressbook(ENV.network);
@@ -60,7 +58,7 @@ export class ContactsService {
});
}
if (existingContact) {
- existingContact.meritAddresses.push({ address: address, alias: alias, network: ENV.network });
+ existingContact.meritAddresses.push({ address: address, alias: alias, network: ENV.network });
} else {
contact.meritAddresses.push({ address: address, network: ENV.network });
addressBook[address] = contact;
@@ -78,17 +76,17 @@ export class ContactsService {
} catch (err) {
throw new Error('Contact with address ' + addr + ' not found');
}
- };
+ }
searchContacts(contacts: MeritContact[], searchQuery: string = ''): MeritContact[] {
searchQuery = searchQuery.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
const exp = new RegExp(searchQuery, 'ig');
return contacts.filter((contact: MeritContact) => {
if (contact.name.formatted && contact.name.formatted.match(exp)) return true;
- if (_.some(contact.emails, (email) => email.value.match(exp))) return true;
- if (_.some(contact.phoneNumbers, (phoneNumber) => phoneNumber.value.match(exp))) return true;
- if (_.some(contact.meritAddresses, (address) => address.address.match(exp))) return true;
- if (_.some(contact.meritAddresses, (address) => address.alias && address.alias.match(exp))) return true;
+ if (_.some(contact.emails, email => email.value.match(exp))) return true;
+ if (_.some(contact.phoneNumbers, phoneNumber => phoneNumber.value.match(exp))) return true;
+ if (_.some(contact.meritAddresses, address => address.address.match(exp))) return true;
+ if (_.some(contact.meritAddresses, address => address.alias && address.alias.match(exp))) return true;
return false;
});
}
@@ -97,35 +95,42 @@ export class ContactsService {
const localContacts: IAddressBook = await this.getAddressbook();
const contacts: MeritContact[] = deviceContacts
- .filter((contact: Contact) => !_.isEmpty(contact.displayName) && !_.isEmpty(contact.phoneNumbers) || !_.isEmpty(contact.emails))
+ .filter(
+ (contact: Contact) =>
+ (!_.isEmpty(contact.displayName) && !_.isEmpty(contact.phoneNumbers)) || !_.isEmpty(contact.emails),
+ )
.map((contact: Contact) => createMeritContact(contact));
let localContact: MeritContact, deviceContact: MeritContact;
- Object.keys(localContacts)
- .forEach((key: string) => {
- localContact = localContacts[key];
+ Object.keys(localContacts).forEach((key: string) => {
+ localContact = localContacts[key];
- if (localContact.id || localContact.phoneNumbers.length || localContact.emails.length) {
- deviceContact = contacts.find((c: MeritContact) =>
+ if (localContact.id || localContact.phoneNumbers.length || localContact.emails.length) {
+ deviceContact = contacts.find(
+ (c: MeritContact) =>
// find by ID
- (localContact.id === c.id) ||
+ localContact.id === c.id ||
// find by phone number
- (localContact.phoneNumbers.some((p: IContactField) => Boolean(c.phoneNumbers.find(_p => _p.value == p.value)))) ||
+ localContact.phoneNumbers.some((p: IContactField) =>
+ Boolean(c.phoneNumbers.find(_p => _p.value == p.value)),
+ ) ||
// compare emails
- (localContact.emails.some((e: IContactField) => Boolean(c.emails.find(_e => _e.value == e.value))))
- );
+ localContact.emails.some((e: IContactField) => Boolean(c.emails.find(_e => _e.value == e.value))),
+ );
- if (deviceContact) {
- // merge addresses
- deviceContact.meritAddresses = _.uniq(Array.prototype.concat((deviceContact.meritAddresses || []), (localContact.meritAddresses || [])));
- deviceContact = void 0;
- return;
- }
+ if (deviceContact) {
+ // merge addresses
+ deviceContact.meritAddresses = _.uniq(
+ Array.prototype.concat(deviceContact.meritAddresses || [], localContact.meritAddresses || []),
+ );
+ deviceContact = void 0;
+ return;
}
+ }
- contacts.push(localContact);
- });
+ contacts.push(localContact);
+ });
localContact = void 0;
@@ -136,7 +141,7 @@ export class ContactsService {
delete this.addressBook[addr];
await this.persistenceService.setAddressbook(network, this.addressBook);
return this.addressBook;
- };
+ }
deleteAddressBook() {
return this.persistenceService.setAddressbook(ENV.network, {});
@@ -146,7 +151,4 @@ export class ContactsService {
const addressBook = await this.persistenceService.getAddressbook(network);
return _.isEmpty(addressBook) ? {} : addressBook;
}
-
-
-
}
diff --git a/packages/lightwallet/common/services/easy-receive.service.ts b/packages/lightwallet/common/services/easy-receive.service.ts
index c6b2c0ec2b..6fa4b3d084 100644
--- a/packages/lightwallet/common/services/easy-receive.service.ts
+++ b/packages/lightwallet/common/services/easy-receive.service.ts
@@ -12,7 +12,7 @@ import { RateService } from '@merit/common/services/rate.service';
import { accessWallet, WalletService } from '@merit/common/services/wallet.service';
import { Address, crypto, HDPrivateKey, HDPublicKey, PrivateKey, PublicKey, Script, Transaction } from 'meritcore-lib';
import { Subject } from 'rxjs/Subject';
-import { AlertService } from "@merit/common/services/alert.service";
+import { AlertService } from '@merit/common/services/alert.service';
@Injectable()
export class EasyReceiveService {
@@ -25,9 +25,8 @@ export class EasyReceiveService {
private ledger: LedgerService,
private rateService: RateService,
private walletService: WalletService,
- private alertCtrl: AlertService
- ) {
- }
+ private alertCtrl: AlertService,
+ ) {}
private cancelEasySendSource = new Subject();
private cancelledEasySendSource = new Subject();
@@ -57,7 +56,7 @@ export class EasyReceiveService {
senderName: params.sn,
senderPublicKey: params.sk,
blockTimeout: params.bt,
- deepLinkURL: params['~referring_link']
+ deepLinkURL: params['~referring_link'],
});
}
@@ -87,7 +86,8 @@ export class EasyReceiveService {
wallet: MeritWalletClient,
receipt: EasyReceipt,
input: any,
- destinationAddress: any): Promise {
+ destinationAddress: any,
+ ): Promise {
return this.spendEasyReceipt(receipt, wallet, input, destinationAddress);
}
@@ -122,12 +122,10 @@ export class EasyReceiveService {
return tx ? tx.amount : 0;
}
-
isInviteOnly(txs: Array) {
return !txs.some(tx => !tx.invite);
}
-
async validateEasyReceiptOnBlockchain(receipt: EasyReceipt, password = ''): Promise {
const walletClient = this.mwcService.getClient(null, {});
@@ -143,7 +141,7 @@ export class EasyReceiveService {
privateKey: scriptData.privateKey,
publicKey: scriptData.publicKey,
script: scriptData.script,
- scriptId: scriptAddress
+ scriptId: scriptAddress,
};
} catch (err) {
this.logger.error('Could not validate easyScript on the blockchain.', err);
@@ -151,7 +149,12 @@ export class EasyReceiveService {
}
}
- private async spendEasyReceipt(receipt: EasyReceipt, wallet: MeritWalletClient, input: any, destinationAddress: any): Promise {
+ private async spendEasyReceipt(
+ receipt: EasyReceipt,
+ wallet: MeritWalletClient,
+ input: any,
+ destinationAddress: any,
+ ): Promise {
// Claim invites
await Promise.all(input.txs.map(tx => tx.invite && this.sendEasyReceiveTx(input, tx, destinationAddress, wallet)));
@@ -167,7 +170,7 @@ export class EasyReceiveService {
const txp = await this.buildEasySendRedeemTransaction(input, tx, destinationAddress, fee);
return this.walletService.broadcastRawTx(wallet, {
rawTx: txp.serialize({ disableSmallFees: tx.invite }),
- network: ENV.network
+ network: ENV.network,
});
}
@@ -183,7 +186,7 @@ export class EasyReceiveService {
privateKey: receivePrv,
publicKey: receivePub,
script: script,
- scriptPubKey: script.toMixedScriptHashOut(senderPubKey)
+ scriptPubKey: script.toMixedScriptHashOut(senderPubKey),
};
}
@@ -208,7 +211,6 @@ export class EasyReceiveService {
* @param {toAddress} Address to put the funds into.
*/
buildEasySendRedeemTransaction(input: any, txn: any, toAddress: string, fee = FeeService.DEFAULT_FEE): Promise {
-
const totalAmount = txn.amount;
const amount = txn.invite ? txn.amount : totalAmount - fee;
@@ -225,7 +227,7 @@ export class EasyReceiveService {
output: Transaction.Output.fromObject({ script: p2shScript, micros: totalAmount }),
prevTxId: txn.txid,
outputIndex: txn.index,
- script: input.script
+ script: input.script,
};
tx.addInput(new Transaction.Input.PayToScriptHashInput(p2shInput, input.script, p2shScript));
@@ -243,7 +245,6 @@ export class EasyReceiveService {
return tx;
}
-
cancelEasySend(url: string) {
let params = this.parseEasySendUrl(url);
let receipt = this.paramsToReceipt(params);
@@ -260,8 +261,8 @@ export class EasyReceiveService {
wallet: MeritWalletClient,
receipt: EasyReceipt,
password: string,
- walletPassword: string) {
-
+ walletPassword: string,
+ ) {
//figure out wallet info
const signingKey = wallet.getRootPrivateKey(walletPassword);
const pubKey = wallet.getRootAddressPubkey();
@@ -280,18 +281,16 @@ export class EasyReceiveService {
const input = {
script: redeemScript,
privateKey: signingKey,
- senderPublicKey: pubKey.toString()
+ senderPublicKey: pubKey.toString(),
};
//get the invite back
const invite = txs.find(tx => tx.invite);
- if (invite)
- await this.sendEasyReceiveTx(input, invite, destAddress, wallet);
+ if (invite) await this.sendEasyReceiveTx(input, invite, destAddress, wallet);
//get the merit back
const transact = txs.find(tx => !tx.invite);
- if (transact)
- await this.sendEasyReceiveTx(input, transact, destAddress, wallet);
+ if (transact) await this.sendEasyReceiveTx(input, transact, destAddress, wallet);
await wallet.cancelGlobalSend(scriptAddress.toString());
@@ -299,8 +298,7 @@ export class EasyReceiveService {
return {
invite: invite,
- tx: transact
+ tx: transact,
};
}
-
}
diff --git a/packages/lightwallet/common/services/easy-send.service.ts b/packages/lightwallet/common/services/easy-send.service.ts
index 2489fc564e..107c065723 100644
--- a/packages/lightwallet/common/services/easy-send.service.ts
+++ b/packages/lightwallet/common/services/easy-send.service.ts
@@ -12,7 +12,6 @@ import { AlertService } from '@merit/common/services/alert.service';
@Injectable()
export class EasySendService {
-
private readonly DEFAULT_TIMEOUT = 10080; // 7 days * 24 hours * 60 minutes
constructor(
@@ -20,7 +19,8 @@ export class EasySendService {
private persistenceService: PersistenceService,
@Optional() private socialSharing: SocialSharing,
private addressService: AddressService,
- private alertCtrl: AlertService) {}
+ private alertCtrl: AlertService,
+ ) {}
@accessWallet
async createEasySendScriptHash(wallet: MeritWalletClient, password?: string): Promise {
@@ -37,7 +37,7 @@ export class EasySendService {
signPrivKey,
address: easySendAddress,
addressType: Address.PayToScriptHashType, // script address
- network: ENV.network
+ network: ENV.network,
};
// easy send address is a mix of script_id pubkey_id
@@ -58,7 +58,6 @@ export class EasySendService {
// HACK:
msg = msg2;
-
}
try {
@@ -86,11 +85,13 @@ export class EasySendService {
async updatePendingEasySends(wallet: MeritWalletClient) {
let easySends: EasySend[] = (await this.persistenceService.getPendingEasySends(wallet.id)) || [];
- easySends = await Promise.all(easySends.map(async (easySend: EasySend) => {
- if (!easySend.scriptAddress) return null;
- const txs = await wallet.validateEasyScript(easySend.scriptAddress.toString());
- return txs.result.every(tx => !tx.spent) ? easySend : null;
- }));
+ easySends = await Promise.all(
+ easySends.map(async (easySend: EasySend) => {
+ if (!easySend.scriptAddress) return null;
+ const txs = await wallet.validateEasyScript(easySend.scriptAddress.toString());
+ return txs.result.every(tx => !tx.spent) ? easySend : null;
+ }),
+ );
easySends = easySends.filter((easySend: EasySend) => easySend !== null);
await this.persistenceService.setPendingEasySends(wallet.id, easySends);
@@ -98,7 +99,7 @@ export class EasySendService {
}
async storeEasySend(walletId: string, easySend: EasySend): Promise {
- const history: EasySend[] = await this.persistenceService.getPendingEasySends(walletId) || [];
+ const history: EasySend[] = (await this.persistenceService.getPendingEasySends(walletId)) || [];
history.push(easySend);
return this.persistenceService.setPendingEasySends(walletId, history);
}
@@ -107,16 +108,18 @@ export class EasySendService {
if (amount > Number.MAX_SAFE_INTEGER) throw new Error('The amount is too big');
const txp: any = {
- outputs: [{
- 'script': easySend.script.toHex(),
- 'toAddress': easySend.scriptAddress,
- 'amount': amount
- }],
+ outputs: [
+ {
+ script: easySend.script.toHex(),
+ toAddress: easySend.scriptAddress,
+ amount: amount,
+ },
+ ],
inputs: [], // will be defined on MWS side
feeLevel: this.feeService.getCurrentFeeLevel(),
excludeUnconfirmedUtxos: false,
dryRun: true,
- addressType: 'P2SH'
+ addressType: 'P2SH',
};
if (amount == wallet.balance.spendableAmount) {
@@ -125,7 +128,6 @@ export class EasySendService {
}
return wallet.createTxProposal(txp);
-
}
/**
@@ -135,10 +137,7 @@ export class EasySendService {
passphrase = passphrase || '';
const pubKey = wallet.getRootAddressPubkey();
const rcvPair = PrivateKey.forNewEasySend(passphrase, ENV.network);
- const pubKeys = [
- rcvPair.key.publicKey.toBuffer(),
- pubKey.toBuffer()
- ];
+ const pubKeys = [rcvPair.key.publicKey.toBuffer(), pubKey.toBuffer()];
const script = Script.buildEasySendOut(pubKeys, timeout, ENV.network);
const addressInfo = await this.addressService.getAddressInfo(wallet.getRootAddress().toString());
@@ -154,8 +153,7 @@ export class EasySendService {
scriptAddress: '',
scriptReferralOpts: {},
cancelled: false,
- inviteOnly: false
+ inviteOnly: false,
};
}
-
}
diff --git a/packages/lightwallet/common/services/email-notification.service.ts b/packages/lightwallet/common/services/email-notification.service.ts
index 4ce9133006..b4951db232 100644
--- a/packages/lightwallet/common/services/email-notification.service.ts
+++ b/packages/lightwallet/common/services/email-notification.service.ts
@@ -6,10 +6,11 @@ import { WalletService } from '@merit/common/services/wallet.service';
@Injectable()
export class EmailNotificationsService {
-
- constructor(private configService: ConfigService,
- private profileService: ProfileService,
- private walletService: WalletService) {}
+ constructor(
+ private configService: ConfigService,
+ private profileService: ProfileService,
+ private walletService: WalletService,
+ ) {}
async updateEmail(opts: any) {
opts = opts || {};
@@ -21,12 +22,12 @@ export class EmailNotificationsService {
emailFor: null, // Backward compatibility
emailNotifications: {
enabled: opts.enabled,
- email: opts.enabled ? opts.email : null
- }
+ email: opts.enabled ? opts.email : null,
+ },
});
return this.walletService.updateRemotePreferences(wallets);
- };
+ }
getEmailIfEnabled(config) {
config = config || this.configService.get();
@@ -34,8 +35,7 @@ export class EmailNotificationsService {
if (config.emailNotifications) {
if (!config.emailNotifications.enabled) return;
- if (config.emailNotifications.email)
- return config.emailNotifications.email;
+ if (config.emailNotifications.email) return config.emailNotifications.email;
}
if (_.isEmpty(config.emailFor)) return;
@@ -57,9 +57,8 @@ export class EmailNotificationsService {
let currentEmail = emailNotifications.emailAddress;
return this.updateEmail({
enabled: currentEmail ? true : false,
- email: currentEmail
+ email: currentEmail,
});
}
}
-
}
diff --git a/packages/lightwallet/common/services/fee.service.ts b/packages/lightwallet/common/services/fee.service.ts
index 1037955b17..fc316bc2ce 100644
--- a/packages/lightwallet/common/services/fee.service.ts
+++ b/packages/lightwallet/common/services/fee.service.ts
@@ -12,20 +12,16 @@ export class FeeLevels {
static SUPER_ECONOMY = 'superEconomy';
}
-
@Injectable()
export class FeeService {
-
public mwClient: MeritWalletClient;
public static DEFAULT_FEE = 10000;
private readonly CACHE_TIME = 120000; //2min
- private cache = {updatedTs: 0, levels: []};
+ private cache = { updatedTs: 0, levels: [] };
- constructor(
- mwcService: MWCService
- ) {
+ constructor(mwcService: MWCService) {
this.mwClient = mwcService.getClient(null);
}
@@ -35,7 +31,7 @@ export class FeeService {
public async getFeeRate(levelName) {
if (this.cache.updatedTs + this.CACHE_TIME < Date.now()) {
const levels = await this.mwClient.getFeeLevels(ENV.network);
- this.cache = {updatedTs: Date.now(), levels};
+ this.cache = { updatedTs: Date.now(), levels };
}
return this.cache.levels.find(l => l.level == levelName).feePerKb;
@@ -46,7 +42,7 @@ export class FeeService {
*/
public async getTxpFee(txp) {
const feePerKB = await this.getFeeRate(ENV.feeLevel);
- const fee = Math.round(feePerKB * txp.serialize().length / 1024);
+ const fee = Math.round((feePerKB * txp.serialize().length) / 1024);
return fee;
}
@@ -64,5 +60,4 @@ export class FeeService {
public getCurrentFeeLevel() {
return ENV.feeLevel;
}
-
}
diff --git a/packages/lightwallet/common/services/language.service.ts b/packages/lightwallet/common/services/language.service.ts
index d2e7939152..d04241ffbc 100644
--- a/packages/lightwallet/common/services/language.service.ts
+++ b/packages/lightwallet/common/services/language.service.ts
@@ -11,45 +11,52 @@ export class LanguageService {
private languages: Array = [
{
name: 'English',
- isoCode: 'en'
- }, {
+ isoCode: 'en',
+ },
+ {
name: 'Espaรฑol',
- isoCode: 'es'
- }, {
+ isoCode: 'es',
+ },
+ {
name: 'Franรงais',
isoCode: 'fr',
- }, {
+ },
+ {
name: 'Italiano',
isoCode: 'it',
- }, {
+ },
+ {
name: 'Polski',
isoCode: 'pl',
- }, {
+ },
+ {
name: 'Deutsch',
isoCode: 'de',
- }, {
+ },
+ {
name: 'ๆฅๆฌ่ช',
isoCode: 'ja',
useIdeograms: true,
- }, {
+ },
+ {
name: 'ไธญๆ๏ผ็ฎไฝ๏ผ',
isoCode: 'zh',
useIdeograms: true,
- }, {
+ },
+ {
name: 'Pัััะบะธะน',
isoCode: 'ru',
- }, {
+ },
+ {
name: 'Portuguรชs',
isoCode: 'pt',
- }
+ },
];
private current: string;
- constructor(private logger: LoggerService,
- private translate: TranslateService,
- private config: ConfigService) {
+ constructor(private logger: LoggerService, private translate: TranslateService, private config: ConfigService) {
this.logger.info('LanguageService initialized.');
- this.translate.onLangChange.subscribe((event) => {
+ this.translate.onLangChange.subscribe(event => {
this.logger.info('Settings language changed to: ' + event.lang);
});
}
@@ -74,9 +81,12 @@ export class LanguageService {
}
getName(lang: string) {
- return _.result(_.find(this.languages, {
- 'isoCode': lang
- }), 'name');
+ return _.result(
+ _.find(this.languages, {
+ isoCode: lang,
+ }),
+ 'name',
+ );
}
getDefault() {
@@ -93,12 +103,11 @@ export class LanguageService {
getCurrentInfo() {
return _.find(this.languages, {
- 'isoCode': this.current
+ isoCode: this.current,
});
}
getAvailables() {
return this.languages;
}
-
}
diff --git a/packages/lightwallet/common/services/ledger.service.ts b/packages/lightwallet/common/services/ledger.service.ts
index 5a37c2664e..c5facc7fdb 100644
--- a/packages/lightwallet/common/services/ledger.service.ts
+++ b/packages/lightwallet/common/services/ledger.service.ts
@@ -2,13 +2,12 @@ import { Injectable } from '@angular/core';
@Injectable()
export class LedgerService {
-
static description = {
id: 'ledger',
name: 'Ledger',
longName: 'Ledger Hardware Wallet',
isEmbeddedHardware: false,
- supportsTestnet: false
+ supportsTestnet: false,
};
private static LEDGER_CHROME_ID = 'kkdpmhnladdopljabkgpacgpliggeeaf';
@@ -17,10 +16,9 @@ export class LedgerService {
let bstr = new ByteString(s, GP.HEX).toBuffer();
let a = new Uint8Array(bstr.length);
- Array.prototype.forEach.call(bstr,
- (ch, i) => {
- a[i] = (ch + '').charCodeAt(0);
- });
+ Array.prototype.forEach.call(bstr, (ch, i) => {
+ a[i] = (ch + '').charCodeAt(0);
+ });
return a;
}
@@ -28,12 +26,9 @@ export class LedgerService {
public hexToString(s) {
return new ByteString(s, GP.HEX).toBuffer();
}
-
}
-
class Convert {
-
/**
* Convert a binary string to his hexadecimal representation
* @param {String} src binary string
@@ -47,7 +42,7 @@ class Convert {
r += hexes[src.charCodeAt(i) >> 4] + hexes[src.charCodeAt(i) & 0xf];
}
return r;
- };
+ }
/**
* Convert an hexadecimal string to its binary representation
@@ -59,7 +54,7 @@ class Convert {
static hexToBin(src) {
var result = '';
var digits = '0123456789ABCDEF';
- if ((src.length % 2) != 0) {
+ if (src.length % 2 != 0) {
throw 'Invalid string: ' + src;
}
src = src.toUpperCase();
@@ -84,12 +79,15 @@ class Convert {
* @param {Number} offset offset to the digit (default is 0)
* @returns {Number} converted digit
*/
- public static readHexDigit = function (data, offset) {
+ public static readHexDigit = function(data, offset) {
var digits = '0123456789ABCDEF';
if (typeof offset == 'undefined') {
offset = 0;
}
- return (digits.indexOf(data.substring(offset, offset + 1).toUpperCase()) << 4) + (digits.indexOf(data.substring(offset + 1, offset + 2).toUpperCase()));
+ return (
+ (digits.indexOf(data.substring(offset, offset + 1).toUpperCase()) << 4) +
+ digits.indexOf(data.substring(offset + 1, offset + 2).toUpperCase())
+ );
};
/**
@@ -98,9 +96,9 @@ class Convert {
* @param {Number} number number to convert
* @returns {String} converted number
*/
- public static toHexDigit = function (number) {
+ public static toHexDigit = function(number) {
var digits = '0123456789abcdef';
- return digits.charAt(number >> 4) + digits.charAt(number & 0x0F);
+ return digits.charAt(number >> 4) + digits.charAt(number & 0x0f);
};
/**
@@ -109,7 +107,7 @@ class Convert {
* @param {Number} number number to convert
* @returns {String} converted number
*/
- public static toHexByte = function (number) {
+ public static toHexByte = function(number) {
return this.toHexDigit(number);
};
@@ -119,19 +117,18 @@ class Convert {
* @param {Number} number number to convert
* @returns {String} converted number
*/
- public static toHexByteBCD = function (numberBCD) {
- var number = ((numberBCD / 10) * 16) + (numberBCD % 10);
+ public static toHexByteBCD = function(numberBCD) {
+ var number = (numberBCD / 10) * 16 + (numberBCD % 10);
return this.toHexDigit(number);
};
-
/**
* Convert a number to an hexadecimal short number
* @static
* @param {Number} number number to convert
* @returns {String} converted number
*/
- public static toHexShort = function (number) {
+ public static toHexShort = function(number) {
return this.toHexDigit((number >> 8) & 0xff) + this.toHexDigit(number & 0xff);
};
@@ -141,9 +138,13 @@ class Convert {
* @param {Number} number number to convert
* @returns {String} converted number
*/
- public static toHexInt = function (number) {
- return this.toHexDigit((number >> 24) & 0xff) + this.toHexDigit((number >> 16) & 0xff) +
- this.toHexDigit((number >> 8) & 0xff) + this.toHexDigit(number & 0xff);
+ public static toHexInt = function(number) {
+ return (
+ this.toHexDigit((number >> 24) & 0xff) +
+ this.toHexDigit((number >> 16) & 0xff) +
+ this.toHexDigit((number >> 8) & 0xff) +
+ this.toHexDigit(number & 0xff)
+ );
};
}
@@ -159,8 +160,7 @@ GP.HEX = 5;
* @constructs
*/
class ByteString {
-
- public toBuffer = function () {
+ public toBuffer = function() {
return this.value;
};
private hasBuffer: boolean;
@@ -168,10 +168,10 @@ class ByteString {
private length: any;
constructor(value, private encoding) {
- this.hasBuffer = (typeof Buffer != 'undefined');
+ this.hasBuffer = typeof Buffer != 'undefined';
this.hasBuffer = false;
- if (this.hasBuffer && (value instanceof Buffer)) {
+ if (this.hasBuffer && value instanceof Buffer) {
this.value = value;
this.encoding = GP.HEX;
} else {
diff --git a/packages/lightwallet/common/services/logger.service.ts b/packages/lightwallet/common/services/logger.service.ts
index c598605d71..feabc2dbb5 100644
--- a/packages/lightwallet/common/services/logger.service.ts
+++ b/packages/lightwallet/common/services/logger.service.ts
@@ -7,14 +7,13 @@ export enum LogLevel {
ERROR = 0,
WARN,
INFO,
- DEBUG
+ DEBUG,
}
declare const process: any;
@Injectable()
export class LoggerService {
-
private logs = [];
getLogs(level = LogLevel.INFO) {
@@ -25,16 +24,14 @@ export class LoggerService {
this.logs.push({ level: LogLevel.ERROR, timestamp: Date.now(), arguments: messages });
if (!LOGGING_ENABLED) return;
console.error.apply(console, messages);
- if (TRACE_ENABLED)
- console.trace();
+ if (TRACE_ENABLED) console.trace();
}
warn(...messages) {
this.logs.unshift({ level: LogLevel.WARN, timestamp: Date.now(), arguments: messages });
if (!LOGGING_ENABLED) return;
console.warn.apply(console, messages);
- if (TRACE_ENABLED)
- console.trace();
+ if (TRACE_ENABLED) console.trace();
}
info(...messages) {
@@ -54,4 +51,3 @@ export class LoggerService {
this.info(messages);
}
}
-
diff --git a/packages/lightwallet/common/services/mnemonic.service.ts b/packages/lightwallet/common/services/mnemonic.service.ts
index c3758875c8..b545e601c3 100644
--- a/packages/lightwallet/common/services/mnemonic.service.ts
+++ b/packages/lightwallet/common/services/mnemonic.service.ts
@@ -7,11 +7,7 @@ import { MeritWalletClient } from '@merit/common/merit-wallet-client';
@Injectable()
export class MnemonicService {
-
- constructor(private logger: LoggerService,
- private profileService: ProfileService,
- private mwcService: MWCService) {
- }
+ constructor(private logger: LoggerService, private profileService: ProfileService, private mwcService: MWCService) {}
async importMnemonic(words: string, opts: any): Promise {
const walletClient = this.mwcService.getClient(null, opts);
@@ -24,7 +20,7 @@ export class MnemonicService {
passphrase: opts.passphrase,
entropySourcePath: opts.entropySourcePath,
derivationStrategy: opts.derivationStrategy || 'BIP44',
- account: opts.account || 0
+ account: opts.account || 0,
});
return this.profileService.addWallet(walletClient);
@@ -40,7 +36,7 @@ export class MnemonicService {
network: opts.networkName || ENV.network,
passphrase: opts.passphrase,
account: opts.account || 0,
- derivationStrategy: opts.derivationStrategy || 'BIP44'
+ derivationStrategy: opts.derivationStrategy || 'BIP44',
});
return walletClient;
@@ -56,5 +52,5 @@ export class MnemonicService {
let wordList = words.split(/[\u3000\s]+/);
return wordList.join(isJA ? '\u3000' : ' ');
- };
+ }
}
diff --git a/packages/lightwallet/common/services/mobile-push-notifications-service.ts b/packages/lightwallet/common/services/mobile-push-notifications-service.ts
index ec53e02922..3a730dfd75 100644
--- a/packages/lightwallet/common/services/mobile-push-notifications-service.ts
+++ b/packages/lightwallet/common/services/mobile-push-notifications-service.ts
@@ -24,18 +24,20 @@ export class MobilePushNotificationsService extends PushNotificationsService {
return this.configService.get().pushNotificationsEnabled;
}
- constructor(http: HttpClient,
- public profileService: ProfileService,
- public platformService: PlatformService,
- public configService: ConfigService,
- logger: LoggerService,
- public appService: AppSettingsService,
- private app: App,
- private mwcService: MWCService,
- platform: Platform,
- private FCM: FCM,
- private ngZone: NgZone,
- private pollingNotifications: PollingNotificationsService) {
+ constructor(
+ http: HttpClient,
+ public profileService: ProfileService,
+ public platformService: PlatformService,
+ public configService: ConfigService,
+ logger: LoggerService,
+ public appService: AppSettingsService,
+ private app: App,
+ private mwcService: MWCService,
+ platform: Platform,
+ private FCM: FCM,
+ private ngZone: NgZone,
+ private pollingNotifications: PollingNotificationsService,
+ ) {
super(http, logger);
this.logger.info('Hello PushNotificationsService Service');
this.isIOS = this.platformService.isIOS;
@@ -114,11 +116,14 @@ export class MobilePushNotificationsService extends PushNotificationsService {
const wallet = (await this.profileService.getWallets()).find(w => w.id == data.walletId);
if (!_.isEmpty(wallet)) {
// Let's re-shape the event to match the notificatons stored in MWS
- this.profileService.propogateBwsEvent({
- data: _.pick(data, ['amount', 'address', 'txid']),
- type: data.type,
- walletId: data.walletId
- }, wallet);
+ this.profileService.propogateBwsEvent(
+ {
+ data: _.pick(data, ['amount', 'address', 'txid']),
+ type: data.type,
+ walletId: data.walletId,
+ },
+ wallet,
+ );
}
}
}
@@ -138,14 +143,13 @@ export class MobilePushNotificationsService extends PushNotificationsService {
this.subscribe(walletClient);
}
-
enable() {
if (!this.token) {
this.logger.warn('No token available for this device. Cannot set push notifications. Needs registration.');
return;
}
return super.enable();
- };
+ }
async disable() {
if (!this.usePushNotifications) {
@@ -183,7 +187,11 @@ export class MobilePushNotificationsService extends PushNotificationsService {
}
if (!this.token && this.retriesRemaining > 0) {
this.retriesRemaining--;
- this.logger.warn(`Attempted to subscribe without an available token; attempting to acquire. ${this.retriesRemaining} attempts remaining.`);
+ this.logger.warn(
+ `Attempted to subscribe without an available token; attempting to acquire. ${
+ this.retriesRemaining
+ } attempts remaining.`,
+ );
await this.getToken();
return super.subscribe(walletClient);
}
diff --git a/packages/lightwallet/common/services/mwc.service.ts b/packages/lightwallet/common/services/mwc.service.ts
index 22ba7c8803..36c2183d12 100644
--- a/packages/lightwallet/common/services/mwc.service.ts
+++ b/packages/lightwallet/common/services/mwc.service.ts
@@ -5,7 +5,7 @@ import { ENV } from '@app/env';
export enum MWCErrors {
AUTHENTICATION = 'MWC_AUTH_ERROR',
- CONNECTION = 'MWC_CONNECTION_ERROR'
+ CONNECTION = 'MWC_CONNECTION_ERROR',
}
@Injectable()
@@ -14,8 +14,7 @@ export class MWCService {
buildTx: Function = this.MWC.buildTx;
parseSecret: Function = this.MWC.parseSecret;
- constructor(private events: Events) {
- }
+ constructor(private events: Events) {}
public getMeritcore() {
return this.MWC.Meritcore;
@@ -33,7 +32,7 @@ export class MWCService {
return this.MWC.Utils;
}
- public getClient(walletData?, opts?: { bwsurl?: string; verbose?: boolean; }): MeritWalletClient {
+ public getClient(walletData?, opts?: { bwsurl?: string; verbose?: boolean }): MeritWalletClient {
if (!walletData && !opts && this.MWC) return this.MWC;
opts = opts || {};
diff --git a/packages/lightwallet/common/services/persistence.service.ts b/packages/lightwallet/common/services/persistence.service.ts
index a7900d9897..47b9ca11d0 100644
--- a/packages/lightwallet/common/services/persistence.service.ts
+++ b/packages/lightwallet/common/services/persistence.service.ts
@@ -408,10 +408,7 @@ export class PersistenceService {
async hideUnlockRequestAddress(address: string) {
const addresses = await this.getHiddenUnlockRequestsAddresses();
- return this.setHiddenUnlockRequestsAddresses([
- ...addresses,
- address
- ]);
+ return this.setHiddenUnlockRequestsAddresses([...addresses, address]);
}
async getActiveRequestsNumber() {
diff --git a/packages/lightwallet/common/services/persistence2.service.ts b/packages/lightwallet/common/services/persistence2.service.ts
index 93cac7c38b..d7de64480c 100644
--- a/packages/lightwallet/common/services/persistence2.service.ts
+++ b/packages/lightwallet/common/services/persistence2.service.ts
@@ -21,7 +21,7 @@ export enum UserSettingsKey {
GetStartedTips = 'get_started_tips',
recordPassphrase = 'record_passphrase',
primaryWalletID = 'primary_wallet_id',
- SmsNotificationsPrompt = 'sms_notifications_prompt'
+ SmsNotificationsPrompt = 'sms_notifications_prompt',
}
export interface INotificationSettings {
@@ -37,7 +37,7 @@ const DEFAULT_NOTIFICATION_SETTINGS: INotificationSettings = {
emailNotifications: false,
pushNotifications: true,
smsNotifications: false,
- phoneNumber: ''
+ phoneNumber: '',
};
/**
@@ -45,7 +45,7 @@ const DEFAULT_NOTIFICATION_SETTINGS: INotificationSettings = {
*/
@Injectable()
export class PersistenceService2 {
- constructor(private storage: Storage) { }
+ constructor(private storage: Storage) {}
/**
* Use this method to set a generic value that doesn't require it's own function
@@ -76,8 +76,8 @@ export class PersistenceService2 {
async setNotificationSettings(settings: Partial) {
return this.storage.set(StorageKey.NotificationSettings, {
- ...await this.getNotificationSettings(),
- ...settings
+ ...(await this.getNotificationSettings()),
+ ...settings,
});
}
@@ -85,7 +85,7 @@ export class PersistenceService2 {
const settings = (await this.storage.get(StorageKey.NotificationSettings)) || {};
return {
...DEFAULT_NOTIFICATION_SETTINGS,
- ...settings
+ ...settings,
};
}
@@ -113,7 +113,7 @@ export class PersistenceService2 {
await this.setEasySends(easySends);
return true;
} else {
- console.error('Couldn\'t find EasySend to cancel', scriptAddress);
+ console.error("Couldn't find EasySend to cancel", scriptAddress);
return false;
}
}
diff --git a/packages/lightwallet/common/services/platform.service.ts b/packages/lightwallet/common/services/platform.service.ts
index 16e45799b2..68c74aa767 100644
--- a/packages/lightwallet/common/services/platform.service.ts
+++ b/packages/lightwallet/common/services/platform.service.ts
@@ -15,8 +15,7 @@ export class PlatformService {
isDevel: boolean;
supportsLedger: boolean;
- constructor(private platform: Platform,
- private log: LoggerService) {
+ constructor(private platform: Platform, private log: LoggerService) {
let ua = navigator ? navigator.userAgent : null;
if (!ua) {
diff --git a/packages/lightwallet/common/services/polling-notification.service.ts b/packages/lightwallet/common/services/polling-notification.service.ts
index a25fa0dd26..c92f3aeccc 100644
--- a/packages/lightwallet/common/services/polling-notification.service.ts
+++ b/packages/lightwallet/common/services/polling-notification.service.ts
@@ -16,10 +16,12 @@ import { ElectronService } from '../../desktop/src/services/electron.service';
export class PollingNotificationsService {
private pollingNotificationsSubscriptions: { [walletId: string]: Subscription } = {};
- constructor(protected profileService: ProfileService,
- protected logger: LoggerService,
- @Optional() private store: Store,
- @Optional() private persistenceService: PersistenceService2) {
+ constructor(
+ protected profileService: ProfileService,
+ protected logger: LoggerService,
+ @Optional() private store: Store,
+ @Optional() private persistenceService: PersistenceService2,
+ ) {
this.logger.info('Hello PollingNotification Service');
}
@@ -30,7 +32,7 @@ export class PollingNotificationsService {
}
(await this.profileService.getWallets()).forEach(w => this.enablePolling(w));
- };
+ }
disable() {
let walletId: string;
@@ -46,11 +48,12 @@ export class PollingNotificationsService {
if (this.pollingNotificationsSubscriptions[walletClient.id]) {
this.logger.warn('Attempting to enable polling for wallet that already has polling enabled: ', walletClient.id);
} else {
- this.pollingNotificationsSubscriptions[walletClient.id] = walletClient.initNotifications()
+ this.pollingNotificationsSubscriptions[walletClient.id] = walletClient
+ .initNotifications()
.pipe(
filter((notifications: any[]) => !!notifications),
map((notifications: any[]) => uniqBy(notifications, 'walletId')),
- debounceTime(500)
+ debounceTime(500),
)
.subscribe(this.onFetch.bind(this));
}
@@ -64,12 +67,12 @@ export class PollingNotificationsService {
}
protected onFetch(notifications: any[]) {
- notifications.forEach((notification) => {
+ notifications.forEach(notification => {
if (notification) {
notification = {
...notification,
...notification.data,
- read: false
+ read: false,
};
delete notification.data;
@@ -77,10 +80,12 @@ export class PollingNotificationsService {
this.store.dispatch(new AddNotificationAction(notification));
if (notification.walletId) {
- this.store.dispatch(new RefreshOneWalletAction(notification.walletId, {
- skipAlias: true,
- skipShareCode: true
- }));
+ this.store.dispatch(
+ new RefreshOneWalletAction(notification.walletId, {
+ skipAlias: true,
+ skipShareCode: true,
+ }),
+ );
}
}
});
diff --git a/packages/lightwallet/common/services/profile.service.ts b/packages/lightwallet/common/services/profile.service.ts
index 62ac5da450..fc78d1ab6e 100644
--- a/packages/lightwallet/common/services/profile.service.ts
+++ b/packages/lightwallet/common/services/profile.service.ts
@@ -3,7 +3,7 @@ import { Events } from 'ionic-angular/util/events';
import { ENV } from '@app/env';
import { MeritWalletClient } from '@merit/common/merit-wallet-client';
import { PersistenceService } from '@merit/common/services/persistence.service';
-import { IVault } from "@merit/common/models/vault";
+import { IVault } from '@merit/common/models/vault';
import { LoggerService } from '@merit/common/services/logger.service';
import { MWCService } from '@merit/common/services/mwc.service';
@@ -12,23 +12,22 @@ import { MWCService } from '@merit/common/services/mwc.service';
*/
@Injectable()
export class ProfileService {
-
public wallets: Array;
public communityInfo: {
- communitySize: number,
- networkValue: number,
- miningRewards: number,
- growthRewards: number,
+ communitySize: number;
+ networkValue: number;
+ miningRewards: number;
+ growthRewards: number;
wallets: Array<{
- name: string,
- alias: string,
- referralAddress: string,
- confirmed: boolean,
- communitySize: number,
- miningRewards: number,
- growthRewards: number,
- color: string
+ name: string;
+ alias: string;
+ referralAddress: string;
+ confirmed: boolean;
+ communitySize: number;
+ miningRewards: number;
+ growthRewards: number;
+ color: string;
}>;
};
@@ -36,8 +35,8 @@ export class ProfileService {
private persistenceService: PersistenceService,
private logger: LoggerService,
private events: Events,
- private mwcService: MWCService
- ){
+ private mwcService: MWCService,
+ ) {
this.loadProfile();
}
@@ -74,7 +73,6 @@ export class ProfileService {
this.events.publish(eventName, wallet.id, n.type, n);
}
-
async loadProfile() {
const profile = await this.persistenceService.getProfile();
@@ -83,9 +81,7 @@ export class ProfileService {
if (profile.wallets) {
wallets = profile.wallets.map(w => MeritWalletClient.fromObj(w));
} else if (profile.credentials) {
- wallets = profile.credentials.map(c =>
- this.mwcService.getClient(JSON.stringify(c))
- )
+ wallets = profile.credentials.map(c => this.mwcService.getClient(JSON.stringify(c)));
}
}
this.wallets = wallets;
@@ -96,7 +92,7 @@ export class ProfileService {
async isAuthorized() {
if (this.wallets == undefined) await this.loadProfile();
- return (this.wallets.length > 0);
+ return this.wallets.length > 0;
}
async getWallets() {
@@ -122,23 +118,24 @@ export class ProfileService {
}
async refreshData() {
- let updateWallets = () => this.wallets.map(async (w) => {
- status = await w.getStatus();
- });
+ let updateWallets = () =>
+ this.wallets.map(async w => {
+ status = await w.getStatus();
+ });
- let updateVaults = () => this.wallets.map(async (w) => {
- w.vaults = await w.getVaults();
- w.vaults.forEach(v => {
- v.walletClient = w;
- })
- });
+ let updateVaults = () =>
+ this.wallets.map(async w => {
+ w.vaults = await w.getVaults();
+ w.vaults.forEach(v => {
+ v.walletClient = w;
+ });
+ });
await Promise.all(updateWallets().concat(updateVaults()));
this.storeProfile();
}
async addWallet(wallet: MeritWalletClient) {
-
if (this.wallets.find(w => w.id == wallet.credentials.walletId)) throw new Error('Wallet already added');
wallet.initialize(true);
@@ -153,7 +150,6 @@ export class ProfileService {
}
async updateWallet(wallet: MeritWalletClient) {
-
this.wallets = this.wallets.filter(w => w.id != wallet.id);
this.wallets.push(wallet);
@@ -162,16 +158,14 @@ export class ProfileService {
}
async deleteWallet(wallet: MeritWalletClient) {
-
wallet.eventEmitter.removeAllListeners();
- this.wallets = this.wallets.filter(w => (w.id != wallet.id));
+ this.wallets = this.wallets.filter(w => w.id != wallet.id);
return this.storeProfile();
}
async addVault(vault: IVault) {
-
this.wallets.some(w => {
if (w.id == vault.walletClient.id) {
if (!w.vaults) w.vaults = [];
@@ -184,10 +178,9 @@ export class ProfileService {
}
async updateVault(vault: IVault) {
-
this.wallets.some(w => {
if (w.id == vault.walletClient.id) {
- w.vaults = w.vaults.filter(v => (v._id != vault._id));
+ w.vaults = w.vaults.filter(v => v._id != vault._id);
w.vaults.push(vault);
return true;
}
@@ -197,7 +190,6 @@ export class ProfileService {
}
storeProfile() {
-
if (this.wallets == undefined) return;
/** do not save profile if we have wallet in temporary mode */
@@ -206,7 +198,7 @@ export class ProfileService {
let profile = {
version: '2.0.0',
wallets: this.wallets.map(w => w.toObj()),
- credentials: this.wallets.map(w => w.export())
+ credentials: this.wallets.map(w => w.export()),
};
this.persistenceService.storeProfile(profile);
@@ -229,28 +221,30 @@ export class ProfileService {
networkValue: 0,
miningRewards: 0,
growthRewards: 0,
- wallets: wallets.map(w => { return {
- name: w.name,
- alias: w.rootAlias,
- referralAddress: w.rootAddress.toString(),
- confirmed: w.confirmed,
- communitySize: 0,
- miningRewards: 0,
- growthRewards: 0,
- color: w.color
- }})
+ wallets: wallets.map(w => {
+ return {
+ name: w.name,
+ alias: w.rootAlias,
+ referralAddress: w.rootAddress.toString(),
+ confirmed: w.confirmed,
+ communitySize: 0,
+ miningRewards: 0,
+ growthRewards: 0,
+ color: w.color,
+ };
+ }),
};
const addresses = network.wallets.map(w => w.referralAddress);
if (addresses.length) {
-
- const getCommunitySizes = () => addresses.map(async (a) => {
- const { referralcount } = await wallets[0].getCommunityInfo(a);
- let w = network.wallets.find(w => w.referralAddress == a);
- w.communitySize = referralcount;
- network.communitySize += referralcount;
- });
+ const getCommunitySizes = () =>
+ addresses.map(async a => {
+ const { referralcount } = await wallets[0].getCommunityInfo(a);
+ let w = network.wallets.find(w => w.referralAddress == a);
+ w.communitySize = referralcount;
+ network.communitySize += referralcount;
+ });
const getRewards = async () => {
const rewards = await this.wallets[0].getRewards(addresses);
@@ -278,5 +272,4 @@ export class ProfileService {
}
return this.communityInfo;
}
-
}
diff --git a/packages/lightwallet/common/services/push-notification.service.ts b/packages/lightwallet/common/services/push-notification.service.ts
index fd1c52e4db..ceb3bf2c5f 100644
--- a/packages/lightwallet/common/services/push-notification.service.ts
+++ b/packages/lightwallet/common/services/push-notification.service.ts
@@ -9,9 +9,7 @@ export class PushNotificationsService {
protected platform: string;
protected packageName: string;
- constructor(
- protected http: HttpClient,
- protected logger: LoggerService) {}
+ constructor(protected http: HttpClient, protected logger: LoggerService) {}
protected get pushNotificationsEnabled(): boolean {
return false;
@@ -22,15 +20,23 @@ export class PushNotificationsService {
}
// abstract methods
- init(): Promise { return; }
+ init(): Promise {
+ return;
+ }
- protected requestPermission(): Promise { return; }
+ protected requestPermission(): Promise {
+ return;
+ }
- protected getToken(): Promise { return; }
+ protected getToken(): Promise {
+ return;
+ }
protected subscribeToEvents() {}
- protected getWallets(): Promise { return; }
+ protected getWallets(): Promise {
+ return;
+ }
protected enablePolling() {}
@@ -59,7 +65,7 @@ export class PushNotificationsService {
await walletClient.pushNotificationsSubscribe({
token: this.token,
platform: this.platform,
- packageName: this.packageName
+ packageName: this.packageName,
});
} catch (err) {
if (err) {
diff --git a/packages/lightwallet/common/services/rate.service.ts b/packages/lightwallet/common/services/rate.service.ts
index c5be7653c1..c0edcdfb90 100644
--- a/packages/lightwallet/common/services/rate.service.ts
+++ b/packages/lightwallet/common/services/rate.service.ts
@@ -1,18 +1,17 @@
import { MeritWalletClient } from '@merit/common/merit-wallet-client';
export class RateService {
-
private readonly CACHE_TIME = 120000; //2min
public mwClient: MeritWalletClient;
private MRT_TO_MIC = 1e8;
private cache: {
- updatedTs: number,
+ updatedTs: number;
rates: Array<{
- code: string,
- name: string,
- rate: number
- }>
+ code: string;
+ name: string;
+ rate: number;
+ }>;
};
/**
@@ -73,12 +72,11 @@ export class RateService {
return this.microsToMrt(micros) * rate;
}
- async fiatToMicros(amount: number, code: string): Promise {
+ async fiatToMicros(amount: number, code: string): Promise {
const rate = await this.getRate(code);
- return Math.ceil(amount / rate * this.MRT_TO_MIC);
+ return Math.ceil((amount / rate) * this.MRT_TO_MIC);
}
-
/**
* @OBSOLETE Remove this after removing usages of this method
*
@@ -100,8 +98,6 @@ export class RateService {
*/
fromFiatToMicros(amount: number, code: string) {
const r = this.cache.rates.find(l => l.code == code) || { rate: 0 };
- return Math.ceil(amount / r.rate * this.MRT_TO_MIC);
+ return Math.ceil((amount / r.rate) * this.MRT_TO_MIC);
}
-
}
-
diff --git a/packages/lightwallet/common/services/send.service.ts b/packages/lightwallet/common/services/send.service.ts
index 4289be3ef5..1774e2f0d2 100644
--- a/packages/lightwallet/common/services/send.service.ts
+++ b/packages/lightwallet/common/services/send.service.ts
@@ -12,23 +12,25 @@ import { isAddress } from '@merit/common/utils/addresses';
import { clone } from 'lodash';
import { EasySendService } from '@merit/common/services/easy-send.service';
import { Address } from 'meritcore-lib';
-import { accessWallet } from "./wallet.service";
+import { accessWallet } from './wallet.service';
import { getEasySendURL } from '@merit/common/models/easy-send';
-import { AlertService } from "@merit/common/services/alert.service";
+import { AlertService } from '@merit/common/services/alert.service';
export interface ISendTxData {
amount?: number; // micros
totalAmount?: number; // micros
fee?: number; // micros
feeIncluded?: boolean;
- easyFee?: number,
+ easyFee?: number;
password?: string;
- recipient?: {
- label?: string;
- name?: string;
- emails?: Array<{ value: string }>;
- phoneNumbers?: Array<{ value: string }>;
- } | MeritContact;
+ recipient?:
+ | {
+ label?: string;
+ name?: string;
+ emails?: Array<{ value: string }>;
+ phoneNumbers?: Array<{ value: string }>;
+ }
+ | MeritContact;
sendMethod?: ISendMethod;
txp?: any;
easySend?: EasySend;
@@ -41,12 +43,14 @@ export interface ISendTxData {
@Injectable()
export class SendService {
- constructor(private feeService: FeeService,
- private walletService: WalletService,
- private loggerService: LoggerService,
- private easySendService: EasySendService,
- private addressService: AddressService,
- private alertCtrl: AlertService) {}
+ constructor(
+ private feeService: FeeService,
+ private walletService: WalletService,
+ private loggerService: LoggerService,
+ private easySendService: EasySendService,
+ private addressService: AddressService,
+ private alertCtrl: AlertService,
+ ) {}
async prepareTxp(wallet: MeritWalletClient, amount: number, toAddress: string) {
if (!isAddress(toAddress)) {
@@ -61,7 +65,7 @@ export class SendService {
inputs: [], // will be defined on MWS side
feeLevel: this.feeService.getCurrentFeeLevel(),
excludeUnconfirmedUtxos: false,
- dryRun: true
+ dryRun: true,
};
if (amount == wallet.balance.spendableAmount) {
@@ -81,7 +85,7 @@ export class SendService {
fee: preparedTxp.fee,
excludeUnconfirmedUtxos: false,
dryRun: false,
- addressType: preparedTxp.addressType
+ addressType: preparedTxp.addressType,
};
if (preparedTxp.sendMax || !feeIncluded) {
@@ -95,10 +99,9 @@ export class SendService {
@accessWallet
async send(wallet: MeritWalletClient, txData: ISendTxData) {
-
- if (txData.sendMethod.type == SendMethodType.Easy) {
+ if (txData.sendMethod.type == SendMethodType.Easy) {
const easySend = await this.easySendService.createEasySendScriptHash(wallet, txData.password);
- const amount = txData.feeIncluded ? txData.amount : (txData.amount + await this.feeService.getEasyReceiveFee());
+ const amount = txData.feeIncluded ? txData.amount : txData.amount + (await this.feeService.getEasyReceiveFee());
txData.easySend = easySend;
txData.txp = await this.easySendService.prepareTxp(wallet, amount, easySend);
@@ -134,7 +137,6 @@ export class SendService {
}
}
-
async estimateFee(wallet: MeritWalletClient, amount: number, isEasySend: boolean, toAddress?: string) {
if (isEasySend) {
const easySend = await this.easySendService.bulidScript(wallet);
@@ -148,5 +150,4 @@ export class SendService {
return txp.fee;
}
}
-
}
diff --git a/packages/lightwallet/common/services/sms-notifications.service.ts b/packages/lightwallet/common/services/sms-notifications.service.ts
index af2de8f4b9..55f886ce3d 100644
--- a/packages/lightwallet/common/services/sms-notifications.service.ts
+++ b/packages/lightwallet/common/services/sms-notifications.service.ts
@@ -7,8 +7,7 @@ import { ISmsNotificationSettings, ISmsNotificationStatus } from '@merit/common/
export class SmsNotificationsService {
status: ISmsNotificationStatus;
- constructor(private profileService: ProfileService,
- private persistenceService: PersistenceService2) {}
+ constructor(private profileService: ProfileService, private persistenceService: PersistenceService2) {}
async getSmsSubscriptionStatus(): Promise {
if (this.status) {
@@ -22,7 +21,6 @@ export class SmsNotificationsService {
if (!wallets || !wallets.length) {
status = { enabled: false };
} else {
-
try {
status = await wallets[0].getSmsNotificationSubscription();
} catch (err) {}
@@ -36,17 +34,21 @@ export class SmsNotificationsService {
await this.persistenceService.setNotificationSettings({
smsNotifications: status.enabled,
- phoneNumber: status.phoneNumber || ''
+ phoneNumber: status.phoneNumber || '',
});
- return this.status = status;
+ return (this.status = status);
}
- async setSmsSubscription(enabled: boolean, phoneNumber?: string, platform?: string, settings?: ISmsNotificationSettings) {
+ async setSmsSubscription(
+ enabled: boolean,
+ phoneNumber?: string,
+ platform?: string,
+ settings?: ISmsNotificationSettings,
+ ) {
await this.persistenceService.setNotificationSettings({ smsNotifications: enabled, phoneNumber });
- if (enabled && !phoneNumber)
- return;
+ if (enabled && !phoneNumber) return;
const wallets = await this.profileService.getWallets();
let promises;
@@ -56,13 +58,13 @@ export class SmsNotificationsService {
enabled,
phoneNumber,
platform,
- settings
+ settings,
};
promises = wallets.map(wallet => wallet.smsNotificationsSubscribe(phoneNumber, platform, settings));
} else {
this.status = {
- enabled
+ enabled,
};
promises = wallets.map(wallet => wallet.smsNotificationsUnsubscribe());
diff --git a/packages/lightwallet/common/services/tx-format.service.ts b/packages/lightwallet/common/services/tx-format.service.ts
index c5047ed289..3eea521811 100644
--- a/packages/lightwallet/common/services/tx-format.service.ts
+++ b/packages/lightwallet/common/services/tx-format.service.ts
@@ -9,14 +9,15 @@ import { FiatAmount } from '@merit/common/models/fiat-amount';
@Injectable()
export class TxFormatService {
-
// TODO: implement configService
pendingTxProposalsCountForUs: number;
- constructor(private mwcService: MWCService,
- private rate: RateService,
- private config: ConfigService,
- private logger: LoggerService) {
+ constructor(
+ private mwcService: MWCService,
+ private rate: RateService,
+ private config: ConfigService,
+ private logger: LoggerService,
+ ) {
this.logger.info('Hello TxFormatService Service');
}
@@ -27,7 +28,7 @@ export class TxFormatService {
//TODO : now only works for english, specify opts to change thousand separator and decimal separator
let opts = {
- fullPrecision: !!fullPrecision
+ fullPrecision: !!fullPrecision,
};
return this.mwcService.getUtils().formatAmount(micros, settings.unitCode, opts);
}
@@ -46,7 +47,7 @@ export class TxFormatService {
}
toFiatStr(micros: number, code: string): Promise {
- return this.toFiat(micros, code).then((fiatAmount) => {
+ return this.toFiat(micros, code).then(fiatAmount => {
return new FiatAmount(parseFloat(fiatAmount)).amountStr;
});
}
@@ -62,7 +63,7 @@ export class TxFormatService {
if (isNaN(micros)) return;
let settings = this.config.get().wallet.settings;
- let v1 = parseFloat((this.rate.fromMicrosToFiat(micros, settings.alternativeIsoCode)).toFixed(2));
+ let v1 = parseFloat(this.rate.fromMicrosToFiat(micros, settings.alternativeIsoCode).toFixed(2));
if (!v1) return null;
let v1FormatFiat = new FiatAmount(v1);
if (!v1FormatFiat) return null;
@@ -94,12 +95,10 @@ export class TxFormatService {
}
async processTx(tx: any): Promise {
- if (!tx || tx.action == 'invalid')
- return tx;
+ if (!tx || tx.action == 'invalid') return tx;
// New transaction output format
if (tx.outputs && tx.outputs.length) {
-
let outputsNr = tx.outputs.length;
if (tx.action != 'received') {
@@ -127,44 +126,42 @@ export class TxFormatService {
this.pendingTxProposalsCountForUs = 0;
let now = Math.floor(Date.now() / 1000);
- const pTxps = await Promise.all(txps.map(async (tx: any) => {
- // no future transactions...
- if (tx.createdOn > now)
- tx.createdOn = now;
-
+ const pTxps = await Promise.all(
+ txps.map(async (tx: any) => {
+ // no future transactions...
+ if (tx.createdOn > now) tx.createdOn = now;
- // TODO: We should not call any services here. Data should be passed in.
- tx.wallet = { copayerId: 'yepNope' };
+ // TODO: We should not call any services here. Data should be passed in.
+ tx.wallet = { copayerId: 'yepNope' };
+ if (!tx.wallet) {
+ this.logger.info('no wallet at txp?');
+ return;
+ }
- if (!tx.wallet) {
- this.logger.info('no wallet at txp?');
- return;
- }
-
- const pTx = await this.processTx(tx);
+ const pTx = await this.processTx(tx);
- let action: any = _.find(pTx.actions, {
- copayerId: pTx.wallet.copayerId
- });
+ let action: any = _.find(pTx.actions, {
+ copayerId: pTx.wallet.copayerId,
+ });
- if (!action && pTx.status == 'pending') {
- pTx.pendingForUs = true;
- }
+ if (!action && pTx.status == 'pending') {
+ pTx.pendingForUs = true;
+ }
- if (action && action.type == 'accept') {
- pTx.statusForUs = 'accepted';
- } else if (action && action.type == 'reject') {
- pTx.statusForUs = 'rejected';
- } else {
- pTx.statusForUs = 'pending';
- }
+ if (action && action.type == 'accept') {
+ pTx.statusForUs = 'accepted';
+ } else if (action && action.type == 'reject') {
+ pTx.statusForUs = 'rejected';
+ } else {
+ pTx.statusForUs = 'pending';
+ }
- if (!pTx.deleteLockTime)
- pTx.canBeRemoved = true;
+ if (!pTx.deleteLockTime) pTx.canBeRemoved = true;
- return pTx;
- }));
+ return pTx;
+ }),
+ );
this.logger.warn('What are the TXPs after promise all?');
this.logger.warn(pTxps);
@@ -203,9 +200,8 @@ export class TxFormatService {
currency: currency,
alternativeIsoCode: alternativeIsoCode,
amountMicros: amountMicros,
- amountUnitStr: amountUnitStr
+ amountUnitStr: amountUnitStr,
};
-
}
satToUnit(amount: any) {
@@ -216,5 +212,4 @@ export class TxFormatService {
let unitDecimals = settings.unitDecimals;
return parseFloat((amount * satToUnit).toFixed(unitDecimals));
}
-
}
diff --git a/packages/lightwallet/common/services/unlock-request.service.ts b/packages/lightwallet/common/services/unlock-request.service.ts
index adc51fc48f..f18e6c0f4e 100644
--- a/packages/lightwallet/common/services/unlock-request.service.ts
+++ b/packages/lightwallet/common/services/unlock-request.service.ts
@@ -23,18 +23,18 @@ export interface IUnlockRequest {
@Injectable()
export class UnlockRequestService {
-
hiddenAddresses: Array;
activeRequestsNumber: number;
hiddenRequests: Array = [];
confirmedRequests: Array = [];
activeRequests: Array = [];
- constructor(private profileService: ProfileService,
- private persistenseService: PersistenceService,
- private walletService: WalletService,
- private contactsService: ContactsService) {
- }
+ constructor(
+ private profileService: ProfileService,
+ private persistenseService: PersistenceService,
+ private walletService: WalletService,
+ private contactsService: ContactsService,
+ ) {}
//todo subscribe to new block event, then update info
async loadRequestsData() {
@@ -46,26 +46,27 @@ export class UnlockRequestService {
let requests = { hidden: [], active: [], confirmed: [] };
const wallets = await this.profileService.getWallets();
- const updateWallets = (requests) => wallets.map(async (w) => {
- const rqs = await w.getUnlockRequests();
- rqs.forEach(request => {
- request.walletClient = w;
- if (request.isConfirmed) {
- request.status = 'accepted';
- const foundContacts = this.contactsService.searchContacts(knownContacts, request.address);
- if (foundContacts.length) {
- request.contact = foundContacts[0];
+ const updateWallets = requests =>
+ wallets.map(async w => {
+ const rqs = await w.getUnlockRequests();
+ rqs.forEach(request => {
+ request.walletClient = w;
+ if (request.isConfirmed) {
+ request.status = 'accepted';
+ const foundContacts = this.contactsService.searchContacts(knownContacts, request.address);
+ if (foundContacts.length) {
+ request.contact = foundContacts[0];
+ }
+ requests.confirmed.push(request);
+ } else if (this.hiddenAddresses.indexOf(request.address) != -1) {
+ request.status = 'hidden';
+ requests.hidden.push(request);
+ } else {
+ request.status = 'pending';
+ requests.active.push(request);
}
- requests.confirmed.push(request);
- } else if (this.hiddenAddresses.indexOf(request.address) != -1) {
- request.status = 'hidden';
- requests.hidden.push(request);
- } else {
- request.status = 'pending';
- requests.active.push(request);
- }
- })
- });
+ });
+ });
await Promise.all(updateWallets(requests));
diff --git a/packages/lightwallet/common/services/vaults.service.ts b/packages/lightwallet/common/services/vaults.service.ts
index 89a26b7834..1de224fa9a 100644
--- a/packages/lightwallet/common/services/vaults.service.ts
+++ b/packages/lightwallet/common/services/vaults.service.ts
@@ -1,10 +1,10 @@
import { Injectable } from '@angular/core';
import { LoggerService } from '@merit/common/services/logger.service';
-import { IVault } from "@merit/common/models/vault";
+import { IVault } from '@merit/common/models/vault';
import { WalletService } from '@merit/common/services/wallet.service';
import { ProfileService } from '@merit/common/services/profile.service';
-import { RateService } from "@merit/common/services/rate.service";
+import { RateService } from '@merit/common/services/rate.service';
import { MeritWalletClient } from '@merit/common/merit-wallet-client';
import { Constants } from '@merit/common/merit-wallet-client/lib/common/constants';
import { FeeService } from '@merit/common/services/fee.service';
@@ -12,24 +12,22 @@ import { ENV } from '@app/env';
import { HDPrivateKey, Address, Script, Transaction, PublicKey, Opcode, crypto } from 'meritcore-lib';
export interface IVaultCreateData {
- vaultName: string,
- whiteList: Array,
- wallet: MeritWalletClient,
- amount: number,
- masterKey: {key: any, phrase: string}
+ vaultName: string;
+ whiteList: Array;
+ wallet: MeritWalletClient;
+ amount: number;
+ masterKey: { key: any; phrase: string };
}
@Injectable()
export class VaultsService {
-
constructor(
private logger: LoggerService,
private walletService: WalletService,
private profileService: ProfileService,
private rateService: RateService,
- private feeService: FeeService
- ) {
- }
+ private feeService: FeeService,
+ ) {}
/**
* Receiving fresh data from MWS db, does not look into blockchain
@@ -49,7 +47,7 @@ export class VaultsService {
* Changing only name in MWS, no transactions created
*/
async editVaultName(vault: IVault, newName: string) {
- return vault.walletClient.updateVaultInfo({_id: vault._id, name: newName});
+ return vault.walletClient.updateVaultInfo({ _id: vault._id, name: newName });
}
/**
@@ -62,7 +60,7 @@ export class VaultsService {
const fee = await this.feeService.getTxpFee(txp);
const tx = await this.getSendTxp(vault, amount, toAddress, fee);
await vault.walletClient.broadcastRawTx({ rawTx: tx.serialize(), network: ENV.network });
- await vault.walletClient.updateVaultInfo({_id: vault._id});
+ await vault.walletClient.updateVaultInfo({ _id: vault._id });
vault = await this.getVaultInfo(vault);
await this.profileService.updateVault(vault);
@@ -70,9 +68,9 @@ export class VaultsService {
}
/**
- * renewing vault means changing whitelist. Address and redeem script stays the same, but scriptPubKey changes
- * so we take all utxos and send them to the same address but differrent scriptPubkey
- */
+ * renewing vault means changing whitelist. Address and redeem script stays the same, but scriptPubKey changes
+ * so we take all utxos and send them to the same address but differrent scriptPubkey
+ */
async renewVaultWhitelist(vault: IVault, newWhitelist: Array, masterKey) {
vault = await this.getVaultInfo(vault);
@@ -87,18 +85,18 @@ export class VaultsService {
_id: vault._id,
status: 'renewing',
whitelist: newWhitelist,
- initialTxId: txid
+ initialTxId: txid,
};
return vault.walletClient.updateVaultInfo(infoToUpdate);
}
/**
- * create and deposit new vault
- */
+ * create and deposit new vault
+ */
async createVault(data: IVaultCreateData) {
await this.checkCreateData(data);
- const vault:any = this.prepareVault(0, {
+ const vault: any = this.prepareVault(0, {
whitelist: data.whiteList.map(w => w.rootAddress.toBuffer()),
masterPubKey: data.masterKey.key.publicKey,
spendPubKey: HDPrivateKey.fromString(data.wallet.credentials.xPrivKey).publicKey,
@@ -110,7 +108,7 @@ export class VaultsService {
signPrivKey: data.masterKey.key.privateKey,
address: vault.address.toString(),
addressType: Address.ParameterizedPayToScriptHashType, // pubkey address
- network: data.wallet.credentials.network
+ network: data.wallet.credentials.network,
};
//todo use wallet decrypt-encrypt decorator
@@ -119,7 +117,7 @@ export class VaultsService {
await this.walletService.sendInvite(data.wallet, scriptReferralOpts.address, 1, vault.scriptPubKey.toHex());
vault.scriptPubKey = vault.scriptPubKey.toBuffer().toString('hex');
- const depositData = {amount: data.amount, address: vault.address, scriptPubKey: vault.scriptPubKey};
+ const depositData = { amount: data.amount, address: vault.address, scriptPubKey: vault.scriptPubKey };
const txp = await this.getDepositTxp(depositData, data.wallet);
const pubTxp = await this.walletService.publishTx(data.wallet, txp);
//todo wallet should be decrypted by the moment
@@ -135,32 +133,36 @@ export class VaultsService {
}
/**
- * sending money to existing vault
- */
+ * sending money to existing vault
+ */
async depositVault(vault, amount) {
vault = await this.getVaultInfo(vault);
const address = Address(vault.address);
- const scriptPubKey = Script(vault.scriptPubKey).toBuffer().toString('hex');
- const txp = await this.getDepositTxp({address, scriptPubKey, amount}, vault.walletClient);
+ const scriptPubKey = Script(vault.scriptPubKey)
+ .toBuffer()
+ .toString('hex');
+ const txp = await this.getDepositTxp({ address, scriptPubKey, amount }, vault.walletClient);
await this.walletService.publishAndSign(vault.walletClient, txp);
- await vault.walletClient.updateVaultInfo({_id: vault._id, name: vault.name});
+ await vault.walletClient.updateVaultInfo({ _id: vault._id, name: vault.name });
vault = await this.getVaultInfo(vault);
await this.profileService.updateVault(vault);
return vault;
}
/**
- * check if we can create vault
- */
+ * check if we can create vault
+ */
private async checkCreateData(data) {
if (
- !data.vaultName
- || !data.wallet
- || !data.whiteList
- || !data.whiteList.length
- || !data.amount
- || !data.masterKey || !data.masterKey.key || !data.masterKey.phrase
+ !data.vaultName ||
+ !data.wallet ||
+ !data.whiteList ||
+ !data.whiteList.length ||
+ !data.amount ||
+ !data.masterKey ||
+ !data.masterKey.key ||
+ !data.masterKey.phrase
) {
this.logger.warn('Incorrect data', data);
throw new Error('Incorrect data');
@@ -172,16 +174,16 @@ export class VaultsService {
throw new Error("You don't have any active invites that you can use to create a vault");
}
if (data.amount > data.wallet.balance.spendableAmount) {
- throw new Error("Wallet balance is less than vault balance");
+ throw new Error('Wallet balance is less than vault balance');
}
return true;
}
/**
- * renewing vault means changing whitelist. Address and redeem script stays the same, but scriptPubKey changes
- * so we take all utxos and send them to the same address but differrent scriptPubkey
- */
+ * renewing vault means changing whitelist. Address and redeem script stays the same, but scriptPubKey changes
+ * so we take all utxos and send them to the same address but differrent scriptPubkey
+ */
private getRenewTxp(vault, newWhitelist, masterKey, fee = FeeService.DEFAULT_FEE) {
const amount = vault.amount - fee;
@@ -191,7 +193,7 @@ export class VaultsService {
let params = [
new PublicKey(vault.spendPubKey, { network: ENV.network }).toBuffer(),
- new PublicKey(vault.masterPubKey, { network: ENV.network }).toBuffer()
+ new PublicKey(vault.masterPubKey, { network: ENV.network }).toBuffer(),
];
const whitelist = newWhitelist.map(w => Address(w).hashBuffer);
@@ -227,10 +229,9 @@ export class VaultsService {
}
/**
- * creating transaction to transfer money from vault to one of whitelisted addresses
- */
+ * creating transaction to transfer money from vault to one of whitelisted addresses
+ */
private getSendTxp(vault, amount, address, fee = FeeService.DEFAULT_FEE) {
-
if (vault.type != 0) throw new Error('Vault type is not supported');
//todo why are we using wallet private key here???
@@ -238,13 +239,13 @@ export class VaultsService {
let selectedCoins = [];
let selectedAmount = 0;
- for(let c = 0; c < vault.coins.length && selectedAmount < amount; c++) {
+ for (let c = 0; c < vault.coins.length && selectedAmount < amount; c++) {
let coin = vault.coins[c];
selectedAmount += coin.micros;
selectedCoins.push(coin);
}
- if(selectedAmount < amount) throw new Error('Insufficient funds');
+ if (selectedAmount < amount) throw new Error('Insufficient funds');
const change = selectedAmount - amount;
@@ -268,10 +269,12 @@ export class VaultsService {
let scriptPubKey = Script.buildMixedParameterizedP2SH(redeemScript, params, vault.masterPubKey);
- tx.addOutput(Transaction.Output({
- script: scriptPubKey,
- micros: change
- }));
+ tx.addOutput(
+ Transaction.Output({
+ script: scriptPubKey,
+ micros: change,
+ }),
+ );
tx.fee(fee);
@@ -290,29 +293,30 @@ export class VaultsService {
});
return tx;
-
}
/**
- * transfer money to vault
- */
+ * transfer money to vault
+ */
private async getDepositTxp(vault: any, wallet: MeritWalletClient): Promise {
let feeLevel = this.feeService.getCurrentFeeLevel();
- if (vault.amount > Number.MAX_SAFE_INTEGER) throw new Error('The amount is too big'); // Because Javascript
+ if (vault.amount > Number.MAX_SAFE_INTEGER) throw new Error('The amount is too big'); // Because Javascript
- let txp:any = {
- outputs: [{
- 'toAddress': vault.address.toString(),
- 'script': vault.scriptPubKey,
- 'amount': vault.amount
- }],
+ let txp: any = {
+ outputs: [
+ {
+ toAddress: vault.address.toString(),
+ script: vault.scriptPubKey,
+ amount: vault.amount,
+ },
+ ],
addressType: 'PP2SH',
inputs: null, //Let Merit wallet service figure out the inputs based
- //on the selected wallet.
+ //on the selected wallet.
feeLevel: feeLevel,
excludeUnconfirmedUtxos: true,
- dryRun: true
+ dryRun: true,
};
if (vault.amount == wallet.balance.totalConfirmedAmount) {
delete txp.outputs[0].amount;
@@ -331,21 +335,16 @@ export class VaultsService {
}
/**
- * create vautl object before transfering Merit
- */
+ * create vautl object before transfering Merit
+ */
private prepareVault(type: number, opts: any = {}) {
-
if (type != 0) throw new Error('Vault type is not supported');
let tag = opts.masterPubKey.toAddress().hashBuffer;
let whitelist = opts.whitelist.map(w => Address(w).hashBuffer);
- let params = [
- opts.spendPubKey.toBuffer(),
- opts.masterPubKey.toBuffer(),
- ];
-
+ let params = [opts.spendPubKey.toBuffer(), opts.masterPubKey.toBuffer()];
const spendLimit = this.rateService.mrtToMicro(Constants.VAULT_SPEND_LIMIT);
params.push(crypto.BN.fromNumber(spendLimit).toScriptNumBuffer());
@@ -365,10 +364,9 @@ export class VaultsService {
masterPubKey: opts.masterPubKey,
redeemScript: redeemScript,
scriptPubKey: scriptPubKey,
- address: Address(scriptPubKey.getAddressInfo())
+ address: Address(scriptPubKey.getAddressInfo()),
};
return vault;
}
-
}
diff --git a/packages/lightwallet/common/services/wallet.service.ts b/packages/lightwallet/common/services/wallet.service.ts
index b411505d86..202bd4140a 100644
--- a/packages/lightwallet/common/services/wallet.service.ts
+++ b/packages/lightwallet/common/services/wallet.service.ts
@@ -11,13 +11,11 @@ import { PersistenceService } from '@merit/common/services/persistence.service';
import { ProfileService } from '@merit/common/services/profile.service';
import { Events } from 'ionic-angular/util/events';
import * as _ from 'lodash';
-import { AlertService } from "@merit/common/services/alert.service";
-
+import { AlertService } from '@merit/common/services/alert.service';
export function accessWallet(target, key: string, descriptor: any) {
-
return {
- value: async function (...args:any[]) {
+ value: async function(...args: any[]) {
const wallet: MeritWalletClient = args[0];
if (!wallet || !wallet.credentials) {
@@ -49,26 +47,23 @@ export function accessWallet(target, key: string, descriptor: any) {
}
}
return result;
- }
-
+ },
};
}
@Injectable()
export class WalletService {
-
-
- constructor(private logger: LoggerService,
- private mwcService: MWCService,
- private configService: ConfigService,
- private profileService: ProfileService,
- private persistenceService: PersistenceService,
- private mnemonicService: MnemonicService,
- private easySendService: EasySendService,
- private events: Events,
- private alertCtrl: AlertService
- ) {
- }
+ constructor(
+ private logger: LoggerService,
+ private mwcService: MWCService,
+ private configService: ConfigService,
+ private profileService: ProfileService,
+ private persistenceService: PersistenceService,
+ private mnemonicService: MnemonicService,
+ private easySendService: EasySendService,
+ private events: Events,
+ private alertCtrl: AlertService,
+ ) {}
isWalletEncrypted(wallet: MeritWalletClient) {
return wallet.isPrivKeyEncrypted();
@@ -77,7 +72,7 @@ export class WalletService {
encryptWallet(wallet: MeritWalletClient, password: string): Promise {
wallet.encryptPrivateKey(password, {});
return this.profileService.updateWallet(wallet);
- };
+ }
decryptWallet(wallet: MeritWalletClient, password: string) {
return wallet.decryptPrivateKey(password);
@@ -106,8 +101,7 @@ export class WalletService {
@accessWallet
broadcastTx(wallet: MeritWalletClient, txp: any): Promise {
- if (txp.status != 'accepted')
- throw new Error('TX_NOT_ACCEPTED');
+ if (txp.status != 'accepted') throw new Error('TX_NOT_ACCEPTED');
return wallet.broadcastTxProposal(txp);
}
@@ -135,7 +129,6 @@ export class WalletService {
@accessWallet
async publishAndSign(wallet: MeritWalletClient, txp: any): Promise {
-
if (txp.status != 'pending') {
txp = await this.publishTx(wallet, txp);
}
@@ -168,16 +161,24 @@ export class WalletService {
*
*/
@accessWallet
- async sendInvite(wallet: MeritWalletClient, toAddress: string, amount: number = 1, script = null, message: string = ''): Promise {
+ async sendInvite(
+ wallet: MeritWalletClient,
+ toAddress: string,
+ amount: number = 1,
+ script = null,
+ message: string = '',
+ ): Promise {
amount = parseInt(amount as any);
const opts = {
invite: true,
- outputs: [_.pickBy({
- amount,
- toAddress,
- message,
- script
- })]
+ outputs: [
+ _.pickBy({
+ amount,
+ toAddress,
+ message,
+ script,
+ }),
+ ],
};
let txp = await wallet.createTxProposal(opts);
@@ -207,7 +208,6 @@ export class WalletService {
return easySend;
}
-
/** =================== CREATE WALLET METHODS ================ */
createDefaultWallet(parentAddress: string, alias: string) {
@@ -233,7 +233,7 @@ export class WalletService {
singleAddress: opts.singleAddress,
walletPrivKey: opts.walletPrivKey,
parentAddress: opts.parentAddress,
- alias: opts.alias
+ alias: opts.alias,
});
await this.profileService.addWallet(wallet);
@@ -243,7 +243,6 @@ export class WalletService {
// TODO: Rename this.
private async seedWallet(opts: any): Promise {
-
let walletClient = this.mwcService.getClient(null, opts);
if (opts.mnemonic) {
@@ -256,9 +255,9 @@ export class WalletService {
} else if (opts.extendedPrivateKey) {
try {
walletClient.seedFromExtendedPrivateKey(opts.extendedPrivateKey, {
- network: ENV.network,
+ network: ENV.network,
account: opts.account || 0,
- derivationStrategy: opts.derivationStrategy || 'BIP44'
+ derivationStrategy: opts.derivationStrategy || 'BIP44',
});
} catch (ex) {
this.logger.warn(ex);
@@ -268,7 +267,7 @@ export class WalletService {
try {
walletClient.seedFromExtendedPublicKey(opts.extendedPublicKey, opts.externalSource, opts.entropySource, {
account: opts.account || 0,
- derivationStrategy: opts.derivationStrategy || 'BIP44'
+ derivationStrategy: opts.derivationStrategy || 'BIP44',
});
walletClient.credentials.hwInfo = opts.hwInfo;
} catch (ex) {
@@ -276,11 +275,11 @@ export class WalletService {
throw new Error('Could not create using the specified extended key'); // TODO GetTextCatalog
}
} else {
- walletClient.seedFromRandomWithMnemonic({
- network: ENV.network,
- passphrase: opts.passphrase,
- account: 0
- });
+ walletClient.seedFromRandomWithMnemonic({
+ network: ENV.network,
+ passphrase: opts.passphrase,
+ account: 0,
+ });
}
return walletClient;
}
@@ -290,7 +289,7 @@ export class WalletService {
const encodingType = {
mnemonic: 1,
xpriv: 2,
- xpub: 3
+ xpub: 3,
};
let info: any = {};
@@ -302,41 +301,47 @@ export class WalletService {
if (keys.mnemonic) {
info = {
type: encodingType.mnemonic,
- data: keys.mnemonic
+ data: keys.mnemonic,
};
} else {
info = {
type: encodingType.xpriv,
- data: keys.xPrivKey
+ data: keys.xPrivKey,
};
}
- return info.type + '|' + info.data + '|' + wallet.credentials.network.toLowerCase() + '|' + derivationPath + '|' + (wallet.credentials.mnemonicHasPassphrase);
+ return (
+ info.type +
+ '|' +
+ info.data +
+ '|' +
+ wallet.credentials.network.toLowerCase() +
+ '|' +
+ derivationPath +
+ '|' +
+ wallet.credentials.mnemonicHasPassphrase
+ );
}
-
/** ================ PREFERENCES METHODS ======================== **/
async setHiddenBalanceOption(walletId: string, hideBalance: boolean): Promise {
- await this.persistenceService.setHideBalanceFlag(walletId, String(hideBalance));
+ await this.persistenceService.setHideBalanceFlag(walletId, String(hideBalance));
}
private updateRemotePreferencesFor(clients: any[], prefs: any): Promise {
- return Promise.all(clients.map((wallet: any) =>
- wallet.savePreferences(prefs)
- ));
+ return Promise.all(clients.map((wallet: any) => wallet.savePreferences(prefs)));
}
async updateRemotePreferences(clients: any[], prefs: any = {}): Promise {
- if (!_.isArray(clients))
- clients = [clients];
+ if (!_.isArray(clients)) clients = [clients];
// Update this JIC.
let config: any = this.configService.get();
prefs.email = config.emailNotifications.email;
prefs.language = 'en';
- Promise.all(clients.map(async (w) => w.savePreferences(prefs) ));
+ Promise.all(clients.map(async w => w.savePreferences(prefs)));
clients.forEach(c => {
c.preferences = _.assign(prefs, c.preferences);
@@ -351,7 +356,7 @@ export class WalletService {
try {
await walletClient.importFromExtendedPublicKey(opts.extendedPublicKey, opts.externalSource, opts.entropySource, {
account: opts.account || 0,
- derivationStrategy: opts.derivationStrategy || 'BIP44'
+ derivationStrategy: opts.derivationStrategy || 'BIP44',
});
return this.profileService.addWallet(walletClient);
@@ -362,7 +367,6 @@ export class WalletService {
}
async importExtendedPrivateKey(xPrivKey: string, opts: any): Promise {
-
const walletClient = this.mwcService.getClient(null, opts);
this.logger.debug('Importing Wallet xPrivKey');
@@ -398,5 +402,4 @@ export class WalletService {
throw new Error('Could not import. Check input file and spending password'); // TODO getTextCatalog
}
}
-
}
diff --git a/packages/lightwallet/common/services/web-push-notifications.service.ts b/packages/lightwallet/common/services/web-push-notifications.service.ts
index 439ec882a2..7a6461cbcf 100644
--- a/packages/lightwallet/common/services/web-push-notifications.service.ts
+++ b/packages/lightwallet/common/services/web-push-notifications.service.ts
@@ -17,13 +17,11 @@ import { filter, map, take } from 'rxjs/operators';
const FirebaseAppConfig = {
apiKey: 'APIKEY',
projectId: 'prime-service-181121',
- messagingSenderId: '1091326413792'
+ messagingSenderId: '1091326413792',
};
-
@Injectable()
export class WebPushNotificationsService extends PushNotificationsService {
-
protected get pushNotificationsEnabled(): boolean {
return this._pushNotificationsEnabled;
}
@@ -37,11 +35,13 @@ export class WebPushNotificationsService extends PushNotificationsService {
private firebaseApp;
private firebaseMessaging;
- constructor(http: HttpClient,
- logger: LoggerService,
- private pollingNotificationService: PollingNotificationsService,
- private persistenceService: PersistenceService2,
- private store: Store) {
+ constructor(
+ http: HttpClient,
+ logger: LoggerService,
+ private pollingNotificationService: PollingNotificationsService,
+ private persistenceService: PersistenceService2,
+ private store: Store,
+ ) {
super(http, logger);
this.logger.info('Web PushNotifications service is alive!');
this.platform = 'web';
@@ -49,11 +49,12 @@ export class WebPushNotificationsService extends PushNotificationsService {
}
getWallets() {
- return this.store.select(selectWallets)
+ return this.store
+ .select(selectWallets)
.pipe(
filter((wallets: DisplayWallet[]) => wallets && wallets.length > 0),
take(1),
- map((wallets: DisplayWallet[]) => wallets.map(wallet => wallet.client))
+ map((wallets: DisplayWallet[]) => wallets.map(wallet => wallet.client)),
)
.toPromise();
}
@@ -82,7 +83,7 @@ export class WebPushNotificationsService extends PushNotificationsService {
if (this.pushNotificationsEnabled) {
if (!this.token) {
- this.firebaseApp = firebase.apps.length? firebase.app() : firebase.initializeApp(FirebaseAppConfig);
+ this.firebaseApp = firebase.apps.length ? firebase.app() : firebase.initializeApp(FirebaseAppConfig);
this.firebaseMessaging = firebase.messaging(this.firebaseApp);
await this.registerSW();
try {
@@ -94,7 +95,7 @@ export class WebPushNotificationsService extends PushNotificationsService {
this._hasPermission = false;
await this.persistenceService.setNotificationSettings({
...settings,
- pushNotifications: false
+ pushNotifications: false,
});
this.enablePolling();
return;
@@ -125,17 +126,21 @@ export class WebPushNotificationsService extends PushNotificationsService {
async subscribeToEvents() {
this.firebaseMessaging.onMessage((data: NotificationData) => {
if (data.data) {
- this.store.dispatch(new AddNotificationAction({
- ...data.data,
- timestamp: Date.now(),
- read: false
- }));
+ this.store.dispatch(
+ new AddNotificationAction({
+ ...data.data,
+ timestamp: Date.now(),
+ read: false,
+ }),
+ );
if (data.data.walletId) {
- this.store.dispatch(new RefreshOneWalletAction(data.data.walletId, {
- skipAlias: true,
- skipShareCode: true
- }));
+ this.store.dispatch(
+ new RefreshOneWalletAction(data.data.walletId, {
+ skipAlias: true,
+ skipShareCode: true,
+ }),
+ );
}
}
});
diff --git a/packages/lightwallet/common/utils/constants.ts b/packages/lightwallet/common/utils/constants.ts
index f6bae6e21a..539768ee6b 100644
--- a/packages/lightwallet/common/utils/constants.ts
+++ b/packages/lightwallet/common/utils/constants.ts
@@ -1,11 +1,10 @@
import { ModalOptions } from 'ionic-angular';
import { ENV } from '@app/env';
-
export const MERIT_MODAL_OPTS: ModalOptions = {
leaveAnimation: 'modal-slide-out',
enterAnimation: 'modal-slide-in',
- cssClass: 'merit-modal'
+ cssClass: 'merit-modal',
};
export const COINBASE_CONFIRMATION_THRESHOLD = ENV.network == 'testnet' ? 6 : 100;
@@ -22,7 +21,7 @@ export const UNITS = {
short: {
maxDecimals: 6,
minDecimals: 2,
- }
+ },
},
bit: {
toMicros: 100,
@@ -33,6 +32,6 @@ export const UNITS = {
short: {
maxDecimals: 0,
minDecimals: 0,
- }
+ },
},
};
diff --git a/packages/lightwallet/common/utils/contacts.ts b/packages/lightwallet/common/utils/contacts.ts
index a48afcc2f7..aa99630360 100644
--- a/packages/lightwallet/common/utils/contacts.ts
+++ b/packages/lightwallet/common/utils/contacts.ts
@@ -4,7 +4,10 @@ import { clone, isEmpty } from 'lodash';
export function getContactInitials(contact: IContactProperties) {
if (!contact.name || !contact.name.formatted) return '';
- const nameParts = contact.name.formatted.toUpperCase().replace(/\s\s+/g, ' ').split(' ');
+ const nameParts = contact.name.formatted
+ .toUpperCase()
+ .replace(/\s\s+/g, ' ')
+ .split(' ');
let name = nameParts[0].charAt(0);
if (nameParts[1]) name += '' + nameParts[1].charAt(0);
return name;
@@ -18,7 +21,7 @@ export function createMeritContact(contact: Partial): MeritC
meritContact.phoneNumbers = clone(contact.phoneNumbers) || [];
meritContact.emails = clone(contact.emails) || [];
meritContact.photos = clone(contact.photos) || [];
- meritContact.meritAddresses = isEmpty(contact['meritAddresses'])? [] : clone(contact['meritAddresses']);
+ meritContact.meritAddresses = isEmpty(contact['meritAddresses']) ? [] : clone(contact['meritAddresses']);
return meritContact;
}
diff --git a/packages/lightwallet/common/utils/derivation-path.ts b/packages/lightwallet/common/utils/derivation-path.ts
index 8e38770c58..fa3f233b97 100644
--- a/packages/lightwallet/common/utils/derivation-path.ts
+++ b/packages/lightwallet/common/utils/derivation-path.ts
@@ -12,20 +12,19 @@ export class DerivationPath {
let ret: any = {};
- if (arr[0] != 'm')
- return false;
+ if (arr[0] != 'm') return false;
switch (arr[1]) {
- case '44\'':
+ case "44'":
ret.derivationStrategy = 'BIP44';
break;
- case '45\'':
+ case "45'":
return {
derivationStrategy: 'BIP45',
networkName: 'livenet',
account: 0,
};
- case '48\'':
+ case "48'":
ret.derivationStrategy = 'BIP48';
break;
default:
@@ -33,10 +32,10 @@ export class DerivationPath {
}
switch (arr[2]) {
- case '0\'':
+ case "0'":
ret.networkName = 'livenet';
break;
- case '1\'':
+ case "1'":
ret.networkName = 'testnet';
break;
default:
@@ -44,8 +43,7 @@ export class DerivationPath {
}
let match = arr[3].match(/(\d+)'/);
- if (!match)
- return false;
+ if (!match) return false;
ret.account = +match[1];
return ret;
diff --git a/packages/lightwallet/common/utils/destination.spec.ts b/packages/lightwallet/common/utils/destination.spec.ts
index bf88a61733..368469131e 100644
--- a/packages/lightwallet/common/utils/destination.spec.ts
+++ b/packages/lightwallet/common/utils/destination.spec.ts
@@ -2,12 +2,11 @@ import { SendMethodDestination } from '@merit/common/models/send-method';
import { getSendMethodDestinationType, validateEmail, validatePhoneNumber } from '@merit/common/utils/destination';
describe('[Validators] Destination', () => {
-
it('should validate email', () => {
expect(validateEmail('hello@merit.me')).toBeTruthy();
});
- it('should return type as email', () =>{
+ it('should return type as email', () => {
expect(getSendMethodDestinationType('hello@merit.me')).toBe(SendMethodDestination.Email);
});
@@ -19,8 +18,7 @@ describe('[Validators] Destination', () => {
expect(getSendMethodDestinationType('8444169972')).toBe(SendMethodDestination.Sms);
});
- it('should return type as null if it\'s not a phone number or email', () => {
+ it("should return type as null if it's not a phone number or email", () => {
expect(getSendMethodDestinationType('definitely nothing valid')).toBeFalsy();
});
-
});
diff --git a/packages/lightwallet/common/utils/destination.ts b/packages/lightwallet/common/utils/destination.ts
index af58d23967..903367acbc 100644
--- a/packages/lightwallet/common/utils/destination.ts
+++ b/packages/lightwallet/common/utils/destination.ts
@@ -4,7 +4,11 @@ const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"
export function validateEmail(email: string) {
email = email || '';
- return EMAIL_REGEX.test(String(email).trim().toLowerCase());
+ return EMAIL_REGEX.test(
+ String(email)
+ .trim()
+ .toLowerCase(),
+ );
}
export function validatePhoneNumber(phoneNumber: string) {
diff --git a/packages/lightwallet/common/utils/format.ts b/packages/lightwallet/common/utils/format.ts
index 596789a643..b3e42465f1 100644
--- a/packages/lightwallet/common/utils/format.ts
+++ b/packages/lightwallet/common/utils/format.ts
@@ -26,6 +26,6 @@ export const formatAmount = (micros: number, unit: string, opts: any = {}): stri
if (!u) throw new Error('Invalid unit');
const precision: string = opts.fullPrecision ? 'full' : 'short',
- amount: string = clipDecimals((micros / u.toMicros), u[precision].maxDecimals).toFixed(u[precision].maxDecimals);
+ amount: string = clipDecimals(micros / u.toMicros, u[precision].maxDecimals).toFixed(u[precision].maxDecimals);
return addSeparators(amount, opts.thousandsSeparator || ',', opts.decimalSeparator || '.', u[precision].minDecimals);
};
diff --git a/packages/lightwallet/common/utils/invites.ts b/packages/lightwallet/common/utils/invites.ts
index 295d55bd11..f3e38a1ae8 100644
--- a/packages/lightwallet/common/utils/invites.ts
+++ b/packages/lightwallet/common/utils/invites.ts
@@ -1,5 +1,5 @@
import { MWCService } from '@merit/common/services/mwc.service';
export function getSendableInvites(mwcService: MWCService) {
- return mwcService.getClient().invitesBalance.availableAmount -1;
+ return mwcService.getClient().invitesBalance.availableAmount - 1;
}
diff --git a/packages/lightwallet/common/utils/mnemonic.spec.ts b/packages/lightwallet/common/utils/mnemonic.spec.ts
index 19ff77b443..42293f69f7 100644
--- a/packages/lightwallet/common/utils/mnemonic.spec.ts
+++ b/packages/lightwallet/common/utils/mnemonic.spec.ts
@@ -1,7 +1,6 @@
import { hasValidEntropy, hasValidWords, isValidSize } from './mnemonic';
describe('Utils.Mnemonic', () => {
-
it('12 words mnemonic should be valid size', () => {
expect(isValidSize('chair sing cool west birth stock disease sniff bulb surround absorb design')).toBeTruthy();
});
@@ -11,11 +10,12 @@ describe('Utils.Mnemonic', () => {
});
it('mnemonic should be valid', () => {
- expect(hasValidEntropy('miracle tilt alone fresh sustain course awesome holiday fix tuna vital ginger')).toBeTruthy();
+ expect(
+ hasValidEntropy('miracle tilt alone fresh sustain course awesome holiday fix tuna vital ginger'),
+ ).toBeTruthy();
});
it('mnemonic should be invalid', () => {
expect(hasValidEntropy('chair sing cool west birth stock disease sniff bulb surround absorb design')).toBeFalsy();
});
-
});
diff --git a/packages/lightwallet/common/utils/mnemonic.ts b/packages/lightwallet/common/utils/mnemonic.ts
index 5d3301f40b..a0aac30ab1 100644
--- a/packages/lightwallet/common/utils/mnemonic.ts
+++ b/packages/lightwallet/common/utils/mnemonic.ts
@@ -34,15 +34,15 @@ export function isValidSize(mnemonic: string) {
}
export function hasValidWords(mnemonic: string, wordlist: string[] = EnglishWordlist) {
- return !mnemonic.split(' ')
- .some((word: string) => wordlist.indexOf(word) === -1);
+ return !mnemonic.split(' ').some((word: string) => wordlist.indexOf(word) === -1);
}
export function hasValidEntropy(mnemonic: string, wordlist: string[] = EnglishWordlist) {
const words = mnemonic.split(' ');
let bin = '';
- let i = 0, ind;
+ let i = 0,
+ ind;
for (i; i < words.length; i++) {
ind = wordlist.indexOf(words[i]);
@@ -69,7 +69,9 @@ export function mnemonicToHDPrivateKey(mnemonic, passphrase, network) {
}
function entropyChecksum(entropy: Buffer): string {
- const hash = createHash('sha256').update(entropy).digest(),
+ const hash = createHash('sha256')
+ .update(entropy)
+ .digest(),
bits = entropy.length * 8,
cs = bits / 32;
diff --git a/packages/lightwallet/common/utils/notification-settings.ts b/packages/lightwallet/common/utils/notification-settings.ts
index a387252a5c..d0a1005b53 100644
--- a/packages/lightwallet/common/utils/notification-settings.ts
+++ b/packages/lightwallet/common/utils/notification-settings.ts
@@ -14,9 +14,7 @@ import { Subscription } from 'rxjs/Subscription';
import { SmsNotificationSetting } from '@merit/common/models/sms-subscription';
export type SavingStatus = 'saving' | 'saved' | 'none';
-export type SmsNotificationSettingsText = {
- [k in keyof typeof SmsNotificationSetting]: string;
-}
+export type SmsNotificationSettingsText = { [k in keyof typeof SmsNotificationSetting]: string };
const smsNotificationSettingsText: SmsNotificationSettingsText = {
IncomingInvite: 'Incoming invites',
@@ -35,7 +33,7 @@ export class NotificationSettingsController {
emailNotifications: [false, [Validators.required]],
email: [''],
smsNotifications: [false],
- phoneNumber: ['', [Validators.required, Validators.pattern(/\d{10,}/)]]
+ phoneNumber: ['', [Validators.required, Validators.pattern(/\d{10,}/)]],
});
private subs: Subscription[] = [];
private emailStatus: Subject = new Subject();
@@ -69,13 +67,15 @@ export class NotificationSettingsController {
return this.formData.get('phoneNumber');
}
- constructor(private persistenceService: PersistenceService2,
- private pushNotificationsService: PushNotificationsService,
- private emailNotificationsService: EmailNotificationsService,
- private smsNotificationsService: SmsNotificationsService,
- private formBuilder: FormBuilder,
- private toastCtrl: ToastControllerService,
- private platform: 'ios' | 'android' | 'desktop') {}
+ constructor(
+ private persistenceService: PersistenceService2,
+ private pushNotificationsService: PushNotificationsService,
+ private emailNotificationsService: EmailNotificationsService,
+ private smsNotificationsService: SmsNotificationsService,
+ private formBuilder: FormBuilder,
+ private toastCtrl: ToastControllerService,
+ private platform: 'ios' | 'android' | 'desktop',
+ ) {}
async init() {
const settings = await this.persistenceService.getNotificationSettings();
@@ -84,15 +84,17 @@ export class NotificationSettingsController {
const smsNotificationSettings = [];
- Object.keys(SmsNotificationSetting)
- .forEach((key: keyof SmsNotificationSetting) => {
- this.formData.addControl(SmsNotificationSetting[key], new FormControl(status && status.settings && status.settings[key]));
+ Object.keys(SmsNotificationSetting).forEach((key: keyof SmsNotificationSetting) => {
+ this.formData.addControl(
+ SmsNotificationSetting[key],
+ new FormControl(status && status.settings && status.settings[key]),
+ );
- smsNotificationSettings.push({
- name: SmsNotificationSetting[key],
- label: smsNotificationSettingsText[key]
- });
+ smsNotificationSettings.push({
+ name: SmsNotificationSetting[key],
+ label: smsNotificationSettingsText[key],
});
+ });
if (!isEmpty(settings)) {
this.formData.patchValue(settings, { emitEvent: false });
@@ -109,9 +111,9 @@ export class NotificationSettingsController {
this.formData.valueChanges
.pipe(
filter(() => this.formData.valid),
- tap((newValue: any) => this.persistenceService.setNotificationSettings(newValue))
+ tap((newValue: any) => this.persistenceService.setNotificationSettings(newValue)),
)
- .subscribe()
+ .subscribe(),
);
this.subs.push(
@@ -125,9 +127,9 @@ export class NotificationSettingsController {
} else {
this.pushNotificationsService.disable();
}
- })
+ }),
)
- .subscribe()
+ .subscribe(),
);
this.subs.push(
@@ -141,9 +143,9 @@ export class NotificationSettingsController {
fromPromise(
this.emailNotificationsService.updateEmail({
enabled: this.emailNotificationsEnabled,
- email: this.email.value
- })
- )
+ email: this.email.value,
+ }),
+ ),
),
tap(() => {
this.emailStatus.next('saved');
@@ -151,22 +153,21 @@ export class NotificationSettingsController {
this.toastCtrl.success('You are now subscribed to Email notifications!');
}
this.updateStorage();
- })
+ }),
)
- .subscribe()
+ .subscribe(),
);
const smsObservables = [
this.formData.get('smsNotifications').valueChanges,
- this.formData.get('phoneNumber').valueChanges
+ this.formData.get('phoneNumber').valueChanges,
];
- this.smsNotificationSettings.forEach(({ name }) =>
- smsObservables.push(this.formData.get(name).valueChanges)
- );
+ this.smsNotificationSettings.forEach(({ name }) => smsObservables.push(this.formData.get(name).valueChanges));
this.subs.push(
- merge.apply(merge, smsObservables)
+ merge
+ .apply(merge, smsObservables)
.pipe(
tap(() => this.smsStatus.next('none')),
filter(() => this.smsNotifications.value == false || this.phoneNumber.valid),
@@ -174,17 +175,22 @@ export class NotificationSettingsController {
debounceTime(750),
switchMap(() =>
fromPromise(
- this.smsNotificationsService.setSmsSubscription(this.smsNotificationsEnabled, this.formData.get('phoneNumber').value, this.platform, this.getSmsNotificationSettings())
- )
+ this.smsNotificationsService.setSmsSubscription(
+ this.smsNotificationsEnabled,
+ this.formData.get('phoneNumber').value,
+ this.platform,
+ this.getSmsNotificationSettings(),
+ ),
+ ),
),
tap(() => {
this.smsStatus.next('saved');
if (this.smsNotificationsEnabled && this.phoneNumber.valid) {
this.toastCtrl.success('You are now subscribed to SMS notifications!');
}
- })
+ }),
)
- .subscribe()
+ .subscribe(),
);
}
@@ -192,8 +198,7 @@ export class NotificationSettingsController {
this.subs.forEach(sub => {
try {
sub.unsubscribe();
- } catch (e) {
- }
+ } catch (e) {}
});
}
diff --git a/packages/lightwallet/common/utils/observables.ts b/packages/lightwallet/common/utils/observables.ts
index 20b057107f..5ae56735b5 100644
--- a/packages/lightwallet/common/utils/observables.ts
+++ b/packages/lightwallet/common/utils/observables.ts
@@ -14,4 +14,5 @@ export const getLatestValue = (obs: Observable, filterFn?: (val: any) => bo
return obs.pipe.apply(obs, args).toPromise();
};
-export const getLatestDefinedValue = (obs: Observable) => getLatestValue(obs, val => typeof val !== 'undefined' && val !== null);
+export const getLatestDefinedValue = (obs: Observable) =>
+ getLatestValue(obs, val => typeof val !== 'undefined' && val !== null);
diff --git a/packages/lightwallet/common/utils/transactions.ts b/packages/lightwallet/common/utils/transactions.ts
index 1400aa00b5..f4a2cc62ad 100644
--- a/packages/lightwallet/common/utils/transactions.ts
+++ b/packages/lightwallet/common/utils/transactions.ts
@@ -4,14 +4,21 @@ import {
IDisplayTransaction,
ITransactionIO,
IVisitedTransaction,
- TransactionAction
+ TransactionAction,
} from '@merit/common/models/transaction';
import { ContactsService } from '@merit/common/services/contacts.service';
-import { MeritWalletClient } from "@merit/common/merit-wallet-client";
-import { FeeService } from "@merit/common/services/fee.service";
+import { MeritWalletClient } from '@merit/common/merit-wallet-client';
+import { FeeService } from '@merit/common/services/fee.service';
import { PersistenceService2 } from '@merit/common/services/persistence2.service';
-export async function formatWalletHistory(walletHistory: IDisplayTransaction[], wallet: MeritWalletClient, easySends: EasySend[] = [], feeService: FeeService, contactsProvider?: ContactsService, persistenceService?: PersistenceService2): Promise {
+export async function formatWalletHistory(
+ walletHistory: IDisplayTransaction[],
+ wallet: MeritWalletClient,
+ easySends: EasySend[] = [],
+ feeService: FeeService,
+ contactsProvider?: ContactsService,
+ persistenceService?: PersistenceService2,
+): Promise {
if (_.isEmpty(walletHistory)) return [];
const easyReceiveFee = await feeService.getEasyReceiveFee();
@@ -32,142 +39,161 @@ export async function formatWalletHistory(walletHistory: IDisplayTransaction[],
let visitedTxs: IVisitedTransaction[];
if (persistenceService) {
- visitedTxs = await persistenceService.getVisitedTransactions() || [];
+ visitedTxs = (await persistenceService.getVisitedTransactions()) || [];
}
- walletHistory = await Promise.all(walletHistory.map(async (tx: IDisplayTransaction, i: number) => {
- if (!_.isNil(tx) && !_.isNil(tx.action)) {
- pendingString = tx.isPendingEasySend ? '(pending) ' : '';
+ walletHistory = await Promise.all(
+ walletHistory.map(async (tx: IDisplayTransaction, i: number) => {
+ if (!_.isNil(tx) && !_.isNil(tx.action)) {
+ pendingString = tx.isPendingEasySend ? '(pending) ' : '';
- let received: boolean = false,
- isEasySend: boolean;
+ let received: boolean = false,
+ isEasySend: boolean;
- switch (tx.action) {
- case TransactionAction.SENT:
- tx.type = 'debit';
- isEasySend = true;
- break;
-
- case TransactionAction.RECEIVED:
- tx.type = 'credit';
-
- if (tx.isInvite) {
- if (i === 0) {
- tx.isWalletUnlock = true;
- tx.name = 'Wallet Unlocked';
- }
- } else {
+ switch (tx.action) {
+ case TransactionAction.SENT:
+ tx.type = 'debit';
isEasySend = true;
- }
+ break;
+
+ case TransactionAction.RECEIVED:
+ tx.type = 'credit';
+
+ if (tx.isInvite) {
+ if (i === 0) {
+ tx.isWalletUnlock = true;
+ tx.name = 'Wallet Unlocked';
+ }
+ } else {
+ isEasySend = true;
+ }
- received = true;
- break;
+ received = true;
+ break;
- case TransactionAction.MOVED:
- tx.name = tx.actionStr = tx.isInvite ? 'Moved Invite' : 'Moved Merit';
- break;
- }
+ case TransactionAction.MOVED:
+ tx.name = tx.actionStr = tx.isInvite ? 'Moved Invite' : 'Moved Merit';
+ break;
+ }
- const { alias: inputAlias, address: inputAddress } = tx.inputs.find((input: ITransactionIO) => input.isMine === !received) || {};
- const { alias: outputAlias, address: outputAddress } = tx.outputs.find((output: ITransactionIO) => output.isMine === received) || {};
+ const { alias: inputAlias, address: inputAddress } =
+ tx.inputs.find((input: ITransactionIO) => input.isMine === !received) || {};
+ const { alias: outputAlias, address: outputAddress } =
+ tx.outputs.find((output: ITransactionIO) => output.isMine === received) || {};
- tx.input = inputAlias ? '@' + inputAlias : 'Anonymous';
- tx.output = outputAlias ? '@' + outputAlias : 'Anonymous';
+ tx.input = inputAlias ? '@' + inputAlias : 'Anonymous';
+ tx.output = outputAlias ? '@' + outputAlias : 'Anonymous';
- tx.name = tx.name || (received ? tx.input : tx.output);
+ tx.name = tx.name || (received ? tx.input : tx.output);
- tx.addressFrom = inputAlias || inputAddress;
- tx.addressTo = outputAlias || outputAddress;
+ tx.addressFrom = inputAlias || inputAddress;
+ tx.addressTo = outputAlias || outputAddress;
- tx.from = {
- alias: inputAlias,
- address: inputAddress
- };
+ tx.from = {
+ alias: inputAlias,
+ address: inputAddress,
+ };
- tx.to = {
- alias: outputAlias,
- address: outputAddress
- };
+ tx.to = {
+ alias: outputAlias,
+ address: outputAddress,
+ };
- if (!tx.isCoinbase && !tx.isWalletUnlock && contactsProvider) {
- const contactAddress = received ? inputAddress || inputAlias : outputAddress || outputAlias;
+ if (!tx.isCoinbase && !tx.isWalletUnlock && contactsProvider) {
+ const contactAddress = received ? inputAddress || inputAlias : outputAddress || outputAlias;
- try {
- tx.contact = contactsProvider.get(contactAddress);
- tx.name = tx.contact ? tx.contact.name.formatted : tx.name;
- } catch (e) {
+ try {
+ tx.contact = contactsProvider.get(contactAddress);
+ tx.name = tx.contact ? tx.contact.name.formatted : tx.name;
+ } catch (e) {}
}
- }
- tx.actionStr = pendingString + tx.actionStr;
+ tx.actionStr = pendingString + tx.actionStr;
- if (wallet && !tx.walletId) {
- tx.walletId = wallet.id;
- tx.wallet = wallet;
- }
-
- if (tx.isCoinbase) {
- if (tx.isInvite) {
- tx.name = 'Mined Invite';
- tx.action = TransactionAction.INVITE;
- tx.type = 'credit';
- } else {
- const output = tx.outputs.find(o => o.isMine);
+ if (wallet && !tx.walletId) {
+ tx.walletId = wallet.id;
+ tx.wallet = wallet;
+ }
- if (output && output.index !== 0) {
- // Ambassador reward
- tx.name = 'Growth Reward';
- tx.action = TransactionAction.AMBASSADOR_REWARD;
- tx.isGrowthReward = true;
+ if (tx.isCoinbase) {
+ if (tx.isInvite) {
+ tx.name = 'Mined Invite';
+ tx.action = TransactionAction.INVITE;
+ tx.type = 'credit';
} else {
- tx.name = 'Mining Reward';
- tx.action = TransactionAction.MINING_REWARD;
- tx.isMiningReward = true;
+ const output = tx.outputs.find(o => o.isMine);
+
+ if (output && output.index !== 0) {
+ // Ambassador reward
+ tx.name = 'Growth Reward';
+ tx.action = TransactionAction.AMBASSADOR_REWARD;
+ tx.isGrowthReward = true;
+ } else {
+ tx.name = 'Mining Reward';
+ tx.action = TransactionAction.MINING_REWARD;
+ tx.isMiningReward = true;
+ }
}
- }
- } else {
- if (tx.outputs.some(o => o.amount == 0 && _.get(o, 'data', '').toLowerCase().indexOf('pool') > -1)) {
- tx.name = 'Pool Reward';
- tx.action = TransactionAction.POOL_REWARD;
- tx.isPoolReward = true;
} else {
- if (tx.outputs.some(o => o.amount == 0 && _.get(o, 'data', '').toLowerCase().indexOf('market') > -1)) {
- tx.name = 'Market Escrow';
- tx.isMarketPayment = true;
+ if (
+ tx.outputs.some(
+ o =>
+ o.amount == 0 &&
+ _.get(o, 'data', '')
+ .toLowerCase()
+ .indexOf('pool') > -1,
+ )
+ ) {
+ tx.name = 'Pool Reward';
+ tx.action = TransactionAction.POOL_REWARD;
+ tx.isPoolReward = true;
+ } else {
+ if (
+ tx.outputs.some(
+ o =>
+ o.amount == 0 &&
+ _.get(o, 'data', '')
+ .toLowerCase()
+ .indexOf('market') > -1,
+ )
+ ) {
+ tx.name = 'Market Escrow';
+ tx.isMarketPayment = true;
+ }
}
}
}
- }
- if (easySendsByAddress[tx.addressTo]) {
- const easySend = easySendsByAddress[tx.addressTo];
- tx.name = tx.isInvite ? 'MeritInvite' : 'MeritMoney';
- tx.type = tx.name.toLowerCase();
- tx.easySend = easySend;
- tx.easySendUrl = getEasySendURL(easySend);
- tx.cancelled = easySend.cancelled;
- if (tx.type === 'meritmoney') {
- meritMoneyAddresses.push(tx.addressTo);
- tx.fees += easyReceiveFee;
- tx.amount -= easyReceiveFee;
+ if (easySendsByAddress[tx.addressTo]) {
+ const easySend = easySendsByAddress[tx.addressTo];
+ tx.name = tx.isInvite ? 'MeritInvite' : 'MeritMoney';
+ tx.type = tx.name.toLowerCase();
+ tx.easySend = easySend;
+ tx.easySendUrl = getEasySendURL(easySend);
+ tx.cancelled = easySend.cancelled;
+ if (tx.type === 'meritmoney') {
+ meritMoneyAddresses.push(tx.addressTo);
+ tx.fees += easyReceiveFee;
+ tx.amount -= easyReceiveFee;
+ }
}
- }
- tx.isNew = false;
+ tx.isNew = false;
- if (persistenceService) {
- if (!visitedTxs.find(visTx => visTx.txid === tx.txid)) {
- tx.isNew = true;
- // add new one in visited
- visitedTxs.push({
- txid: tx.txid,
- counter: 1
- });
+ if (persistenceService) {
+ if (!visitedTxs.find(visTx => visTx.txid === tx.txid)) {
+ tx.isNew = true;
+ // add new one in visited
+ visitedTxs.push({
+ txid: tx.txid,
+ counter: 1,
+ });
+ }
}
- }
- return tx;
- }));
+ return tx;
+ }),
+ );
if (persistenceService) {
//save to storage
@@ -177,7 +203,6 @@ export async function formatWalletHistory(walletHistory: IDisplayTransaction[],
// remove meritmoney invites so we have only one tx for meritmoney
return walletHistory
.filter(t => {
-
if (meritMoneyAddresses.indexOf(t.addressFrom) !== -1) {
//filtering out txs from cancelled MeritMoney/MeritInvite
return false;
diff --git a/packages/lightwallet/common/utils/url.ts b/packages/lightwallet/common/utils/url.ts
index 3019362fb0..0141ab002d 100644
--- a/packages/lightwallet/common/utils/url.ts
+++ b/packages/lightwallet/common/utils/url.ts
@@ -3,12 +3,10 @@ import { ENV } from '@app/env';
export function parseQuery(query: string): object {
query = query.substr(query.indexOf('?') + 1);
- return query
- .split('&')
- .reduce((res, pair) => {
- const q = pair.split('=');
- return { ...res, [q[0]]: q[1] };
- }, {});
+ return query.split('&').reduce((res, pair) => {
+ const q = pair.split('=');
+ return { ...res, [q[0]]: q[1] };
+ }, {});
}
export function getQueryParam(key: string, query: string = window.location.search): string {
@@ -16,9 +14,9 @@ export function getQueryParam(key: string, query: string = window.location.searc
}
export function getWalletUrl() {
- return ENV.network === 'testnet'? 'https://testnet.wallet.merit.me/' : 'https://wallet.merit.me/';
+ return ENV.network === 'testnet' ? 'https://testnet.wallet.merit.me/' : 'https://wallet.merit.me/';
}
export function getShareLink(aliasOrAddress: string) {
- return `${ getWalletUrl() }?invite=${aliasOrAddress}`
+ return `${getWalletUrl()}?invite=${aliasOrAddress}`;
}
diff --git a/packages/lightwallet/common/utils/wordlists/english.ts b/packages/lightwallet/common/utils/wordlists/english.ts
index f3705878dc..51dbbdf50c 100644
--- a/packages/lightwallet/common/utils/wordlists/english.ts
+++ b/packages/lightwallet/common/utils/wordlists/english.ts
@@ -1 +1,2050 @@
-export default ['abandon', 'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd', 'abuse', 'access', 'accident', 'account', 'accuse', 'achieve', 'acid', 'acoustic', 'acquire', 'across', 'act', 'action', 'actor', 'actress', 'actual', 'adapt', 'add', 'addict', 'address', 'adjust', 'admit', 'adult', 'advance', 'advice', 'aerobic', 'affair', 'afford', 'afraid', 'again', 'age', 'agent', 'agree', 'ahead', 'aim', 'air', 'airport', 'aisle', 'alarm', 'album', 'alcohol', 'alert', 'alien', 'all', 'alley', 'allow', 'almost', 'alone', 'alpha', 'already', 'also', 'alter', 'always', 'amateur', 'amazing', 'among', 'amount', 'amused', 'analyst', 'anchor', 'ancient', 'anger', 'angle', 'angry', 'animal', 'ankle', 'announce', 'annual', 'another', 'answer', 'antenna', 'antique', 'anxiety', 'any', 'apart', 'apology', 'appear', 'apple', 'approve', 'april', 'arch', 'arctic', 'area', 'arena', 'argue', 'arm', 'armed', 'armor', 'army', 'around', 'arrange', 'arrest', 'arrive', 'arrow', 'art', 'artefact', 'artist', 'artwork', 'ask', 'aspect', 'assault', 'asset', 'assist', 'assume', 'asthma', 'athlete', 'atom', 'attack', 'attend', 'attitude', 'attract', 'auction', 'audit', 'august', 'aunt', 'author', 'auto', 'autumn', 'average', 'avocado', 'avoid', 'awake', 'aware', 'away', 'awesome', 'awful', 'awkward', 'axis', 'baby', 'bachelor', 'bacon', 'badge', 'bag', 'balance', 'balcony', 'ball', 'bamboo', 'banana', 'banner', 'bar', 'barely', 'bargain', 'barrel', 'base', 'basic', 'basket', 'battle', 'beach', 'bean', 'beauty', 'because', 'become', 'beef', 'before', 'begin', 'behave', 'behind', 'believe', 'below', 'belt', 'bench', 'benefit', 'best', 'betray', 'better', 'between', 'beyond', 'bicycle', 'bid', 'bike', 'bind', 'biology', 'bird', 'birth', 'bitter', 'black', 'blade', 'blame', 'blanket', 'blast', 'bleak', 'bless', 'blind', 'blood', 'blossom', 'blouse', 'blue', 'blur', 'blush', 'board', 'boat', 'body', 'boil', 'bomb', 'bone', 'bonus', 'book', 'boost', 'border', 'boring', 'borrow', 'boss', 'bottom', 'bounce', 'box', 'boy', 'bracket', 'brain', 'brand', 'brass', 'brave', 'bread', 'breeze', 'brick', 'bridge', 'brief', 'bright', 'bring', 'brisk', 'broccoli', 'broken', 'bronze', 'broom', 'brother', 'brown', 'brush', 'bubble', 'buddy', 'budget', 'buffalo', 'build', 'bulb', 'bulk', 'bullet', 'bundle', 'bunker', 'burden', 'burger', 'burst', 'bus', 'business', 'busy', 'butter', 'buyer', 'buzz', 'cabbage', 'cabin', 'cable', 'cactus', 'cage', 'cake', 'call', 'calm', 'camera', 'camp', 'can', 'canal', 'cancel', 'candy', 'cannon', 'canoe', 'canvas', 'canyon', 'capable', 'capital', 'captain', 'car', 'carbon', 'card', 'cargo', 'carpet', 'carry', 'cart', 'case', 'cash', 'casino', 'castle', 'casual', 'cat', 'catalog', 'catch', 'category', 'cattle', 'caught', 'cause', 'caution', 'cave', 'ceiling', 'celery', 'cement', 'census', 'century', 'cereal', 'certain', 'chair', 'chalk', 'champion', 'change', 'chaos', 'chapter', 'charge', 'chase', 'chat', 'cheap', 'check', 'cheese', 'chef', 'cherry', 'chest', 'chicken', 'chief', 'child', 'chimney', 'choice', 'choose', 'chronic', 'chuckle', 'chunk', 'churn', 'cigar', 'cinnamon', 'circle', 'citizen', 'city', 'civil', 'claim', 'clap', 'clarify', 'claw', 'clay', 'clean', 'clerk', 'clever', 'click', 'client', 'cliff', 'climb', 'clinic', 'clip', 'clock', 'clog', 'close', 'cloth', 'cloud', 'clown', 'club', 'clump', 'cluster', 'clutch', 'coach', 'coast', 'coconut', 'code', 'coffee', 'coil', 'coin', 'collect', 'color', 'column', 'combine', 'come', 'comfort', 'comic', 'common', 'company', 'concert', 'conduct', 'confirm', 'congress', 'connect', 'consider', 'control', 'convince', 'cook', 'cool', 'copper', 'copy', 'coral', 'core', 'corn', 'correct', 'cost', 'cotton', 'couch', 'country', 'couple', 'course', 'cousin', 'cover', 'coyote', 'crack', 'cradle', 'craft', 'cram', 'crane', 'crash', 'crater', 'crawl', 'crazy', 'cream', 'credit', 'creek', 'crew', 'cricket', 'crime', 'crisp', 'critic', 'crop', 'cross', 'crouch', 'crowd', 'crucial', 'cruel', 'cruise', 'crumble', 'crunch', 'crush', 'cry', 'crystal', 'cube', 'culture', 'cup', 'cupboard', 'curious', 'current', 'curtain', 'curve', 'cushion', 'custom', 'cute', 'cycle', 'dad', 'damage', 'damp', 'dance', 'danger', 'daring', 'dash', 'daughter', 'dawn', 'day', 'deal', 'debate', 'debris', 'decade', 'december', 'decide', 'decline', 'decorate', 'decrease', 'deer', 'defense', 'define', 'defy', 'degree', 'delay', 'deliver', 'demand', 'demise', 'denial', 'dentist', 'deny', 'depart', 'depend', 'deposit', 'depth', 'deputy', 'derive', 'describe', 'desert', 'design', 'desk', 'despair', 'destroy', 'detail', 'detect', 'develop', 'device', 'devote', 'diagram', 'dial', 'diamond', 'diary', 'dice', 'diesel', 'diet', 'differ', 'digital', 'dignity', 'dilemma', 'dinner', 'dinosaur', 'direct', 'dirt', 'disagree', 'discover', 'disease', 'dish', 'dismiss', 'disorder', 'display', 'distance', 'divert', 'divide', 'divorce', 'dizzy', 'doctor', 'document', 'dog', 'doll', 'dolphin', 'domain', 'donate', 'donkey', 'donor', 'door', 'dose', 'double', 'dove', 'draft', 'dragon', 'drama', 'drastic', 'draw', 'dream', 'dress', 'drift', 'drill', 'drink', 'drip', 'drive', 'drop', 'drum', 'dry', 'duck', 'dumb', 'dune', 'during', 'dust', 'dutch', 'duty', 'dwarf', 'dynamic', 'eager', 'eagle', 'early', 'earn', 'earth', 'easily', 'east', 'easy', 'echo', 'ecology', 'economy', 'edge', 'edit', 'educate', 'effort', 'egg', 'eight', 'either', 'elbow', 'elder', 'electric', 'elegant', 'element', 'elephant', 'elevator', 'elite', 'else', 'embark', 'embody', 'embrace', 'emerge', 'emotion', 'employ', 'empower', 'empty', 'enable', 'enact', 'end', 'endless', 'endorse', 'enemy', 'energy', 'enforce', 'engage', 'engine', 'enhance', 'enjoy', 'enlist', 'enough', 'enrich', 'enroll', 'ensure', 'enter', 'entire', 'entry', 'envelope', 'episode', 'equal', 'equip', 'era', 'erase', 'erode', 'erosion', 'error', 'erupt', 'escape', 'essay', 'essence', 'estate', 'eternal', 'ethics', 'evidence', 'evil', 'evoke', 'evolve', 'exact', 'example', 'excess', 'exchange', 'excite', 'exclude', 'excuse', 'execute', 'exercise', 'exhaust', 'exhibit', 'exile', 'exist', 'exit', 'exotic', 'expand', 'expect', 'expire', 'explain', 'expose', 'express', 'extend', 'extra', 'eye', 'eyebrow', 'fabric', 'face', 'faculty', 'fade', 'faint', 'faith', 'fall', 'false', 'fame', 'family', 'famous', 'fan', 'fancy', 'fantasy', 'farm', 'fashion', 'fat', 'fatal', 'father', 'fatigue', 'fault', 'favorite', 'feature', 'february', 'federal', 'fee', 'feed', 'feel', 'female', 'fence', 'festival', 'fetch', 'fever', 'few', 'fiber', 'fiction', 'field', 'figure', 'file', 'film', 'filter', 'final', 'find', 'fine', 'finger', 'finish', 'fire', 'firm', 'first', 'fiscal', 'fish', 'fit', 'fitness', 'fix', 'flag', 'flame', 'flash', 'flat', 'flavor', 'flee', 'flight', 'flip', 'float', 'flock', 'floor', 'flower', 'fluid', 'flush', 'fly', 'foam', 'focus', 'fog', 'foil', 'fold', 'follow', 'food', 'foot', 'force', 'forest', 'forget', 'fork', 'fortune', 'forum', 'forward', 'fossil', 'foster', 'found', 'fox', 'fragile', 'frame', 'frequent', 'fresh', 'friend', 'fringe', 'frog', 'front', 'frost', 'frown', 'frozen', 'fruit', 'fuel', 'fun', 'funny', 'furnace', 'fury', 'future', 'gadget', 'gain', 'galaxy', 'gallery', 'game', 'gap', 'garage', 'garbage', 'garden', 'garlic', 'garment', 'gas', 'gasp', 'gate', 'gather', 'gauge', 'gaze', 'general', 'genius', 'genre', 'gentle', 'genuine', 'gesture', 'ghost', 'giant', 'gift', 'giggle', 'ginger', 'giraffe', 'girl', 'give', 'glad', 'glance', 'glare', 'glass', 'glide', 'glimpse', 'globe', 'gloom', 'glory', 'glove', 'glow', 'glue', 'goat', 'goddess', 'gold', 'good', 'goose', 'gorilla', 'gospel', 'gossip', 'govern', 'gown', 'grab', 'grace', 'grain', 'grant', 'grape', 'grass', 'gravity', 'great', 'green', 'grid', 'grief', 'grit', 'grocery', 'group', 'grow', 'grunt', 'guard', 'guess', 'guide', 'guilt', 'guitar', 'gun', 'gym', 'habit', 'hair', 'half', 'hammer', 'hamster', 'hand', 'happy', 'harbor', 'hard', 'harsh', 'harvest', 'hat', 'have', 'hawk', 'hazard', 'head', 'health', 'heart', 'heavy', 'hedgehog', 'height', 'hello', 'helmet', 'help', 'hen', 'hero', 'hidden', 'high', 'hill', 'hint', 'hip', 'hire', 'history', 'hobby', 'hockey', 'hold', 'hole', 'holiday', 'hollow', 'home', 'honey', 'hood', 'hope', 'horn', 'horror', 'horse', 'hospital', 'host', 'hotel', 'hour', 'hover', 'hub', 'huge', 'human', 'humble', 'humor', 'hundred', 'hungry', 'hunt', 'hurdle', 'hurry', 'hurt', 'husband', 'hybrid', 'ice', 'icon', 'idea', 'identify', 'idle', 'ignore', 'ill', 'illegal', 'illness', 'image', 'imitate', 'immense', 'immune', 'impact', 'impose', 'improve', 'impulse', 'inch', 'include', 'income', 'increase', 'index', 'indicate', 'indoor', 'industry', 'infant', 'inflict', 'inform', 'inhale', 'inherit', 'initial', 'inject', 'injury', 'inmate', 'inner', 'innocent', 'input', 'inquiry', 'insane', 'insect', 'inside', 'inspire', 'install', 'intact', 'interest', 'into', 'invest', 'invite', 'involve', 'iron', 'island', 'isolate', 'issue', 'item', 'ivory', 'jacket', 'jaguar', 'jar', 'jazz', 'jealous', 'jeans', 'jelly', 'jewel', 'job', 'join', 'joke', 'journey', 'joy', 'judge', 'juice', 'jump', 'jungle', 'junior', 'junk', 'just', 'kangaroo', 'keen', 'keep', 'ketchup', 'key', 'kick', 'kid', 'kidney', 'kind', 'kingdom', 'kiss', 'kit', 'kitchen', 'kite', 'kitten', 'kiwi', 'knee', 'knife', 'knock', 'know', 'lab', 'label', 'labor', 'ladder', 'lady', 'lake', 'lamp', 'language', 'laptop', 'large', 'later', 'latin', 'laugh', 'laundry', 'lava', 'law', 'lawn', 'lawsuit', 'layer', 'lazy', 'leader', 'leaf', 'learn', 'leave', 'lecture', 'left', 'leg', 'legal', 'legend', 'leisure', 'lemon', 'lend', 'length', 'lens', 'leopard', 'lesson', 'letter', 'level', 'liar', 'liberty', 'library', 'license', 'life', 'lift', 'light', 'like', 'limb', 'limit', 'link', 'lion', 'liquid', 'list', 'little', 'live', 'lizard', 'load', 'loan', 'lobster', 'local', 'lock', 'logic', 'lonely', 'long', 'loop', 'lottery', 'loud', 'lounge', 'love', 'loyal', 'lucky', 'luggage', 'lumber', 'lunar', 'lunch', 'luxury', 'lyrics', 'machine', 'mad', 'magic', 'magnet', 'maid', 'mail', 'main', 'major', 'make', 'mammal', 'man', 'manage', 'mandate', 'mango', 'mansion', 'manual', 'maple', 'marble', 'march', 'margin', 'marine', 'market', 'marriage', 'mask', 'mass', 'master', 'match', 'material', 'math', 'matrix', 'matter', 'maximum', 'maze', 'meadow', 'mean', 'measure', 'meat', 'mechanic', 'medal', 'media', 'melody', 'melt', 'member', 'memory', 'mention', 'menu', 'mercy', 'merge', 'merit', 'merry', 'mesh', 'message', 'metal', 'method', 'middle', 'midnight', 'milk', 'million', 'mimic', 'mind', 'minimum', 'minor', 'minute', 'miracle', 'mirror', 'misery', 'miss', 'mistake', 'mix', 'mixed', 'mixture', 'mobile', 'model', 'modify', 'mom', 'moment', 'monitor', 'monkey', 'monster', 'month', 'moon', 'moral', 'more', 'morning', 'mosquito', 'mother', 'motion', 'motor', 'mountain', 'mouse', 'move', 'movie', 'much', 'muffin', 'mule', 'multiply', 'muscle', 'museum', 'mushroom', 'music', 'must', 'mutual', 'myself', 'mystery', 'myth', 'naive', 'name', 'napkin', 'narrow', 'nasty', 'nation', 'nature', 'near', 'neck', 'need', 'negative', 'neglect', 'neither', 'nephew', 'nerve', 'nest', 'net', 'network', 'neutral', 'never', 'news', 'next', 'nice', 'night', 'noble', 'noise', 'nominee', 'noodle', 'normal', 'north', 'nose', 'notable', 'note', 'nothing', 'notice', 'novel', 'now', 'nuclear', 'number', 'nurse', 'nut', 'oak', 'obey', 'object', 'oblige', 'obscure', 'observe', 'obtain', 'obvious', 'occur', 'ocean', 'october', 'odor', 'off', 'offer', 'office', 'often', 'oil', 'okay', 'old', 'olive', 'olympic', 'omit', 'once', 'one', 'onion', 'online', 'only', 'open', 'opera', 'opinion', 'oppose', 'option', 'orange', 'orbit', 'orchard', 'order', 'ordinary', 'organ', 'orient', 'original', 'orphan', 'ostrich', 'other', 'outdoor', 'outer', 'output', 'outside', 'oval', 'oven', 'over', 'own', 'owner', 'oxygen', 'oyster', 'ozone', 'pact', 'paddle', 'page', 'pair', 'palace', 'palm', 'panda', 'panel', 'panic', 'panther', 'paper', 'parade', 'parent', 'park', 'parrot', 'party', 'pass', 'patch', 'path', 'patient', 'patrol', 'pattern', 'pause', 'pave', 'payment', 'peace', 'peanut', 'pear', 'peasant', 'pelican', 'pen', 'penalty', 'pencil', 'people', 'pepper', 'perfect', 'permit', 'person', 'pet', 'phone', 'photo', 'phrase', 'physical', 'piano', 'picnic', 'picture', 'piece', 'pig', 'pigeon', 'pill', 'pilot', 'pink', 'pioneer', 'pipe', 'pistol', 'pitch', 'pizza', 'place', 'planet', 'plastic', 'plate', 'play', 'please', 'pledge', 'pluck', 'plug', 'plunge', 'poem', 'poet', 'point', 'polar', 'pole', 'police', 'pond', 'pony', 'pool', 'popular', 'portion', 'position', 'possible', 'post', 'potato', 'pottery', 'poverty', 'powder', 'power', 'practice', 'praise', 'predict', 'prefer', 'prepare', 'present', 'pretty', 'prevent', 'price', 'pride', 'primary', 'print', 'priority', 'prison', 'private', 'prize', 'problem', 'process', 'produce', 'profit', 'program', 'project', 'promote', 'proof', 'property', 'prosper', 'protect', 'proud', 'provide', 'public', 'pudding', 'pull', 'pulp', 'pulse', 'pumpkin', 'punch', 'pupil', 'puppy', 'purchase', 'purity', 'purpose', 'purse', 'push', 'put', 'puzzle', 'pyramid', 'quality', 'quantum', 'quarter', 'question', 'quick', 'quit', 'quiz', 'quote', 'rabbit', 'raccoon', 'race', 'rack', 'radar', 'radio', 'rail', 'rain', 'raise', 'rally', 'ramp', 'ranch', 'random', 'range', 'rapid', 'rare', 'rate', 'rather', 'raven', 'raw', 'razor', 'ready', 'real', 'reason', 'rebel', 'rebuild', 'recall', 'receive', 'recipe', 'record', 'recycle', 'reduce', 'reflect', 'reform', 'refuse', 'region', 'regret', 'regular', 'reject', 'relax', 'release', 'relief', 'rely', 'remain', 'remember', 'remind', 'remove', 'render', 'renew', 'rent', 'reopen', 'repair', 'repeat', 'replace', 'report', 'require', 'rescue', 'resemble', 'resist', 'resource', 'response', 'result', 'retire', 'retreat', 'return', 'reunion', 'reveal', 'review', 'reward', 'rhythm', 'rib', 'ribbon', 'rice', 'rich', 'ride', 'ridge', 'rifle', 'right', 'rigid', 'ring', 'riot', 'ripple', 'risk', 'ritual', 'rival', 'river', 'road', 'roast', 'robot', 'robust', 'rocket', 'romance', 'roof', 'rookie', 'room', 'rose', 'rotate', 'rough', 'round', 'route', 'royal', 'rubber', 'rude', 'rug', 'rule', 'run', 'runway', 'rural', 'sad', 'saddle', 'sadness', 'safe', 'sail', 'salad', 'salmon', 'salon', 'salt', 'salute', 'same', 'sample', 'sand', 'satisfy', 'satoshi', 'sauce', 'sausage', 'save', 'say', 'scale', 'scan', 'scare', 'scatter', 'scene', 'scheme', 'school', 'science', 'scissors', 'scorpion', 'scout', 'scrap', 'screen', 'script', 'scrub', 'sea', 'search', 'season', 'seat', 'second', 'secret', 'section', 'security', 'seed', 'seek', 'segment', 'select', 'sell', 'seminar', 'senior', 'sense', 'sentence', 'series', 'service', 'session', 'settle', 'setup', 'seven', 'shadow', 'shaft', 'shallow', 'share', 'shed', 'shell', 'sheriff', 'shield', 'shift', 'shine', 'ship', 'shiver', 'shock', 'shoe', 'shoot', 'shop', 'short', 'shoulder', 'shove', 'shrimp', 'shrug', 'shuffle', 'shy', 'sibling', 'sick', 'side', 'siege', 'sight', 'sign', 'silent', 'silk', 'silly', 'silver', 'similar', 'simple', 'since', 'sing', 'siren', 'sister', 'situate', 'six', 'size', 'skate', 'sketch', 'ski', 'skill', 'skin', 'skirt', 'skull', 'slab', 'slam', 'sleep', 'slender', 'slice', 'slide', 'slight', 'slim', 'slogan', 'slot', 'slow', 'slush', 'small', 'smart', 'smile', 'smoke', 'smooth', 'snack', 'snake', 'snap', 'sniff', 'snow', 'soap', 'soccer', 'social', 'sock', 'soda', 'soft', 'solar', 'soldier', 'solid', 'solution', 'solve', 'someone', 'song', 'soon', 'sorry', 'sort', 'soul', 'sound', 'soup', 'source', 'south', 'space', 'spare', 'spatial', 'spawn', 'speak', 'special', 'speed', 'spell', 'spend', 'sphere', 'spice', 'spider', 'spike', 'spin', 'spirit', 'split', 'spoil', 'sponsor', 'spoon', 'sport', 'spot', 'spray', 'spread', 'spring', 'spy', 'square', 'squeeze', 'squirrel', 'stable', 'stadium', 'staff', 'stage', 'stairs', 'stamp', 'stand', 'start', 'state', 'stay', 'steak', 'steel', 'stem', 'step', 'stereo', 'stick', 'still', 'sting', 'stock', 'stomach', 'stone', 'stool', 'story', 'stove', 'strategy', 'street', 'strike', 'strong', 'struggle', 'student', 'stuff', 'stumble', 'style', 'subject', 'submit', 'subway', 'success', 'such', 'sudden', 'suffer', 'sugar', 'suggest', 'suit', 'summer', 'sun', 'sunny', 'sunset', 'super', 'supply', 'supreme', 'sure', 'surface', 'surge', 'surprise', 'surround', 'survey', 'suspect', 'sustain', 'swallow', 'swamp', 'swap', 'swarm', 'swear', 'sweet', 'swift', 'swim', 'swing', 'switch', 'sword', 'symbol', 'symptom', 'syrup', 'system', 'table', 'tackle', 'tag', 'tail', 'talent', 'talk', 'tank', 'tape', 'target', 'task', 'taste', 'tattoo', 'taxi', 'teach', 'team', 'tell', 'ten', 'tenant', 'tennis', 'tent', 'term', 'test', 'text', 'thank', 'that', 'theme', 'then', 'theory', 'there', 'they', 'thing', 'this', 'thought', 'three', 'thrive', 'throw', 'thumb', 'thunder', 'ticket', 'tide', 'tiger', 'tilt', 'timber', 'time', 'tiny', 'tip', 'tired', 'tissue', 'title', 'toast', 'tobacco', 'today', 'toddler', 'toe', 'together', 'toilet', 'token', 'tomato', 'tomorrow', 'tone', 'tongue', 'tonight', 'tool', 'tooth', 'top', 'topic', 'topple', 'torch', 'tornado', 'tortoise', 'toss', 'total', 'tourist', 'toward', 'tower', 'town', 'toy', 'track', 'trade', 'traffic', 'tragic', 'train', 'transfer', 'trap', 'trash', 'travel', 'tray', 'treat', 'tree', 'trend', 'trial', 'tribe', 'trick', 'trigger', 'trim', 'trip', 'trophy', 'trouble', 'truck', 'true', 'truly', 'trumpet', 'trust', 'truth', 'try', 'tube', 'tuition', 'tumble', 'tuna', 'tunnel', 'turkey', 'turn', 'turtle', 'twelve', 'twenty', 'twice', 'twin', 'twist', 'two', 'type', 'typical', 'ugly', 'umbrella', 'unable', 'unaware', 'uncle', 'uncover', 'under', 'undo', 'unfair', 'unfold', 'unhappy', 'uniform', 'unique', 'unit', 'universe', 'unknown', 'unlock', 'until', 'unusual', 'unveil', 'update', 'upgrade', 'uphold', 'upon', 'upper', 'upset', 'urban', 'urge', 'usage', 'use', 'used', 'useful', 'useless', 'usual', 'utility', 'vacant', 'vacuum', 'vague', 'valid', 'valley', 'valve', 'van', 'vanish', 'vapor', 'various', 'vast', 'vault', 'vehicle', 'velvet', 'vendor', 'venture', 'venue', 'verb', 'verify', 'version', 'very', 'vessel', 'veteran', 'viable', 'vibrant', 'vicious', 'victory', 'video', 'view', 'village', 'vintage', 'violin', 'virtual', 'virus', 'visa', 'visit', 'visual', 'vital', 'vivid', 'vocal', 'voice', 'void', 'volcano', 'volume', 'vote', 'voyage', 'wage', 'wagon', 'wait', 'walk', 'wall', 'walnut', 'want', 'warfare', 'warm', 'warrior', 'wash', 'wasp', 'waste', 'water', 'wave', 'way', 'wealth', 'weapon', 'wear', 'weasel', 'weather', 'web', 'wedding', 'weekend', 'weird', 'welcome', 'west', 'wet', 'whale', 'what', 'wheat', 'wheel', 'when', 'where', 'whip', 'whisper', 'wide', 'width', 'wife', 'wild', 'will', 'win', 'window', 'wine', 'wing', 'wink', 'winner', 'winter', 'wire', 'wisdom', 'wise', 'wish', 'witness', 'wolf', 'woman', 'wonder', 'wood', 'wool', 'word', 'work', 'world', 'worry', 'worth', 'wrap', 'wreck', 'wrestle', 'wrist', 'write', 'wrong', 'yard', 'year', 'yellow', 'you', 'young', 'youth', 'zebra', 'zero', 'zone', 'zoo'];
+export default [
+ 'abandon',
+ 'ability',
+ 'able',
+ 'about',
+ 'above',
+ 'absent',
+ 'absorb',
+ 'abstract',
+ 'absurd',
+ 'abuse',
+ 'access',
+ 'accident',
+ 'account',
+ 'accuse',
+ 'achieve',
+ 'acid',
+ 'acoustic',
+ 'acquire',
+ 'across',
+ 'act',
+ 'action',
+ 'actor',
+ 'actress',
+ 'actual',
+ 'adapt',
+ 'add',
+ 'addict',
+ 'address',
+ 'adjust',
+ 'admit',
+ 'adult',
+ 'advance',
+ 'advice',
+ 'aerobic',
+ 'affair',
+ 'afford',
+ 'afraid',
+ 'again',
+ 'age',
+ 'agent',
+ 'agree',
+ 'ahead',
+ 'aim',
+ 'air',
+ 'airport',
+ 'aisle',
+ 'alarm',
+ 'album',
+ 'alcohol',
+ 'alert',
+ 'alien',
+ 'all',
+ 'alley',
+ 'allow',
+ 'almost',
+ 'alone',
+ 'alpha',
+ 'already',
+ 'also',
+ 'alter',
+ 'always',
+ 'amateur',
+ 'amazing',
+ 'among',
+ 'amount',
+ 'amused',
+ 'analyst',
+ 'anchor',
+ 'ancient',
+ 'anger',
+ 'angle',
+ 'angry',
+ 'animal',
+ 'ankle',
+ 'announce',
+ 'annual',
+ 'another',
+ 'answer',
+ 'antenna',
+ 'antique',
+ 'anxiety',
+ 'any',
+ 'apart',
+ 'apology',
+ 'appear',
+ 'apple',
+ 'approve',
+ 'april',
+ 'arch',
+ 'arctic',
+ 'area',
+ 'arena',
+ 'argue',
+ 'arm',
+ 'armed',
+ 'armor',
+ 'army',
+ 'around',
+ 'arrange',
+ 'arrest',
+ 'arrive',
+ 'arrow',
+ 'art',
+ 'artefact',
+ 'artist',
+ 'artwork',
+ 'ask',
+ 'aspect',
+ 'assault',
+ 'asset',
+ 'assist',
+ 'assume',
+ 'asthma',
+ 'athlete',
+ 'atom',
+ 'attack',
+ 'attend',
+ 'attitude',
+ 'attract',
+ 'auction',
+ 'audit',
+ 'august',
+ 'aunt',
+ 'author',
+ 'auto',
+ 'autumn',
+ 'average',
+ 'avocado',
+ 'avoid',
+ 'awake',
+ 'aware',
+ 'away',
+ 'awesome',
+ 'awful',
+ 'awkward',
+ 'axis',
+ 'baby',
+ 'bachelor',
+ 'bacon',
+ 'badge',
+ 'bag',
+ 'balance',
+ 'balcony',
+ 'ball',
+ 'bamboo',
+ 'banana',
+ 'banner',
+ 'bar',
+ 'barely',
+ 'bargain',
+ 'barrel',
+ 'base',
+ 'basic',
+ 'basket',
+ 'battle',
+ 'beach',
+ 'bean',
+ 'beauty',
+ 'because',
+ 'become',
+ 'beef',
+ 'before',
+ 'begin',
+ 'behave',
+ 'behind',
+ 'believe',
+ 'below',
+ 'belt',
+ 'bench',
+ 'benefit',
+ 'best',
+ 'betray',
+ 'better',
+ 'between',
+ 'beyond',
+ 'bicycle',
+ 'bid',
+ 'bike',
+ 'bind',
+ 'biology',
+ 'bird',
+ 'birth',
+ 'bitter',
+ 'black',
+ 'blade',
+ 'blame',
+ 'blanket',
+ 'blast',
+ 'bleak',
+ 'bless',
+ 'blind',
+ 'blood',
+ 'blossom',
+ 'blouse',
+ 'blue',
+ 'blur',
+ 'blush',
+ 'board',
+ 'boat',
+ 'body',
+ 'boil',
+ 'bomb',
+ 'bone',
+ 'bonus',
+ 'book',
+ 'boost',
+ 'border',
+ 'boring',
+ 'borrow',
+ 'boss',
+ 'bottom',
+ 'bounce',
+ 'box',
+ 'boy',
+ 'bracket',
+ 'brain',
+ 'brand',
+ 'brass',
+ 'brave',
+ 'bread',
+ 'breeze',
+ 'brick',
+ 'bridge',
+ 'brief',
+ 'bright',
+ 'bring',
+ 'brisk',
+ 'broccoli',
+ 'broken',
+ 'bronze',
+ 'broom',
+ 'brother',
+ 'brown',
+ 'brush',
+ 'bubble',
+ 'buddy',
+ 'budget',
+ 'buffalo',
+ 'build',
+ 'bulb',
+ 'bulk',
+ 'bullet',
+ 'bundle',
+ 'bunker',
+ 'burden',
+ 'burger',
+ 'burst',
+ 'bus',
+ 'business',
+ 'busy',
+ 'butter',
+ 'buyer',
+ 'buzz',
+ 'cabbage',
+ 'cabin',
+ 'cable',
+ 'cactus',
+ 'cage',
+ 'cake',
+ 'call',
+ 'calm',
+ 'camera',
+ 'camp',
+ 'can',
+ 'canal',
+ 'cancel',
+ 'candy',
+ 'cannon',
+ 'canoe',
+ 'canvas',
+ 'canyon',
+ 'capable',
+ 'capital',
+ 'captain',
+ 'car',
+ 'carbon',
+ 'card',
+ 'cargo',
+ 'carpet',
+ 'carry',
+ 'cart',
+ 'case',
+ 'cash',
+ 'casino',
+ 'castle',
+ 'casual',
+ 'cat',
+ 'catalog',
+ 'catch',
+ 'category',
+ 'cattle',
+ 'caught',
+ 'cause',
+ 'caution',
+ 'cave',
+ 'ceiling',
+ 'celery',
+ 'cement',
+ 'census',
+ 'century',
+ 'cereal',
+ 'certain',
+ 'chair',
+ 'chalk',
+ 'champion',
+ 'change',
+ 'chaos',
+ 'chapter',
+ 'charge',
+ 'chase',
+ 'chat',
+ 'cheap',
+ 'check',
+ 'cheese',
+ 'chef',
+ 'cherry',
+ 'chest',
+ 'chicken',
+ 'chief',
+ 'child',
+ 'chimney',
+ 'choice',
+ 'choose',
+ 'chronic',
+ 'chuckle',
+ 'chunk',
+ 'churn',
+ 'cigar',
+ 'cinnamon',
+ 'circle',
+ 'citizen',
+ 'city',
+ 'civil',
+ 'claim',
+ 'clap',
+ 'clarify',
+ 'claw',
+ 'clay',
+ 'clean',
+ 'clerk',
+ 'clever',
+ 'click',
+ 'client',
+ 'cliff',
+ 'climb',
+ 'clinic',
+ 'clip',
+ 'clock',
+ 'clog',
+ 'close',
+ 'cloth',
+ 'cloud',
+ 'clown',
+ 'club',
+ 'clump',
+ 'cluster',
+ 'clutch',
+ 'coach',
+ 'coast',
+ 'coconut',
+ 'code',
+ 'coffee',
+ 'coil',
+ 'coin',
+ 'collect',
+ 'color',
+ 'column',
+ 'combine',
+ 'come',
+ 'comfort',
+ 'comic',
+ 'common',
+ 'company',
+ 'concert',
+ 'conduct',
+ 'confirm',
+ 'congress',
+ 'connect',
+ 'consider',
+ 'control',
+ 'convince',
+ 'cook',
+ 'cool',
+ 'copper',
+ 'copy',
+ 'coral',
+ 'core',
+ 'corn',
+ 'correct',
+ 'cost',
+ 'cotton',
+ 'couch',
+ 'country',
+ 'couple',
+ 'course',
+ 'cousin',
+ 'cover',
+ 'coyote',
+ 'crack',
+ 'cradle',
+ 'craft',
+ 'cram',
+ 'crane',
+ 'crash',
+ 'crater',
+ 'crawl',
+ 'crazy',
+ 'cream',
+ 'credit',
+ 'creek',
+ 'crew',
+ 'cricket',
+ 'crime',
+ 'crisp',
+ 'critic',
+ 'crop',
+ 'cross',
+ 'crouch',
+ 'crowd',
+ 'crucial',
+ 'cruel',
+ 'cruise',
+ 'crumble',
+ 'crunch',
+ 'crush',
+ 'cry',
+ 'crystal',
+ 'cube',
+ 'culture',
+ 'cup',
+ 'cupboard',
+ 'curious',
+ 'current',
+ 'curtain',
+ 'curve',
+ 'cushion',
+ 'custom',
+ 'cute',
+ 'cycle',
+ 'dad',
+ 'damage',
+ 'damp',
+ 'dance',
+ 'danger',
+ 'daring',
+ 'dash',
+ 'daughter',
+ 'dawn',
+ 'day',
+ 'deal',
+ 'debate',
+ 'debris',
+ 'decade',
+ 'december',
+ 'decide',
+ 'decline',
+ 'decorate',
+ 'decrease',
+ 'deer',
+ 'defense',
+ 'define',
+ 'defy',
+ 'degree',
+ 'delay',
+ 'deliver',
+ 'demand',
+ 'demise',
+ 'denial',
+ 'dentist',
+ 'deny',
+ 'depart',
+ 'depend',
+ 'deposit',
+ 'depth',
+ 'deputy',
+ 'derive',
+ 'describe',
+ 'desert',
+ 'design',
+ 'desk',
+ 'despair',
+ 'destroy',
+ 'detail',
+ 'detect',
+ 'develop',
+ 'device',
+ 'devote',
+ 'diagram',
+ 'dial',
+ 'diamond',
+ 'diary',
+ 'dice',
+ 'diesel',
+ 'diet',
+ 'differ',
+ 'digital',
+ 'dignity',
+ 'dilemma',
+ 'dinner',
+ 'dinosaur',
+ 'direct',
+ 'dirt',
+ 'disagree',
+ 'discover',
+ 'disease',
+ 'dish',
+ 'dismiss',
+ 'disorder',
+ 'display',
+ 'distance',
+ 'divert',
+ 'divide',
+ 'divorce',
+ 'dizzy',
+ 'doctor',
+ 'document',
+ 'dog',
+ 'doll',
+ 'dolphin',
+ 'domain',
+ 'donate',
+ 'donkey',
+ 'donor',
+ 'door',
+ 'dose',
+ 'double',
+ 'dove',
+ 'draft',
+ 'dragon',
+ 'drama',
+ 'drastic',
+ 'draw',
+ 'dream',
+ 'dress',
+ 'drift',
+ 'drill',
+ 'drink',
+ 'drip',
+ 'drive',
+ 'drop',
+ 'drum',
+ 'dry',
+ 'duck',
+ 'dumb',
+ 'dune',
+ 'during',
+ 'dust',
+ 'dutch',
+ 'duty',
+ 'dwarf',
+ 'dynamic',
+ 'eager',
+ 'eagle',
+ 'early',
+ 'earn',
+ 'earth',
+ 'easily',
+ 'east',
+ 'easy',
+ 'echo',
+ 'ecology',
+ 'economy',
+ 'edge',
+ 'edit',
+ 'educate',
+ 'effort',
+ 'egg',
+ 'eight',
+ 'either',
+ 'elbow',
+ 'elder',
+ 'electric',
+ 'elegant',
+ 'element',
+ 'elephant',
+ 'elevator',
+ 'elite',
+ 'else',
+ 'embark',
+ 'embody',
+ 'embrace',
+ 'emerge',
+ 'emotion',
+ 'employ',
+ 'empower',
+ 'empty',
+ 'enable',
+ 'enact',
+ 'end',
+ 'endless',
+ 'endorse',
+ 'enemy',
+ 'energy',
+ 'enforce',
+ 'engage',
+ 'engine',
+ 'enhance',
+ 'enjoy',
+ 'enlist',
+ 'enough',
+ 'enrich',
+ 'enroll',
+ 'ensure',
+ 'enter',
+ 'entire',
+ 'entry',
+ 'envelope',
+ 'episode',
+ 'equal',
+ 'equip',
+ 'era',
+ 'erase',
+ 'erode',
+ 'erosion',
+ 'error',
+ 'erupt',
+ 'escape',
+ 'essay',
+ 'essence',
+ 'estate',
+ 'eternal',
+ 'ethics',
+ 'evidence',
+ 'evil',
+ 'evoke',
+ 'evolve',
+ 'exact',
+ 'example',
+ 'excess',
+ 'exchange',
+ 'excite',
+ 'exclude',
+ 'excuse',
+ 'execute',
+ 'exercise',
+ 'exhaust',
+ 'exhibit',
+ 'exile',
+ 'exist',
+ 'exit',
+ 'exotic',
+ 'expand',
+ 'expect',
+ 'expire',
+ 'explain',
+ 'expose',
+ 'express',
+ 'extend',
+ 'extra',
+ 'eye',
+ 'eyebrow',
+ 'fabric',
+ 'face',
+ 'faculty',
+ 'fade',
+ 'faint',
+ 'faith',
+ 'fall',
+ 'false',
+ 'fame',
+ 'family',
+ 'famous',
+ 'fan',
+ 'fancy',
+ 'fantasy',
+ 'farm',
+ 'fashion',
+ 'fat',
+ 'fatal',
+ 'father',
+ 'fatigue',
+ 'fault',
+ 'favorite',
+ 'feature',
+ 'february',
+ 'federal',
+ 'fee',
+ 'feed',
+ 'feel',
+ 'female',
+ 'fence',
+ 'festival',
+ 'fetch',
+ 'fever',
+ 'few',
+ 'fiber',
+ 'fiction',
+ 'field',
+ 'figure',
+ 'file',
+ 'film',
+ 'filter',
+ 'final',
+ 'find',
+ 'fine',
+ 'finger',
+ 'finish',
+ 'fire',
+ 'firm',
+ 'first',
+ 'fiscal',
+ 'fish',
+ 'fit',
+ 'fitness',
+ 'fix',
+ 'flag',
+ 'flame',
+ 'flash',
+ 'flat',
+ 'flavor',
+ 'flee',
+ 'flight',
+ 'flip',
+ 'float',
+ 'flock',
+ 'floor',
+ 'flower',
+ 'fluid',
+ 'flush',
+ 'fly',
+ 'foam',
+ 'focus',
+ 'fog',
+ 'foil',
+ 'fold',
+ 'follow',
+ 'food',
+ 'foot',
+ 'force',
+ 'forest',
+ 'forget',
+ 'fork',
+ 'fortune',
+ 'forum',
+ 'forward',
+ 'fossil',
+ 'foster',
+ 'found',
+ 'fox',
+ 'fragile',
+ 'frame',
+ 'frequent',
+ 'fresh',
+ 'friend',
+ 'fringe',
+ 'frog',
+ 'front',
+ 'frost',
+ 'frown',
+ 'frozen',
+ 'fruit',
+ 'fuel',
+ 'fun',
+ 'funny',
+ 'furnace',
+ 'fury',
+ 'future',
+ 'gadget',
+ 'gain',
+ 'galaxy',
+ 'gallery',
+ 'game',
+ 'gap',
+ 'garage',
+ 'garbage',
+ 'garden',
+ 'garlic',
+ 'garment',
+ 'gas',
+ 'gasp',
+ 'gate',
+ 'gather',
+ 'gauge',
+ 'gaze',
+ 'general',
+ 'genius',
+ 'genre',
+ 'gentle',
+ 'genuine',
+ 'gesture',
+ 'ghost',
+ 'giant',
+ 'gift',
+ 'giggle',
+ 'ginger',
+ 'giraffe',
+ 'girl',
+ 'give',
+ 'glad',
+ 'glance',
+ 'glare',
+ 'glass',
+ 'glide',
+ 'glimpse',
+ 'globe',
+ 'gloom',
+ 'glory',
+ 'glove',
+ 'glow',
+ 'glue',
+ 'goat',
+ 'goddess',
+ 'gold',
+ 'good',
+ 'goose',
+ 'gorilla',
+ 'gospel',
+ 'gossip',
+ 'govern',
+ 'gown',
+ 'grab',
+ 'grace',
+ 'grain',
+ 'grant',
+ 'grape',
+ 'grass',
+ 'gravity',
+ 'great',
+ 'green',
+ 'grid',
+ 'grief',
+ 'grit',
+ 'grocery',
+ 'group',
+ 'grow',
+ 'grunt',
+ 'guard',
+ 'guess',
+ 'guide',
+ 'guilt',
+ 'guitar',
+ 'gun',
+ 'gym',
+ 'habit',
+ 'hair',
+ 'half',
+ 'hammer',
+ 'hamster',
+ 'hand',
+ 'happy',
+ 'harbor',
+ 'hard',
+ 'harsh',
+ 'harvest',
+ 'hat',
+ 'have',
+ 'hawk',
+ 'hazard',
+ 'head',
+ 'health',
+ 'heart',
+ 'heavy',
+ 'hedgehog',
+ 'height',
+ 'hello',
+ 'helmet',
+ 'help',
+ 'hen',
+ 'hero',
+ 'hidden',
+ 'high',
+ 'hill',
+ 'hint',
+ 'hip',
+ 'hire',
+ 'history',
+ 'hobby',
+ 'hockey',
+ 'hold',
+ 'hole',
+ 'holiday',
+ 'hollow',
+ 'home',
+ 'honey',
+ 'hood',
+ 'hope',
+ 'horn',
+ 'horror',
+ 'horse',
+ 'hospital',
+ 'host',
+ 'hotel',
+ 'hour',
+ 'hover',
+ 'hub',
+ 'huge',
+ 'human',
+ 'humble',
+ 'humor',
+ 'hundred',
+ 'hungry',
+ 'hunt',
+ 'hurdle',
+ 'hurry',
+ 'hurt',
+ 'husband',
+ 'hybrid',
+ 'ice',
+ 'icon',
+ 'idea',
+ 'identify',
+ 'idle',
+ 'ignore',
+ 'ill',
+ 'illegal',
+ 'illness',
+ 'image',
+ 'imitate',
+ 'immense',
+ 'immune',
+ 'impact',
+ 'impose',
+ 'improve',
+ 'impulse',
+ 'inch',
+ 'include',
+ 'income',
+ 'increase',
+ 'index',
+ 'indicate',
+ 'indoor',
+ 'industry',
+ 'infant',
+ 'inflict',
+ 'inform',
+ 'inhale',
+ 'inherit',
+ 'initial',
+ 'inject',
+ 'injury',
+ 'inmate',
+ 'inner',
+ 'innocent',
+ 'input',
+ 'inquiry',
+ 'insane',
+ 'insect',
+ 'inside',
+ 'inspire',
+ 'install',
+ 'intact',
+ 'interest',
+ 'into',
+ 'invest',
+ 'invite',
+ 'involve',
+ 'iron',
+ 'island',
+ 'isolate',
+ 'issue',
+ 'item',
+ 'ivory',
+ 'jacket',
+ 'jaguar',
+ 'jar',
+ 'jazz',
+ 'jealous',
+ 'jeans',
+ 'jelly',
+ 'jewel',
+ 'job',
+ 'join',
+ 'joke',
+ 'journey',
+ 'joy',
+ 'judge',
+ 'juice',
+ 'jump',
+ 'jungle',
+ 'junior',
+ 'junk',
+ 'just',
+ 'kangaroo',
+ 'keen',
+ 'keep',
+ 'ketchup',
+ 'key',
+ 'kick',
+ 'kid',
+ 'kidney',
+ 'kind',
+ 'kingdom',
+ 'kiss',
+ 'kit',
+ 'kitchen',
+ 'kite',
+ 'kitten',
+ 'kiwi',
+ 'knee',
+ 'knife',
+ 'knock',
+ 'know',
+ 'lab',
+ 'label',
+ 'labor',
+ 'ladder',
+ 'lady',
+ 'lake',
+ 'lamp',
+ 'language',
+ 'laptop',
+ 'large',
+ 'later',
+ 'latin',
+ 'laugh',
+ 'laundry',
+ 'lava',
+ 'law',
+ 'lawn',
+ 'lawsuit',
+ 'layer',
+ 'lazy',
+ 'leader',
+ 'leaf',
+ 'learn',
+ 'leave',
+ 'lecture',
+ 'left',
+ 'leg',
+ 'legal',
+ 'legend',
+ 'leisure',
+ 'lemon',
+ 'lend',
+ 'length',
+ 'lens',
+ 'leopard',
+ 'lesson',
+ 'letter',
+ 'level',
+ 'liar',
+ 'liberty',
+ 'library',
+ 'license',
+ 'life',
+ 'lift',
+ 'light',
+ 'like',
+ 'limb',
+ 'limit',
+ 'link',
+ 'lion',
+ 'liquid',
+ 'list',
+ 'little',
+ 'live',
+ 'lizard',
+ 'load',
+ 'loan',
+ 'lobster',
+ 'local',
+ 'lock',
+ 'logic',
+ 'lonely',
+ 'long',
+ 'loop',
+ 'lottery',
+ 'loud',
+ 'lounge',
+ 'love',
+ 'loyal',
+ 'lucky',
+ 'luggage',
+ 'lumber',
+ 'lunar',
+ 'lunch',
+ 'luxury',
+ 'lyrics',
+ 'machine',
+ 'mad',
+ 'magic',
+ 'magnet',
+ 'maid',
+ 'mail',
+ 'main',
+ 'major',
+ 'make',
+ 'mammal',
+ 'man',
+ 'manage',
+ 'mandate',
+ 'mango',
+ 'mansion',
+ 'manual',
+ 'maple',
+ 'marble',
+ 'march',
+ 'margin',
+ 'marine',
+ 'market',
+ 'marriage',
+ 'mask',
+ 'mass',
+ 'master',
+ 'match',
+ 'material',
+ 'math',
+ 'matrix',
+ 'matter',
+ 'maximum',
+ 'maze',
+ 'meadow',
+ 'mean',
+ 'measure',
+ 'meat',
+ 'mechanic',
+ 'medal',
+ 'media',
+ 'melody',
+ 'melt',
+ 'member',
+ 'memory',
+ 'mention',
+ 'menu',
+ 'mercy',
+ 'merge',
+ 'merit',
+ 'merry',
+ 'mesh',
+ 'message',
+ 'metal',
+ 'method',
+ 'middle',
+ 'midnight',
+ 'milk',
+ 'million',
+ 'mimic',
+ 'mind',
+ 'minimum',
+ 'minor',
+ 'minute',
+ 'miracle',
+ 'mirror',
+ 'misery',
+ 'miss',
+ 'mistake',
+ 'mix',
+ 'mixed',
+ 'mixture',
+ 'mobile',
+ 'model',
+ 'modify',
+ 'mom',
+ 'moment',
+ 'monitor',
+ 'monkey',
+ 'monster',
+ 'month',
+ 'moon',
+ 'moral',
+ 'more',
+ 'morning',
+ 'mosquito',
+ 'mother',
+ 'motion',
+ 'motor',
+ 'mountain',
+ 'mouse',
+ 'move',
+ 'movie',
+ 'much',
+ 'muffin',
+ 'mule',
+ 'multiply',
+ 'muscle',
+ 'museum',
+ 'mushroom',
+ 'music',
+ 'must',
+ 'mutual',
+ 'myself',
+ 'mystery',
+ 'myth',
+ 'naive',
+ 'name',
+ 'napkin',
+ 'narrow',
+ 'nasty',
+ 'nation',
+ 'nature',
+ 'near',
+ 'neck',
+ 'need',
+ 'negative',
+ 'neglect',
+ 'neither',
+ 'nephew',
+ 'nerve',
+ 'nest',
+ 'net',
+ 'network',
+ 'neutral',
+ 'never',
+ 'news',
+ 'next',
+ 'nice',
+ 'night',
+ 'noble',
+ 'noise',
+ 'nominee',
+ 'noodle',
+ 'normal',
+ 'north',
+ 'nose',
+ 'notable',
+ 'note',
+ 'nothing',
+ 'notice',
+ 'novel',
+ 'now',
+ 'nuclear',
+ 'number',
+ 'nurse',
+ 'nut',
+ 'oak',
+ 'obey',
+ 'object',
+ 'oblige',
+ 'obscure',
+ 'observe',
+ 'obtain',
+ 'obvious',
+ 'occur',
+ 'ocean',
+ 'october',
+ 'odor',
+ 'off',
+ 'offer',
+ 'office',
+ 'often',
+ 'oil',
+ 'okay',
+ 'old',
+ 'olive',
+ 'olympic',
+ 'omit',
+ 'once',
+ 'one',
+ 'onion',
+ 'online',
+ 'only',
+ 'open',
+ 'opera',
+ 'opinion',
+ 'oppose',
+ 'option',
+ 'orange',
+ 'orbit',
+ 'orchard',
+ 'order',
+ 'ordinary',
+ 'organ',
+ 'orient',
+ 'original',
+ 'orphan',
+ 'ostrich',
+ 'other',
+ 'outdoor',
+ 'outer',
+ 'output',
+ 'outside',
+ 'oval',
+ 'oven',
+ 'over',
+ 'own',
+ 'owner',
+ 'oxygen',
+ 'oyster',
+ 'ozone',
+ 'pact',
+ 'paddle',
+ 'page',
+ 'pair',
+ 'palace',
+ 'palm',
+ 'panda',
+ 'panel',
+ 'panic',
+ 'panther',
+ 'paper',
+ 'parade',
+ 'parent',
+ 'park',
+ 'parrot',
+ 'party',
+ 'pass',
+ 'patch',
+ 'path',
+ 'patient',
+ 'patrol',
+ 'pattern',
+ 'pause',
+ 'pave',
+ 'payment',
+ 'peace',
+ 'peanut',
+ 'pear',
+ 'peasant',
+ 'pelican',
+ 'pen',
+ 'penalty',
+ 'pencil',
+ 'people',
+ 'pepper',
+ 'perfect',
+ 'permit',
+ 'person',
+ 'pet',
+ 'phone',
+ 'photo',
+ 'phrase',
+ 'physical',
+ 'piano',
+ 'picnic',
+ 'picture',
+ 'piece',
+ 'pig',
+ 'pigeon',
+ 'pill',
+ 'pilot',
+ 'pink',
+ 'pioneer',
+ 'pipe',
+ 'pistol',
+ 'pitch',
+ 'pizza',
+ 'place',
+ 'planet',
+ 'plastic',
+ 'plate',
+ 'play',
+ 'please',
+ 'pledge',
+ 'pluck',
+ 'plug',
+ 'plunge',
+ 'poem',
+ 'poet',
+ 'point',
+ 'polar',
+ 'pole',
+ 'police',
+ 'pond',
+ 'pony',
+ 'pool',
+ 'popular',
+ 'portion',
+ 'position',
+ 'possible',
+ 'post',
+ 'potato',
+ 'pottery',
+ 'poverty',
+ 'powder',
+ 'power',
+ 'practice',
+ 'praise',
+ 'predict',
+ 'prefer',
+ 'prepare',
+ 'present',
+ 'pretty',
+ 'prevent',
+ 'price',
+ 'pride',
+ 'primary',
+ 'print',
+ 'priority',
+ 'prison',
+ 'private',
+ 'prize',
+ 'problem',
+ 'process',
+ 'produce',
+ 'profit',
+ 'program',
+ 'project',
+ 'promote',
+ 'proof',
+ 'property',
+ 'prosper',
+ 'protect',
+ 'proud',
+ 'provide',
+ 'public',
+ 'pudding',
+ 'pull',
+ 'pulp',
+ 'pulse',
+ 'pumpkin',
+ 'punch',
+ 'pupil',
+ 'puppy',
+ 'purchase',
+ 'purity',
+ 'purpose',
+ 'purse',
+ 'push',
+ 'put',
+ 'puzzle',
+ 'pyramid',
+ 'quality',
+ 'quantum',
+ 'quarter',
+ 'question',
+ 'quick',
+ 'quit',
+ 'quiz',
+ 'quote',
+ 'rabbit',
+ 'raccoon',
+ 'race',
+ 'rack',
+ 'radar',
+ 'radio',
+ 'rail',
+ 'rain',
+ 'raise',
+ 'rally',
+ 'ramp',
+ 'ranch',
+ 'random',
+ 'range',
+ 'rapid',
+ 'rare',
+ 'rate',
+ 'rather',
+ 'raven',
+ 'raw',
+ 'razor',
+ 'ready',
+ 'real',
+ 'reason',
+ 'rebel',
+ 'rebuild',
+ 'recall',
+ 'receive',
+ 'recipe',
+ 'record',
+ 'recycle',
+ 'reduce',
+ 'reflect',
+ 'reform',
+ 'refuse',
+ 'region',
+ 'regret',
+ 'regular',
+ 'reject',
+ 'relax',
+ 'release',
+ 'relief',
+ 'rely',
+ 'remain',
+ 'remember',
+ 'remind',
+ 'remove',
+ 'render',
+ 'renew',
+ 'rent',
+ 'reopen',
+ 'repair',
+ 'repeat',
+ 'replace',
+ 'report',
+ 'require',
+ 'rescue',
+ 'resemble',
+ 'resist',
+ 'resource',
+ 'response',
+ 'result',
+ 'retire',
+ 'retreat',
+ 'return',
+ 'reunion',
+ 'reveal',
+ 'review',
+ 'reward',
+ 'rhythm',
+ 'rib',
+ 'ribbon',
+ 'rice',
+ 'rich',
+ 'ride',
+ 'ridge',
+ 'rifle',
+ 'right',
+ 'rigid',
+ 'ring',
+ 'riot',
+ 'ripple',
+ 'risk',
+ 'ritual',
+ 'rival',
+ 'river',
+ 'road',
+ 'roast',
+ 'robot',
+ 'robust',
+ 'rocket',
+ 'romance',
+ 'roof',
+ 'rookie',
+ 'room',
+ 'rose',
+ 'rotate',
+ 'rough',
+ 'round',
+ 'route',
+ 'royal',
+ 'rubber',
+ 'rude',
+ 'rug',
+ 'rule',
+ 'run',
+ 'runway',
+ 'rural',
+ 'sad',
+ 'saddle',
+ 'sadness',
+ 'safe',
+ 'sail',
+ 'salad',
+ 'salmon',
+ 'salon',
+ 'salt',
+ 'salute',
+ 'same',
+ 'sample',
+ 'sand',
+ 'satisfy',
+ 'satoshi',
+ 'sauce',
+ 'sausage',
+ 'save',
+ 'say',
+ 'scale',
+ 'scan',
+ 'scare',
+ 'scatter',
+ 'scene',
+ 'scheme',
+ 'school',
+ 'science',
+ 'scissors',
+ 'scorpion',
+ 'scout',
+ 'scrap',
+ 'screen',
+ 'script',
+ 'scrub',
+ 'sea',
+ 'search',
+ 'season',
+ 'seat',
+ 'second',
+ 'secret',
+ 'section',
+ 'security',
+ 'seed',
+ 'seek',
+ 'segment',
+ 'select',
+ 'sell',
+ 'seminar',
+ 'senior',
+ 'sense',
+ 'sentence',
+ 'series',
+ 'service',
+ 'session',
+ 'settle',
+ 'setup',
+ 'seven',
+ 'shadow',
+ 'shaft',
+ 'shallow',
+ 'share',
+ 'shed',
+ 'shell',
+ 'sheriff',
+ 'shield',
+ 'shift',
+ 'shine',
+ 'ship',
+ 'shiver',
+ 'shock',
+ 'shoe',
+ 'shoot',
+ 'shop',
+ 'short',
+ 'shoulder',
+ 'shove',
+ 'shrimp',
+ 'shrug',
+ 'shuffle',
+ 'shy',
+ 'sibling',
+ 'sick',
+ 'side',
+ 'siege',
+ 'sight',
+ 'sign',
+ 'silent',
+ 'silk',
+ 'silly',
+ 'silver',
+ 'similar',
+ 'simple',
+ 'since',
+ 'sing',
+ 'siren',
+ 'sister',
+ 'situate',
+ 'six',
+ 'size',
+ 'skate',
+ 'sketch',
+ 'ski',
+ 'skill',
+ 'skin',
+ 'skirt',
+ 'skull',
+ 'slab',
+ 'slam',
+ 'sleep',
+ 'slender',
+ 'slice',
+ 'slide',
+ 'slight',
+ 'slim',
+ 'slogan',
+ 'slot',
+ 'slow',
+ 'slush',
+ 'small',
+ 'smart',
+ 'smile',
+ 'smoke',
+ 'smooth',
+ 'snack',
+ 'snake',
+ 'snap',
+ 'sniff',
+ 'snow',
+ 'soap',
+ 'soccer',
+ 'social',
+ 'sock',
+ 'soda',
+ 'soft',
+ 'solar',
+ 'soldier',
+ 'solid',
+ 'solution',
+ 'solve',
+ 'someone',
+ 'song',
+ 'soon',
+ 'sorry',
+ 'sort',
+ 'soul',
+ 'sound',
+ 'soup',
+ 'source',
+ 'south',
+ 'space',
+ 'spare',
+ 'spatial',
+ 'spawn',
+ 'speak',
+ 'special',
+ 'speed',
+ 'spell',
+ 'spend',
+ 'sphere',
+ 'spice',
+ 'spider',
+ 'spike',
+ 'spin',
+ 'spirit',
+ 'split',
+ 'spoil',
+ 'sponsor',
+ 'spoon',
+ 'sport',
+ 'spot',
+ 'spray',
+ 'spread',
+ 'spring',
+ 'spy',
+ 'square',
+ 'squeeze',
+ 'squirrel',
+ 'stable',
+ 'stadium',
+ 'staff',
+ 'stage',
+ 'stairs',
+ 'stamp',
+ 'stand',
+ 'start',
+ 'state',
+ 'stay',
+ 'steak',
+ 'steel',
+ 'stem',
+ 'step',
+ 'stereo',
+ 'stick',
+ 'still',
+ 'sting',
+ 'stock',
+ 'stomach',
+ 'stone',
+ 'stool',
+ 'story',
+ 'stove',
+ 'strategy',
+ 'street',
+ 'strike',
+ 'strong',
+ 'struggle',
+ 'student',
+ 'stuff',
+ 'stumble',
+ 'style',
+ 'subject',
+ 'submit',
+ 'subway',
+ 'success',
+ 'such',
+ 'sudden',
+ 'suffer',
+ 'sugar',
+ 'suggest',
+ 'suit',
+ 'summer',
+ 'sun',
+ 'sunny',
+ 'sunset',
+ 'super',
+ 'supply',
+ 'supreme',
+ 'sure',
+ 'surface',
+ 'surge',
+ 'surprise',
+ 'surround',
+ 'survey',
+ 'suspect',
+ 'sustain',
+ 'swallow',
+ 'swamp',
+ 'swap',
+ 'swarm',
+ 'swear',
+ 'sweet',
+ 'swift',
+ 'swim',
+ 'swing',
+ 'switch',
+ 'sword',
+ 'symbol',
+ 'symptom',
+ 'syrup',
+ 'system',
+ 'table',
+ 'tackle',
+ 'tag',
+ 'tail',
+ 'talent',
+ 'talk',
+ 'tank',
+ 'tape',
+ 'target',
+ 'task',
+ 'taste',
+ 'tattoo',
+ 'taxi',
+ 'teach',
+ 'team',
+ 'tell',
+ 'ten',
+ 'tenant',
+ 'tennis',
+ 'tent',
+ 'term',
+ 'test',
+ 'text',
+ 'thank',
+ 'that',
+ 'theme',
+ 'then',
+ 'theory',
+ 'there',
+ 'they',
+ 'thing',
+ 'this',
+ 'thought',
+ 'three',
+ 'thrive',
+ 'throw',
+ 'thumb',
+ 'thunder',
+ 'ticket',
+ 'tide',
+ 'tiger',
+ 'tilt',
+ 'timber',
+ 'time',
+ 'tiny',
+ 'tip',
+ 'tired',
+ 'tissue',
+ 'title',
+ 'toast',
+ 'tobacco',
+ 'today',
+ 'toddler',
+ 'toe',
+ 'together',
+ 'toilet',
+ 'token',
+ 'tomato',
+ 'tomorrow',
+ 'tone',
+ 'tongue',
+ 'tonight',
+ 'tool',
+ 'tooth',
+ 'top',
+ 'topic',
+ 'topple',
+ 'torch',
+ 'tornado',
+ 'tortoise',
+ 'toss',
+ 'total',
+ 'tourist',
+ 'toward',
+ 'tower',
+ 'town',
+ 'toy',
+ 'track',
+ 'trade',
+ 'traffic',
+ 'tragic',
+ 'train',
+ 'transfer',
+ 'trap',
+ 'trash',
+ 'travel',
+ 'tray',
+ 'treat',
+ 'tree',
+ 'trend',
+ 'trial',
+ 'tribe',
+ 'trick',
+ 'trigger',
+ 'trim',
+ 'trip',
+ 'trophy',
+ 'trouble',
+ 'truck',
+ 'true',
+ 'truly',
+ 'trumpet',
+ 'trust',
+ 'truth',
+ 'try',
+ 'tube',
+ 'tuition',
+ 'tumble',
+ 'tuna',
+ 'tunnel',
+ 'turkey',
+ 'turn',
+ 'turtle',
+ 'twelve',
+ 'twenty',
+ 'twice',
+ 'twin',
+ 'twist',
+ 'two',
+ 'type',
+ 'typical',
+ 'ugly',
+ 'umbrella',
+ 'unable',
+ 'unaware',
+ 'uncle',
+ 'uncover',
+ 'under',
+ 'undo',
+ 'unfair',
+ 'unfold',
+ 'unhappy',
+ 'uniform',
+ 'unique',
+ 'unit',
+ 'universe',
+ 'unknown',
+ 'unlock',
+ 'until',
+ 'unusual',
+ 'unveil',
+ 'update',
+ 'upgrade',
+ 'uphold',
+ 'upon',
+ 'upper',
+ 'upset',
+ 'urban',
+ 'urge',
+ 'usage',
+ 'use',
+ 'used',
+ 'useful',
+ 'useless',
+ 'usual',
+ 'utility',
+ 'vacant',
+ 'vacuum',
+ 'vague',
+ 'valid',
+ 'valley',
+ 'valve',
+ 'van',
+ 'vanish',
+ 'vapor',
+ 'various',
+ 'vast',
+ 'vault',
+ 'vehicle',
+ 'velvet',
+ 'vendor',
+ 'venture',
+ 'venue',
+ 'verb',
+ 'verify',
+ 'version',
+ 'very',
+ 'vessel',
+ 'veteran',
+ 'viable',
+ 'vibrant',
+ 'vicious',
+ 'victory',
+ 'video',
+ 'view',
+ 'village',
+ 'vintage',
+ 'violin',
+ 'virtual',
+ 'virus',
+ 'visa',
+ 'visit',
+ 'visual',
+ 'vital',
+ 'vivid',
+ 'vocal',
+ 'voice',
+ 'void',
+ 'volcano',
+ 'volume',
+ 'vote',
+ 'voyage',
+ 'wage',
+ 'wagon',
+ 'wait',
+ 'walk',
+ 'wall',
+ 'walnut',
+ 'want',
+ 'warfare',
+ 'warm',
+ 'warrior',
+ 'wash',
+ 'wasp',
+ 'waste',
+ 'water',
+ 'wave',
+ 'way',
+ 'wealth',
+ 'weapon',
+ 'wear',
+ 'weasel',
+ 'weather',
+ 'web',
+ 'wedding',
+ 'weekend',
+ 'weird',
+ 'welcome',
+ 'west',
+ 'wet',
+ 'whale',
+ 'what',
+ 'wheat',
+ 'wheel',
+ 'when',
+ 'where',
+ 'whip',
+ 'whisper',
+ 'wide',
+ 'width',
+ 'wife',
+ 'wild',
+ 'will',
+ 'win',
+ 'window',
+ 'wine',
+ 'wing',
+ 'wink',
+ 'winner',
+ 'winter',
+ 'wire',
+ 'wisdom',
+ 'wise',
+ 'wish',
+ 'witness',
+ 'wolf',
+ 'woman',
+ 'wonder',
+ 'wood',
+ 'wool',
+ 'word',
+ 'work',
+ 'world',
+ 'worry',
+ 'worth',
+ 'wrap',
+ 'wreck',
+ 'wrestle',
+ 'wrist',
+ 'write',
+ 'wrong',
+ 'yard',
+ 'year',
+ 'yellow',
+ 'you',
+ 'young',
+ 'youth',
+ 'zebra',
+ 'zero',
+ 'zone',
+ 'zoo',
+];
diff --git a/packages/lightwallet/common/validators/address.validator.ts b/packages/lightwallet/common/validators/address.validator.ts
index 459dad5302..c9639492b3 100644
--- a/packages/lightwallet/common/validators/address.validator.ts
+++ b/packages/lightwallet/common/validators/address.validator.ts
@@ -7,20 +7,22 @@ export class AddressValidator {
return async (abstractCtrl: AbstractControl) => {
let { value } = abstractCtrl;
- if (!value)
- return { required: true };
+ if (!value) return { required: true };
value = cleanAddress(value);
- if (value.length < 3)
- return { minlength: true };
+ if (value.length < 3) return { minlength: true };
- if (!isAddress(value) && !couldBeAlias(value))
- return { InvalidFormat: true };
+ if (!isAddress(value) && !couldBeAlias(value)) return { InvalidFormat: true };
const addressInfo = await getAddressInfo(value, mwcService);
- if (!addressInfo || !addressInfo.isValid || !addressInfo.isBeaconed || (!allowUnconfirmed && !addressInfo.isConfirmed))
+ if (
+ !addressInfo ||
+ !addressInfo.isValid ||
+ !addressInfo.isBeaconed ||
+ (!allowUnconfirmed && !addressInfo.isConfirmed)
+ )
return { AddressNotFound: true };
};
}
@@ -29,18 +31,15 @@ export class AddressValidator {
return async (abstractCtrl: AbstractControl) => {
let { value } = abstractCtrl;
- if (!value)
- return null;
+ if (!value) return null;
value = cleanAddress(value);
- if (!couldBeAlias(value))
- return { InvalidFormat: true };
+ if (!couldBeAlias(value)) return { InvalidFormat: true };
const addressInfo = await getAddressInfo(value, mwcService);
- if (addressInfo && addressInfo.isConfirmed)
- return { AliasInUse: true };
+ if (addressInfo && addressInfo.isConfirmed) return { AliasInUse: true };
};
}
}
diff --git a/packages/lightwallet/common/validators/email.validator.spec.ts b/packages/lightwallet/common/validators/email.validator.spec.ts
index 99f7d8858d..2249a4bf3d 100644
--- a/packages/lightwallet/common/validators/email.validator.spec.ts
+++ b/packages/lightwallet/common/validators/email.validator.spec.ts
@@ -4,6 +4,8 @@ import { EmailValidator } from './email.validator';
describe('Validators.Email', () => {
it('should validate email', () => {
expect(EmailValidator.isValidEmail({ value: 'valid@email.com' } as AbstractControl)).toBe(null);
- expect(EmailValidator.isValidEmail({ value: 'definitelyNotAValidEmail' } as AbstractControl)).toHaveProperty('InvalidEmail');
+ expect(EmailValidator.isValidEmail({ value: 'definitelyNotAValidEmail' } as AbstractControl)).toHaveProperty(
+ 'InvalidEmail',
+ );
});
});
diff --git a/packages/lightwallet/common/validators/email.validator.ts b/packages/lightwallet/common/validators/email.validator.ts
index abf57bc535..a3f8c7970f 100644
--- a/packages/lightwallet/common/validators/email.validator.ts
+++ b/packages/lightwallet/common/validators/email.validator.ts
@@ -2,34 +2,35 @@ import { AbstractControl, ValidationErrors } from '@angular/forms';
import { ConfigService } from '@merit/common/services/config.service';
import { EmailNotificationsService } from '@merit/common/services/email-notification.service';
-
export class EmailValidator {
-
static isValidEmail(control: AbstractControl) {
- const validEmail = (/^[a-zA-Z0-9.!#$%&*+=?^_{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/).test(control.value);
+ const validEmail = /^[a-zA-Z0-9.!#$%&*+=?^_{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(control.value);
if (!validEmail) {
return {
- InvalidEmail: true
+ InvalidEmail: true,
};
}
return null;
}
- static isValid(cnf: ConfigService, eml: EmailNotificationsService): (control: AbstractControl) => ValidationErrors | null {
- return function (control: AbstractControl): ValidationErrors | null {
+ static isValid(
+ cnf: ConfigService,
+ eml: EmailNotificationsService,
+ ): (control: AbstractControl) => ValidationErrors | null {
+ return function(control: AbstractControl): ValidationErrors | null {
const config = cnf.get();
const latestEmail = eml.getEmailIfEnabled(config);
- const validEmail = (/^[a-zA-Z0-9.!#$%&*+=?^_{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/).test(control.value);
+ const validEmail = /^[a-zA-Z0-9.!#$%&*+=?^_{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(control.value);
if (validEmail && control.value != latestEmail) {
return null;
}
return {
- 'Invalid Email': true
+ 'Invalid Email': true,
};
- }
+ };
}
}
diff --git a/packages/lightwallet/common/validators/invite.validator.ts b/packages/lightwallet/common/validators/invite.validator.ts
index 78e6fad140..146283afc2 100644
--- a/packages/lightwallet/common/validators/invite.validator.ts
+++ b/packages/lightwallet/common/validators/invite.validator.ts
@@ -2,12 +2,11 @@ import { AbstractControl } from '@angular/forms';
import { DisplayWallet } from '@merit/common/models/display-wallet';
export class InviteValidator {
-
static InviteQuantityValidator(control: AbstractControl) {
try {
- const wallet:DisplayWallet = control.parent.get("wallet").value;
+ const wallet: DisplayWallet = control.parent.get('wallet').value;
if (control.value > wallet.sendableInvites) {
- return { NotEnoughInvites: true }
+ return { NotEnoughInvites: true };
}
} catch (e) {
return null;
diff --git a/packages/lightwallet/common/validators/mnemonic.validator.ts b/packages/lightwallet/common/validators/mnemonic.validator.ts
index d9525f2b71..498c2c292b 100644
--- a/packages/lightwallet/common/validators/mnemonic.validator.ts
+++ b/packages/lightwallet/common/validators/mnemonic.validator.ts
@@ -7,12 +7,12 @@ export class MnemonicValidator {
if (!isValidSize(words))
return {
- InvalidSize: true
+ InvalidSize: true,
};
if (!hasValidWords(words))
return {
- InvalidWords: true
+ InvalidWords: true,
};
return null;
@@ -23,7 +23,7 @@ export class MnemonicValidator {
if (!hasValidEntropy(words))
return {
- InvalidEntropy: true
+ InvalidEntropy: true,
};
return null;
diff --git a/packages/lightwallet/common/validators/password.validator.ts b/packages/lightwallet/common/validators/password.validator.ts
index c6a81ebb11..8f03672d0d 100644
--- a/packages/lightwallet/common/validators/password.validator.ts
+++ b/packages/lightwallet/common/validators/password.validator.ts
@@ -16,7 +16,7 @@ export class PasswordValidator {
}
static VerifyWalletPassword(wallet: MeritWalletClient): ValidatorFn {
- return (control: AbstractControl) => wallet.checkPassword(control.value) ? null : { IncorrectPassword: true };
+ return (control: AbstractControl) => (wallet.checkPassword(control.value) ? null : { IncorrectPassword: true });
}
static ValidateEasyReceivePassword(receipt: EasyReceipt, easyReceiveService: EasyReceiveService): AsyncValidatorFn {
@@ -24,7 +24,7 @@ export class PasswordValidator {
const { txs } = await easyReceiveService.validateEasyReceiptOnBlockchain(receipt, control.value);
if (!txs || !txs.length) {
return {
- IncorrectPassword: true
+ IncorrectPassword: true,
};
}
};
diff --git a/packages/lightwallet/common/validators/send.validator.spec.ts b/packages/lightwallet/common/validators/send.validator.spec.ts
index 65ecaac77f..a9cfd5a9f1 100644
--- a/packages/lightwallet/common/validators/send.validator.spec.ts
+++ b/packages/lightwallet/common/validators/send.validator.spec.ts
@@ -4,25 +4,27 @@ import { SendValidator } from '@merit/common/validators/send.validator';
const mockObj: any = {};
describe('Validators.Send', () => {
-
describe('validateWallet', () => {
it('should detect a valid wallet', () => {
const result = SendValidator.validateWallet({
- value: new DisplayWallet({
- getRootAddress: () => 0,
- } as any, mockObj, mockObj)
+ value: new DisplayWallet(
+ {
+ getRootAddress: () => 0,
+ } as any,
+ mockObj,
+ mockObj,
+ ),
});
expect(result).toBe(null);
});
it('should detect an invalid wallet', () => {
- const result = SendValidator.validateWallet( {
- value: {}
+ const result = SendValidator.validateWallet({
+ value: {},
});
expect(result.InvalidWallet).toBeTruthy();
});
});
-
});
diff --git a/packages/lightwallet/common/validators/send.validator.ts b/packages/lightwallet/common/validators/send.validator.ts
index c78e819b13..4375a9217b 100644
--- a/packages/lightwallet/common/validators/send.validator.ts
+++ b/packages/lightwallet/common/validators/send.validator.ts
@@ -8,7 +8,7 @@ export class SendValidator {
static validateWallet(control: AbstractControl) {
if (!control.value || !(control.value instanceof DisplayWallet)) {
return {
- InvalidWallet: true
+ InvalidWallet: true,
};
}
@@ -32,30 +32,27 @@ export class SendValidator {
}
static validateMaximumAvailable(control: AbstractControl) {
- const wallet:DisplayWallet = control.parent.get("wallet").value;
+ const wallet: DisplayWallet = control.parent.get('wallet').value;
try {
if (control.value > wallet.balance.spendableAmount) {
- return { NotEnoughMRT: true }
- }
+ return { NotEnoughMRT: true };
+ }
} catch (e) {
return null;
}
}
-
static validateGlobalSendDestination(control: AbstractControl) {
const { value } = control;
- if (control.parent && control.parent.get('type').value === 'classic')
- return null;
+ if (control.parent && control.parent.get('type').value === 'classic') return null;
- if (!value || value.trim() == '')
- return null;
+ if (!value || value.trim() == '') return null;
if (!validatePhoneNumber(value) && !validateEmail(value))
return {
- InvalidDestination: true
+ InvalidDestination: true,
};
// validate email / phone number
@@ -63,7 +60,7 @@ export class SendValidator {
return null;
}
- static isEmail(value) {
- return validateEmail(value);
+ static isEmail(value) {
+ return validateEmail(value);
}
}
diff --git a/packages/lightwallet/desktop/e2e/app.e2e-spec.ts b/packages/lightwallet/desktop/e2e/app.e2e-spec.ts
index 3e669f6537..f2e3f84832 100644
--- a/packages/lightwallet/desktop/e2e/app.e2e-spec.ts
+++ b/packages/lightwallet/desktop/e2e/app.e2e-spec.ts
@@ -12,7 +12,10 @@ export async function isBrowser(browser: string) {
describe('[Desktop] Onboarding', () => {
beforeAll(() => {
// maximize window
- browser.driver.manage().window().maximize();
+ browser.driver
+ .manage()
+ .window()
+ .maximize();
browser.get('/');
@@ -29,7 +32,7 @@ describe('[Desktop] Onboarding', () => {
expect(browser.getCurrentUrl()).toContain('onboarding');
});
- it('shouldn\'t let the user go to dashboard', async () => {
+ it("shouldn't let the user go to dashboard", async () => {
await browser.get('/dashboard');
expect(browser.getCurrentUrl()).toContain('onboarding');
});
@@ -67,7 +70,6 @@ describe('[Desktop] Onboarding', () => {
});
describe('> QT Wallet unboarding', () => {
-
beforeEach(() => {
browser.get('/onboarding');
const el = element(by.css('[routerlink=tour-desktop]'));
@@ -135,13 +137,10 @@ describe('[Desktop] Onboarding', () => {
expect(browser.getCurrentUrl()).not.toContain('tour-desktop');
expect(browser.getCurrentUrl()).toContain('import');
});
-
});
-
});
describe('> Unlock view', () => {
-
let el;
beforeAll(() => {
@@ -184,13 +183,10 @@ describe('[Desktop] Onboarding', () => {
browser.wait(EC.not(EC.urlContains('unlock')));
expect(browser.getCurrentUrl()).not.toContain('unlock');
});
-
});
describe('> Import wallet', () => {
-
describe('> Main import view', () => {
-
beforeAll(() => {
browser.get('/');
const el = element(by.css('[routerLink="import"]'));
@@ -207,14 +203,10 @@ describe('[Desktop] Onboarding', () => {
expect(mnemonicButton.isDisplayed()).toBeTruthy();
});
- it('should have a file backup option', async () => {
-
- });
-
+ it('should have a file backup option', async () => {});
});
describe('> Mnemonic phrase', () => {
-
let mnemonicButton, mnemonicInput, submitButton;
beforeAll(() => {
@@ -247,13 +239,10 @@ describe('[Desktop] Onboarding', () => {
browser.wait(EC.urlContains('wallets'));
expect(browser.getCurrentUrl()).toContain('wallets');
});
-
});
// describe('File backup', () => {
//
// });
-
});
-
});
diff --git a/packages/lightwallet/desktop/e2e/community.e2e-spec.ts b/packages/lightwallet/desktop/e2e/community.e2e-spec.ts
index dda236023f..657b55a523 100644
--- a/packages/lightwallet/desktop/e2e/community.e2e-spec.ts
+++ b/packages/lightwallet/desktop/e2e/community.e2e-spec.ts
@@ -80,7 +80,8 @@ describe('[Desktop] Community', () => {
});
it('should show "Copy to clipboard" when user hovers over invite code', async () => {
- browser.actions()
+ browser
+ .actions()
.mouseMove(inviteCodeEl)
.perform();
diff --git a/packages/lightwallet/desktop/e2e/dashboard.e2e-spec.ts b/packages/lightwallet/desktop/e2e/dashboard.e2e-spec.ts
index 5d80096d60..419f317bed 100644
--- a/packages/lightwallet/desktop/e2e/dashboard.e2e-spec.ts
+++ b/packages/lightwallet/desktop/e2e/dashboard.e2e-spec.ts
@@ -2,7 +2,6 @@ import { browser, by, element } from 'protractor';
import { TEST_WALLET_MNEMONIC, EC } from './app.e2e-spec';
describe('[Desktop] Dashboard view', () => {
-
beforeAll(() => {
const link = element(by.css('[ng-reflect-router-link="/dashboard"]'));
browser.wait(EC.visibilityOf(link), 5000);
@@ -19,7 +18,6 @@ describe('[Desktop] Dashboard view', () => {
});
describe('> Welcome guide', () => {
-
let rootEl;
beforeEach(() => {
@@ -67,8 +65,5 @@ describe('[Desktop] Dashboard view', () => {
browser.sleep(200);
expect(rootEl.isPresent()).toBeFalsy('Guide is still visible');
});
-
});
-
-
});
diff --git a/packages/lightwallet/desktop/e2e/history.e2e-spec.ts b/packages/lightwallet/desktop/e2e/history.e2e-spec.ts
index 07a2fd6540..9c75f6fb19 100644
--- a/packages/lightwallet/desktop/e2e/history.e2e-spec.ts
+++ b/packages/lightwallet/desktop/e2e/history.e2e-spec.ts
@@ -2,7 +2,6 @@ import { browser, by, element } from 'protractor';
import { EC } from './app.e2e-spec';
describe('[Desktop] History', () => {
-
beforeAll(() => {
const link = element(by.css('[ng-reflect-router-link="/history"]'));
browser.wait(EC.visibilityOf(link), 5000);
@@ -23,5 +22,4 @@ describe('[Desktop] History', () => {
it('should have a list of history items', () => {
expect(element(by.css('history-list history-item')).isDisplayed()).toBeTruthy();
});
-
});
diff --git a/packages/lightwallet/desktop/e2e/send-flow.e2e-spec.ts b/packages/lightwallet/desktop/e2e/send-flow.e2e-spec.ts
index a23c231ca3..4056326ade 100644
--- a/packages/lightwallet/desktop/e2e/send-flow.e2e-spec.ts
+++ b/packages/lightwallet/desktop/e2e/send-flow.e2e-spec.ts
@@ -2,7 +2,6 @@ import { browser, by, element } from 'protractor';
import { EC, TEST_WALLET_ALIAS } from './app.e2e-spec';
describe('[Desktop] Sending Merit', () => {
-
beforeAll(() => {
const link = element(by.css('[ng-reflect-router-link="/send"]'));
browser.wait(EC.visibilityOf(link), 5000);
@@ -84,7 +83,6 @@ describe('[Desktop] Sending Merit', () => {
});
describe('> Sending', () => {
-
const amountInputEl = element(by.css('[formcontrolname=amountMrt]')),
selectBoxEl = element(by.css('.ui-input.ui-input--select.ui-input--form.selectbox__selected')),
selectMethodEl = element(by.css('.select-method')),
@@ -251,7 +249,5 @@ describe('[Desktop] Sending Merit', () => {
});
});
});
-
});
-
});
diff --git a/packages/lightwallet/desktop/e2e/wallet-details.e2e-spec.ts b/packages/lightwallet/desktop/e2e/wallet-details.e2e-spec.ts
index eb04f1accb..aaa9528812 100644
--- a/packages/lightwallet/desktop/e2e/wallet-details.e2e-spec.ts
+++ b/packages/lightwallet/desktop/e2e/wallet-details.e2e-spec.ts
@@ -2,21 +2,23 @@ import { browser, by, element, protractor } from 'protractor';
import { EC, TEST_WALLET_ALIAS, TEST_WALLET_MNEMONIC, TEST_WALLET_NAME } from './app.e2e-spec';
describe('[Desktop] Wallet details view', () => {
-
let header, walletId;
beforeAll(async () => {
const link = element(by.css('[ng-reflect-router-link="/dashboard"]'));
- browser.wait(EC.visibilityOf(link), 5000, 'Dashboard menu link isn\'t visible');
+ browser.wait(EC.visibilityOf(link), 5000, "Dashboard menu link isn't visible");
link.click();
- browser.wait(EC.urlContains('dashboard'), 5000, 'URL doesn\'t contain dashboard');
+ browser.wait(EC.urlContains('dashboard'), 5000, "URL doesn't contain dashboard");
const el = element(by.css('wallets-list .wallets__group__wallet'));
browser.wait(EC.visibilityOf(el), 8000, 'Wallet list item is not visible');
await el.click();
- browser.wait(EC.urlContains('wallets'), 5000, 'URL doesn\'t contain wallets');
+ browser.wait(EC.urlContains('wallets'), 5000, "URL doesn't contain wallets");
header = element(by.css('.wallet-details__header'));
browser.wait(EC.visibilityOf(header), 5000);
- walletId = (await browser.getCurrentUrl()).replace('/history', '').split('/').pop();
+ walletId = (await browser.getCurrentUrl())
+ .replace('/history', '')
+ .split('/')
+ .pop();
});
it('should go to wallet details view', async () => {
@@ -53,7 +55,6 @@ describe('[Desktop] Wallet details view', () => {
});
describe('> History tab', () => {
-
it('url should have /history', () => {
expect(EC.urlContains('/history')).toBeTruthy();
});
@@ -62,14 +63,10 @@ describe('[Desktop] Wallet details view', () => {
// it('should have wallet unlocked transaction', async () => {
// expect(await element(by.css('history-item:last-child')).getText()).toContain('Wallet Unlocked');
// });
-
});
describe('> Preferences tab', () => {
-
- let header,
- initialHeaderColor: string,
- initialToolbarBalance: string;
+ let header, initialHeaderColor: string, initialToolbarBalance: string;
beforeAll(async () => {
element(by.css('a[href*="settings"]')).click();
@@ -90,7 +87,7 @@ describe('[Desktop] Wallet details view', () => {
expect(await element(by.css('app-select')).getText()).toContain('Merit blue');
});
- it('header color should change when we change the wallet\'s color', () => {
+ it("header color should change when we change the wallet's color", () => {
element(by.css('app-select .selectbox > button')).click();
element(by.css('app-select .selectbox__dropdown button:first-child')).click();
expect(element(by.css('.wallet-details__header')).getAttribute('style')).not.toEqual(initialHeaderColor);
@@ -112,7 +109,10 @@ describe('[Desktop] Wallet details view', () => {
});
it('should hide balance in app toolbar', () => {
- expect(element(by.css('app-toolbar .amount-merit')).getText()).not.toEqual(initialToolbarBalance, 'Toolbar balance didn\'t change');
+ expect(element(by.css('app-toolbar .amount-merit')).getText()).not.toEqual(
+ initialToolbarBalance,
+ "Toolbar balance didn't change",
+ );
});
it('should make balance visible', async () => {
@@ -120,11 +120,9 @@ describe('[Desktop] Wallet details view', () => {
browser.wait(EC.not(EC.textToBePresentInElement(header, '[Balance hidden]')));
expect(header.getText()).not.toContain('[Balance hidden]', 'Unable to un-hide balance');
});
-
});
describe('> Backup tab', () => {
-
beforeAll(async () => {
element(by.css('a[href*="export"]')).click();
});
@@ -152,7 +150,6 @@ describe('[Desktop] Wallet details view', () => {
});
describe('> QR Code backup', () => {
-
beforeAll(() => {
element(by.css('div[routerLink=qr-code]')).click();
browser.wait(EC.urlContains('qr-code'));
@@ -165,7 +162,7 @@ describe('[Desktop] Wallet details view', () => {
it('should have QR Code Backup title', () => {
const el = element(by.css('.page-title h3'));
expect(el.isDisplayed()).toBeTruthy('Title is not visible');
- expect(el.getText()).toContain('QR Code backup', 'Doesn\'t have the right title');
+ expect(el.getText()).toContain('QR Code backup', "Doesn't have the right title");
});
it('should have a QR code image', () => {
@@ -176,7 +173,7 @@ describe('[Desktop] Wallet details view', () => {
it('should have a back button', () => {
backButton = element(by.css('[routerlink="../"]'));
- expect(backButton.isDisplayed()).toBeTruthy('Back button doesn\'t exist');
+ expect(backButton.isDisplayed()).toBeTruthy("Back button doesn't exist");
});
it('should take us back to root export page when clicking on back button', () => {
@@ -184,11 +181,9 @@ describe('[Desktop] Wallet details view', () => {
browser.wait(EC.not(EC.urlContains('qr-code')));
expect(browser.getCurrentUrl()).not.toContain('qr-code');
});
-
});
describe('> Mnemonic phrase backup', () => {
-
beforeAll(() => {
element(by.css('div[routerLink=mnemonic]')).click();
browser.wait(EC.urlContains('mnemonic'));
@@ -201,20 +196,20 @@ describe('[Desktop] Wallet details view', () => {
it('should have a Mnemonic Phrase title', () => {
const el = element(by.css('.page-title h3'));
expect(el.isDisplayed()).toBeTruthy('Title is not visible');
- expect(el.getText()).toContain('Mnemonic Phrase', 'Doesn\'t have the right title');
+ expect(el.getText()).toContain('Mnemonic Phrase', "Doesn't have the right title");
});
it('should display mnemonic phrase', () => {
const el = element(by.css('.mnemonic-container'));
expect(el.isDisplayed()).toBeTruthy('Mnemonic container not visible');
- expect(el.getText()).toContain(TEST_WALLET_MNEMONIC, 'Doesn\'t show mnemonic');
+ expect(el.getText()).toContain(TEST_WALLET_MNEMONIC, "Doesn't show mnemonic");
});
let backButton;
it('should have a back button', () => {
backButton = element(by.css('[routerlink="../"]'));
- expect(backButton.isDisplayed()).toBeTruthy('Back button doesn\'t exist');
+ expect(backButton.isDisplayed()).toBeTruthy("Back button doesn't exist");
});
it('should take us back to root export page when clicking on back button', () => {
@@ -222,11 +217,9 @@ describe('[Desktop] Wallet details view', () => {
browser.wait(EC.not(EC.urlContains('mnemonic')));
expect(browser.getCurrentUrl()).not.toContain('mnemonic');
});
-
});
describe('> Backup file export', () => {
-
beforeAll(() => {
element(by.css('div[routerLink=file]')).click();
browser.wait(EC.urlContains('file'));
@@ -239,7 +232,7 @@ describe('[Desktop] Wallet details view', () => {
it('should have a File backup title', () => {
const el = element(by.css('.page-title h3'));
expect(el.isDisplayed()).toBeTruthy('Title is not visible');
- expect(el.getText()).toContain('File backup', 'Doesn\'t have the right title');
+ expect(el.getText()).toContain('File backup', "Doesn't have the right title");
});
let passwordEl, repeatPasswordEl, submitButtonEl;
@@ -282,9 +275,6 @@ describe('[Desktop] Wallet details view', () => {
it('download file button should be enabled', () => {
expect(submitButtonEl.isEnabled()).toBeTruthy();
});
-
});
-
});
-
});
diff --git a/packages/lightwallet/desktop/electron.bootstrap.js b/packages/lightwallet/desktop/electron.bootstrap.js
index ed74bcc180..321073a8c9 100644
--- a/packages/lightwallet/desktop/electron.bootstrap.js
+++ b/packages/lightwallet/desktop/electron.bootstrap.js
@@ -19,7 +19,7 @@ const showWindowsNotification = (title, message = ' ') => {
icon,
appId: 'wallet.merit.me',
wait: true,
- sound: true
+ sound: true,
});
};
@@ -28,8 +28,8 @@ nn.on('click', () => {
});
window['electron'] = {
- showNotification: isWin? showWindowsNotification : showNotification,
+ showNotification: isWin ? showWindowsNotification : showNotification,
checkForUpdates: updater.checkForUpdates,
downloadUpdate: updater.downloadUpdate,
- installUpdate: updater.installUpdate
+ installUpdate: updater.installUpdate,
};
diff --git a/packages/lightwallet/desktop/electron.main.js b/packages/lightwallet/desktop/electron.main.js
index c643feb36a..077d6b66ae 100644
--- a/packages/lightwallet/desktop/electron.main.js
+++ b/packages/lightwallet/desktop/electron.main.js
@@ -31,8 +31,8 @@ function buildMenuTemplate() {
{ role: 'paste' },
{ role: 'pasteandmatchstyle' },
{ role: 'delete' },
- { role: 'selectall' }
- ]
+ { role: 'selectall' },
+ ],
},
{
label: 'View',
@@ -43,26 +43,24 @@ function buildMenuTemplate() {
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
- { type: 'separator' }
- ]
+ { type: 'separator' },
+ ],
},
{
role: 'window',
- submenu: [
- { role: 'minimize' },
- { role: 'close' },
- { role: 'toggledevtools' }
- ]
+ submenu: [{ role: 'minimize' }, { role: 'close' }, { role: 'toggledevtools' }],
},
{
role: 'help',
submenu: [
{
label: 'Learn More',
- click() { shell.openExternal('https://www.merit.me'); }
- }
- ]
- }
+ click() {
+ shell.openExternal('https://www.merit.me');
+ },
+ },
+ ],
+ },
];
if (process.platform === 'darwin') {
@@ -77,8 +75,8 @@ function buildMenuTemplate() {
{ role: 'hideothers' },
{ role: 'unhide' },
{ type: 'separator' },
- { role: 'quit', label: `Quit ${appName}` }
- ]
+ { role: 'quit', label: `Quit ${appName}` },
+ ],
});
}
@@ -93,10 +91,8 @@ function createWindow() {
let after;
- if (dir.includes('assets'))
- after = path.resolve(__dirname, 'dist', 'assets', dir.split(/assets\/?/).pop(), base);
- else
- after = path.resolve(__dirname, 'dist', base);
+ if (dir.includes('assets')) after = path.resolve(__dirname, 'dist', 'assets', dir.split(/assets\/?/).pop(), base);
+ else after = path.resolve(__dirname, 'dist', base);
cb(after);
});
@@ -106,20 +102,20 @@ function createWindow() {
height: 720,
autoHideMenuBar: true,
webPreferences: {
- devTools: true
- }
+ devTools: true,
+ },
});
const URL = url.format({
pathname: path.resolve(__dirname, './dist/index.html'),
protocol: 'file:',
- slashes: true
+ slashes: true,
});
mainWindow.loadURL(URL);
mainWindow.maximize();
- mainWindow.on('closed', function () {
+ mainWindow.on('closed', function() {
mainWindow = null;
});
@@ -139,7 +135,7 @@ ipcMain.on('notificationClick', () => {
app.on('ready', createWindow);
// Quit when all windows are closed.
-app.on('window-all-closed', function () {
+app.on('window-all-closed', function() {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
@@ -147,7 +143,7 @@ app.on('window-all-closed', function () {
}
});
-app.on('activate', function () {
+app.on('activate', function() {
log.verbose('App activated');
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
diff --git a/packages/lightwallet/desktop/electron.updater.js b/packages/lightwallet/desktop/electron.updater.js
index 64ffec57ea..8d434fd48e 100644
--- a/packages/lightwallet/desktop/electron.updater.js
+++ b/packages/lightwallet/desktop/electron.updater.js
@@ -24,10 +24,10 @@ const checkForUpdates = async () => {
const file = res.updateInfo.files[0];
return {
- size: file.size? (Math.round(file.size / 1024 / 1024 * 100) / 100) + 'MB' : 'Unknown',
+ size: file.size ? Math.round((file.size / 1024 / 1024) * 100) / 100 + 'MB' : 'Unknown',
releaseDate: res.updateInfo.releaseDate,
releaseNotes: res.updateInfo.releaseNotes,
- version: res.updateInfo.version
+ version: res.updateInfo.version,
};
}
} catch (err) {
@@ -38,7 +38,7 @@ const checkForUpdates = async () => {
const downloadUpdate = async progressCallback => {
autoUpdater.on('download-progress', progressCallback);
try {
- await autoUpdater.downloadUpdate()
+ await autoUpdater.downloadUpdate();
} catch (err) {
log.error('Error downloading update', err);
}
@@ -49,5 +49,5 @@ const installUpdate = () => autoUpdater.quitAndInstall(false, true);
module.exports = {
checkForUpdates,
downloadUpdate,
- installUpdate
+ installUpdate,
};
diff --git a/packages/lightwallet/desktop/src/app/app-routing.module.ts b/packages/lightwallet/desktop/src/app/app-routing.module.ts
index 3696d567e2..b86208e9fd 100644
--- a/packages/lightwallet/desktop/src/app/app-routing.module.ts
+++ b/packages/lightwallet/desktop/src/app/app-routing.module.ts
@@ -14,7 +14,12 @@ import { RateService } from '@merit/common/services/rate.service';
@Injectable()
export class CoreModuleResolver implements Resolve {
- constructor(private appService: AppSettingsService, private ratesService: RateService, private profileService: ProfileService, private store: Store) {}
+ constructor(
+ private appService: AppSettingsService,
+ private ratesService: RateService,
+ private profileService: ProfileService,
+ private store: Store,
+ ) {}
// resolver here is a hack for lazy loaded CoreModule route
// TODO: figure out if there is a better place to hook in in module initialization process
@@ -22,24 +27,34 @@ export class CoreModuleResolver implements Resolve {
await this.appService.getInfo();
await this.ratesService.loadRates();
- this.store.select(selectAppState).pipe(
- filter((state: IAppState) => state.authorized),
- tap((state: IAppState) => this.store.dispatch(new RefreshWalletsAction()))
- ).subscribe();
+ this.store
+ .select(selectAppState)
+ .pipe(
+ filter((state: IAppState) => state.authorized),
+ tap((state: IAppState) => this.store.dispatch(new RefreshWalletsAction())),
+ )
+ .subscribe();
}
}
const routes: Routes = [
- { path: 'onboarding', loadChildren: './onboarding/onboarding.module#OnboardingModule', canActivate: [OnboardingGuard] },
+ {
+ path: 'onboarding',
+ loadChildren: './onboarding/onboarding.module#OnboardingModule',
+ canActivate: [OnboardingGuard],
+ },
{ path: 'market', loadChildren: './market/market.module#MarketModule', canActivate: [DashboardGuard] },
- { path: '', loadChildren: './core/core.module#CoreModule', canActivate: [DashboardGuard], resolve: { init: CoreModuleResolver } }
+ {
+ path: '',
+ loadChildren: './core/core.module#CoreModule',
+ canActivate: [DashboardGuard],
+ resolve: { init: CoreModuleResolver },
+ },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
- providers: [
- CoreModuleResolver,
- ]
+ providers: [CoreModuleResolver],
})
-export class AppRoutingModule { }
+export class AppRoutingModule {}
diff --git a/packages/lightwallet/desktop/src/app/app.component.ts b/packages/lightwallet/desktop/src/app/app.component.ts
index 1266882084..cce79489c4 100644
--- a/packages/lightwallet/desktop/src/app/app.component.ts
+++ b/packages/lightwallet/desktop/src/app/app.component.ts
@@ -10,14 +10,16 @@ import { ElectronService, IUpdateInfo } from '@merit/desktop/services/electron.s
selector: 'merit-lw',
templateUrl: './app.component.html',
styleUrls: ['./app.component.sass'],
- encapsulation: ViewEncapsulation.None
+ encapsulation: ViewEncapsulation.None,
})
export class AppComponent {
- constructor(private domCtrl: DOMController,
- private renderer2: Renderer2,
- private easyReceiveService: EasyReceiveService,
- private updateDialogCtrl: UpdateDialogController,
- private perstitenceService: PersistenceService2) {
+ constructor(
+ private domCtrl: DOMController,
+ private renderer2: Renderer2,
+ private easyReceiveService: EasyReceiveService,
+ private updateDialogCtrl: UpdateDialogController,
+ private perstitenceService: PersistenceService2,
+ ) {
// Services can't inject Renderer, so this is a workaround.
domCtrl.rnd = renderer2;
}
diff --git a/packages/lightwallet/desktop/src/app/app.module.ts b/packages/lightwallet/desktop/src/app/app.module.ts
index ec256a0184..4599ade547 100644
--- a/packages/lightwallet/desktop/src/app/app.module.ts
+++ b/packages/lightwallet/desktop/src/app/app.module.ts
@@ -49,7 +49,7 @@ export function loadConfigs(profileService: ProfileService, store: Store {
-
let instance: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [ConfirmDialogComponent, BackdropComponent]
+ declarations: [ConfirmDialogComponent, BackdropComponent],
}).compileComponents();
instance = TestBed.createComponent(ConfirmDialogComponent);
@@ -18,12 +17,12 @@ describe('Confirm Dialog', () => {
buttons: [
{
text: 'Ok',
- class: 'primary'
+ class: 'primary',
},
{
- text: 'Cancel'
- }
- ]
+ text: 'Cancel',
+ },
+ ],
});
instance.detectChanges();
});
@@ -69,5 +68,4 @@ describe('Confirm Dialog', () => {
instance.detectChanges();
expect(spy).toHaveBeenCalledWith();
});
-
});
diff --git a/packages/lightwallet/desktop/src/app/components/dom.controller.ts b/packages/lightwallet/desktop/src/app/components/dom.controller.ts
index 033cd1639e..22d74fc8b9 100644
--- a/packages/lightwallet/desktop/src/app/components/dom.controller.ts
+++ b/packages/lightwallet/desktop/src/app/components/dom.controller.ts
@@ -5,7 +5,7 @@ import {
Injectable,
Injector,
Renderer2,
- Type
+ Type,
} from '@angular/core';
export interface IDynamicComponent {
@@ -30,9 +30,7 @@ export interface IDynamicComponent {
export class DOMController {
rnd: Renderer2;
- constructor(private appRef: ApplicationRef,
- private cfr: ComponentFactoryResolver,
- private injector: Injector) {}
+ constructor(private appRef: ApplicationRef, private cfr: ComponentFactoryResolver, private injector: Injector) {}
create(component: Type, config: any, parentElement?: HTMLElement) {
const componentRef = this.cfr.resolveComponentFactory(component).create(this.injector);
diff --git a/packages/lightwallet/desktop/src/app/components/globalsend-link-popup/globalsend-link-popup.component.ts b/packages/lightwallet/desktop/src/app/components/globalsend-link-popup/globalsend-link-popup.component.ts
index c8d44fc8bf..6a2712fcb2 100644
--- a/packages/lightwallet/desktop/src/app/components/globalsend-link-popup/globalsend-link-popup.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/globalsend-link-popup/globalsend-link-popup.component.ts
@@ -20,7 +20,7 @@ import { ToastControllerService } from '../toast-notification/toast-controller.s
- `
+ `,
})
export class GlobalsendLinkPopupComponent implements IDynamicComponent {
destroy: Function;
@@ -35,7 +35,7 @@ export class GlobalsendLinkPopupComponent implements IDynamicComponent {
}
onCopy() {
- this.toastCtrl.success((this.isInvite? 'MeritInvite' : 'MeritMoney') + ' link copied!');
+ this.toastCtrl.success((this.isInvite ? 'MeritInvite' : 'MeritMoney') + ' link copied!');
}
dismiss() {
diff --git a/packages/lightwallet/desktop/src/app/components/illustations/sending-merit/sending-merit.component.ts b/packages/lightwallet/desktop/src/app/components/illustations/sending-merit/sending-merit.component.ts
index 9326f3adb2..58489b68ff 100644
--- a/packages/lightwallet/desktop/src/app/components/illustations/sending-merit/sending-merit.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/illustations/sending-merit/sending-merit.component.ts
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'illustations-sending-merit',
templateUrl: './sending-merit.component.html',
- styleUrls: ['./sending-merit.component.sass']
+ styleUrls: ['./sending-merit.component.sass'],
})
export class IllustationsSendingMeritComponent {}
diff --git a/packages/lightwallet/desktop/src/app/components/illustations/thats-it/thats-it.component.ts b/packages/lightwallet/desktop/src/app/components/illustations/thats-it/thats-it.component.ts
index db2ed69056..b8471e59bb 100644
--- a/packages/lightwallet/desktop/src/app/components/illustations/thats-it/thats-it.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/illustations/thats-it/thats-it.component.ts
@@ -1,8 +1,8 @@
-import { Component} from '@angular/core';
+import { Component } from '@angular/core';
@Component({
selector: 'illustations-thats-it',
templateUrl: './thats-it.component.html',
- styleUrls: ['./thats-it.component.sass']
+ styleUrls: ['./thats-it.component.sass'],
})
export class IllustationsThatsItComponent {}
diff --git a/packages/lightwallet/desktop/src/app/components/illustations/worry-free/worry-free.component.ts b/packages/lightwallet/desktop/src/app/components/illustations/worry-free/worry-free.component.ts
index bfdf87ab03..e4226b9a9a 100644
--- a/packages/lightwallet/desktop/src/app/components/illustations/worry-free/worry-free.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/illustations/worry-free/worry-free.component.ts
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'illustations-worry-free',
templateUrl: './worry-free.component.html',
- styleUrls: ['./worry-free.component.sass']
+ styleUrls: ['./worry-free.component.sass'],
})
export class IllustationsWorryFreeComponent {}
diff --git a/packages/lightwallet/desktop/src/app/components/illustations/your-way/your-way.component.ts b/packages/lightwallet/desktop/src/app/components/illustations/your-way/your-way.component.ts
index c7defd6c3d..4587dda5f6 100644
--- a/packages/lightwallet/desktop/src/app/components/illustations/your-way/your-way.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/illustations/your-way/your-way.component.ts
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'illustations-your-way',
templateUrl: './your-way.component.html',
- styleUrls: ['./your-way.component.sass']
+ styleUrls: ['./your-way.component.sass'],
})
export class IllustationsYourWayComponent {}
diff --git a/packages/lightwallet/desktop/src/app/components/loading-spinner-small/loading-spinner-small.component.ts b/packages/lightwallet/desktop/src/app/components/loading-spinner-small/loading-spinner-small.component.ts
index 8653b7c34e..fd94d80e06 100644
--- a/packages/lightwallet/desktop/src/app/components/loading-spinner-small/loading-spinner-small.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/loading-spinner-small/loading-spinner-small.component.ts
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'loading-spinner-small',
templateUrl: './loading-spinner-small.component.html',
- styleUrls: ['./loading-spinner-small.component.sass']
+ styleUrls: ['./loading-spinner-small.component.sass'],
})
export class LoadingSpinnerSmallComponent {}
diff --git a/packages/lightwallet/desktop/src/app/components/loading-spinner/loading-spinner.component.ts b/packages/lightwallet/desktop/src/app/components/loading-spinner/loading-spinner.component.ts
index f2b2eaa057..a3c1bc5217 100644
--- a/packages/lightwallet/desktop/src/app/components/loading-spinner/loading-spinner.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/loading-spinner/loading-spinner.component.ts
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'loading-spinner',
templateUrl: './loading-spinner.component.html',
- styleUrls: ['./loading-spinner.component.sass']
+ styleUrls: ['./loading-spinner.component.sass'],
})
export class LoadingSpinnerComponent {}
diff --git a/packages/lightwallet/desktop/src/app/components/lock-screen/lock-screen.component.ts b/packages/lightwallet/desktop/src/app/components/lock-screen/lock-screen.component.ts
index a4671428bd..a82e3cec84 100644
--- a/packages/lightwallet/desktop/src/app/components/lock-screen/lock-screen.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/lock-screen/lock-screen.component.ts
@@ -3,14 +3,14 @@ import { Component, Input } from '@angular/core';
@Component({
selector: 'app-lock-screen',
templateUrl: './lock-screen.component.html',
- styleUrls: ['./lock-screen.component.sass']
+ styleUrls: ['./lock-screen.component.sass'],
})
export class LockScreenComponent {
private _fullScreen: boolean;
@Input()
set fullScreen(val: any) {
- this._fullScreen = val? Boolean(val) : true;
+ this._fullScreen = val ? Boolean(val) : true;
}
get fullScreen() {
diff --git a/packages/lightwallet/desktop/src/app/components/merit-icon/merit-icon.component.ts b/packages/lightwallet/desktop/src/app/components/merit-icon/merit-icon.component.ts
index a829374b92..92ecad1c00 100644
--- a/packages/lightwallet/desktop/src/app/components/merit-icon/merit-icon.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/merit-icon/merit-icon.component.ts
@@ -5,9 +5,10 @@ import { Component, Input } from '@angular/core';
template: '',
styleUrls: ['./merit-icon.component.sass'],
host: {
- '[class]': 'name'
- }
+ '[class]': 'name',
+ },
})
export class MeritIconComponent {
- @Input() name: string;
+ @Input()
+ name: string;
}
diff --git a/packages/lightwallet/desktop/src/app/components/message-box/message-box.component.ts b/packages/lightwallet/desktop/src/app/components/message-box/message-box.component.ts
index 6aabd3f048..1f398e1971 100644
--- a/packages/lightwallet/desktop/src/app/components/message-box/message-box.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/message-box/message-box.component.ts
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'message-box',
templateUrl: './message-box.component.html',
- styleUrls: ['./message-box.component.sass']
+ styleUrls: ['./message-box.component.sass'],
})
export class MessageBoxComponent {}
diff --git a/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.component.ts b/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.component.ts
index ec12613998..9e638ec612 100644
--- a/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.component.ts
@@ -13,7 +13,7 @@ export interface IPasswordPromptConfig {
@Component({
selector: 'password-prompt',
templateUrl: './password-prompt.component.html',
- styleUrls: ['./password-prompt.component.sass']
+ styleUrls: ['./password-prompt.component.sass'],
})
export class PasswordPromptComponent implements IDynamicComponent {
destroy: Function;
@@ -22,7 +22,9 @@ export class PasswordPromptComponent implements IDynamicComponent {
ready: boolean;
title: string;
- get password(): AbstractControl { return this.formData.get('password'); }
+ get password(): AbstractControl {
+ return this.formData.get('password');
+ }
constructor(private formBuilder: FormBuilder) {}
@@ -30,7 +32,7 @@ export class PasswordPromptComponent implements IDynamicComponent {
this.title = config.title;
this.formData = this.formBuilder.group({
- password: ['', config.validators, config.asyncValidators]
+ password: ['', config.validators, config.asyncValidators],
});
this.ready = true;
diff --git a/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.controller.ts b/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.controller.ts
index 77f353f716..cf541e83ca 100644
--- a/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.controller.ts
+++ b/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.controller.ts
@@ -16,7 +16,7 @@ export class PasswordPromptController {
createForWallet(wallet: DisplayWallet | MeritWalletClient) {
const validators: ValidatorFn[] = [Validators.required];
- validators.push(PasswordValidator.VerifyWalletPassword(wallet instanceof DisplayWallet? wallet.client : wallet));
+ validators.push(PasswordValidator.VerifyWalletPassword(wallet instanceof DisplayWallet ? wallet.client : wallet));
return this.create('Enter password for wallet: ' + wallet.name, validators);
}
}
diff --git a/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.spec.ts b/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.spec.ts
index bca85e3616..5e17c1bf40 100644
--- a/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.spec.ts
+++ b/packages/lightwallet/desktop/src/app/components/password-prompt/password-prompt.spec.ts
@@ -5,17 +5,12 @@ import { BackdropComponent } from '../backdrop/backdrop.component';
import { PasswordPromptComponent } from './password-prompt.component';
describe('Password Prompt', () => {
- let instance: ComponentFixture,
- de: DebugElement,
- comp: PasswordPromptComponent;
+ let instance: ComponentFixture, de: DebugElement, comp: PasswordPromptComponent;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PasswordPromptComponent, BackdropComponent],
- imports: [
- FormsModule,
- ReactiveFormsModule
- ]
+ imports: [FormsModule, ReactiveFormsModule],
}).compileComponents();
instance = TestBed.createComponent(PasswordPromptComponent);
@@ -23,7 +18,7 @@ describe('Password Prompt', () => {
comp.init({
title: 'Enter password',
validators: [Validators.required],
- asyncValidators: []
+ asyncValidators: [],
});
instance.detectChanges();
de = instance.debugElement;
@@ -34,11 +29,11 @@ describe('Password Prompt', () => {
});
it('should display a title', () => {
- expect(de.nativeElement.querySelector('h2.title').innerHTML).toContain('Enter password');
+ expect(de.nativeElement.querySelector('h2.title').innerHTML).toContain('Enter password');
});
it('should display a password input', () => {
- expect(de.nativeElement.querySelector('input[type=password]')).toBeDefined();
+ expect(de.nativeElement.querySelector('input[type=password]')).toBeDefined();
});
it('should validate password input', () => {
diff --git a/packages/lightwallet/desktop/src/app/components/shared-components.module.ts b/packages/lightwallet/desktop/src/app/components/shared-components.module.ts
index 018ce4aa2d..91446d690f 100644
--- a/packages/lightwallet/desktop/src/app/components/shared-components.module.ts
+++ b/packages/lightwallet/desktop/src/app/components/shared-components.module.ts
@@ -51,7 +51,7 @@ export function getComponents() {
UICheckboxComponent,
WalletUnlockAlertComponent,
SmsNotificationsPromptComponent,
- UpdateDialogComponent
+ UpdateDialogComponent,
];
}
@@ -62,7 +62,7 @@ export function getComponents() {
ConfirmDialogComponent,
GlobalsendLinkPopupComponent,
SmsNotificationsPromptComponent,
- UpdateDialogComponent
+ UpdateDialogComponent,
],
imports: [CommonModule, FormsModule, ReactiveFormsModule, ClipModule, CommonDirectivesModule, MomentModule],
declarations: getComponents(),
@@ -79,7 +79,7 @@ export class SharedComponentsModule {
ConfirmDialogControllerService,
GlobalsendLinkPopupController,
SmsNotificationsPromptController,
- UpdateDialogController
+ UpdateDialogController,
],
};
}
diff --git a/packages/lightwallet/desktop/src/app/components/sms-notifications-prompt/sms-notifications-prompt.component.ts b/packages/lightwallet/desktop/src/app/components/sms-notifications-prompt/sms-notifications-prompt.component.ts
index 19ffd69860..e58ac22d78 100644
--- a/packages/lightwallet/desktop/src/app/components/sms-notifications-prompt/sms-notifications-prompt.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/sms-notifications-prompt/sms-notifications-prompt.component.ts
@@ -9,20 +9,22 @@ import { Ng4LoadingSpinnerService } from 'ng4-loading-spinner';
@Component({
selector: 'sms-notifications-prompt',
templateUrl: './sms-notifications-prompt.component.html',
- styleUrls: ['./sms-notifications-prompt.component.sass']
+ styleUrls: ['./sms-notifications-prompt.component.sass'],
})
export class SmsNotificationsPromptComponent implements IDynamicComponent {
formData: FormGroup = this.formBuilder.group({
- phoneNumber: ['', [Validators.required, Validators.pattern(/\d{10,}/)]]
+ phoneNumber: ['', [Validators.required, Validators.pattern(/\d{10,}/)]],
});
destroy: Function;
- constructor(private smsNotificationsService: SmsNotificationsService,
- private toastCtrl: ToastControllerService,
- private formBuilder: FormBuilder,
- private loadingCtrl: Ng4LoadingSpinnerService,
- private persistenceService: PersistenceService2) {}
+ constructor(
+ private smsNotificationsService: SmsNotificationsService,
+ private toastCtrl: ToastControllerService,
+ private formBuilder: FormBuilder,
+ private loadingCtrl: Ng4LoadingSpinnerService,
+ private persistenceService: PersistenceService2,
+ ) {}
init() {}
diff --git a/packages/lightwallet/desktop/src/app/components/toast-notification/toast-controller.service.ts b/packages/lightwallet/desktop/src/app/components/toast-notification/toast-controller.service.ts
index 362bf998fb..a494a15dcb 100644
--- a/packages/lightwallet/desktop/src/app/components/toast-notification/toast-controller.service.ts
+++ b/packages/lightwallet/desktop/src/app/components/toast-notification/toast-controller.service.ts
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import {
IMeritToastConfig,
- ToastControllerService as ToastControllerServiceBase
+ ToastControllerService as ToastControllerServiceBase,
} from '@merit/common/services/toast-controller.service';
import { DOMController } from '../dom.controller';
import { ToastNotificationComponent } from './toast-notification.component';
@@ -20,7 +20,7 @@ export class ToastControllerService extends ToastControllerServiceBase {
return this.create({
cssClass: 'error',
title: 'Error',
- message
+ message,
});
}
@@ -28,7 +28,7 @@ export class ToastControllerService extends ToastControllerServiceBase {
return this.create({
cssClass: 'success',
title: 'Success',
- message
+ message,
});
}
}
diff --git a/packages/lightwallet/desktop/src/app/components/toast-notification/toast-notification.component.ts b/packages/lightwallet/desktop/src/app/components/toast-notification/toast-notification.component.ts
index f1d0e936fe..abb32760f0 100644
--- a/packages/lightwallet/desktop/src/app/components/toast-notification/toast-notification.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/toast-notification/toast-notification.component.ts
@@ -8,8 +8,8 @@ import { IDynamicComponent } from '@merit/desktop/app/components/dom.controller'
styleUrls: ['./toast-notification.component.sass'],
host: {
'[class]': 'config.cssClass',
- '[hidden]': '!show'
- }
+ '[hidden]': '!show',
+ },
})
export class ToastNotificationComponent implements IDynamicComponent, OnDestroy {
config: IMeritToastConfig;
diff --git a/packages/lightwallet/desktop/src/app/components/toast-notification/toast-notification.spec.ts b/packages/lightwallet/desktop/src/app/components/toast-notification/toast-notification.spec.ts
index 6ac815bd62..5b45ee9d3a 100644
--- a/packages/lightwallet/desktop/src/app/components/toast-notification/toast-notification.spec.ts
+++ b/packages/lightwallet/desktop/src/app/components/toast-notification/toast-notification.spec.ts
@@ -3,20 +3,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ToastNotificationComponent } from './toast-notification.component';
describe('Toast notification', () => {
- let instance: ComponentFixture,
- de: DebugElement,
- comp: ToastNotificationComponent;
+ let instance: ComponentFixture, de: DebugElement, comp: ToastNotificationComponent;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [ToastNotificationComponent]
+ declarations: [ToastNotificationComponent],
}).compileComponents();
instance = TestBed.createComponent(ToastNotificationComponent);
comp = instance.componentInstance;
comp.init({
title: 'Test title',
- message: 'Test message'
+ message: 'Test message',
});
instance.detectChanges();
de = instance.debugElement;
diff --git a/packages/lightwallet/desktop/src/app/components/ui-checkbox/ui-checkbox.component.ts b/packages/lightwallet/desktop/src/app/components/ui-checkbox/ui-checkbox.component.ts
index d6ff1bc72c..4a60ada1df 100644
--- a/packages/lightwallet/desktop/src/app/components/ui-checkbox/ui-checkbox.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/ui-checkbox/ui-checkbox.component.ts
@@ -9,15 +9,15 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
styleUrls: ['./ui-checkbox.component.sass'],
host: {
'(click)': 'onClick()',
- '[class.checked]': 'value'
+ '[class.checked]': 'value',
},
providers: [
{
provide: NG_VALUE_ACCESSOR,
multi: true,
- useExisting: forwardRef(() => UICheckboxComponent)
- }
- ]
+ useExisting: forwardRef(() => UICheckboxComponent),
+ },
+ ],
})
export class UICheckboxComponent implements ControlValueAccessor {
value: boolean;
@@ -25,7 +25,7 @@ export class UICheckboxComponent implements ControlValueAccessor {
onTouched: Function = () => {};
writeValue(val: boolean) {
- this.onChange(this.value = Boolean(val));
+ this.onChange((this.value = Boolean(val)));
}
registerOnChange(fn: Function) {
diff --git a/packages/lightwallet/desktop/src/app/components/update-dialog/update-dialog.component.ts b/packages/lightwallet/desktop/src/app/components/update-dialog/update-dialog.component.ts
index 8839af1b03..f6ee73cc75 100644
--- a/packages/lightwallet/desktop/src/app/components/update-dialog/update-dialog.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/update-dialog/update-dialog.component.ts
@@ -6,7 +6,7 @@ import { ElectronService, IUpdateInfo, IUpdateProgress } from '@merit/desktop/se
@Component({
selector: 'update-dialog',
templateUrl: './update-dialog.component.html',
- styleUrls: ['./update-dialog.component.sass']
+ styleUrls: ['./update-dialog.component.sass'],
})
export class UpdateDialogComponent implements IDynamicComponent {
destroy: Function;
@@ -15,8 +15,7 @@ export class UpdateDialogComponent implements IDynamicComponent {
updateInfo: IUpdateInfo;
- constructor(private persistenceService: PersistenceService2,
- private ngZone: NgZone) {}
+ constructor(private persistenceService: PersistenceService2, private ngZone: NgZone) {}
init(updateInfo: IUpdateInfo) {
this.updateInfo = updateInfo;
@@ -24,23 +23,22 @@ export class UpdateDialogComponent implements IDynamicComponent {
downloadUpdate() {
this.step = 'downloading';
- ElectronService.downloadUpdate()
- .subscribe({
- next: (val: IUpdateProgress) => {
- this.ngZone.run(() => {
- val.timeRemaining = Math.ceil((val.total - val.transferred) / val.bytesPerSecond);
- val.transferred = Math.round(val.transferred / 1024 / 1024 * 100) / 100;
- val.total = Math.round(val.total / 1024 / 1024 * 100) / 100;
- val.percent = Math.round(val.percent);
- this.downloadProgress = val;
- });
- },
- complete: () => {
- this.ngZone.run(() => {
- this.step = 'downloaded'
- });
- }
- });
+ ElectronService.downloadUpdate().subscribe({
+ next: (val: IUpdateProgress) => {
+ this.ngZone.run(() => {
+ val.timeRemaining = Math.ceil((val.total - val.transferred) / val.bytesPerSecond);
+ val.transferred = Math.round((val.transferred / 1024 / 1024) * 100) / 100;
+ val.total = Math.round((val.total / 1024 / 1024) * 100) / 100;
+ val.percent = Math.round(val.percent);
+ this.downloadProgress = val;
+ });
+ },
+ complete: () => {
+ this.ngZone.run(() => {
+ this.step = 'downloaded';
+ });
+ },
+ });
}
installUpdate() {
diff --git a/packages/lightwallet/desktop/src/app/components/wallet-icon/wallet-icon.component.ts b/packages/lightwallet/desktop/src/app/components/wallet-icon/wallet-icon.component.ts
index 9878de5645..0dd60a60f0 100644
--- a/packages/lightwallet/desktop/src/app/components/wallet-icon/wallet-icon.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/wallet-icon/wallet-icon.component.ts
@@ -3,9 +3,9 @@ import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'wallet-icon',
templateUrl: './wallet-icon.component.html',
- styleUrls: ['./wallet-icon.component.scss']
+ styleUrls: ['./wallet-icon.component.scss'],
})
-
export class WalletIconComponent {
- @Input() strokeColor: string;
+ @Input()
+ strokeColor: string;
}
diff --git a/packages/lightwallet/desktop/src/app/components/wallet-unlock-alert/wallet-unlock-alert.component.ts b/packages/lightwallet/desktop/src/app/components/wallet-unlock-alert/wallet-unlock-alert.component.ts
index 7eb7566acc..db67bbc4ec 100644
--- a/packages/lightwallet/desktop/src/app/components/wallet-unlock-alert/wallet-unlock-alert.component.ts
+++ b/packages/lightwallet/desktop/src/app/components/wallet-unlock-alert/wallet-unlock-alert.component.ts
@@ -1,5 +1,5 @@
import { Component, Input } from '@angular/core';
-import { DisplayWallet } from "@merit/common/models/display-wallet";
+import { DisplayWallet } from '@merit/common/models/display-wallet';
@Component({
selector: 'app-wallet-unlock-alert',
@@ -7,5 +7,6 @@ import { DisplayWallet } from "@merit/common/models/display-wallet";
styleUrls: ['./wallet-unlock-alert.component.sass'],
})
export class WalletUnlockAlertComponent {
- @Input() wallets: DisplayWallet[];
+ @Input()
+ wallets: DisplayWallet[];
}
diff --git a/packages/lightwallet/desktop/src/app/core/backup/backup.view.ts b/packages/lightwallet/desktop/src/app/core/backup/backup.view.ts
index 00ee6ee7c5..58a619afe4 100644
--- a/packages/lightwallet/desktop/src/app/core/backup/backup.view.ts
+++ b/packages/lightwallet/desktop/src/app/core/backup/backup.view.ts
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-backup',
templateUrl: './backup.view.html',
- styleUrls: ['./backup.view.sass']
+ styleUrls: ['./backup.view.sass'],
})
export class BackupView {}
diff --git a/packages/lightwallet/desktop/src/app/core/backup/file-backup/file-backup.view.ts b/packages/lightwallet/desktop/src/app/core/backup/file-backup/file-backup.view.ts
index 3225d47f11..4a877ade8a 100644
--- a/packages/lightwallet/desktop/src/app/core/backup/file-backup/file-backup.view.ts
+++ b/packages/lightwallet/desktop/src/app/core/backup/file-backup/file-backup.view.ts
@@ -11,18 +11,17 @@ import { PasswordValidator } from '@merit/common/validators/password.validator';
import { MWCService } from '@merit/common/services/mwc.service';
import { AppSettingsService } from '@merit/common/services/app-settings.service';
import * as FileSaver from 'file-saver';
-import 'rxjs/add/operator/toPromise'
-import 'rxjs/add/operator/take'
+import 'rxjs/add/operator/toPromise';
+import 'rxjs/add/operator/take';
@Component({
selector: 'view-file-backup',
- templateUrl: './file-backup.view.html'
+ templateUrl: './file-backup.view.html',
})
export class FileBackupView {
-
formData = this.formBuilder.group({
password: ['', [Validators.required, Validators.minLength(1)]],
- repeatPassword: ['', [Validators.required, PasswordValidator.MatchPassword]]
+ repeatPassword: ['', [Validators.required, PasswordValidator.MatchPassword]],
});
get password() {
@@ -34,15 +33,16 @@ export class FileBackupView {
}
wallet$: Observable = this.route.parent.params.pipe(
- switchMap((params: any) => this.store.select(selectWalletById(params.id)))
+ switchMap((params: any) => this.store.select(selectWalletById(params.id))),
);
- constructor(private route: ActivatedRoute,
- private store: Store,
- private formBuilder: FormBuilder,
- private mwcService: MWCService,
- private appSettingsService: AppSettingsService) {
- }
+ constructor(
+ private route: ActivatedRoute,
+ private store: Store,
+ private formBuilder: FormBuilder,
+ private mwcService: MWCService,
+ private appSettingsService: AppSettingsService,
+ ) {}
async downloadFileBackup() {
const wallet = await this.wallet$.take(1).toPromise();
@@ -50,7 +50,7 @@ export class FileBackupView {
const encryptedData = this.mwcService.getSJCL().encrypt(this.password.value, exportData, { iter: 10000 });
const walletName = wallet.name;
const info = await this.appSettingsService.getInfo();
- const fileName = `${ walletName }-${ info.nameCase || '' }.backup.aes.json`;
+ const fileName = `${walletName}-${info.nameCase || ''}.backup.aes.json`;
const blob = new Blob([encryptedData], { type: 'text/plain;charset=utf-8' });
FileSaver.saveAs(blob, fileName);
diff --git a/packages/lightwallet/desktop/src/app/core/backup/mnemonic-phrase/mnemonic-phrase.view.ts b/packages/lightwallet/desktop/src/app/core/backup/mnemonic-phrase/mnemonic-phrase.view.ts
index 090862d304..902112c38f 100644
--- a/packages/lightwallet/desktop/src/app/core/backup/mnemonic-phrase/mnemonic-phrase.view.ts
+++ b/packages/lightwallet/desktop/src/app/core/backup/mnemonic-phrase/mnemonic-phrase.view.ts
@@ -10,15 +10,13 @@ import { Store } from '@ngrx/store';
@Component({
selector: 'app-mnemonic-phrase',
templateUrl: './mnemonic-phrase.view.html',
- styleUrls: ['./mnemonic-phrase.view.sass']
+ styleUrls: ['./mnemonic-phrase.view.sass'],
})
export class MnemonicPhraseView {
mnemonic$: Observable = this.route.parent.params.pipe(
switchMap((params: any) => this.store.select(selectWalletById(params.id))),
- map((wallet: DisplayWallet) => wallet.client.getMnemonic())
+ map((wallet: DisplayWallet) => wallet.client.getMnemonic()),
);
- constructor(private route: ActivatedRoute,
- private store: Store) {
- }
+ constructor(private route: ActivatedRoute, private store: Store) {}
}
diff --git a/packages/lightwallet/desktop/src/app/core/backup/qr-code-backup/qr-code-backup.view.ts b/packages/lightwallet/desktop/src/app/core/backup/qr-code-backup/qr-code-backup.view.ts
index 7d561f6c6c..b23972b328 100644
--- a/packages/lightwallet/desktop/src/app/core/backup/qr-code-backup/qr-code-backup.view.ts
+++ b/packages/lightwallet/desktop/src/app/core/backup/qr-code-backup/qr-code-backup.view.ts
@@ -12,16 +12,17 @@ import { Store } from '@ngrx/store';
@Component({
selector: 'view-qr-code-backup',
templateUrl: './qr-code-backup.view.html',
- styleUrls: ['./qr-code-backup.view.sass']
+ styleUrls: ['./qr-code-backup.view.sass'],
})
export class QrCodeBackupView {
mnemonic$: Observable = this.route.parent.params.pipe(
switchMap((params: any) => this.store.select(selectWalletById(params.id)).pipe(take(1))),
- switchMap((wallet: DisplayWallet) => fromPromise(this.walletService.getEncodedWalletInfo(wallet.client, null)))
+ switchMap((wallet: DisplayWallet) => fromPromise(this.walletService.getEncodedWalletInfo(wallet.client, null))),
);
- constructor(private route: ActivatedRoute,
- private store: Store,
- private walletService: WalletService) {
- }
+ constructor(
+ private route: ActivatedRoute,
+ private store: Store,
+ private walletService: WalletService,
+ ) {}
}
diff --git a/packages/lightwallet/desktop/src/app/core/community/community.view.ts b/packages/lightwallet/desktop/src/app/core/community/community.view.ts
index 62ebda1652..d108dbe873 100644
--- a/packages/lightwallet/desktop/src/app/core/community/community.view.ts
+++ b/packages/lightwallet/desktop/src/app/core/community/community.view.ts
@@ -4,22 +4,22 @@ import { Observable } from 'rxjs/Observable';
import { Store } from '@ngrx/store';
import {
selectInviteRequests,
- selectInvites, selectWallets, selectWalletsLoading,
- selectWalletTotals
+ selectInvites,
+ selectWallets,
+ selectWalletsLoading,
+ selectWalletTotals,
} from '@merit/common/reducers/wallets.reducer';
import { IRootAppState } from '@merit/common/reducers';
@Component({
selector: 'view-network',
templateUrl: './community.view.html',
- styleUrls: ['./community.view.sass']
+ styleUrls: ['./community.view.sass'],
})
export class CommunityView {
wallets$: Observable = this.store.select(selectWallets);
walletsLoading$: Observable = this.store.select(selectWalletsLoading);
totals$: Observable = this.store.select(selectWalletTotals);
- constructor(private store: Store) {
- }
-
+ constructor(private store: Store) {}
}
diff --git a/packages/lightwallet/desktop/src/app/core/components/fee-selector/fee-selector.component.ts b/packages/lightwallet/desktop/src/app/core/components/fee-selector/fee-selector.component.ts
index f52585df8f..17abcafa0a 100644
--- a/packages/lightwallet/desktop/src/app/core/components/fee-selector/fee-selector.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/fee-selector/fee-selector.component.ts
@@ -9,9 +9,9 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
{
provide: NG_VALUE_ACCESSOR,
multi: true,
- useExisting: forwardRef(() => FeeSelectorComponent)
- }
- ]
+ useExisting: forwardRef(() => FeeSelectorComponent),
+ },
+ ],
})
export class FeeSelectorComponent implements ControlValueAccessor {
value: boolean;
@@ -19,7 +19,7 @@ export class FeeSelectorComponent implements ControlValueAccessor {
onTouched: Function = () => {};
writeValue(val: boolean) {
- this.onChange(this.value = Boolean(val));
+ this.onChange((this.value = Boolean(val)));
}
registerOnChange(fn: Function) {
diff --git a/packages/lightwallet/desktop/src/app/core/components/history-item/history-item.component.ts b/packages/lightwallet/desktop/src/app/core/components/history-item/history-item.component.ts
index 6e9fa3048f..53442ddc52 100644
--- a/packages/lightwallet/desktop/src/app/core/components/history-item/history-item.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/history-item/history-item.component.ts
@@ -8,10 +8,11 @@ import { GlobalsendLinkPopupController } from '@merit/desktop/app/components/glo
selector: 'history-item',
templateUrl: './history-item.component.html',
styleUrls: ['./history-item.component.sass'],
- changeDetection: ChangeDetectionStrategy.OnPush
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HistoryItemComponent implements OnInit {
- @Input() tx: IDisplayTransaction;
+ @Input()
+ tx: IDisplayTransaction;
confirmationsExplanation: string;
isUnlockRequest: boolean;
@@ -30,10 +31,7 @@ export class HistoryItemComponent implements OnInit {
}
}
- constructor(
- private globalSendLinkCtrl: GlobalsendLinkPopupController,
- private easyReceive: EasyReceiveService
- ) {}
+ constructor(private globalSendLinkCtrl: GlobalsendLinkPopupController, private easyReceive: EasyReceiveService) {}
ngOnInit() {
const { tx } = this;
@@ -45,7 +43,8 @@ export class HistoryItemComponent implements OnInit {
this.isMiningReward = this.isReward && tx.outputs[0].index === 0;
this.isEasySend = !this.isInvite && !this.isReward;
if (tx.isCoinbase && !tx.isMature) {
- this.confirmationsExplanation = String(this.tx.confirmations) + ' block(s) confirmed from ' + COINBASE_CONFIRMATION_THRESHOLD;
+ this.confirmationsExplanation =
+ String(this.tx.confirmations) + ' block(s) confirmed from ' + COINBASE_CONFIRMATION_THRESHOLD;
}
if (tx.isGrowthReward) this.image = 'growth';
diff --git a/packages/lightwallet/desktop/src/app/core/components/history-item/history-item.spec.ts b/packages/lightwallet/desktop/src/app/core/components/history-item/history-item.spec.ts
index 41b9cbc92b..14bb3ed5b5 100644
--- a/packages/lightwallet/desktop/src/app/core/components/history-item/history-item.spec.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/history-item/history-item.spec.ts
@@ -9,15 +9,14 @@ import { ClipModule } from 'ng2-clip';
import { MomentModule } from 'ngx-moment';
import { HistoryItemComponent } from './history-item.component';
-
const BASE_TRANSACTION: Partial = {
isConfirmed: true,
isInvite: false,
isCoinbase: false,
wallet: {
- name: 'Personal wallet'
+ name: 'Personal wallet',
},
- time: Date.now() / 1000
+ time: Date.now() / 1000,
};
@Injectable()
@@ -35,25 +34,17 @@ class MockMeritMoneyLinkPopupController {
class MockEasyReceiveService {}
describe('History item component', () => {
-
- let instance: ComponentFixture,
- de: DebugElement,
- comp: HistoryItemComponent;
+ let instance: ComponentFixture, de: DebugElement, comp: HistoryItemComponent;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [
- HistoryItemComponent
- ],
+ declarations: [HistoryItemComponent],
providers: [
{ provide: GlobalsendLinkPopupController, useClass: MockMeritMoneyLinkPopupController },
{ provide: ToastControllerService, useClass: MockToastController },
{ provide: EasyReceiveService, useClass: MockEasyReceiveService },
],
- imports: [
- ClipModule,
- MomentModule
- ]
+ imports: [ClipModule, MomentModule],
}).compileComponents();
instance = TestBed.createComponent(HistoryItemComponent);
@@ -73,7 +64,7 @@ describe('History item component', () => {
action: TransactionAction.RECEIVED,
name,
amountStr,
- alternativeAmountStr
+ alternativeAmountStr,
};
instance.detectChanges();
});
@@ -91,7 +82,5 @@ describe('History item component', () => {
expect(innerHTML).toContain('Received to');
expect(innerHTML).toContain('Personal wallet');
});
-
});
-
});
diff --git a/packages/lightwallet/desktop/src/app/core/components/history-list/history-list.component.ts b/packages/lightwallet/desktop/src/app/core/components/history-list/history-list.component.ts
index 19af2a8613..d93da4be77 100644
--- a/packages/lightwallet/desktop/src/app/core/components/history-list/history-list.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/history-list/history-list.component.ts
@@ -14,7 +14,7 @@ import { DisplayWallet } from '@merit/common/models/display-wallet';
selector: 'history-list',
templateUrl: './history-list.component.html',
styleUrls: ['./history-list.component.sass'],
- encapsulation: ViewEncapsulation.None
+ encapsulation: ViewEncapsulation.None,
})
export class HistoryListComponent {
private _transactions: IDisplayTransaction[];
@@ -29,20 +29,20 @@ export class HistoryListComponent {
return this._transactions;
}
- @Input() loading: boolean;
- @Input() widget: boolean;
+ @Input()
+ loading: boolean;
+ @Input()
+ widget: boolean;
viewPortItems: IDisplayTransaction[];
mineInviteTaskSlug: TaskSlug = TaskSlug.MineInvite;
unlockTaskSlug: TaskSlug = TaskSlug.UnlockWallet;
- isInviteMined$: Observable = this.store.select(selectStatusForTask(this.mineInviteTaskSlug))
- .pipe(
- map((status: ProgressStatus) => status !== ProgressStatus.Incomplete)
- );
- isWalletUnlocked$: Observable = this.store.select(selectPrimaryWallet)
- .pipe(
- map((wallet: DisplayWallet) => wallet && wallet.confirmed)
- );
+ isInviteMined$: Observable = this.store
+ .select(selectStatusForTask(this.mineInviteTaskSlug))
+ .pipe(map((status: ProgressStatus) => status !== ProgressStatus.Incomplete));
+ isWalletUnlocked$: Observable = this.store
+ .select(selectPrimaryWallet)
+ .pipe(map((wallet: DisplayWallet) => wallet && wallet.confirmed));
constructor(private store: Store) {}
@@ -53,11 +53,12 @@ export class HistoryListComponent {
const primaryWallet = await getLatestDefinedValue(this.store.select(selectPrimaryWallet));
- if (this.transactions.some((tx: IDisplayTransaction) =>
- tx.action === TransactionAction.INVITE &&
- !tx.isWalletUnlock &&
- tx.walletId === primaryWallet.id
- )) {
+ if (
+ this.transactions.some(
+ (tx: IDisplayTransaction) =>
+ tx.action === TransactionAction.INVITE && !tx.isWalletUnlock && tx.walletId === primaryWallet.id,
+ )
+ ) {
this.store.dispatch(new SetTaskStatus(this.mineInviteTaskSlug, ProgressStatus.Complete));
}
}
diff --git a/packages/lightwallet/desktop/src/app/core/components/notifications-history/notifications-history.component.ts b/packages/lightwallet/desktop/src/app/core/components/notifications-history/notifications-history.component.ts
index 23d4719ccf..eeb67ae714 100644
--- a/packages/lightwallet/desktop/src/app/core/components/notifications-history/notifications-history.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/notifications-history/notifications-history.component.ts
@@ -6,14 +6,17 @@ import { INotification } from '@merit/common/reducers/notifications.reducer';
templateUrl: './notifications-history.component.html',
styleUrls: ['./notifications-history.component.sass'],
host: {
- '[class.show]': 'showHistory'
+ '[class.show]': 'showHistory',
},
- changeDetection: ChangeDetectionStrategy.OnPush
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NotificationsHistoryComponent {
- @Input() notifications: INotification[];
- @Input() showHistory: boolean;
- @Output() onClear: EventEmitter = new EventEmitter();
+ @Input()
+ notifications: INotification[];
+ @Input()
+ showHistory: boolean;
+ @Output()
+ onClear: EventEmitter = new EventEmitter();
clearAll() {
this.onClear.emit();
diff --git a/packages/lightwallet/desktop/src/app/core/components/notifications/notifications.component.ts b/packages/lightwallet/desktop/src/app/core/components/notifications/notifications.component.ts
index fac248eee2..5a73f9bb6a 100644
--- a/packages/lightwallet/desktop/src/app/core/components/notifications/notifications.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/notifications/notifications.component.ts
@@ -3,19 +3,21 @@ import { IRootAppState } from '@merit/common/reducers';
import {
ClearNotificationsAction,
INotification,
- MarkAllNotificationsAsReadAction
+ MarkAllNotificationsAsReadAction,
} from '@merit/common/reducers/notifications.reducer';
import { Store } from '@ngrx/store';
@Component({
selector: 'app-notifications',
templateUrl: './notifications.component.html',
- styleUrls: ['./notifications.component.sass']
+ styleUrls: ['./notifications.component.sass'],
})
export class NotificationsComponent {
showHistory: boolean;
- @Input() notifications: INotification[];
- @Input() hasNewNotifications: boolean;
+ @Input()
+ notifications: INotification[];
+ @Input()
+ hasNewNotifications: boolean;
constructor(private store: Store) {}
diff --git a/packages/lightwallet/desktop/src/app/core/components/profile-stats/community-rank/community-rank.component.ts b/packages/lightwallet/desktop/src/app/core/components/profile-stats/community-rank/community-rank.component.ts
index 2691e1bd94..629e0965b8 100644
--- a/packages/lightwallet/desktop/src/app/core/components/profile-stats/community-rank/community-rank.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/profile-stats/community-rank/community-rank.component.ts
@@ -20,13 +20,19 @@ export class CommunityRankComponent {
private _wallets: any[];
private _ranks: any;
- @Output() close: EventEmitter = new EventEmitter();
+ @Output()
+ close: EventEmitter = new EventEmitter();
- @Input() onMoreSecurityRewards: Function;
- @Input() onMoreCommunity: Function;
- @Input() active: boolean;
- @Input() leaderboard: any[];
- @Input() rankData: any;
+ @Input()
+ onMoreSecurityRewards: Function;
+ @Input()
+ onMoreCommunity: Function;
+ @Input()
+ active: boolean;
+ @Input()
+ leaderboard: any[];
+ @Input()
+ rankData: any;
@Input()
set ranks(val: any[]) {
this._ranks = val;
@@ -55,7 +61,7 @@ export class CommunityRankComponent {
private assignRanks() {
if (!this._ranks || !this._wallets) return;
- this._wallets.map((w) => {
+ this._wallets.map(w => {
w.rank = this.ranks.find(r => r.address == w.referrerAddress);
});
}
diff --git a/packages/lightwallet/desktop/src/app/core/components/profile-stats/get-started-tips/get-started-tips.component.ts b/packages/lightwallet/desktop/src/app/core/components/profile-stats/get-started-tips/get-started-tips.component.ts
index 9782493d8f..c0e2ac6f6b 100644
--- a/packages/lightwallet/desktop/src/app/core/components/profile-stats/get-started-tips/get-started-tips.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/profile-stats/get-started-tips/get-started-tips.component.ts
@@ -21,13 +21,12 @@ declare global {
trigger('showTips', [
state('true', style({ maxHeight: '1000px', padding: '60px 20px 30px' })),
state('false', style({})),
- transition('* => *', animate('100ms cubic-bezier(0.445, 0.05, 0.55, 0.95)'))
- ])
- ]
+ transition('* => *', animate('100ms cubic-bezier(0.445, 0.05, 0.55, 0.95)')),
+ ]),
+ ],
})
export class GetStartedTipsComponent implements OnInit {
- constructor(private persistenceService: PersistenceService2, private store: Store) {
- }
+ constructor(private persistenceService: PersistenceService2, private store: Store) {}
active: boolean;
getArticle: boolean;
diff --git a/packages/lightwallet/desktop/src/app/core/components/profile-stats/profile-stats.component.ts b/packages/lightwallet/desktop/src/app/core/components/profile-stats/profile-stats.component.ts
index a609b641d4..0467e6adc0 100644
--- a/packages/lightwallet/desktop/src/app/core/components/profile-stats/profile-stats.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/profile-stats/profile-stats.component.ts
@@ -29,8 +29,10 @@ interface IRankInfo {
export class ProfileStatsComponent {
private _wallets: DisplayWallet[];
- @Input() totals: any;
- @Input() loading: boolean;
+ @Input()
+ totals: any;
+ @Input()
+ loading: boolean;
@Input()
set wallets(val: DisplayWallet[]) {
@@ -81,7 +83,9 @@ export class ProfileStatsComponent {
}
});
- const topRankWallet: DisplayWallet = this.wallets.find((wallet: DisplayWallet) => wallet.referrerAddress === topRank.address);
+ const topRankWallet: DisplayWallet = this.wallets.find(
+ (wallet: DisplayWallet) => wallet.referrerAddress === topRank.address,
+ );
this.rankData = {
unlocked: true,
@@ -95,12 +99,11 @@ export class ProfileStatsComponent {
this.displayLeaderboard = this.leaderboard.slice(this.offset, this.LIMIT);
}
-
// TODO: move this function to a utils file
private getPercentileStr(rankData: IRankInfo) {
const percentile = Number(rankData.percentile);
- return (percentile > 20)
+ return percentile > 20
? 'Top ' + Math.max(Math.round(100 - percentile), 1) + '%'
: 'Bottom ' + Math.max(Math.round(percentile), 1) + '%';
}
diff --git a/packages/lightwallet/desktop/src/app/core/components/select/select.component.ts b/packages/lightwallet/desktop/src/app/core/components/select/select.component.ts
index f48e079740..e924503318 100644
--- a/packages/lightwallet/desktop/src/app/core/components/select/select.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/select/select.component.ts
@@ -3,14 +3,17 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'app-select',
templateUrl: './select.component.html',
- styleUrls: ['./select.component.sass']
+ styleUrls: ['./select.component.sass'],
})
export class SelectComponent {
-
- @Output() selectionEvent = new EventEmitter();
- @Input() selected: any;
- @Input() input: any;
- @Input() cssClass: any;
+ @Output()
+ selectionEvent = new EventEmitter();
+ @Input()
+ selected: any;
+ @Input()
+ input: any;
+ @Input()
+ cssClass: any;
show: boolean = false;
select(item) {
diff --git a/packages/lightwallet/desktop/src/app/core/components/send-method/send-method.component.ts b/packages/lightwallet/desktop/src/app/core/components/send-method/send-method.component.ts
index fcf00e56df..44725a9c6f 100644
--- a/packages/lightwallet/desktop/src/app/core/components/send-method/send-method.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/send-method/send-method.component.ts
@@ -10,9 +10,9 @@ import { SendMethodType } from '@merit/common/models/send-method';
{
provide: NG_VALUE_ACCESSOR,
multi: true,
- useExisting: forwardRef(() => SendMethodComponent)
- }
- ]
+ useExisting: forwardRef(() => SendMethodComponent),
+ },
+ ],
})
export class SendMethodComponent implements ControlValueAccessor {
value: SendMethodType;
@@ -23,7 +23,7 @@ export class SendMethodComponent implements ControlValueAccessor {
invite: boolean;
writeValue(val: SendMethodType) {
- this.onChange(this.value = val);
+ this.onChange((this.value = val));
}
registerOnChange(fn: Function) {
diff --git a/packages/lightwallet/desktop/src/app/core/components/share-box/share-box.component.ts b/packages/lightwallet/desktop/src/app/core/components/share-box/share-box.component.ts
index 0f5382b7a0..83631d8ebd 100644
--- a/packages/lightwallet/desktop/src/app/core/components/share-box/share-box.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/share-box/share-box.component.ts
@@ -19,7 +19,11 @@ import { ElectronService } from '@merit/desktop/services/electron.service';
styleUrls: ['./share-box.component.sass'],
})
export class ShareBoxComponent implements OnInit {
- constructor(private store: Store, private toastCtrl: ToastControllerService, private socialSharing: SocialSharing) {}
+ constructor(
+ private store: Store,
+ private toastCtrl: ToastControllerService,
+ private socialSharing: SocialSharing,
+ ) {}
wallets$: Observable = this.store.select(selectWallets);
selectedWallet = {
@@ -35,18 +39,22 @@ export class ShareBoxComponent implements OnInit {
shareTitle: string = 'Merit - digital currency for humans.';
shareText: string = `Merit aims to be the worldโs friendliest digital currency, making it dead simple to pay friends, buy goods, and manage your wealth.\n Get wallet now, your activation: `;
- @Output() dismiss: EventEmitter = new EventEmitter();
+ @Output()
+ dismiss: EventEmitter = new EventEmitter();
async ngOnInit() {
const wallets: DisplayWallet[] = await this.wallets$
- .pipe(filter((wallets: DisplayWallet[]) => wallets.length > 0), take(1))
+ .pipe(
+ filter((wallets: DisplayWallet[]) => wallets.length > 0),
+ take(1),
+ )
.toPromise();
if (wallets.length > 0) {
this.selectedWallet = wallets[0];
this.selectWallet(wallets[0]);
}
- this.FB = await this.socialSharing.authorizeFBSDK();
+ this.FB = await this.socialSharing.authorizeFBSDK();
}
get isElectron(): boolean {
@@ -69,31 +77,34 @@ export class ShareBoxComponent implements OnInit {
}
shareFacebook() {
- this.FB.ui({
- method: 'share_open_graph',
- action_type: 'og.shares',
- action_properties: JSON.stringify({
- object : {
- 'og:url': `${this.shareLink}`,
- 'og:title': `${this.shareTitle}`,
- 'og:site_name':'MeritLightWallet',
- 'og:description': `${this.shareText} ${this.shareLink}`,
- 'og:image': 'https://www.merit.me/uploads/2018/02/17/shareImage.png',
- 'og:image:width':'250',
- 'og:image:height':'257'
- }
- })
- }, function(response){
- console.debug(response);
- });
+ this.FB.ui(
+ {
+ method: 'share_open_graph',
+ action_type: 'og.shares',
+ action_properties: JSON.stringify({
+ object: {
+ 'og:url': `${this.shareLink}`,
+ 'og:title': `${this.shareTitle}`,
+ 'og:site_name': 'MeritLightWallet',
+ 'og:description': `${this.shareText} ${this.shareLink}`,
+ 'og:image': 'https://www.merit.me/uploads/2018/02/17/shareImage.png',
+ 'og:image:width': '250',
+ 'og:image:height': '257',
+ },
+ }),
+ },
+ function(response) {
+ console.debug(response);
+ },
+ );
}
shareTweeter() {
- this._newWindow(`https://twitter.com/intent/tweet?text=${this.shareText} ${this.shareLink}`);
+ this._newWindow(`https://twitter.com/intent/tweet?text=${this.shareText} ${this.shareLink}`);
}
mailTo() {
- window.location.href = (`mailto:?subject=${this.shareTitle}&body=${this.shareText} ${this.shareLink}`);
+ window.location.href = `mailto:?subject=${this.shareTitle}&body=${this.shareText} ${this.shareLink}`;
}
private _newWindow(url) {
diff --git a/packages/lightwallet/desktop/src/app/core/components/toolbar/toolbar.component.ts b/packages/lightwallet/desktop/src/app/core/components/toolbar/toolbar.component.ts
index 28ec1907e8..546196ee99 100644
--- a/packages/lightwallet/desktop/src/app/core/components/toolbar/toolbar.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/toolbar/toolbar.component.ts
@@ -3,13 +3,13 @@ import { IRootAppState } from '@merit/common/reducers';
import {
INotification,
selectNotifications,
- selectTotalUnreadNotifications
+ selectTotalUnreadNotifications,
} from '@merit/common/reducers/notifications.reducer';
import {
RefreshWalletsAction,
selectWalletsLoading,
selectWalletTotals,
- selectWalletTotalsLoading
+ selectWalletTotalsLoading,
} from '@merit/common/reducers/wallets.reducer';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs/Observable';
@@ -18,7 +18,7 @@ import { SetShareDialogAction } from '@merit/common/reducers/interface-preferenc
@Component({
selector: 'app-toolbar',
templateUrl: './toolbar.component.html',
- styleUrls: ['./toolbar.component.sass']
+ styleUrls: ['./toolbar.component.sass'],
})
export class ToolbarComponent {
showMenu: boolean;
@@ -26,7 +26,7 @@ export class ToolbarComponent {
selectedCurrency: any = {
name: 'USD',
symbol: '$',
- value: '1'
+ value: '1',
};
totals$: Observable = this.store.select(selectWalletTotals);
@@ -37,12 +37,12 @@ export class ToolbarComponent {
walletsLoading$: Observable = this.store.select(selectWalletsLoading);
- @Output() shareActivate: EventEmitter = new EventEmitter();
+ @Output()
+ shareActivate: EventEmitter = new EventEmitter();
showAdvTb: boolean;
- constructor(private store: Store) {
- }
+ constructor(private store: Store) {}
receiveSelection($event) {
this.selectedCurrency = $event;
diff --git a/packages/lightwallet/desktop/src/app/core/components/vaults-list/vaults-list.component.ts b/packages/lightwallet/desktop/src/app/core/components/vaults-list/vaults-list.component.ts
index 4a56d604d2..5e43d2a8f6 100644
--- a/packages/lightwallet/desktop/src/app/core/components/vaults-list/vaults-list.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/vaults-list/vaults-list.component.ts
@@ -4,9 +4,11 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
selector: 'vaults-list',
templateUrl: './vaults-list.component.html',
styleUrls: ['./vaults-list.component.sass'],
- changeDetection: ChangeDetectionStrategy.OnPush
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
export class VaultsListComponent {
- @Input() showButton: boolean = true;
- @Input() vaults: any[];
+ @Input()
+ showButton: boolean = true;
+ @Input()
+ vaults: any[];
}
diff --git a/packages/lightwallet/desktop/src/app/core/components/wallets-list/wallets-list.component.ts b/packages/lightwallet/desktop/src/app/core/components/wallets-list/wallets-list.component.ts
index 328ca9a097..2cd6f02b16 100644
--- a/packages/lightwallet/desktop/src/app/core/components/wallets-list/wallets-list.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/components/wallets-list/wallets-list.component.ts
@@ -7,18 +7,21 @@ import { DisplayWallet } from '@merit/common/models/display-wallet';
styleUrls: ['./wallets-list.component.sass'],
})
export class WalletsListComponent {
- @Input() wallets: DisplayWallet[];
- @Input() loading: boolean;
- @Input() limit: number;
+ @Input()
+ wallets: DisplayWallet[];
+ @Input()
+ loading: boolean;
+ @Input()
+ limit: number;
trackByFn(wallet: DisplayWallet) {
return wallet.id;
}
- isShowMore() {
- if(this.limit > 1 && this.limit < this.wallets.length) {
+ isShowMore() {
+ if (this.limit > 1 && this.limit < this.wallets.length) {
return true;
- }else {
+ } else {
this.limit = this.wallets.length;
return false;
}
diff --git a/packages/lightwallet/desktop/src/app/core/core.component.ts b/packages/lightwallet/desktop/src/app/core/core.component.ts
index d8b132678d..006a146ea9 100644
--- a/packages/lightwallet/desktop/src/app/core/core.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/core.component.ts
@@ -87,7 +87,7 @@ export class CoreView implements OnInit, AfterViewInit {
{
name: 'Market Beta',
icon: '/assets/v1/icons/ui/aside-navigation/market.svg',
- link: '/market/gate'
+ link: '/market/gate',
},
{
name: 'Help & Support',
@@ -102,14 +102,12 @@ export class CoreView implements OnInit, AfterViewInit {
recordPassphrase: boolean = true;
lockedWallets$: Observable = this.wallets$.pipe(
map((wallets: DisplayWallet[]) => wallets.filter((wallet: DisplayWallet) => !wallet.confirmed)),
- map((wallets: DisplayWallet[]) => (wallets && wallets.length ? wallets : null))
+ map((wallets: DisplayWallet[]) => (wallets && wallets.length ? wallets : null)),
+ );
+ isWelcomeDialogEnabled$: Observable = this.store.select(selectGoalSettings).pipe(
+ filter((goalSettings: IGoalSettings) => !!goalSettings),
+ map((goalSettings: IGoalSettings) => goalSettings.isWelcomeDialogEnabled),
);
- isWelcomeDialogEnabled$: Observable = this.store
- .select(selectGoalSettings)
- .pipe(
- filter((goalSettings: IGoalSettings) => !!goalSettings),
- map((goalSettings: IGoalSettings) => goalSettings.isWelcomeDialogEnabled)
- );
showShare$: Observable = this.store.select(selectShareDialogState);
constructor(
@@ -125,7 +123,7 @@ export class CoreView implements OnInit, AfterViewInit {
private domSanitizer: DomSanitizer,
private smsNotificationsService: SmsNotificationsService,
private smsNotificationsPromptCtrl: SmsNotificationsPromptController,
- private goalsService: GoalsService
+ private goalsService: GoalsService,
) {}
async ngOnInit() {
@@ -145,7 +143,7 @@ export class CoreView implements OnInit, AfterViewInit {
if (smsNotificationStatus.enabled) return;
- if(this.recordPassphrase) {
+ if (this.recordPassphrase) {
this.smsNotificationsPromptCtrl.create();
}
}
@@ -156,7 +154,7 @@ export class CoreView implements OnInit, AfterViewInit {
getIconStyle(icon: string) {
return this.domSanitizer.bypassSecurityTrustStyle(
- `mask-image: url('${icon}'); -webkit-mask-image: url('${icon}');`
+ `mask-image: url('${icon}'); -webkit-mask-image: url('${icon}');`,
);
}
@@ -174,7 +172,7 @@ export class CoreView implements OnInit, AfterViewInit {
const passwordPrompt = this.passwordPromptCtrl.create(
message,
[Validators.required],
- [PasswordValidator.ValidateEasyReceivePassword(receipt, this.easyReceiveService)]
+ [PasswordValidator.ValidateEasyReceivePassword(receipt, this.easyReceiveService)],
);
passwordPrompt.onDidDismiss((password: any) => {
if (password) {
@@ -188,7 +186,7 @@ export class CoreView implements OnInit, AfterViewInit {
receipt: EasyReceipt,
data: any,
wallet?: MeritWalletClient,
- inviteOnly?: boolean
+ inviteOnly?: boolean,
) {
const amount = await this.easyReceiveService.getReceiverAmount(data.txs);
@@ -234,7 +232,7 @@ export class CoreView implements OnInit, AfterViewInit {
data: any,
wallet?: MeritWalletClient,
cancelling?: boolean,
- inviteOnly?: boolean
+ inviteOnly?: boolean,
) {
const amount = await this.easyReceiveService.getReceiverAmount(data.txs);
@@ -261,7 +259,7 @@ export class CoreView implements OnInit, AfterViewInit {
text: "Don't Cancel",
value: 'no',
},
- ]
+ ],
);
confirmDialog.onDidDismiss((val: string) => {
@@ -290,7 +288,7 @@ export class CoreView implements OnInit, AfterViewInit {
skipShareCode: true,
skipRewards: true,
skipAlias: true,
- })
+ }),
);
} catch (err) {
console.error(err);
@@ -312,7 +310,7 @@ export class CoreView implements OnInit, AfterViewInit {
skipShareCode: true,
skipRewards: true,
skipAlias: true,
- })
+ }),
);
} catch (err) {
console.error(err);
@@ -330,7 +328,7 @@ export class CoreView implements OnInit, AfterViewInit {
this.confirmDialogCtrl.create(
'Transaction expired',
'The Merit from this link has not been lost! You can ask the sender to make a new transaction.',
- [{ text: 'Ok' }]
+ [{ text: 'Ok' }],
);
}
@@ -348,7 +346,7 @@ export class CoreView implements OnInit, AfterViewInit {
password?: string,
processAll: boolean = true,
wallet?: MeritWalletClient,
- cancelling?: boolean
+ cancelling?: boolean,
): Promise {
password = password || '';
const data = await this.easyReceiveService.validateEasyReceiptOnBlockchain(receipt, password);
diff --git a/packages/lightwallet/desktop/src/app/core/core.module.ts b/packages/lightwallet/desktop/src/app/core/core.module.ts
index 692baf3709..c388fb1554 100644
--- a/packages/lightwallet/desktop/src/app/core/core.module.ts
+++ b/packages/lightwallet/desktop/src/app/core/core.module.ts
@@ -72,7 +72,7 @@ export function getPages() {
SendInviteView,
WalletSetupView,
WalletSetupListView,
- BackupNewWallet
+ BackupNewWallet,
];
}
diff --git a/packages/lightwallet/desktop/src/app/core/dashboard/dashboard.view.ts b/packages/lightwallet/desktop/src/app/core/dashboard/dashboard.view.ts
index fd6e4a0dd8..1f297ae31a 100644
--- a/packages/lightwallet/desktop/src/app/core/dashboard/dashboard.view.ts
+++ b/packages/lightwallet/desktop/src/app/core/dashboard/dashboard.view.ts
@@ -28,7 +28,7 @@ export class DashboardView {
.pipe(map((transactions: IDisplayTransaction[]) => (isArray(transactions) ? transactions.slice(0, 5) : [])));
transactionsLoading$: Observable = this.store.select(selectTransactionsLoading);
- constructor(private store: Store, private sanitizer: DomSanitizer) { }
+ constructor(private store: Store, private sanitizer: DomSanitizer) {}
getHistoryStyle(length: number) {
return this.sanitizer.bypassSecurityTrustStyle('height: ' + length * 110 + 'px');
diff --git a/packages/lightwallet/desktop/src/app/core/dialog/backup-new-wallet/backup-new-wallet.component.ts b/packages/lightwallet/desktop/src/app/core/dialog/backup-new-wallet/backup-new-wallet.component.ts
index 07b2190bf3..2cf8e993f1 100644
--- a/packages/lightwallet/desktop/src/app/core/dialog/backup-new-wallet/backup-new-wallet.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/dialog/backup-new-wallet/backup-new-wallet.component.ts
@@ -3,12 +3,13 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'backup-new-wallet',
templateUrl: './backup-new-wallet.component.html',
- styleUrls: ['./backup-new-wallet.component.sass']
+ styleUrls: ['./backup-new-wallet.component.sass'],
})
-
export class BackupNewWallet {
- @Input() wallet;
- @Output() dismiss: EventEmitter = new EventEmitter();
+ @Input()
+ wallet;
+ @Output()
+ dismiss: EventEmitter = new EventEmitter();
copy: string = 'COPY';
showPhrase: boolean = false;
@@ -20,6 +21,6 @@ export class BackupNewWallet {
setTimeout(() => {
this.copy = 'COPY';
}, 1000);
- this.showNextBtn=true;
+ this.showNextBtn = true;
}
}
diff --git a/packages/lightwallet/desktop/src/app/core/dialog/record-passphrase/record-passphrase.component.ts b/packages/lightwallet/desktop/src/app/core/dialog/record-passphrase/record-passphrase.component.ts
index b074d62618..d23a0eae7f 100644
--- a/packages/lightwallet/desktop/src/app/core/dialog/record-passphrase/record-passphrase.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/dialog/record-passphrase/record-passphrase.component.ts
@@ -9,8 +9,10 @@ import { DisplayWallet } from '@merit/common/models/display-wallet';
export class RecordPassphraseComponent {
constructor() {}
- @Input() wallets: DisplayWallet[];
- @Output() dismiss: EventEmitter = new EventEmitter();
+ @Input()
+ wallets: DisplayWallet[];
+ @Output()
+ dismiss: EventEmitter = new EventEmitter();
copy: string = 'COPY';
showPhrase: boolean = false;
showNextBtn: boolean = false;
@@ -20,6 +22,6 @@ export class RecordPassphraseComponent {
setTimeout(() => {
this.copy = 'COPY';
}, 1000);
- this.showNextBtn=true;
+ this.showNextBtn = true;
}
}
diff --git a/packages/lightwallet/desktop/src/app/core/dialog/task-confirm/task-confirm.component.ts b/packages/lightwallet/desktop/src/app/core/dialog/task-confirm/task-confirm.component.ts
index 24d43d21d2..d16ca1646b 100644
--- a/packages/lightwallet/desktop/src/app/core/dialog/task-confirm/task-confirm.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/dialog/task-confirm/task-confirm.component.ts
@@ -10,7 +10,7 @@ import { filter, map } from 'rxjs/operators';
@Component({
selector: 'task-confirm',
templateUrl: './task-confirm.component.html',
- styleUrls: ['./task-confirm.component.sass']
+ styleUrls: ['./task-confirm.component.sass'],
})
export class TaskConfirmComponent implements OnInit {
@Input()
@@ -34,22 +34,18 @@ export class TaskConfirmComponent implements OnInit {
@Input()
arrow: string;
- trackerEnabled$: Observable = this.store.select(selectGoalSettings)
- .pipe(
- filter(settings => !!settings),
- map(settings => settings.isSetupTrackerEnabled)
- );
+ trackerEnabled$: Observable = this.store.select(selectGoalSettings).pipe(
+ filter(settings => !!settings),
+ map(settings => settings.isSetupTrackerEnabled),
+ );
goal: IFullGoal;
task: IFullTask;
- constructor(private store: Store,
- private goalsService: GoalsService) {}
+ constructor(private store: Store, private goalsService: GoalsService) {}
ngOnInit() {
- this.goal = this.goalsService.getGoal(
- this.goalsService.getGoalForTask(this.taskSlug)
- );
+ this.goal = this.goalsService.getGoal(this.goalsService.getGoalForTask(this.taskSlug));
this.task = this.goalsService.getFullTask(this.taskSlug);
}
diff --git a/packages/lightwallet/desktop/src/app/core/dialog/welcome-to-setup-tracker/welcome-to-setup-tracker.component.ts b/packages/lightwallet/desktop/src/app/core/dialog/welcome-to-setup-tracker/welcome-to-setup-tracker.component.ts
index d9e31ec492..9fe0c0a2ca 100644
--- a/packages/lightwallet/desktop/src/app/core/dialog/welcome-to-setup-tracker/welcome-to-setup-tracker.component.ts
+++ b/packages/lightwallet/desktop/src/app/core/dialog/welcome-to-setup-tracker/welcome-to-setup-tracker.component.ts
@@ -22,7 +22,7 @@ export class WelcomeToSetupTrackerComponent {
private formBuilder: FormBuilder,
private store: Store,
private router: Router,
- private goalsService: GoalsService
+ private goalsService: GoalsService,
) {}
closeAndSave() {
diff --git a/packages/lightwallet/desktop/src/app/core/global-settings/global-settings.view.ts b/packages/lightwallet/desktop/src/app/core/global-settings/global-settings.view.ts
index 196f1f7bcb..7346dee165 100644
--- a/packages/lightwallet/desktop/src/app/core/global-settings/global-settings.view.ts
+++ b/packages/lightwallet/desktop/src/app/core/global-settings/global-settings.view.ts
@@ -3,8 +3,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'view-global-settings',
templateUrl: './global-settings.view.html',
- styleUrls: ['./global-settings.view.sass']
+ styleUrls: ['./global-settings.view.sass'],
})
-export class GlobalSettingsView {
-
-}
+export class GlobalSettingsView {}
diff --git a/packages/lightwallet/desktop/src/app/core/global-settings/settings-preferences/settings-preferences.view.ts b/packages/lightwallet/desktop/src/app/core/global-settings/settings-preferences/settings-preferences.view.ts
index f37ea7457a..f43066eed3 100644
--- a/packages/lightwallet/desktop/src/app/core/global-settings/settings-preferences/settings-preferences.view.ts
+++ b/packages/lightwallet/desktop/src/app/core/global-settings/settings-preferences/settings-preferences.view.ts
@@ -24,10 +24,9 @@ declare const WEBPACK_CONFIG: any;
@Component({
selector: 'view-settings-preferences',
templateUrl: './settings-preferences.view.html',
- styleUrls: ['./settings-preferences.view.sass']
+ styleUrls: ['./settings-preferences.view.sass'],
})
export class SettingsPreferencesView implements OnInit, OnDestroy {
-
get isElectron(): boolean {
return ElectronService.isElectronAvailable;
}
@@ -42,20 +41,22 @@ export class SettingsPreferencesView implements OnInit, OnDestroy {
this.smsNotificationsService,
this.formBuilder,
this.toastCtrl,
- 'desktop'
+ 'desktop',
);
- constructor(private formBuilder: FormBuilder,
- private state: State,
- private persistenceService: PersistenceService2,
- private emailNotificationsService: EmailNotificationsService,
- private pushNotificationsService: PushNotificationsService,
- private toastCtrl: ToastControllerService,
- private confirmDialogCtrl: ConfirmDialogControllerService,
- private passwordPromptCtrl: PasswordPromptController,
- private profileService: ProfileService,
- private store: Store,
- private smsNotificationsService: SmsNotificationsService) {
+ constructor(
+ private formBuilder: FormBuilder,
+ private state: State