Commit 5e3ec797 authored by Paul Herbert's avatar Paul Herbert

2100 - Breeze Updates for ICO. First commit.

parent 9c171842
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
"zone.js": "0.8.18" "zone.js": "0.8.18"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "1.6.0", "@angular/cli": "^1.7.4",
"@angular/compiler-cli": "5.1.0", "@angular/compiler-cli": "5.1.0",
"@angular/language-service": "5.1.0", "@angular/language-service": "5.1.0",
"@types/core-js": "0.9.36", "@types/core-js": "0.9.36",
...@@ -73,8 +73,8 @@ ...@@ -73,8 +73,8 @@
"autoprefixer": "7.2.2", "autoprefixer": "7.2.2",
"circular-dependency-plugin": "4.3.0", "circular-dependency-plugin": "4.3.0",
"codelyzer": "4.0.2", "codelyzer": "4.0.2",
"copyfiles": "1.2.0",
"copy-webpack-plugin": "4.2.3", "copy-webpack-plugin": "4.2.3",
"copyfiles": "1.2.0",
"cross-env": "5.1.1", "cross-env": "5.1.1",
"css-loader": "0.28.7", "css-loader": "0.28.7",
"cssnano": "3.10.0", "cssnano": "3.10.0",
...@@ -101,10 +101,11 @@ ...@@ -101,10 +101,11 @@
"less-loader": "4.0.5", "less-loader": "4.0.5",
"minimist": "1.2.0", "minimist": "1.2.0",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"node-sass": "4.7.2",
"npm-run-all": "4.1.2", "npm-run-all": "4.1.2",
"npx": "9.7.1", "npx": "9.7.1",
"node-sass": "4.7.2",
"popper.js": "1.12.9", "popper.js": "1.12.9",
"postcss-custom-properties": "^7.0.0",
"postcss-loader": "2.0.9", "postcss-loader": "2.0.9",
"postcss-url": "7.3.0", "postcss-url": "7.3.0",
"protractor": "5.2.1", "protractor": "5.2.1",
......
...@@ -28,7 +28,7 @@ export class ApiService { ...@@ -28,7 +28,7 @@ export class ApiService {
private headers = new Headers({'Content-Type': 'application/json'}); private headers = new Headers({'Content-Type': 'application/json'});
private pollingInterval = 3000; private pollingInterval = 3000;
private bitcoinApiUrl = 'http://localhost:37220/api'; private bitcoinApiUrl = 'http://localhost:37220/api';
private stratisApiUrl = 'http://localhost:37221/api'; private stratisApiUrl = 'http://localhost:37221/api' ;
private currentApiUrl = 'http://localhost:37220/api'; private currentApiUrl = 'http://localhost:37220/api';
private getCurrentCoin() { private getCurrentCoin() {
......
<div class="container" style="border:1px solid lightgray; border-radius: 4px; padding:10px; position: absolute; left:100px; width:50%">
<h4>ICO</h4>
<div style="margin-top:15px">
<div>
<label style="font-size:13px;margin-bottom:0px">Extended Public Key</label>
<div class="myAddress" *ngIf="extPubKeyLoadingState.success; else elseFeedback"><code style="overflow-wrap: break-word">{{ extPubKey }}</code></div>
<ng-template #elseFeedback>
<app-feedback [loading]="extPubKeyLoadingState.loading"
[errored]="extPubKeyLoadingState.errored"
[erroredText]="extPubKeyLoadingState.erroredText"></app-feedback>
</ng-template>
</div>
</div>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdvancedIcoComponent } from './advanced-ico.component';
describe('AdvancedIcoComponent', () => {
let component: AdvancedIcoComponent;
let fixture: ComponentFixture<AdvancedIcoComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdvancedIcoComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdvancedIcoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnDestroy } from '@angular/core';
import { Subscription } from 'rxJs/Subscription';
import { AdvancedService } from './../advanced.service';
import { LoadingState } from './loadingState';
@Component({
selector: 'app-advanced-ico',
templateUrl: './advanced-ico.component.html',
styleUrls: ['./advanced-ico.component.css']
})
export class AdvancedIcoComponent implements OnDestroy {
private _extPubKey = '';
private extPubKeySubs: Subscription;
private _extPubKeyLoadingState: LoadingState = new LoadingState("Failed to get ExtPubKey");
constructor(private advancedService: AdvancedService) {
this.loadExtPubKey();
}
public get extPubKey(): string {
return this._extPubKey;
}
public get extPubKeyLoadingState(): LoadingState {
return this._extPubKeyLoadingState;
}
ngOnDestroy() {
this.extPubKeySubs.unsubscribe();
}
private loadExtPubKey() {
this.extPubKeyLoadingState.loading = true;
this.extPubKeySubs = this.advancedService.getExtPubKey()
.subscribe(x => this.onExtPubKey(x), e => this.extPubKeyLoadingState.errored = true);
}
private onExtPubKey(key: string) {
this._extPubKey = key;
this.extPubKeyLoadingState.loading = false;
}
}
export class LoadingState {
private _loading = false;
private _errored = false;
private _erroredText = "";
constructor(erroredText: string) {
this._erroredText = erroredText;
}
public get erroredText(): string {
return this._erroredText;
}
public get loading(): boolean {
return this._loading;
}
public set loading(value: boolean) {
this._loading = value;
if (this._loading) {
this._errored = false;
}
}
public get errored(): boolean {
return this._errored;
}
public set errored(value: boolean) {
this._errored = value;
if (this._errored) {
this._loading = false;
}
}
public get success(): boolean {
return !this._loading && !this._errored;
}
}
.mainDiv {
margin-left: 100px;
margin-top: 20px;
}
\ No newline at end of file
<div class="mainDiv">
<app-advanced-ico></app-advanced-ico>
</div>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdvancedComponent } from './advanced.component';
describe('AdvancedComponent', () => {
let component: AdvancedComponent;
let fixture: ComponentFixture<AdvancedComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdvancedComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdvancedComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit, OnDestroy } from '@angular/core';
@Component({
selector: 'app-advanced',
templateUrl: './advanced.component.html',
styleUrls: ['./advanced.component.css']
})
export class AdvancedComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { TestBed, inject } from '@angular/core/testing';
import { AdvancedService } from './advanced.service';
describe('AdvancedService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AdvancedService]
});
});
it('should be created', inject([AdvancedService], (service: AdvancedService) => {
expect(service).toBeTruthy();
}));
});
import { Injectable } from '@angular/core';
import { Observable } from 'rxJs/Observable';
import { HttpClient } from '@angular/common/http';
import { GlobalService } from '../../shared/services/global.service';
@Injectable()
export class AdvancedService {
private readonly accountName = 'account 0';
private readonly urlPrefix = 'http://localhost:37221/api/Wallet/';
constructor(private httpClient: HttpClient, private globalService: GlobalService) { }
public getExtPubKey(): Observable<string> {
const walletName = this.globalService.getWalletName();
const url = `${this.urlPrefix}extpubkey?WalletName=${walletName}&AccountName=${this.accountName}`;
return this.httpClient.get(url).map(x => x.toString());
}
}
<div>
<div class="progress" *ngIf="loading">
<div class="progress-bar progress-bar-striped progress-bar-animated"
role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
Working...
</div>
</div>
<div class="alert alert-danger" role="alert" *ngIf="errored">
{{erroredText}}
</div>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FeedbackComponent } from './feedback.component';
describe('FeedbackComponent', () => {
let component: FeedbackComponent;
let fixture: ComponentFixture<FeedbackComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FeedbackComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FeedbackComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-feedback',
templateUrl: './feedback.component.html',
styleUrls: ['./feedback.component.css']
})
export class FeedbackComponent {
private _loading = false;
private _errored = false;
private _erroredText = "Failed";
@Input()
public set loading(value: boolean) {
this._loading = value;
}
public get loading(): boolean {
return this._loading;
}
@Input()
public set errored(value: boolean) {
this._errored = value;
}
public get errored(): boolean {
return this._errored;
}
@Input()
public set erroredText(value: string) {
this._erroredText = value;
}
public get erroredText(): string {
return this._erroredText;
}
}
...@@ -11,7 +11,6 @@ import { SendComponent } from '../send/send.component'; ...@@ -11,7 +11,6 @@ import { SendComponent } from '../send/send.component';
import { ReceiveComponent } from '../receive/receive.component'; import { ReceiveComponent } from '../receive/receive.component';
import { TransactionDetailsComponent } from '../transaction-details/transaction-details.component'; import { TransactionDetailsComponent } from '../transaction-details/transaction-details.component';
import { Observable } from 'rxjs/Rx';
import { Subscription } from 'rxjs/Subscription'; import { Subscription } from 'rxjs/Subscription';
@Component({ @Component({
......
...@@ -8,7 +8,6 @@ import { ModalService } from '../../shared/services/modal.service'; ...@@ -8,7 +8,6 @@ import { ModalService } from '../../shared/services/modal.service';
import { WalletInfo } from '../../shared/classes/wallet-info'; import { WalletInfo } from '../../shared/classes/wallet-info';
import { TransactionInfo } from '../../shared/classes/transaction-info'; import { TransactionInfo } from '../../shared/classes/transaction-info';
import { Observable } from 'rxjs/Rx';
import { Subscription } from 'rxjs/Subscription'; import { Subscription } from 'rxjs/Subscription';
import { TransactionDetailsComponent } from '../transaction-details/transaction-details.component'; import { TransactionDetailsComponent } from '../transaction-details/transaction-details.component';
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" routerLink="history" [routerLinkActive]="['is-active']">History</a> <a class="nav-link" routerLink="history" [routerLinkActive]="['is-active']">History</a>
</li> </li>
<li class="nav-item">
<a class="nav-link" routerLink="advanced" [routerLinkActive]="['is-active']">Advanced</a>
</li>
</ul> </ul>
<!-- /ul--> <!-- /ul-->
<div class="ml-auto d-flex align-items-center"> <div class="ml-auto d-flex align-items-center">
......
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Component, OnInit, OnDestroy } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { Subscription } from 'rxjs/Subscription'; import { Subscription } from 'rxjs/Subscription';
import { ApiService } from '../../shared/services/api.service'; import { ApiService } from '../../shared/services/api.service';
...@@ -27,7 +26,7 @@ export class StatusBarComponent implements OnInit { ...@@ -27,7 +26,7 @@ export class StatusBarComponent implements OnInit {
constructor(private apiService: ApiService, private globalService: GlobalService, private genericModalService: ModalService) { } constructor(private apiService: ApiService, private globalService: GlobalService, private genericModalService: ModalService) { }
ngOnInit() { ngOnInit() {
this.startSubscriptions(); this.startSubscriptions() ;
} }
ngOnDestroy() { ngOnDestroy() {
......
...@@ -2,24 +2,25 @@ import { NgModule } from '@angular/core'; ...@@ -2,24 +2,25 @@ import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { WalletComponent } from './wallet.component'; import { WalletComponent } from './wallet.component';
import { SendComponent } from './send/send.component';
import { ReceiveComponent } from './receive/receive.component';
import { HistoryComponent } from './history/history.component'; import { HistoryComponent } from './history/history.component';
import { DashboardComponent } from './dashboard/dashboard.component'; import { DashboardComponent } from './dashboard/dashboard.component';
import { AdvancedComponent } from './advanced/advanced.component'
const routes: Routes = [ const routes: Routes = [
{ path: '', component: WalletComponent, { path: '', component: WalletComponent,
children: [ children: [
{ path: '', redirectTo:'dashboard', pathMatch:'full' }, { path: '', redirectTo:'dashboard', pathMatch:'full' },
{ path: 'dashboard', component: DashboardComponent}, { path: 'dashboard', component: DashboardComponent },
{ path: 'history', component: HistoryComponent} { path: 'history', component: HistoryComponent },
{ path: 'advanced', component: AdvancedComponent }
] ]
}, },
{ path: 'stratis-wallet', component: WalletComponent, { path: 'stratis-wallet', component: WalletComponent,
children: [ children: [
{ path: '', redirectTo:'dashboard', pathMatch:'full' }, { path: '', redirectTo:'dashboard', pathMatch:'full' },
{ path: 'dashboard', component: DashboardComponent}, { path: 'dashboard', component: DashboardComponent },
{ path: 'history', component: HistoryComponent} { path: 'history', component: HistoryComponent },
{ path: 'advanced', component: AdvancedComponent }
] ]
} }
]; ];
......
...@@ -3,6 +3,7 @@ import { NgModule } from '@angular/core'; ...@@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { ClipboardModule } from 'ngx-clipboard'; import { ClipboardModule } from 'ngx-clipboard';
import { HttpClientModule } from '@angular/common/http';
import { WalletComponent } from './wallet.component'; import { WalletComponent } from './wallet.component';
import { MenuComponent } from './menu/menu.component'; import { MenuComponent } from './menu/menu.component';
...@@ -13,10 +14,15 @@ import { SharedModule } from '../shared/shared.module'; ...@@ -13,10 +14,15 @@ import { SharedModule } from '../shared/shared.module';
import { WalletRoutingModule } from './wallet-routing.module'; import { WalletRoutingModule } from './wallet-routing.module';
import { SidebarComponent } from './sidebar/sidebar.component'; import { SidebarComponent } from './sidebar/sidebar.component';
import { StatusBarComponent } from './status-bar/status-bar.component'; import { StatusBarComponent } from './status-bar/status-bar.component';
import { TransactionDetailsComponent } from './transaction-details/transaction-details.component'; import { AdvancedComponent } from './advanced/advanced.component';
import { AdvancedIcoComponent } from './advanced/advanced-ico/advanced-ico.component';
import { AdvancedService } from '../wallet/advanced/advanced.service';
import { FeedbackComponent } from './advanced/feedback/feedback.component';
@NgModule({ @NgModule({
imports: [ imports: [
HttpClientModule,
CommonModule, CommonModule,
ClipboardModule, ClipboardModule,
FormsModule, FormsModule,
...@@ -31,7 +37,13 @@ import { TransactionDetailsComponent } from './transaction-details/transaction-d ...@@ -31,7 +37,13 @@ import { TransactionDetailsComponent } from './transaction-details/transaction-d
DashboardComponent, DashboardComponent,
HistoryComponent, HistoryComponent,
SidebarComponent, SidebarComponent,
StatusBarComponent StatusBarComponent,
AdvancedComponent,
AdvancedIcoComponent,
FeedbackComponent
],
providers: [
AdvancedService
], ],
exports: [] exports: []
}) })
......
...@@ -238,7 +238,7 @@ function getPlugins() { ...@@ -238,7 +238,7 @@ function getPlugins() {
} }
module.exports = { module.exports = {
"devtool": "source-map", "devtool": "eval-source-map",
"externals": { "externals": {
"electron": "require('electron')", "electron": "require('electron')",
"buffer": "require('buffer')", "buffer": "require('buffer')",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment