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
4b6fbd86
Commit
4b6fbd86
authored
May 09, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wallet balance to real API
parent
50517ad6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
31 deletions
+50
-31
login.component.ts
Breeze.UI/src/app/login/login.component.ts
+3
-2
wallet-info.ts
Breeze.UI/src/app/shared/classes/wallet-info.ts
+1
-3
api.service.ts
Breeze.UI/src/app/shared/services/api.service.ts
+14
-6
global.service.ts
Breeze.UI/src/app/shared/services/global.service.ts
+12
-3
dashboard.component.ts
Breeze.UI/src/app/wallet/menu/dashboard.component.ts
+20
-17
No files found.
Breeze.UI/src/app/login/login.component.ts
View file @
4b6fbd86
...
...
@@ -46,7 +46,7 @@ export class LoginComponent implements OnInit {
}
private
setGlobalWalletName
(
walletName
:
string
)
{
this
.
globalService
.
set
Current
WalletName
(
walletName
);
this
.
globalService
.
setWalletName
(
walletName
);
}
private
getWalletFiles
()
{
...
...
@@ -85,7 +85,8 @@ export class LoginComponent implements OnInit {
console
.
log
(
response
);
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
let
responseMessage
=
response
.
json
();
this
.
globalService
.
setCurrentWalletName
(
walletLoad
.
name
)
this
.
globalService
.
setWalletName
(
walletLoad
.
name
)
this
.
globalService
.
setCoinType
(
1
);
this
.
router
.
navigate
([
'/wallet'
]);
}
},
...
...
Breeze.UI/src/app/shared/classes/wallet-info.ts
View file @
4b6fbd86
export
class
WalletInfo
{
constructor
(
walletName
:
string
,
coinType
:
number
,
accountName
:
string
)
{
constructor
(
walletName
:
string
,
coinType
:
number
)
{
this
.
walletName
=
walletName
;
this
.
coinType
=
coinType
;
this
.
accountName
=
accountName
;
}
public
walletName
:
string
;
public
coinType
:
number
;
public
accountName
:
string
;
}
Breeze.UI/src/app/shared/services/api.service.ts
View file @
4b6fbd86
...
...
@@ -63,25 +63,33 @@ export class ApiService {
*/
getWalletStatus
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
mock
ApiUrl
+
'/wallet/status'
)
.
get
(
this
.
web
ApiUrl
+
'/wallet/status'
)
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Get wallet balance info from the API.
*/
getWalletBalance
():
Observable
<
any
>
{
getWalletBalance
(
data
:
WalletInfo
):
Observable
<
any
>
{
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
params
.
set
(
'coinType'
,
data
.
coinType
.
toString
());
return
this
.
http
.
get
(
this
.
mockApiUrl
+
'/wallet/balance'
)
.
get
(
this
.
webApiUrl
+
'/wallet/balance'
,
new
RequestOptions
({
headers
:
this
.
headers
,
search
:
params
})
)
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Get a wallets transaction history info from the API.
*/
getWalletHistory
():
Observable
<
any
>
{
getWalletHistory
(
data
:
WalletInfo
):
Observable
<
any
>
{
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
params
.
set
(
'coinType'
,
data
.
coinType
.
toString
());
return
this
.
http
.
get
(
this
.
mockApiUrl
+
'/wallet/history'
)
.
get
(
this
.
webApiUrl
+
'/wallet/history'
,
new
RequestOptions
({
headers
:
this
.
headers
,
search
:
params
})
)
.
map
((
response
:
Response
)
=>
response
);
}
...
...
@@ -92,7 +100,7 @@ export class ApiService {
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
params
.
set
(
'coinType'
,
data
.
coinType
.
toString
());
params
.
set
(
'accountName'
,
data
.
accountName
);
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/address'
,
new
RequestOptions
({
headers
:
this
.
headers
,
search
:
params
}))
.
map
((
response
:
Response
)
=>
response
);
...
...
Breeze.UI/src/app/shared/services/global.service.ts
View file @
4b6fbd86
...
...
@@ -6,6 +6,7 @@ export class GlobalService {
private
walletPath
:
string
;
private
currentWalletName
:
string
;
private
coinType
:
number
;
getWalletPath
()
{
return
this
.
walletPath
;
...
...
@@ -15,11 +16,19 @@ export class GlobalService {
this
.
walletPath
=
walletPath
;
}
get
Current
WalletName
()
{
getWalletName
()
{
return
this
.
currentWalletName
;
}
set
Current
WalletName
(
currentWalletName
:
string
)
{
setWalletName
(
currentWalletName
:
string
)
{
this
.
currentWalletName
=
currentWalletName
;
}
}
\ No newline at end of file
getCoinType
()
{
return
this
.
coinType
;
}
setCoinType
(
coinType
:
number
)
{
this
.
coinType
=
coinType
;
}
}
Breeze.UI/src/app/wallet/menu/dashboard.component.ts
View file @
4b6fbd86
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ApiService
}
from
'../../shared/services/api.service'
;
import
{
GlobalService
}
from
'../../shared/services/global.service'
;
import
{
WalletInfo
}
from
'../../shared/classes/wallet-info'
;
@
Component
({
selector
:
'dashboard-component'
,
...
...
@@ -7,8 +9,8 @@ import { ApiService } from '../../shared/services/api.service';
styleUrls
:
[
'./dashboard.component.css'
],
})
export
class
DashboardComponent
{
constructor
(
private
apiService
:
ApiService
)
{}
constructor
(
private
apiService
:
ApiService
,
private
globalService
:
GlobalService
)
{}
private
balanceResponse
:
any
;
private
confirmedBalance
:
number
;
private
unconfirmedBalance
:
number
;
...
...
@@ -19,21 +21,22 @@ export class DashboardComponent {
}
private
getWalletBalance
()
{
this
.
apiService
.
getWalletBalance
()
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
this
.
balanceResponse
=
response
.
json
();
this
.
confirmedBalance
=
this
.
balanceResponse
.
confirmed
;
this
.
unconfirmedBalance
=
this
.
balanceResponse
.
unconfirmed
;
}
},
error
=>
{
if
(
error
.
status
>=
400
)
{
this
.
errorMessage
=
<
any
>
error
;
console
.
log
(
this
.
errorMessage
);
}
}
let
walletInfo
=
new
WalletInfo
(
this
.
globalService
.
getWalletName
(),
this
.
globalService
.
getCoinType
())
this
.
apiService
.
getWalletBalance
(
walletInfo
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
this
.
balanceResponse
=
response
.
json
();
this
.
confirmedBalance
=
this
.
balanceResponse
.
confirmed
;
this
.
unconfirmedBalance
=
this
.
balanceResponse
.
unconfirmed
;
}
},
error
=>
{
if
(
error
.
status
>=
400
)
{
this
.
errorMessage
=
<
any
>
error
;
console
.
log
(
this
.
errorMessage
);
}
}
);
}
}
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