-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #645 from Cryptorubic/develop
New wallets
- Loading branch information
Showing
137 changed files
with
2,579 additions
and
5,706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
last 2 versions | ||
Firefox ESR | ||
not dead | ||
not IE 11 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,45 @@ | ||
import { ErrorType } from 'src/app/core/errors/models/error-type'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
import { Type } from '@angular/core'; | ||
|
||
export abstract class RubicError extends Error { | ||
public translateKey: string; | ||
type TranslationKey = string; | ||
|
||
public type: ErrorType; | ||
type Component = Type<object>; | ||
|
||
public component: Type<object>; | ||
export abstract class RubicError<T extends ERROR_TYPE> extends Error { | ||
public translateKey: TranslationKey; | ||
|
||
public type: ERROR_TYPE; | ||
|
||
public component: Component; | ||
|
||
public data: object; | ||
|
||
public displayError: boolean; | ||
public displayError = true; | ||
|
||
protected constructor( | ||
errorType: ErrorType, | ||
translateKey?: string, | ||
message?: string, | ||
component?: Type<object>, | ||
data?: object | ||
contentProvider: T extends ERROR_TYPE.TEXT | ||
? TranslationKey | ||
: T extends ERROR_TYPE.COMPONENT | ||
? Component | ||
: null, | ||
data?: object, | ||
message?: string | ||
) { | ||
super(message); | ||
this.translateKey = translateKey; | ||
this.type = errorType; | ||
this.component = component; | ||
this.data = data; | ||
this.displayError = true; | ||
|
||
if (!contentProvider) { | ||
this.type = ERROR_TYPE.RAW_MESSAGE; | ||
return; | ||
} | ||
|
||
if (typeof contentProvider === 'string') { | ||
this.translateKey = contentProvider; | ||
this.type = ERROR_TYPE.TEXT; | ||
return; | ||
} | ||
|
||
this.component = contentProvider; | ||
this.type = ERROR_TYPE.COMPONENT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class NotSupportedBridgeError extends RubicError { | ||
export class NotSupportedBridgeError extends RubicError<ERROR_TYPE.TEXT> { | ||
public comment: string; | ||
|
||
constructor() { | ||
super('text', 'errors.notSupportedBridge'); | ||
super('errors.notSupportedBridge'); | ||
Object.setPrototypeOf(this, NotSupportedBridgeError.prototype); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { OverQueryLimitErrorComponent } from 'src/app/core/errors/components/over-query-limit-error/over-query-limit-error.component'; | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class OverQueryLimitError extends RubicError { | ||
export class OverQueryLimitError extends RubicError<ERROR_TYPE.COMPONENT> { | ||
constructor() { | ||
super('component', null, null, OverQueryLimitErrorComponent); | ||
super(OverQueryLimitErrorComponent); | ||
Object.setPrototypeOf(this, OverQueryLimitError.prototype); | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
src/app/core/errors/models/common/transaction-reverted.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export type ErrorType = 'component' | 'text'; | ||
export enum ERROR_TYPE { | ||
TEXT = 'TEXT', | ||
COMPONENT = 'COMPONENT', | ||
RAW_MESSAGE = 'RAW_MESSAGE' | ||
} |
5 changes: 3 additions & 2 deletions
5
src/app/core/errors/models/instant-trade/InsufficientFundsError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/app/core/errors/models/instant-trade/insufficient-liquidity.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/app/core/errors/models/instant-trade/no-selected-provider.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/app/core/errors/models/instant-trade/not-supported-it-network.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class NotSupportedItNetwork extends RubicError { | ||
export class NotSupportedItNetwork extends RubicError<ERROR_TYPE.TEXT> { | ||
constructor() { | ||
super('text', 'errors.notSupportedItNetwork'); | ||
super('errors.notSupportedItNetwork'); | ||
Object.setPrototypeOf(this, NotSupportedItNetwork.prototype); | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
src/app/core/errors/models/instant-trade/oneinch-refresh.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class OneinchRefreshError extends RubicError { | ||
export class OneinchRefreshError extends RubicError<ERROR_TYPE.TEXT> { | ||
constructor() { | ||
super('text', 'errors.oneinchRefreshError'); | ||
super('errors.oneinchRefreshError'); | ||
Object.setPrototypeOf(this, OneinchRefreshError.prototype); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class AccountError extends RubicError { | ||
export class AccountError extends RubicError<ERROR_TYPE.TEXT> { | ||
constructor() { | ||
super('text', 'errors.noMetamaskAccess'); | ||
super('errors.noMetamaskAccess'); | ||
Object.setPrototypeOf(this, AccountError.prototype); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/app/core/errors/models/provider/CoinbaseExtensionError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class CoinbaseExtensionError extends RubicError<ERROR_TYPE.TEXT> { | ||
constructor() { | ||
super('errors.removeCoinbaseExtension'); | ||
Object.setPrototypeOf(this, CoinbaseExtensionError.prototype); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class LowGasError extends RubicError { | ||
export class LowGasError extends RubicError<ERROR_TYPE.TEXT> { | ||
constructor() { | ||
super('text', 'errors.lowGas'); | ||
super('errors.lowGas'); | ||
Object.setPrototypeOf(this, LowGasError.prototype); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { MetamaskErrorComponent } from 'src/app/core/errors/components/metamask-error/metamask-error.component'; | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class MetamaskError extends RubicError { | ||
export class MetamaskError extends RubicError<ERROR_TYPE.COMPONENT> { | ||
constructor() { | ||
super('component', null, null, MetamaskErrorComponent); | ||
super(MetamaskErrorComponent); | ||
Object.setPrototypeOf(this, MetamaskError.prototype); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { NetworkErrorComponent } from 'src/app/core/errors/components/network-error/network-error.component'; | ||
import { RubicError } from 'src/app/core/errors/models/RubicError'; | ||
import { ERROR_TYPE } from 'src/app/core/errors/models/error-type'; | ||
|
||
export class NetworkError extends RubicError { | ||
export class NetworkError extends RubicError<ERROR_TYPE.COMPONENT> { | ||
constructor(public readonly networkToChoose: string) { | ||
super('component', null, null, NetworkErrorComponent, { networkToChoose }); | ||
super(NetworkErrorComponent, { networkToChoose }); | ||
Object.setPrototypeOf(this, NetworkError.prototype); | ||
} | ||
} |
Oops, something went wrong.