Skip to content

Commit 92f0259

Browse files
committed
feat(insight): begin building out blocks view, related components
1 parent 5550dea commit 92f0259

42 files changed

Lines changed: 624 additions & 124 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/bitcore-node/src/models/block.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,9 @@ import { LoggifyClass } from '../decorators/Loggify';
55
import { Bitcoin } from '../types/namespaces/Bitcoin';
66
import { BaseModel, MongoBound } from './base';
77
import logger from '../logger';
8+
import { IBlock } from '../types/Block';
89

9-
export type IBlock = {
10-
chain: string;
11-
network: string;
12-
height: number;
13-
hash: string;
14-
version: number;
15-
merkleRoot: string;
16-
time: Date;
17-
timeNormalized: Date;
18-
nonce: number;
19-
previousBlockHash: string;
20-
nextBlockHash: string;
21-
transactionCount: number;
22-
size: number;
23-
bits: number;
24-
reward: number;
25-
processed: boolean;
26-
};
10+
export { IBlock };
2711

2812
@LoggifyClass
2913
export class Block extends BaseModel<IBlock> {

packages/bitcore-node/src/services/storage.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ import { ObjectID } from 'bson';
88
import { MongoClient, Db, Cursor } from 'mongodb';
99
import { MongoBound } from '../models/base';
1010
import '../models';
11+
import { StreamingFindOptions } from '../types/Query';
12+
13+
export { StreamingFindOptions };
1114

12-
export type StreamingFindOptions<T> = Partial<{
13-
paging: keyof T;
14-
since: T[keyof T];
15-
sort: any;
16-
direction: 1 | -1;
17-
limit: number;
18-
}>;
1915
@LoggifyClass
2016
export class StorageService {
2117
client?: MongoClient;
@@ -88,8 +84,8 @@ export class StorageService {
8884
typecastedValue = new Date(oldValue) as any;
8985
break;
9086
}
91-
// TODO: Micah check this!
92-
} else if (modelKey == "_id") {
87+
// TODO: Micah check this!
88+
} else if (modelKey == '_id') {
9389
typecastedValue = new ObjectID(oldValue) as any;
9490
}
9591
}
@@ -123,17 +119,13 @@ export class StorageService {
123119
}
124120
getFindOptions<T>(model: TransformableModel<T>, originalOptions: StreamingFindOptions<T>) {
125121
let options: StreamingFindOptions<T> = {};
126-
let query: any = {}, since: any;
127-
if ( originalOptions.paging &&
128-
this.validPagingProperty(model, originalOptions.paging)
129-
) {
130-
131-
122+
let query: any = {},
123+
since: any;
124+
if (originalOptions.paging && this.validPagingProperty(model, originalOptions.paging)) {
132125
if (originalOptions.since !== undefined) {
133126
since = this.typecastForDb(model, originalOptions.paging, originalOptions.since);
134127
}
135128

136-
137129
if (originalOptions.direction && Number(originalOptions.direction) === 1) {
138130
if (since) {
139131
query[originalOptions.paging] = { $gt: since };
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export type IBlock = {
2+
chain: string;
3+
network: string;
4+
height: number;
5+
hash: string;
6+
version: number;
7+
merkleRoot: string;
8+
time: Date;
9+
timeNormalized: Date;
10+
nonce: number;
11+
previousBlockHash: string;
12+
nextBlockHash: string;
13+
transactionCount: number;
14+
size: number;
15+
bits: number;
16+
reward: number;
17+
processed: boolean;
18+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const enum Direction {
2+
ascending = 1,
3+
descending = -1
4+
}
5+
6+
export type StreamingFindOptions<T> = Partial<{
7+
paging: keyof T;
8+
since: T[keyof T];
9+
sort: any;
10+
direction: Direction;
11+
limit: number;
12+
}>;

packages/insight/angular.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
"sourceRoot": "src",
1010
"projectType": "application",
1111
"prefix": "app",
12-
"schematics": {},
12+
"schematics": {
13+
"@schematics/angular:component": {
14+
"styleext": "scss"
15+
}
16+
},
1317
"architect": {
1418
"build": {
1519
"builder": "@angular-devkit/build-angular:browser",

packages/insight/package-lock.json

Lines changed: 36 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/insight/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"@ionic/angular": "^4.0.0-beta.12",
5454
"backoff-rxjs": "0.0.10",
5555
"core-js": "^2.5.3",
56+
"fast-deep-equal": "^2.0.1",
5657
"ngx-logger": "^3.3.2",
5758
"rxjs": "~6.3.3",
5859
"zone.js": "^0.8.26"
Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
<ion-app>
2-
<ion-split-pane when="lg">
3-
<ion-menu>
4-
<ion-content>
5-
<ion-list>
6-
<ion-menu-toggle auto-hide="false" *ngFor="let p of appPages">
7-
<ion-item [routerDirection]="'root'" [routerLink]="[p.url]">
8-
<ion-label>
9-
{{ p.title }}
10-
</ion-label>
11-
</ion-item>
12-
</ion-menu-toggle>
13-
</ion-list>
14-
</ion-content>
15-
</ion-menu>
16-
<ion-router-outlet main></ion-router-outlet>
17-
</ion-split-pane>
18-
</ion-app>
2+
<ion-split-pane when="lg">
3+
<ion-menu>
4+
<ion-content
5+
class="dark-theme"
6+
padding
7+
>
8+
<ion-list>
9+
<ion-menu-toggle
10+
auto-hide="false"
11+
*ngFor="let p of appPages"
12+
>
13+
<ion-item
14+
[routerDirection]="'root'"
15+
[routerLink]="[p.url]"
16+
>
17+
<ion-label>{{ p.title }}</ion-label>
18+
</ion-item>
19+
</ion-menu-toggle>
20+
</ion-list>
21+
</ion-content>
22+
</ion-menu>
23+
<ion-router-outlet main></ion-router-outlet>
24+
</ion-split-pane>
25+
</ion-app>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.dark-theme {
2+
--ion-background-color: #3d3d4d;
3+
--ion-item-background-color-active: lighten(--ion-background-color, 15%);
4+
--ion-text-color: rgba(255, 255, 255, 0.9);
5+
}

packages/insight/src/app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { Platform } from '@ionic/angular';
66

77
@Component({
88
selector: 'app-root',
9-
templateUrl: 'app.component.html'
9+
templateUrl: 'app.component.html',
10+
styleUrls: ['app.component.scss']
1011
})
1112
export class AppComponent {
1213
public appPages = [

0 commit comments

Comments
 (0)