File tree Expand file tree Collapse file tree 5 files changed +9
-3
lines changed Expand file tree Collapse file tree 5 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 2
2
import { Entity } from '../interfaces/Entity'
3
3
import { EntityBase } from './EntityBase'
4
4
5
+ // a ethereum address
5
6
export class Address extends EntityBase implements Entity {
6
7
public errorMessage :string = 'invalid'
7
8
private address
Original file line number Diff line number Diff line change 2
2
import { Entity } from '../interfaces/Entity'
3
3
import { EntityBase } from './EntityBase'
4
4
5
+ // api key for etherscan.io
5
6
export class ApiKey extends EntityBase implements Entity {
6
7
public errorMessage :string = 'invalid'
7
8
private apiKey
Original file line number Diff line number Diff line change
1
+
2
+ // base class for entities
1
3
export abstract class EntityBase {
4
+ // basic error message for exceptions on validations
2
5
public errorMessage : string
6
+ // checks valid() and throws errorMessage
3
7
validate ( ) : void {
4
8
if ( ! this . valid ( ) ) {
5
9
throw new Error ( this . errorMessage )
Original file line number Diff line number Diff line change 1
1
2
2
import { Entity } from '../interfaces/Entity'
3
3
import { EntityBase } from './EntityBase'
4
- /*
5
- * @see https://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hexadecimal-in-javascript
6
- */
4
+
5
+ // a positive number
7
6
export class PositiveNumber extends EntityBase implements Entity {
8
7
public errorMessage :string = 'invalid'
9
8
private positiveNumber :any
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Entity } from '../interfaces/Entity'
3
3
import { EntityBase } from './EntityBase'
4
4
import { sort } from '../parameters/sort'
5
5
6
+ // Sort Parameter asc or desc
6
7
export class Sort extends EntityBase implements Entity {
7
8
public errorMessage :string = 'invalid'
8
9
private sortParam :string
You can’t perform that action at this time.
0 commit comments