Jürgen Eckel fa2c8a5cc5
Ws blocks (#106)
* added another dispatcher to server block changes

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed missing variable definition

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* made the definition of POINON_PILL unique

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* changed some fixtures for web tests, fixed linter errors, updated aiohttp version

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added block hash to the block notification

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed misspelling issue

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed previous merge issues

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed websocket startup issues

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed queuing issue and disabled one tests

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* increased version number

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed docs req deps

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed linting issues

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed linting warnings

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed aiohttp.web.run_app call

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Co-authored-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-05-16 17:01:57 +02:00

32 lines
1.1 KiB
Python

# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
from flask import current_app
from flask_restful import reqparse, Resource
from planetmint.web.views import parameters
class OutputListApi(Resource):
def get(self):
"""API endpoint to retrieve a list of links to transaction
outputs.
Returns:
A :obj:`list` of :cls:`str` of links to outputs.
"""
parser = reqparse.RequestParser()
parser.add_argument('public_key', type=parameters.valid_ed25519,
required=True)
parser.add_argument('spent', type=parameters.valid_bool)
args = parser.parse_args(strict=True)
pool = current_app.config['bigchain_pool']
with pool() as planet:
outputs = planet.get_outputs_filtered(args['public_key'],
args['spent'])
return [{'transaction_id': output.txid, 'output_index': output.output}
for output in outputs]