Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
1344ee0e
Commit
1344ee0e
authored
Jul 31, 2018
by
Paul Herbert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2100 - Breeze Updates for ICO: Generate Addresses complete.
parent
ee131b80
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
32 deletions
+86
-32
advanced-ico.component.html
.../wallet/advanced/advanced-ico/advanced-ico.component.html
+17
-8
advanced-ico.component.ts
...pp/wallet/advanced/advanced-ico/advanced-ico.component.ts
+48
-20
loadingState.ts
...e.UI/src/app/wallet/advanced/advanced-ico/loadingState.ts
+3
-1
advanced.service.ts
Breeze.UI/src/app/wallet/advanced/advanced.service.ts
+18
-3
Tick_Mark-16.png
Breeze.UI/src/assets/images/Tick_Mark-16.png
+0
-0
No files found.
Breeze.UI/src/app/wallet/advanced/advanced-ico/advanced-ico.component.html
View file @
1344ee0e
...
...
@@ -15,14 +15,23 @@
<div
style=
"margin-top:20px"
>
<label
style=
"font-size:14px;margin-bottom:1px"
>
Generate Addresses
</label>
<div
class=
"input-group"
style=
"width:240px; height:35px"
>
<input
formControlName=
"addressCountControl"
type=
"text"
class=
"form-control"
placeholder=
"Number to generate..."
style=
"border-radius: 0px"
>
<span
class=
"input-group-btn"
>
<div>
<button
*
ngIf=
"!addressCountControl.invalid"
style=
"outline: none"
class=
"btn btn-default"
type=
"button"
>
Go
</button>
<button
*
ngIf=
"addressCountControl.invalid"
style=
"outline:none; color: gray"
class=
"btn btn-default"
type=
"button"
>
Go
</button>
</div>
</span>
<div
style=
"display:flex; flex-direction:row"
>
<div
class=
"input-group"
style=
"height:35px; margin-bottom:1px; width:240px"
>
<input
formControlName=
"addressCountControl"
type=
"text"
class=
"form-control"
placeholder=
"Number to generate..."
style=
"border-radius: 0px"
>
<span
class=
"input-group-btn"
>
<div>
<button
*
ngIf=
"!addressCountControl.invalid && addressCount"
(
click
)="
generateAddresses
()"
class=
"btn btn-default"
type=
"button"
>
Go
</button>
<button
*
ngIf=
"addressCountControl.invalid || !addressCount"
style=
"color: gray; outline:none"
class=
"btn btn-default"
type=
"button"
>
Go
</button>
</div>
</span>
</div>
<img
style=
"width:16px; height:16px; margin-left:6px"
*
ngIf=
"showTick"
src=
"../../../../assets/images/Tick_Mark-16.png"
/>
<app-feedback
*
ngIf=
"!generateAddressesLoadingState.success"
style=
"margin-left:5px; width:115px"
[
loading
]="
generateAddressesLoadingState
.
loading
"
[
errored
]="
generateAddressesLoadingState
.
errored
"
[
erroredText
]="'
Failed
to
generate
'"
></app-feedback>
</div>
</div>
...
...
Breeze.UI/src/app/wallet/advanced/advanced-ico/advanced-ico.component.ts
View file @
1344ee0e
import
{
Component
,
OnInit
,
OnDestroy
,
Input
}
from
'@angular/core'
;
import
{
Subscription
}
from
'rxJs/Subscription'
;
import
{
FormGroup
,
FormControl
,
Validators
,
FormBuilder
}
from
'@angular/forms'
;
import
{
FormGroup
,
Validators
,
FormBuilder
}
from
'@angular/forms'
;
import
'rxjs/add/operator/filter'
;
import
{
timer
}
from
'rxjs/observable/timer'
;
import
{
AdvancedService
}
from
'./../advanced.service'
;
import
{
LoadingState
}
from
'./loadingState'
;
...
...
@@ -13,45 +13,68 @@ import { LoadingState } from './loadingState';
styleUrls
:
[
'./advanced-ico.component.css'
]
})
export
class
AdvancedIcoComponent
implements
OnInit
,
OnDestroy
{
public
icoFormGroup
:
FormGroup
;
private
_extPubKey
=
''
;
private
addressCount
:
string
;
private
extPubKeySubs
:
Subscription
;
private
_extPubKeyLoadingState
:
LoadingState
=
new
LoadingState
();
private
generateAddressesSubs
:
Subscription
;
private
addresses
=
new
Array
<
string
>
();
constructor
(
private
advancedService
:
AdvancedService
,
private
formBuilder
:
FormBuilder
)
{
this
.
loadExtPubKey
();
}
constructor
(
private
advancedService
:
AdvancedService
,
private
formBuilder
:
FormBuilder
)
{
}
ngOnInit
()
{
this
.
registerFormControls
();
this
.
loadExtPubKey
();
}
public
get
extPubKey
():
string
{
return
this
.
_extPubKey
;
}
public
get
extPubKeyLoadingState
():
LoadingState
{
return
this
.
_extPubKeyLoadingState
;
}
public
icoFormGroup
:
FormGroup
;
public
extPubKey
=
""
;
public
extPubKeyLoadingState
=
new
LoadingState
();
public
generateAddressesLoadingState
=
new
LoadingState
();
public
get
addressCountControl
()
{
return
this
.
icoFormGroup
.
get
(
'addressCountControl'
);
}
public
get
showTick
()
{
return
this
.
generateAddressesLoadingState
.
success
&&
this
.
addresses
.
length
&&
(
Number
(
this
.
addressCount
)
===
this
.
addresses
.
length
)
}
public
generateAddresses
()
{
this
.
internalGenerateAddresses
();
}
private
loadExtPubKey
()
{
this
.
extPubKeyLoadingState
.
loading
=
true
;
this
.
extPubKeySubs
=
this
.
advancedService
.
getExtPubKey
()
.
subscribe
(
x
=>
this
.
onExtPubKey
(
x
),
e
=>
this
.
extPubKeyLoadingState
.
errored
=
true
);
.
subscribe
(
x
=>
this
.
onExtPubKey
(
x
),
_
=>
this
.
extPubKeyLoadingState
.
errored
=
true
);
}
private
internalGenerateAddresses
()
{
this
.
addresses
=
new
Array
<
string
>
();
this
.
generateAddressesLoadingState
.
loading
=
true
;
if
(
this
.
generateAddressesSubs
)
{
this
.
generateAddressesSubs
.
unsubscribe
();
}
this
.
generateAddressesSubs
=
this
.
advancedService
.
generateAddresses
(
Number
(
this
.
addressCount
))
.
subscribe
(
x
=>
this
.
onGenerateAddresses
(
x
),
_
=>
this
.
generateAddressesLoadingState
.
errored
=
true
);
}
private
onExtPubKey
(
key
:
string
)
{
this
.
_
extPubKey
=
key
;
this
.
extPubKey
=
key
;
this
.
extPubKeyLoadingState
.
loading
=
false
;
}
private
onGenerateAddresses
(
addresses
:
string
[])
{
this
.
generateAddressesLoadingState
.
loading
=
false
;
this
.
addresses
=
addresses
;
}
private
registerFormControls
()
{
this
.
icoFormGroup
=
this
.
formBuilder
.
group
({
addressCountControl
:
[
""
,
[
Validators
.
required
,
Validators
.
pattern
(
'^[1-9][0-9]*$'
)]]
addressCountControl
:
[
''
,
[
Validators
.
pattern
(
'^[1-9][0-9]*$'
)]]
});
let
ignore
=
false
;
this
.
addressCountControl
.
valueChanges
.
filter
(
_
=>
!
ignore
).
subscribe
(
_
=>
{
if
(
this
.
addressCountControl
.
invalid
&&
this
.
addressCountControl
.
value
)
{
ignore
=
true
;
this
.
addressCountControl
.
setValue
(
this
.
addressCount
);
ignore
=
false
;
this
.
addressCountControl
.
valueChanges
.
subscribe
(
_
=>
{
if
(
this
.
addressCountControl
.
invalid
)
{
this
.
addressCountControl
.
setValue
(
this
.
addressCount
);
}
else
{
this
.
addressCount
=
this
.
addressCountControl
.
value
;
}
...
...
@@ -59,6 +82,11 @@ export class AdvancedIcoComponent implements OnInit, OnDestroy {
}
ngOnDestroy
()
{
this
.
extPubKeySubs
.
unsubscribe
();
if
(
this
.
extPubKeySubs
)
{
this
.
extPubKeySubs
.
unsubscribe
();
}
if
(
this
.
generateAddressesSubs
)
{
this
.
generateAddressesSubs
.
unsubscribe
();
}
}
}
Breeze.UI/src/app/wallet/advanced/advanced-ico/loadingState.ts
View file @
1344ee0e
export
class
LoadingState
{
private
_loading
=
false
;
private
_errored
=
false
;
...
...
@@ -7,6 +6,9 @@ export class LoadingState {
public
get
erroredText
():
string
{
return
this
.
_erroredText
;
}
public
set
erroredText
(
value
:
string
)
{
this
.
_erroredText
=
value
;
}
public
get
loading
():
boolean
{
return
this
.
_loading
;
...
...
Breeze.UI/src/app/wallet/advanced/advanced.service.ts
View file @
1344ee0e
...
...
@@ -7,13 +7,28 @@ import { GlobalService } from '../../shared/services/global.service';
@
Injectable
()
export
class
AdvancedService
{
private
readonly
accountName
=
'account 0'
;
private
readonly
walletName
;
private
readonly
urlPrefix
=
'http://localhost:37221/api/Wallet/'
;
constructor
(
private
httpClient
:
HttpClient
,
private
globalService
:
GlobalService
)
{
}
constructor
(
private
httpClient
:
HttpClient
,
private
globalService
:
GlobalService
)
{
this
.
walletName
=
this
.
globalService
.
getWalletName
();
}
public
getExtPubKey
():
Observable
<
string
>
{
const
walletName
=
this
.
globalService
.
getWalletName
();
const
url
=
`
${
this
.
urlPrefix
}
extpubkey?WalletName=
${
walletName
}
&AccountName=
${
this
.
accountName
}
`
;
const
url
=
`
${
this
.
urlPrefix
}
extpubkey?WalletName=
${
this
.
walletName
}
&AccountName=
${
this
.
accountName
}
`
;
return
this
.
httpClient
.
get
(
url
).
map
(
x
=>
x
.
toString
());
}
public
generateAddresses
(
count
:
number
):
Observable
<
string
[]
>
{
const
url
=
`
${
this
.
urlPrefix
}
unusedaddresses?WalletName=
${
this
.
walletName
}
&AccountName=
${
this
.
accountName
}
&Count=
${
count
}
`
;
return
this
.
httpClient
.
get
(
url
).
map
(
x
=>
this
.
processAddresses
(
x
));
}
private
processAddresses
(
response
:
any
):
string
[]
{
let
addresses
=
new
Array
<
string
>
();
for
(
const
address
of
response
)
{
addresses
.
push
(
address
);
}
return
addresses
;
}
}
Breeze.UI/src/assets/images/Tick_Mark-16.png
0 → 100644
View file @
1344ee0e
215 Bytes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment