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
ce6933a8
Commit
ce6933a8
authored
Oct 13, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare max balance call
parent
eeed9db1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
2 deletions
+56
-2
api.service.ts
Breeze.UI/src/app/shared/services/api.service.ts
+17
-0
send.component.html
Breeze.UI/src/app/wallet/send/send.component.html
+2
-2
send.component.ts
Breeze.UI/src/app/wallet/send/send.component.ts
+37
-0
No files found.
Breeze.UI/src/app/shared/services/api.service.ts
View file @
ce6933a8
...
@@ -168,6 +168,23 @@ export class ApiService {
...
@@ -168,6 +168,23 @@ export class ApiService {
.
map
((
response
:
Response
)
=>
response
);
.
map
((
response
:
Response
)
=>
response
);
}
}
/**
* 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
);
params
.
set
(
'accountName'
,
"account 0"
);
params
.
set
(
'feeType'
,
data
.
feeType
);
params
.
set
(
'allowUnconfirmed'
,
"true"
);
return
this
.
http
.
get
(
this
.
currentApiUrl
+
'/wallet/maxbalance'
,
new
RequestOptions
({
headers
:
this
.
headers
,
search
:
params
}))
.
map
((
response
:
Response
)
=>
response
);
}
/**
/**
* Get a wallets transaction history info from the API.
* Get a wallets transaction history info from the API.
*/
*/
...
...
Breeze.UI/src/app/wallet/send/send.component.html
View file @
ce6933a8
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
<form
[
formGroup
]="
sendForm
"
(
ngSubmit
)="
send
()"
>
<form
[
formGroup
]="
sendForm
"
(
ngSubmit
)="
send
()"
>
<!--<div class="form-group has-danger clearfix">-->
<!--<div class="form-group has-danger clearfix">-->
<div
class=
"form-group clearfix"
>
<div
class=
"form-group clearfix"
>
<label
class=
"float-left"
for=
"
yourAddress
"
>
Amount
</label>
<label
class=
"float-left"
for=
"
Amount
"
>
Amount
</label>
<!--
<span class="float-right"><a href="#">max</a></span>
-->
<!--
<span class="float-right btn-link" (click)="getMaxBalance()">max</span>
-->
<input
type=
"text"
class=
"form-control form-control-danger"
formControlName=
"amount"
id=
"Amount"
placeholder=
"0.00 {{ coinUnit }}"
>
<input
type=
"text"
class=
"form-control form-control-danger"
formControlName=
"amount"
id=
"Amount"
placeholder=
"0.00 {{ coinUnit }}"
>
<div
*
ngIf=
"formErrors.amount"
class=
"form-control-feedback"
>
{{ formErrors.amount }}
</div>
<div
*
ngIf=
"formErrors.amount"
class=
"form-control-feedback"
>
{{ formErrors.amount }}
</div>
</div>
</div>
...
...
Breeze.UI/src/app/wallet/send/send.component.ts
View file @
ce6933a8
...
@@ -86,6 +86,43 @@ export class SendComponent implements OnInit {
...
@@ -86,6 +86,43 @@ export class SendComponent implements OnInit {
}
}
};
};
public
getMaxBalance
()
{
let
data
=
{
walletName
:
this
.
globalService
.
getWalletName
(),
feeType
:
this
.
sendForm
.
get
(
"fee"
).
value
}
let
balanceResponse
;
this
.
apiService
.
getMaximumBalance
(
data
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
){
balanceResponse
=
response
.
json
();
console
.
log
(
balanceResponse
);
}
},
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
].
description
);
}
}
},
()
=>
{
this
.
sendForm
.
patchValue
({
amount
:
balanceResponse
.
maxSpendableAmount
});
this
.
estimatedFee
=
balanceResponse
.
fee
;
}
)
};
public
buildTransaction
()
{
public
buildTransaction
()
{
this
.
transaction
=
new
TransactionBuilding
(
this
.
transaction
=
new
TransactionBuilding
(
this
.
globalService
.
getWalletName
(),
this
.
globalService
.
getWalletName
(),
...
...
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