Add filter by contract to get address API #379
This commit is contained in:
parent
f761dbec2a
commit
a6c01534f2
@ -290,7 +290,7 @@ Example response:
|
||||
Returns balances and transactions of an address. The returned transactions are sorted by block height, newest blocks first.
|
||||
|
||||
```
|
||||
GET /api/v2/address/<address>[?page=<page>&pageSize=<size>&from=<block height>&to=<block height>&details=<basic|tokens|tokenBalances|txids|txs>]
|
||||
GET /api/v2/address/<address>[?page=<page>&pageSize=<size>&from=<block height>&to=<block height>&details=<basic|tokens|tokenBalances|txids|txs>&contract=<contract address>]
|
||||
```
|
||||
|
||||
The optional query parameters:
|
||||
@ -303,6 +303,7 @@ The optional query parameters:
|
||||
- *tokenBalances*: *basic* + tokens with balances + belonging to the address (applicable only to some coins)
|
||||
- *txids*: *tokenBalances* + list of txids, subject to *from*, *to* filter and paging
|
||||
- *txs*: *tokenBalances* + list of transaction with details, subject to *from*, *to* filter and paging
|
||||
- *contract*: return only transactions which affect specified contract (applicable only to coins which support contracts)
|
||||
|
||||
Response:
|
||||
|
||||
|
||||
@ -641,11 +641,13 @@ func (s *PublicServer) getAddressQueryParams(r *http.Request, accountDetails api
|
||||
if ec != nil {
|
||||
gap = 0
|
||||
}
|
||||
contract := r.URL.Query().Get("contract")
|
||||
return page, pageSize, accountDetails, &api.AddressFilter{
|
||||
Vout: voutFilter,
|
||||
TokensToReturn: tokensToReturn,
|
||||
FromHeight: uint32(from),
|
||||
ToHeight: uint32(to),
|
||||
Contract: contract,
|
||||
}, filterParam, gap
|
||||
}
|
||||
|
||||
@ -670,6 +672,9 @@ func (s *PublicServer) explorerAddress(w http.ResponseWriter, r *http.Request) (
|
||||
data.Address = address
|
||||
data.Page = address.Page
|
||||
data.PagingRange, data.PrevPage, data.NextPage = getPagingRange(address.Page, address.TotalPages)
|
||||
if filterParam == "" && filter.Vout > -1 {
|
||||
filterParam = strconv.Itoa(filter.Vout)
|
||||
}
|
||||
if filterParam != "" {
|
||||
data.PageParams = template.URL("&filter=" + filterParam)
|
||||
data.Address.Filter = filterParam
|
||||
|
||||
@ -100,8 +100,8 @@
|
||||
<h3 class="col-md-3">Transactions</h3>
|
||||
<select class="col-md-2" style="background-color: #eaeaea;" onchange="self.location='?filter='+options[selectedIndex].value">
|
||||
<option>All</option>
|
||||
<option {{if eq $addr.Filter "inputs" -}} selected{{end}} value="inputs">Inputs</option>
|
||||
<option {{if eq $addr.Filter "outputs" -}} selected{{end}} value="outputs">Outputs</option>
|
||||
<option {{if eq $addr.Filter "inputs" -}} selected{{end}} value="inputs">Address on input side</option>
|
||||
<option {{if eq $addr.Filter "outputs" -}} selected{{end}} value="outputs">Address on output side</option>
|
||||
{{- if $addr.Tokens -}}
|
||||
<option {{if eq $addr.Filter "0" -}} selected{{end}} value="0">Non-contract</option>
|
||||
{{- range $t := $addr.Tokens -}}
|
||||
|
||||
@ -91,12 +91,12 @@
|
||||
{{- end}}{{if or $addr.Transactions $addr.Filter -}}
|
||||
<div class="row h-container">
|
||||
<h3 class="col-md-3">Transactions</h3>
|
||||
<select class="col-md-2" style="background-color: #eaeaea;" onchange="self.location='?filter='+options[selectedIndex].value">
|
||||
<select class="col-md-3" style="background-color: #eaeaea;" onchange="self.location='?filter='+options[selectedIndex].value">
|
||||
<option>All</option>
|
||||
<option {{if eq $addr.Filter "inputs" -}} selected{{end}} value="inputs">Inputs</option>
|
||||
<option {{if eq $addr.Filter "outputs" -}} selected{{end}} value="outputs">Outputs</option>
|
||||
<option {{if eq $addr.Filter "inputs" -}} selected{{end}} value="inputs">XPUB addresses on input side</option>
|
||||
<option {{if eq $addr.Filter "outputs" -}} selected{{end}} value="outputs">XPUB addresses on output side</option>
|
||||
</select>
|
||||
<div class="col-md-7">
|
||||
<div class="col-md-6">
|
||||
<nav>{{template "paging" $data}}</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user