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
6418f25b
Commit
6418f25b
authored
Sep 26, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Stratis to recovery process
parent
1f552fe5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
15 deletions
+48
-15
recover.component.ts
Breeze.UI/src/app/setup/recover/recover.component.ts
+33
-7
wallet-recovery.ts
Breeze.UI/src/app/shared/classes/wallet-recovery.ts
+4
-4
api.service.ts
Breeze.UI/src/app/shared/services/api.service.ts
+11
-4
No files found.
Breeze.UI/src/app/setup/recover/recover.component.ts
View file @
6418f25b
...
@@ -91,20 +91,45 @@ export class RecoverComponent implements OnInit {
...
@@ -91,20 +91,45 @@ export class RecoverComponent implements OnInit {
private
onRecoverClicked
(){
private
onRecoverClicked
(){
this
.
walletRecovery
=
new
WalletRecovery
(
this
.
walletRecovery
=
new
WalletRecovery
(
this
.
recoverWalletForm
.
get
(
"walletName"
).
value
,
this
.
recoverWalletForm
.
get
(
"walletMnemonic"
).
value
,
this
.
recoverWalletForm
.
get
(
"walletMnemonic"
).
value
,
this
.
recoverWalletForm
.
get
(
"walletPassword"
).
value
,
this
.
recoverWalletForm
.
get
(
"walletPassword"
).
value
,
this
.
recoverWalletForm
.
get
(
"selectNetwork"
).
value
,
this
.
recoverWalletForm
.
get
(
"selectNetwork"
).
value
,
this
.
globalService
.
getWalletPath
(),
this
.
recoverWalletForm
.
get
(
"walletName"
).
value
,
this
.
creationDate
this
.
creationDate
);
);
this
.
recoverWallet
(
this
.
walletRecovery
);
this
.
recoverWallet
s
(
this
.
walletRecovery
);
}
}
private
recoverWallet
(
recoverWallet
:
WalletRecovery
)
{
private
recoverWallets
(
recoverWallet
:
WalletRecovery
)
{
this
.
apiService
.
recoverBitcoinWallet
(
recoverWallet
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
//Bitcoin Wallet Recovered
}
},
error
=>
{
console
.
log
(
error
);
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
if
(
!
error
.
json
().
errors
[
0
])
{
console
.
log
(
error
);
}
else
{
alert
(
error
.
json
().
errors
[
0
].
message
);
}
}
},
()
=>
this
.
recoverStratisWallet
(
recoverWallet
)
)
;
}
private
recoverStratisWallet
(
recoverWallet
:
WalletRecovery
){
this
.
apiService
this
.
apiService
.
recoverWallet
(
recoverWallet
)
.
recover
Stratis
Wallet
(
recoverWallet
)
.
subscribe
(
.
subscribe
(
response
=>
{
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
...
@@ -126,6 +151,7 @@ export class RecoverComponent implements OnInit {
...
@@ -126,6 +151,7 @@ export class RecoverComponent implements OnInit {
}
}
}
}
}
}
);
)
;
}
}
}
}
Breeze.UI/src/app/shared/classes/wallet-recovery.ts
View file @
6418f25b
export
class
WalletRecovery
{
export
class
WalletRecovery
{
constructor
(
mnemonic
:
string
,
password
:
string
,
network
:
string
,
folderPath
:
string
,
walletName
:
string
,
creationDate
:
Date
)
{
constructor
(
walletName
:
string
,
mnemonic
:
string
,
password
:
string
,
network
:
string
,
creationDate
:
Date
,
folderPath
:
string
=
null
)
{
this
.
name
=
walletName
;
this
.
mnemonic
=
mnemonic
;
this
.
mnemonic
=
mnemonic
;
this
.
password
=
password
;
this
.
password
=
password
;
this
.
network
=
network
;
this
.
network
=
network
;
this
.
folderPath
=
folderPath
;
this
.
name
=
walletName
;
this
.
creationDate
=
creationDate
;
this
.
creationDate
=
creationDate
;
this
.
folderPath
=
folderPath
;
}
}
mnemonic
:
string
;
mnemonic
:
string
;
password
:
string
;
password
:
string
;
folderPath
:
string
;
name
:
string
;
name
:
string
;
network
:
string
;
network
:
string
;
creationDate
:
Date
;
creationDate
:
Date
;
folderPath
?:
string
;
}
}
Breeze.UI/src/app/shared/services/api.service.ts
View file @
6418f25b
...
@@ -60,13 +60,20 @@ export class ApiService {
...
@@ -60,13 +60,20 @@ export class ApiService {
}
}
/**
/**
* Recover a wallet.
* Recover a
Bitcoin
wallet.
*/
*/
recoverWallet
(
data
:
WalletRecovery
):
Observable
<
any
>
{
recoverBitcoinWallet
(
data
:
WalletRecovery
):
Observable
<
any
>
{
this
.
getCurrentCoin
();
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
return
this
.
http
.
post
(
this
.
current
ApiUrl
+
'/wallet/recover/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
post
(
this
.
stratis
ApiUrl
+
'/wallet/recover/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
((
response
:
Response
)
=>
response
);
.
map
((
response
:
Response
)
=>
response
);
}
}
...
...
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