Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Redesign #1729

Merged
merged 133 commits into from
Apr 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
a690940
introduce 'restapi.py'
Ouziel Apr 5, 2024
00181f9
DRY routes
Ouziel Apr 5, 2024
110e5c8
refactor 'get_asset_info()'
Ouziel Apr 5, 2024
ba61877
Add API authentification
Ouziel Apr 5, 2024
893c86e
move old api in v1/; rename restapi.py to api.py
Ouziel Apr 5, 2024
c1bf32b
--legacy-api -> --enable-v1-api
Ouziel Apr 5, 2024
ad47e52
lint
Ouziel Apr 5, 2024
3d434cf
Add routes for blocks
Ouziel Apr 5, 2024
a222bb8
fix tests
Ouziel Apr 5, 2024
a0d07f4
Add tests for new API
Ouziel Apr 5, 2024
4e6cc2d
use app context instead global variables
Ouziel Apr 5, 2024
840633e
tweaks
Ouziel Apr 5, 2024
6e75205
More routes for blocks, credits and debits
Ouziel Apr 6, 2024
b275944
clean imports
Ouziel Apr 6, 2024
6f4ffeb
More routes
Ouziel Apr 6, 2024
3ed4ba7
More routes: sends, resolutions, ..
Ouziel Apr 7, 2024
83bd420
Add 'event' field in mempool table
Ouziel Apr 7, 2024
38fb161
More routes: dispensers, sweeps, holders, ..
Ouziel Apr 7, 2024
092b312
Add routes for events
Ouziel Apr 7, 2024
46ebe88
Add routes for mempool and events count
Ouziel Apr 7, 2024
f8cc62c
module in subfolder
Ouziel Apr 7, 2024
313b747
Add route to compose transactions
Ouziel Apr 7, 2024
d699408
Add route for healthz and get_tx_info
Ouziel Apr 8, 2024
7d956f6
Add backend proxy routes
Ouziel Apr 8, 2024
d890979
Add route for root
Ouziel Apr 8, 2024
1e3a226
fix tests
Ouziel Apr 8, 2024
c506c0a
inject headers
Ouziel Apr 8, 2024
7cb5a40
Progress in unpack support
Ouziel Apr 8, 2024
71cfb0c
Add route to unpack; supports all type of message
Ouziel Apr 9, 2024
a2878c6
update ledger.CURRENT_BLOCK_INDEX on each request
Ouziel Apr 9, 2024
981d3a5
new flags and config values for the new API
Ouziel Apr 9, 2024
91e69d1
fix tests
Ouziel Apr 9, 2024
9fb4df0
lint
Ouziel Apr 9, 2024
b1b86ac
fix sql query
Ouziel Apr 9, 2024
590b965
Fix api v1 shutdown; Fix typos
Ouziel Apr 9, 2024
bc30b79
Put API v1 behind '/old'
Ouziel Apr 9, 2024
7a403e4
Add X-API-Warn header
Ouziel Apr 9, 2024
d8b4b63
use 'flask_cors' for cors
Ouziel Apr 9, 2024
861411c
fix config.RPC_WEBROOT
Ouziel Apr 9, 2024
366a060
new routes for mempool
Ouziel Apr 9, 2024
7916b62
API_NOT_READY_HTTP_CODE=503 by default
Ouziel Apr 9, 2024
9ca45d6
check -> check_type
Ouziel Apr 9, 2024
f27531c
lint
Ouziel Apr 9, 2024
4b0a7a6
fix rebase
Ouziel Apr 10, 2024
a4b4fd3
fix ruff alert
Ouziel Apr 10, 2024
45998bd
Fix log in file
Ouziel Apr 10, 2024
d607602
Add warning when using API v1
Ouziel Apr 10, 2024
2945b07
fix duplicate sigterm catch
Ouziel Apr 10, 2024
4a5b02e
Merge branch 'develop' into newapi
Ouziel Apr 17, 2024
69c522d
fix merge
Ouziel Apr 17, 2024
3e72e4d
Merge branch 'develop' into newapi
Ouziel Apr 17, 2024
d3d62ac
fix merge
Ouziel Apr 17, 2024
9cc97c1
Fix /healthz endpoint after merging
Ouziel Apr 17, 2024
68e7f1e
new route for compose: /address/<source>/compose/<transaction_name>
Ouziel Apr 17, 2024
07f933c
Add type to routes args
Ouziel Apr 17, 2024
3cc5406
Add type hints to all compose functions
Ouziel Apr 17, 2024
7474f5b
Routes args from function signature; Routes doc from function docstring
Ouziel Apr 18, 2024
c2dea42
Progress in routes documentation
Ouziel Apr 18, 2024
c22ee5f
All routes documented except compose
Ouziel Apr 18, 2024
1c3b049
One route, one function. Even for compose functions
Ouziel Apr 19, 2024
d89d5f3
progress in compose routes
Ouziel Apr 19, 2024
d989d7f
finish compose functions and routes
Ouziel Apr 19, 2024
ae7dfca
Merge branch 'newapi' into develop
Ouziel Apr 19, 2024
d5f6d43
fix merge
Ouziel Apr 19, 2024
881505e
disable missing params check for API v1
Ouziel Apr 19, 2024
e91815c
fixes
Ouziel Apr 19, 2024
234f989
more tests; fixes
Ouziel Apr 22, 2024
1ec5960
compare result with fixtures
Ouziel Apr 22, 2024
01cf546
Test and fix unpack route
Ouziel Apr 22, 2024
c2f5a77
add content-type header
Ouziel Apr 22, 2024
4962ead
compose routes return json
Ouziel Apr 22, 2024
e2dce12
/transactions/info returns also unpacked data
Ouziel Apr 22, 2024
5b5be3a
script to generate blueprint doc
Ouziel Apr 22, 2024
1d8812b
Add required/optional and default value in doc
Ouziel Apr 22, 2024
c0885bd
Tweak `genapidoc.py`
adamkrellenstein Apr 23, 2024
9551a01
remove \n
Ouziel Apr 22, 2024
9c12f63
Use example args to generate output example
Ouziel Apr 23, 2024
064b0cb
Add quotes for docusaurus
Ouziel Apr 23, 2024
129c17f
progress in example args/output
Ouziel Apr 23, 2024
becf57c
All routes with output example except compose and backend; Add some l…
Ouziel Apr 23, 2024
2c37b65
Add cache to generate doc faster
Ouziel Apr 23, 2024
5762f8d
tweak gendoc cache
Ouziel Apr 23, 2024
3b3973a
support float args
Ouziel Apr 23, 2024
0f7ffd3
More output example for compose
Ouziel Apr 23, 2024
961c332
catch correctly compose error
Ouziel Apr 23, 2024
66cdc2e
log unexpected API error
Ouziel Apr 23, 2024
e6070ad
Standardize API result
Ouziel Apr 24, 2024
8a4d607
Output example for all compose routes; fixes
Ouziel Apr 24, 2024
0f71f80
Don't pass db if not needed; Mempool output examples; fixes
Ouziel Apr 24, 2024
92968bf
All routes with output example
Ouziel Apr 24, 2024
8a58374
Refactor function to return data
Ouziel Apr 24, 2024
0f1b4ed
Add notes in API documentation
Ouziel Apr 24, 2024
eddff66
Merge branch 'develop' into newapi2
Ouziel Apr 24, 2024
9041dfd
fix fixtures
Ouziel Apr 24, 2024
d3e13b2
update relase notes
Ouziel Apr 24, 2024
4f1b4d6
lint
Ouziel Apr 24, 2024
f48bc0c
Remove success from result
Ouziel Apr 25, 2024
e206819
db is already initialized
Ouziel Apr 25, 2024
cd0ba21
fix typo
Ouziel Apr 25, 2024
6f78ef5
_by_event -> _by_name
Ouziel Apr 25, 2024
09a64a8
fix fixtures
Ouziel Apr 25, 2024
99ef600
Remove success and add root path in doc
Ouziel Apr 25, 2024
56ff76a
Don't indent json result; Fix typo
Ouziel Apr 25, 2024
611b263
tweak indentation
Ouziel Apr 25, 2024
b71b1fe
order_hash, bet_hash and dispenser_hash instead tx_hash in routes
Ouziel Apr 25, 2024
102b9f1
get_balance_object -> get_balance_by_address_and_asset
Ouziel Apr 25, 2024
a5370ea
handle_healthz_route_v2 -> check_server_status
Ouziel Apr 25, 2024
16ae417
generate also apib compatible with apiary
Ouziel Apr 25, 2024
405b2ed
Introduce counterparty-core.apib; Fix blueprint semantic issues
Ouziel Apr 25, 2024
06a0309
Fix API root paragraph
Ouziel Apr 25, 2024
ba4e5f8
fix blueprint links in Apiary
Ouziel Apr 25, 2024
af4ff31
fix typos
Ouziel Apr 25, 2024
87e367f
Root path always return 200
Ouziel Apr 25, 2024
016b3a9
Rename blueprint; Include unpacked data in get transaction by hash re…
Ouziel Apr 25, 2024
67f0b95
fix apiary filename
Ouziel Apr 25, 2024
8ff2f07
Add Port to Host
adamkrellenstein Apr 25, 2024
6a9f477
replace /old by /v1
Ouziel Apr 25, 2024
7426e1f
Merge branch 'develop' into newapi2
Ouziel Apr 25, 2024
40ea060
backend -> bitcoin
Ouziel Apr 25, 2024
85c9ff7
fix tests
Ouziel Apr 25, 2024
fe5343a
AddrindexRS -> Bitcoin Core
Ouziel Apr 25, 2024
f8cb3a1
search_raw_transactions -> get_transactions_by_address
Ouziel Apr 25, 2024
06d51bc
get_oldest_tx -> get_oldest_transaction_by_address
Ouziel Apr 25, 2024
0b77eb9
remove raw
Ouziel Apr 25, 2024
94bfee0
tweaks and typos
Ouziel Apr 26, 2024
f175dd0
more tweaks and typos
Ouziel Apr 26, 2024
5d8c738
Remove block_index and timestamp when query by block; tweaks and typos
Ouziel Apr 26, 2024
e0afc26
payload -> params
Ouziel Apr 26, 2024
9f686bf
Add doc for encoding parameter
Ouziel Apr 26, 2024
6b2d009
fix typos
Ouziel Apr 26, 2024
57facf7
404 error if function return None
Ouziel Apr 26, 2024
9d61360
Start API server before connecting to backend
Ouziel Apr 26, 2024
44f02ca
fix test
Ouziel Apr 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix merge
Ouziel committed Apr 17, 2024

Unverified

This user has not yet uploaded their public signing key.
commit 69c522d42837e29085e57d65c75002c4c893ec39
4 changes: 2 additions & 2 deletions counterparty-core/counterpartycore/lib/api/routes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from counterpartylib.lib import (
from counterpartycore.lib import (
backend,
config,
ledger,
transaction,
)
from counterpartylib.lib.api import util
from counterpartycore.lib.api import util

# Define the API routes except root (`/`) defined in `api_server.py`
ROUTES = {
2 changes: 1 addition & 1 deletion counterparty-core/counterpartycore/lib/api/util.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
from logging import handlers as logging_handlers

import flask
from counterpartylib.lib import backend, config, exceptions, ledger, transaction
from counterpartycore.lib import backend, config, exceptions, ledger, transaction

logger = logging.getLogger(config.LOGGER_NAME)

2 changes: 1 addition & 1 deletion counterparty-core/counterpartycore/lib/transaction.py
Original file line number Diff line number Diff line change
@@ -1071,7 +1071,7 @@ def compose_transaction(
if not script.is_fully_valid(binascii.unhexlify(pubkey)):
raise script.AddressError(f"invalid public key: {pubkey}")

compose_method = sys.modules[f"counterpartylib.lib.messages.{name}"].compose
compose_method = sys.modules[f"counterpartycore.lib.messages.{name}"].compose
compose_params = inspect.getfullargspec(compose_method)[0]
missing_params = [p for p in compose_params if p not in params and p != "db"]
for param in missing_params:
1 change: 1 addition & 0 deletions counterparty-core/requirements.txt
Original file line number Diff line number Diff line change
@@ -26,4 +26,5 @@ arc4==0.4.0
halo==0.0.31
termcolor==2.4.0
sentry-sdk==1.45.0
Flask-Cors==4.0.0
counterparty-rs==10.1.0