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
cc4ae9ee
Commit
cc4ae9ee
authored
Nov 06, 2018
by
Sergei Zubov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify wallets
Remove bitcoin and stratis wallet, add destream wallet
parent
88763a9f
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
61 additions
and
296 deletions
+61
-296
main.ts
Breeze.UI/main.ts
+11
-61
app.component.ts
Breeze.UI/src/app/app.component.ts
+4
-4
login.component.ts
Breeze.UI/src/app/login/login.component.ts
+4
-34
confirm-mnemonic.component.ts
...tup/create/confirm-mnemonic/confirm-mnemonic.component.ts
+1
-30
recover.component.ts
Breeze.UI/src/app/setup/recover/recover.component.ts
+8
-38
api.service.ts
Breeze.UI/src/app/shared/services/api.service.ts
+13
-84
navigation.service.ts
Breeze.UI/src/app/shared/services/navigation.service.ts
+2
-3
dashboard.component.ts
Breeze.UI/src/app/wallet/dashboard/dashboard.component.ts
+5
-0
history.component.ts
Breeze.UI/src/app/wallet/history/history.component.ts
+7
-0
sidebar.component.html
Breeze.UI/src/app/wallet/sidebar/sidebar.component.html
+1
-5
sidebar.component.ts
Breeze.UI/src/app/wallet/sidebar/sidebar.component.ts
+4
-36
wallet-routing.module.ts
Breeze.UI/src/app/wallet/wallet-routing.module.ts
+1
-1
No files found.
Breeze.UI/main.ts
View file @
cc4ae9ee
...
...
@@ -77,8 +77,7 @@ app.on('ready', function () {
console
.
log
(
"Breeze UI was started in development mode. This requires the user to be running the Breeze Daemon himself."
)
}
else
{
startBitcoinApi
();
startStratisApi
();
startDeStreamApi
();
}
createTray
();
createWindow
();
...
...
@@ -88,8 +87,7 @@ app.on('ready', function () {
});
app
.
on
(
'before-quit'
,
function
()
{
closeBitcoinApi
(),
closeStratisApi
();
closeDeStreamApi
();
});
// Quit when all windows are closed.
...
...
@@ -109,24 +107,7 @@ app.on('activate', function () {
}
});
function
closeBitcoinApi
()
{
// if (process.platform !== 'darwin' && !serve) {
if
(
!
serve
)
{
var
http1
=
require
(
'http'
);
const
options1
=
{
hostname
:
'localhost'
,
port
:
37220
,
path
:
'/api/node/shutdown'
,
method
:
'POST'
};
const
req
=
http1
.
request
(
options1
,
(
res
)
=>
{});
req
.
write
(
''
);
req
.
end
();
}
};
function
closeStratisApi
()
{
function
closeDeStreamApi
()
{
// if (process.platform !== 'darwin' && !serve) {
if
(
process
.
platform
!==
'darwin'
&&
!
serve
)
{
var
http2
=
require
(
'http'
);
...
...
@@ -143,42 +124,11 @@ function closeStratisApi() {
}
};
function
startBitcoinApi
()
{
var
bitcoinProcess
;
const
spawnBitcoin
=
require
(
'child_process'
).
spawn
;
//Start Breeze Bitcoin Daemon
let
apiPath
=
path
.
resolve
(
__dirname
,
'assets//daemon//Stratis.BreezeD'
);
if
(
os
.
platform
()
===
'win32'
)
{
apiPath
=
path
.
resolve
(
__dirname
,
'..
\\
..
\\
resources
\\
daemon
\\
Stratis.BreezeD.exe'
);
}
else
if
(
os
.
platform
()
===
'linux'
)
{
apiPath
=
path
.
resolve
(
__dirname
,
'..//..//resources//daemon//Stratis.BreezeD'
);
}
else
{
apiPath
=
path
.
resolve
(
__dirname
,
'..//..//resources//daemon//Stratis.BreezeD'
);
}
if
(
!
testnet
)
{
bitcoinProcess
=
spawnBitcoin
(
apiPath
,
{
detached
:
true
});
}
else
if
(
testnet
)
{
bitcoinProcess
=
spawnBitcoin
(
apiPath
,
[
'-testnet'
],
{
detached
:
true
});
}
bitcoinProcess
.
stdout
.
on
(
'data'
,
(
data
)
=>
{
writeLog
(
`Bitcoin:
${
data
}
`
);
});
}
function
startStratisApi
()
{
var
stratisProcess
;
const
spawnStratis
=
require
(
'child_process'
).
spawn
;
function
startDeStreamApi
()
{
var
destreamProcess
;
const
spawnDeStream
=
require
(
'child_process'
).
spawn
;
//Start Breeze
Stratis
Daemon
//Start Breeze
DeStream
Daemon
let
apiPath
=
path
.
resolve
(
__dirname
,
'assets//daemon//Stratis.BreezeD'
);
if
(
os
.
platform
()
===
'win32'
)
{
apiPath
=
path
.
resolve
(
__dirname
,
'..
\\
..
\\
resources
\\
daemon
\\
Stratis.BreezeD.exe'
);
...
...
@@ -189,17 +139,17 @@ function startStratisApi() {
}
if
(
!
testnet
)
{
stratisProcess
=
spawnStratis
(
apiPath
,
[
'stratis
'
],
{
destreamProcess
=
spawnDeStream
(
apiPath
,
[
'destream
'
],
{
detached
:
true
});
}
else
if
(
testnet
)
{
stratisProcess
=
spawnStratis
(
apiPath
,
[
'stratis
'
,
'-testnet'
],
{
destreamProcess
=
spawnDeStream
(
apiPath
,
[
'destream
'
,
'-testnet'
],
{
detached
:
true
});
}
stratis
Process
.
stdout
.
on
(
'data'
,
(
data
)
=>
{
writeLog
(
`
Stratis
:
${
data
}
`
);
destream
Process
.
stdout
.
on
(
'data'
,
(
data
)
=>
{
writeLog
(
`
DeStream
:
${
data
}
`
);
});
}
...
...
Breeze.UI/src/app/app.component.ts
View file @
cc4ae9ee
...
...
@@ -23,11 +23,11 @@ export class AppComponent implements OnInit {
ngOnInit
()
{
this
.
setTitle
();
this
.
apiService
.
getWalletFiles
().
retryWhen
(
errors
=>
errors
.
delay
(
2000
)).
subscribe
(()
=>
this
.
check
Stratis
Daemon
());
this
.
apiService
.
getWalletFiles
().
retryWhen
(
errors
=>
errors
.
delay
(
2000
)).
subscribe
(()
=>
this
.
check
DeStream
Daemon
());
}
private
check
Stratis
Daemon
()
{
this
.
apiService
.
get
Stratis
WalletFiles
().
retryWhen
(
errors
=>
errors
.
delay
(
2000
)).
subscribe
(()
=>
this
.
startApp
());
private
check
DeStream
Daemon
()
{
this
.
apiService
.
getWalletFiles
().
retryWhen
(
errors
=>
errors
.
delay
(
2000
)).
subscribe
(()
=>
this
.
startApp
());
}
private
startApp
()
{
...
...
@@ -36,7 +36,7 @@ export class AppComponent implements OnInit {
}
private
setTitle
()
{
const
applicationName
=
"
Stratis
Breeze Wallet"
;
const
applicationName
=
"
DeStream
Breeze Wallet"
;
const
newTitle
=
applicationName
+
" v"
+
remote
.
app
.
getVersion
();
this
.
titleService
.
setTitle
(
newTitle
);
}
...
...
Breeze.UI/src/app/login/login.component.ts
View file @
cc4ae9ee
...
...
@@ -127,33 +127,8 @@ export class LoginComponent implements OnInit {
}
private
loadWallets
(
walletLoad
:
WalletLoad
)
{
this
.
apiService
.
loadBitcoinWallet
(
walletLoad
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
this
.
globalService
.
setWalletName
(
walletLoad
.
name
);
}
},
error
=>
{
this
.
isDecrypting
=
false
;
if
(
error
.
status
===
0
)
{
this
.
genericModalService
.
openModal
(
null
,
null
);
}
else
if
(
error
.
status
>=
400
)
{
if
(
!
error
.
json
().
errors
[
0
])
{
console
.
log
(
error
);
}
else
{
this
.
genericModalService
.
openModal
(
null
,
error
.
json
().
errors
[
0
].
message
);
}
}
},
()
=>
this
.
loadStratisWallet
(
walletLoad
)
)
;
}
private
loadStratisWallet
(
walletLoad
:
WalletLoad
)
{
this
.
apiService
.
loadStratisWallet
(
walletLoad
)
this
.
apiService
.
loadDeStreamWallet
(
walletLoad
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
...
...
@@ -180,19 +155,14 @@ export class LoginComponent implements OnInit {
private
getCurrentNetwork
()
{
let
walletInfo
=
new
WalletInfo
(
this
.
globalService
.
getWalletName
())
this
.
apiService
.
getGeneralInfo
Once
(
walletInfo
)
this
.
apiService
.
getGeneralInfo
(
walletInfo
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
let
responseMessage
=
response
.
json
();
this
.
globalService
.
setNetwork
(
responseMessage
.
network
);
if
(
responseMessage
.
network
===
"Main"
)
{
this
.
globalService
.
setCoinName
(
"Bitcoin"
);
this
.
globalService
.
setCoinUnit
(
"BTC"
);
}
else
if
(
responseMessage
.
network
===
"TestNet"
)
{
this
.
globalService
.
setCoinName
(
"TestBitcoin"
);
this
.
globalService
.
setCoinUnit
(
"TBTC"
);
}
this
.
globalService
.
setCoinName
(
"DeStreamCoin"
);
this
.
globalService
.
setCoinUnit
(
"DST"
);
}
},
error
=>
{
...
...
Breeze.UI/src/app/setup/create/confirm-mnemonic/confirm-mnemonic.component.ts
View file @
cc4ae9ee
...
...
@@ -141,36 +141,7 @@ export class ConfirmMnemonicComponent implements OnInit {
private
createWallets
(
wallet
:
WalletCreation
)
{
this
.
apiService
.
createBitcoinWallet
(
wallet
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
){
// Bitcoin wallet created
}
},
error
=>
{
console
.
log
(
error
);
this
.
isCreating
=
false
;
if
(
error
.
status
===
0
)
{
this
.
genericModalService
.
openModal
(
null
,
null
);
}
else
if
(
error
.
status
>=
400
)
{
if
(
!
error
.
json
().
errors
[
0
])
{
console
.
log
(
error
);
}
else
{
this
.
genericModalService
.
openModal
(
null
,
error
.
json
().
errors
[
0
].
message
);
this
.
router
.
navigate
([
'/setup/create'
]);
}
}
},
()
=>
this
.
createStratisWallet
(
wallet
)
)
;
}
private
createStratisWallet
(
wallet
:
WalletCreation
)
{
this
.
apiService
.
createStratisWallet
(
wallet
)
.
createDeStreamWallet
(
wallet
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
){
...
...
Breeze.UI/src/app/setup/recover/recover.component.ts
View file @
cc4ae9ee
...
...
@@ -114,39 +114,9 @@ export class RecoverComponent implements OnInit {
}
private
recoverWallets
(
recoverWallet
:
WalletRecovery
)
{
let
bitcoin
ErrorMessage
=
""
;
let
destream
ErrorMessage
=
""
;
this
.
apiService
.
recoverBitcoinWallet
(
recoverWallet
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
//Bitcoin Wallet Recovered
}
this
.
recoverStratisWallet
(
recoverWallet
,
bitcoinErrorMessage
);
},
error
=>
{
this
.
isRecovering
=
false
;
console
.
log
(
error
);
if
(
error
.
status
===
0
)
{
this
.
genericModalService
.
openModal
(
null
,
null
);
}
else
if
(
error
.
status
>=
400
)
{
if
(
!
error
.
json
().
errors
[
0
])
{
console
.
log
(
error
);
}
else
{
bitcoinErrorMessage
=
error
.
json
().
errors
[
0
].
message
;
}
}
this
.
recoverStratisWallet
(
recoverWallet
,
bitcoinErrorMessage
);
}
)
;
}
private
recoverStratisWallet
(
recoverWallet
:
WalletRecovery
,
bitcoinErrorMessage
:
string
){
let
stratisErrorMessage
=
""
;
this
.
apiService
.
recoverStratisWallet
(
recoverWallet
)
.
recoverDeStreamWallet
(
recoverWallet
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
...
...
@@ -154,7 +124,7 @@ export class RecoverComponent implements OnInit {
this
.
genericModalService
.
openModal
(
"Wallet Recovered"
,
body
);
this
.
router
.
navigate
([
''
])
}
this
.
AlertIfNeeded
(
bitcoinErrorMessage
,
stratis
ErrorMessage
);
this
.
AlertIfNeeded
(
destream
ErrorMessage
);
},
error
=>
{
this
.
isRecovering
=
false
;
...
...
@@ -166,18 +136,18 @@ export class RecoverComponent implements OnInit {
console
.
log
(
error
);
}
else
{
stratis
ErrorMessage
=
error
.
json
().
errors
[
0
].
message
;
destream
ErrorMessage
=
error
.
json
().
errors
[
0
].
message
;
}
}
this
.
AlertIfNeeded
(
bitcoinErrorMessage
,
stratis
ErrorMessage
);
this
.
AlertIfNeeded
(
destream
ErrorMessage
);
}
)
;
}
private
AlertIfNeeded
(
bitcoinErrorMessage
:
string
,
stratis
ErrorMessage
:
string
)
{
if
(
bitcoinErrorMessage
!==
""
||
stratis
ErrorMessage
!==
""
)
{
let
errorMessage
=
"<strong>
Bitcoin wallet recovery:</strong><br>"
+
bitcoinErrorMessage
+
"<br><br><strong>Stratis wallet recovery:</strong><br>"
+
stratis
ErrorMessage
;
private
AlertIfNeeded
(
destream
ErrorMessage
:
string
)
{
if
(
destream
ErrorMessage
!==
""
)
{
let
errorMessage
=
"<strong>
DeStream wallet recovery:</strong><br>"
+
destream
ErrorMessage
;
this
.
genericModalService
.
openModal
(
null
,
errorMessage
);
}
}
...
...
Breeze.UI/src/app/shared/services/api.service.ts
View file @
cc4ae9ee
...
...
@@ -27,34 +27,15 @@ export class ApiService {
private
headers
=
new
Headers
({
'Content-Type'
:
'application/json'
});
private
pollingInterval
=
3000
;
private
bitcoinApiUrl
=
'http://localhost:37220/api'
;
private
stratisApiUrl
=
'http://localhost:37221/api'
;
private
currentApiUrl
=
'http://localhost:37220/api'
;
private
getCurrentCoin
()
{
let
currentCoin
=
this
.
globalService
.
getCoinName
();
if
(
currentCoin
===
"Bitcoin"
||
currentCoin
===
"TestBitcoin"
)
{
this
.
currentApiUrl
=
this
.
bitcoinApiUrl
;
}
else
if
(
currentCoin
===
"Stratis"
||
currentCoin
===
"TestStratis"
)
{
this
.
currentApiUrl
=
this
.
stratisApiUrl
;
}
}
private
destreamApiUrl
=
'http://localhost:56864/api'
;
private
currentApiUrl
=
'http://localhost:56864/api'
;
/**
* Gets available wallets at the default path
*/
getWalletFiles
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
bitcoinApiUrl
+
'/wallet/files'
)
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Gets available wallets at the default path
*/
getStratisWalletFiles
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
stratisApiUrl
+
'/wallet/files'
)
.
get
(
this
.
destreamApiUrl
+
'/wallet/files'
)
.
map
((
response
:
Response
)
=>
response
);
}
...
...
@@ -67,61 +48,33 @@ export class ApiService {
params
.
set
(
'wordCount'
,
'12'
);
return
this
.
http
.
get
(
this
.
bitcoin
ApiUrl
+
'/wallet/mnemonic'
,
new
RequestOptions
({
headers
:
this
.
headers
,
search
:
params
}))
.
get
(
this
.
destream
ApiUrl
+
'/wallet/mnemonic'
,
new
RequestOptions
({
headers
:
this
.
headers
,
search
:
params
}))
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Create a new
Bitcoin
wallet.
* Create a new
DeStream
wallet.
*/
create
Bitcoin
Wallet
(
data
:
WalletCreation
):
Observable
<
any
>
{
create
DeStream
Wallet
(
data
:
WalletCreation
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
bitcoin
ApiUrl
+
'/wallet/create/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
post
(
this
.
destream
ApiUrl
+
'/wallet/create/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
((
response
:
Response
)
=>
response
);
}
/**
*
Create a new Stratis
wallet.
*
Recover a DeStream
wallet.
*/
createStratisWallet
(
data
:
WalletCreation
):
Observable
<
any
>
{
recoverDeStreamWallet
(
data
:
WalletRecovery
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
stratisApiUrl
+
'/wallet/create
/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
post
(
this
.
destreamApiUrl
+
'/wallet/recover
/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
((
response
:
Response
)
=>
response
);
}
/**
*
Recover a Bitcoin wallet.
*
Load a DeStream wallet
*/
recoverBitcoinWallet
(
data
:
WalletRecovery
):
Observable
<
any
>
{
loadDeStreamWallet
(
data
:
WalletLoad
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
bitcoinApiUrl
+
'/wallet/recover/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Recover a Stratis wallet.
*/
recoverStratisWallet
(
data
:
WalletRecovery
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
stratisApiUrl
+
'/wallet/recover/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Load a Bitcoin wallet
*/
loadBitcoinWallet
(
data
:
WalletLoad
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
bitcoinApiUrl
+
'/wallet/load/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Load a Stratis wallet
*/
loadStratisWallet
(
data
:
WalletLoad
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
stratisApiUrl
+
'/wallet/load/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
post
(
this
.
destreamApiUrl
+
'/wallet/load/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
((
response
:
Response
)
=>
response
);
}
...
...
@@ -129,30 +82,16 @@ export class ApiService {
* Get wallet status info from the API.
*/
getWalletStatus
():
Observable
<
any
>
{
this
.
getCurrentCoin
();
return
this
.
http
.
get
(
this
.
currentApiUrl
+
'/wallet/status'
)
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Get general wallet info from the API once.
*/
getGeneralInfoOnce
(
data
:
WalletInfo
):
Observable
<
any
>
{
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'Name'
,
data
.
walletName
);
return
this
.
http
.
get
(
this
.
bitcoinApiUrl
+
'/wallet/general-info'
,
new
RequestOptions
({
headers
:
this
.
headers
,
search
:
params
}))
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Get general wallet info from the API.
*/
getGeneralInfo
(
data
:
WalletInfo
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'Name'
,
data
.
walletName
);
...
...
@@ -168,7 +107,6 @@ export class ApiService {
* Get wallet balance info from the API.
*/
getWalletBalance
(
data
:
WalletInfo
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
...
...
@@ -184,7 +122,6 @@ export class ApiService {
* Get the maximum sendable amount for a given fee from the API
*/
getMaximumBalance
(
data
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
...
...
@@ -201,7 +138,6 @@ export class ApiService {
* Get a wallets transaction history info from the API.
*/
getWalletHistory
(
data
:
WalletInfo
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
...
...
@@ -217,7 +153,6 @@ export class ApiService {
* Get an unused receive address for a certain wallet from the API.
*/
getUnusedReceiveAddress
(
data
:
WalletInfo
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
...
...
@@ -231,7 +166,6 @@ export class ApiService {
* Get multiple unused receive addresses for a certain wallet from the API.
*/
getUnusedReceiveAddresses
(
data
:
WalletInfo
,
count
:
string
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
...
...
@@ -246,7 +180,6 @@ export class ApiService {
* Get get all receive addresses for an account of a wallet from the API.
*/
getAllReceiveAddresses
(
data
:
WalletInfo
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
...
...
@@ -260,7 +193,6 @@ export class ApiService {
* Estimate the fee of a transaction
*/
estimateFee
(
data
:
FeeEstimation
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
let
params
:
URLSearchParams
=
new
URLSearchParams
();
params
.
set
(
'walletName'
,
data
.
walletName
);
...
...
@@ -279,7 +211,6 @@ export class ApiService {
* Build a transaction
*/
buildTransaction
(
data
:
TransactionBuilding
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
return
this
.
http
.
post
(
this
.
currentApiUrl
+
'/wallet/build-transaction'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
...
...
@@ -290,7 +221,6 @@ export class ApiService {
* Send transaction
*/
sendTransaction
(
data
:
TransactionSending
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
return
this
.
http
.
post
(
this
.
currentApiUrl
+
'/wallet/send-transaction'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
...
...
@@ -301,7 +231,6 @@ export class ApiService {
* Send shutdown signal to the daemon
*/
shutdownNode
():
Observable
<
any
>
{
this
.
getCurrentCoin
();
return
this
.
http
.
post
(
this
.
currentApiUrl
+
'/node/shutdown'
,
''
)
...
...
Breeze.UI/src/app/shared/services/navigation.service.ts
View file @
cc4ae9ee
...
...
@@ -3,7 +3,7 @@ import { Router, NavigationEnd } from '@angular/router';
import
{
ReplaySubject
}
from
'rxjs/ReplaySubject'
;
export
enum
Page
{
Bitcoin
,
Stratis
DeStream
}
@
Injectable
()
...
...
@@ -16,8 +16,7 @@ export class NavigationService {
.
map
(
x
=>
<
NavigationEnd
>
x
)
.
map
(
x
=>
x
.
url
);
navigation$
.
filter
(
x
=>
x
===
this
.
navBase
).
subscribe
(
_
=>
this
.
pageSubject
.
next
(
Page
.
Bitcoin
));
navigation$
.
filter
(
x
=>
x
===
`
${
this
.
navBase
}
/stratis-wallet`
).
subscribe
(
_
=>
this
.
pageSubject
.
next
(
Page
.
Stratis
));
navigation$
.
filter
(
x
=>
x
===
`
${
this
.
navBase
}
/destream-wallet`
).
subscribe
(
_
=>
this
.
pageSubject
.
next
(
Page
.
DeStream
));
}
public
pageSubject
=
new
ReplaySubject
(
1
);
...
...
Breeze.UI/src/app/wallet/dashboard/dashboard.component.ts
View file @
cc4ae9ee
...
...
@@ -58,10 +58,15 @@ export class DashboardComponent implements OnInit {
this
.
walletBalanceSubscription
=
this
.
apiService
.
getWalletBalance
(
walletInfo
)
.
subscribe
(
response
=>
{
console
.
log
(
"HJERE"
);
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
console
.
log
(
"HJERE2"
);
let
balanceResponse
=
response
.
json
();
console
.
log
(
balanceResponse
);
this
.
confirmedBalance
=
balanceResponse
.
balances
[
0
].
amountConfirmed
;
console
.
log
(
balanceResponse
.
balances
[
0
].
amountConfirmed
);
this
.
unconfirmedBalance
=
balanceResponse
.
balances
[
0
].
amountUnconfirmed
;
console
.
log
(
balanceResponse
.
balances
[
0
].
amountUnconfirmed
);
}
},
error
=>
{
...
...
Breeze.UI/src/app/wallet/history/history.component.ts
View file @
cc4ae9ee
...
...
@@ -81,6 +81,7 @@ export class HistoryComponent {
private
getTransactionInfo
(
transactions
:
any
)
{
this
.
transactions
=
[];
console
.
log
(
"hit it"
);
for
(
let
transaction
of
transactions
)
{
let
transactionType
;
if
(
transaction
.
type
===
"send"
)
{
...
...
@@ -100,6 +101,12 @@ export class HistoryComponent {
let
transactionTimestamp
=
transaction
.
timestamp
;
let
transactionConfirmed
;
console
.
log
(
"transactionType: "
+
transactionType
);
console
.
log
(
"transactionId: "
+
transactionId
);
console
.
log
(
"transactionAmount: "
+
transactionAmount
);
console
.
log
(
"transactionFee: "
+
transactionFee
);
console
.
log
(
"transactionConfirmedInBlock: "
+
transactionConfirmedInBlock
);
console
.
log
(
"transactionTimestamp: "
+
transactionTimestamp
);
this
.
transactions
.
push
(
new
TransactionInfo
(
transactionType
,
transactionId
,
transactionAmount
,
transactionFee
,
transactionConfirmedInBlock
,
transactionTimestamp
));
}
}
...
...
Breeze.UI/src/app/wallet/sidebar/sidebar.component.html
View file @
cc4ae9ee
...
...
@@ -2,11 +2,7 @@
<aside
id=
"sidebar"
>
<!-- menu-->
<ul
class=
"list-unstyled menu"
>
<li
(
click
)="
loadBitcoinWallet
()"
[
class
.
active
]="
bitcoinActive
"
>
<img
src=
"../../../assets/images/ico_bitcoin.svg"
alt=
"Bitcoin"
>
<span
class=
"bar"
></span>
</li>
<li
(
click
)="
loadStratisWallet
()"
[
class
.
active
]="
stratisActive
"
>
<li
(
click
)="
loadDeStreamWallet
()"
[
class
.
active
]="
stratisActive
"
>
<img
src=
"../../../assets/images/ico_stratis.svg"
alt=
"Stratis"
>
<span
class=
"bar"
></span>
</li>
...
...
Breeze.UI/src/app/wallet/sidebar/sidebar.component.ts
View file @
cc4ae9ee
...
...
@@ -20,47 +20,15 @@ export class SidebarComponent implements OnInit {
constructor
(
private
globalService
:
GlobalService
,
private
apiService
:
ApiService
,
private
router
:
Router
,
private
modalService
:
NgbModal
,
private
genericModalService
:
ModalService
,
private
navigationService
:
NavigationService
)
{
}
public
bitcoinActive
:
boolean
;
public
stratisActive
:
boolean
;
ngOnInit
()
{
if
(
this
.
globalService
.
getCoinName
()
===
"Bitcoin"
||
this
.
globalService
.
getCoinName
()
===
"TestBitcoin"
)
{
this
.
bitcoinActive
=
true
;
this
.
stratisActive
=
false
;
}
else
if
(
this
.
globalService
.
getCoinName
()
===
"Stratis"
||
this
.
globalService
.
getCoinName
()
===
"TestStratis"
)
{
this
.
bitcoinActive
=
false
;
this
.
stratisActive
=
true
;
}
}
public
loadBitcoinWallet
()
{
let
currentNetwork
=
this
.
globalService
.
getNetwork
();
if
(
currentNetwork
===
"Main"
)
{
this
.
globalService
.
setCoinName
(
"Bitcoin"
);
this
.
globalService
.
setCoinUnit
(
"BTC"
);
}
else
if
(
currentNetwork
===
"TestNet"
){
this
.
globalService
.
setCoinName
(
"TestBitcoin"
);
this
.
globalService
.
setCoinUnit
(
"TBTC"
);
}
this
.
bitcoinActive
=
true
;
this
.
stratisActive
=
false
;
this
.
router
.
navigate
([
'/wallet'
]);
}
public
loadStratisWallet
()
{
let
currentNetwork
=
this
.
globalService
.
getNetwork
();
if
(
currentNetwork
===
"Main"
)
{
this
.
globalService
.
setCoinName
(
"Stratis"
);
this
.
globalService
.
setCoinUnit
(
"STRAT"
);
}
else
if
(
currentNetwork
===
"TestNet"
){
this
.
globalService
.
setCoinName
(
"TestStratis"
);
this
.
globalService
.
setCoinUnit
(
"TSTRAT"
);
}
public
loadDestreamWallet
()
{
this
.
globalService
.
setCoinName
(
"DeStreamCoin"
);
this
.
globalService
.
setCoinUnit
(
"DST"
);
this
.
bitcoinActive
=
false
;
this
.
stratisActive
=
true
;
this
.
router
.
navigate
([
'/wallet/stratis-wallet'
]);
this
.
router
.
navigate
([
'/wallet/destream-wallet'
]);
}
public
logOut
()
{
...
...
Breeze.UI/src/app/wallet/wallet-routing.module.ts
View file @
cc4ae9ee
...
...
@@ -15,7 +15,7 @@ const routes: Routes = [
{
path
:
'advanced'
,
component
:
AdvancedComponent
}
]
},
{
path
:
'
stratis
-wallet'
,
component
:
WalletComponent
,
{
path
:
'
destream
-wallet'
,
component
:
WalletComponent
,
children
:
[
{
path
:
''
,
redirectTo
:
'dashboard'
,
pathMatch
:
'full'
},
{
path
:
'dashboard'
,
component
:
DashboardComponent
},
...
...
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