Skip to content

Commit

Permalink
fixed issues with schema in the open api spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Rutherford committed Oct 17, 2024
1 parent fc7ed49 commit 07cb724
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ target
*.pyc
result
.direnv
.vscode/settings.json
openapitools.json
138 changes: 108 additions & 30 deletions doc/electrs-rest-btcd-1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ paths:
get:
tags:
- block
summary: Get the has of the best tip block
summary: Get the hash of the best tip block
responses:
'200':
description: The hash of the best tip block
Expand All @@ -47,12 +47,12 @@ paths:
content:
text/plain:
schema:
type: string
type: integer
/blocks/{start_height}:
get:
tags:
- block
summary: Get blocks starting from a specific height
summary: Get 10 blocks starting from a specific height or the tip if not provided.
parameters:
- name: start_height
in: path
Expand All @@ -72,7 +72,7 @@ paths:
get:
tags:
- block
summary: Get block header by height
summary: Get hash of header for the block currently at the specified height
parameters:
- name: height
in: path
Expand Down Expand Up @@ -121,7 +121,7 @@ paths:
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/BlockStatus'
/block/{hash}/txids:
get:
tags:
Expand All @@ -135,7 +135,7 @@ paths:
type: string
responses:
'200':
description: Transaction IDs (can be cached indefinitely)
description: Transaction IDs (responses can be cached indefinitely)
content:
application/json:
schema:
Expand Down Expand Up @@ -173,7 +173,7 @@ paths:
type: string
responses:
'200':
description: Raw block data. (this response can be cached indefinitely)
description: Raw block data. (responses can be cached indefinitely)
content:
application/octet-stream:
schema:
Expand All @@ -200,7 +200,7 @@ paths:
get:
tags:
- block
summary: Returns up to 25 transactions based on an optional starting index
summary: Returns up to 25 transactions based on an optional starting index.
parameters:
- name: hash
in: path
Expand All @@ -214,11 +214,36 @@ paths:
type: integer
responses:
'200':
description: Transaction ID (can be cached indefinitely)
description: Transaction ID (responses can be cached indefinitely)
content:
text/plain:
schema:
type: string
/block/{hash}/txs/{start_index}:
get:
tags:
- block
summary: Get transactions in a block starting from an index
parameters:
- name: hash
in: path
required: true
schema:
type: string
- name: start_index
in: path
required: true
schema:
type: integer
responses:
'200':
description: Transactions for a given block
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Transaction'
/block/{hash}/txs:
get:
tags:
Expand Down Expand Up @@ -297,11 +322,11 @@ paths:
type: string
responses:
'200':
description: Address Chain and Mempool stats
description: Scripthash chain and mempool stats
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
$ref: '#/components/schemas/ScriptHash'
/address/{address}/txs:
get:
tags:
Expand Down Expand Up @@ -421,7 +446,7 @@ paths:
tags:
- address
- mempool
summary: Get unconfirmed transaction history for the specified address
summary: Get unconfirmed transaction history for the specified address.
description: Returns up to 50 transactions (No Paging)
parameters:
- name: address
Expand All @@ -443,7 +468,7 @@ paths:
tags:
- scripthash
- mempool
summary: Get unconfirmed transaction history for the specified scripthash
summary: Get unconfirmed transaction history for the specified scripthash.
description: Returns up to 50 transactions (No Paging)
parameters:
- name: hash
Expand Down Expand Up @@ -522,7 +547,7 @@ paths:
get:
tags:
- tx
summary: Returns transaction confirmation status
summary: Returns transaction confirmation status by hash
parameters:
- name: txid
in: path
Expand All @@ -536,6 +561,42 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/TxStatus'
/tx/{txid}/hex:
get:
tags:
- tx
summary: Returns the raw transaction data in hexadecimal
parameters:
- name: txid
in: path
required: true
schema:
type: string
responses:
'200':
description: Raw transaction data
content:
application/octet-stream:
schema:
type: string
/tx/{txid}/raw:
get:
tags:
- tx
summary: Returns the raw transaction data in binary
parameters:
- name: txid
in: path
required: true
schema:
type: string
responses:
'200':
description: Raw transaction data
content:
application/octet-stream:
schema:
type: string
/tx/{hash}/merkleblock-proof:
get:
tags:
Expand Down Expand Up @@ -605,7 +666,7 @@ paths:
get:
tags:
- tx
summary: Get outspend information for all outputs of a transaction
summary: Returns the spending status of all transaction outputs
parameters:
- name: hash
in: path
Expand Down Expand Up @@ -646,7 +707,7 @@ paths:
post:
tags:
- tx
summary: Broadcast a transaction
summary: Broadcast a raw transaction to the bitcoin network
description: |
The transaction should be provided as hex in the request body.
The `txid` will be returned on success.
Expand All @@ -666,7 +727,7 @@ paths:
get:
tags:
- mempool
summary: Get mempool backlog stats
summary: Get mempool backlog statistics
responses:
'200':
description: Mempool backlog stats
Expand All @@ -679,7 +740,7 @@ paths:
tags:
- mempool
summary: Returns the full list of transaction IDs in the mempool as an array.
description: The order of the tansaction IDs is arbitrary and does not match bitcoind's order.
description: The order of the transaction IDs is arbitrary and does not match bitcoind's order.
responses:
'200':
description: Mempool transaction IDs
Expand Down Expand Up @@ -725,7 +786,7 @@ components:
Block:
type: object
properties:
name:
id:
type: string
height:
type: integer
Expand Down Expand Up @@ -769,6 +830,12 @@ components:
type: number
locktime:
type: number
size:
type: integer
weight:
type: integer
fee:
type: number
vin:
type: array
items:
Expand All @@ -777,10 +844,6 @@ components:
type: array
items:
$ref: '#/components/schemas/TxVout'
weight:
type: integer
size:
type: integer
status:
$ref: '#/components/schemas/TxStatus'
TxStatus:
Expand All @@ -791,7 +854,7 @@ components:
block_height:
type: integer
block_hash:
type: integer
type: string
block_time:
type: integer
TxVin:
Expand All @@ -801,20 +864,24 @@ components:
type: string
vout:
type: integer
prevout:
type: string
is_coinbase:
type: boolean
scriptsig:
type: string
scriptsig_asm:
type: string
inner_redeemscript_asm:
type: string
inner_witnessscript_asm:
type: string
sequence:
type: integer
witness:
type: array
items:
type: string
is_coinbase:
type: boolean
sequence:
type: integer
prevout:
$ref: '#/components/schemas/TxVout'
TxVout:
type: object
properties:
Expand All @@ -828,6 +895,17 @@ components:
type: string
value:
type: integer
ScriptHash:
type: object
properties:
address:
type: string
chain_stats:
$ref: '#/components/schemas/ChainStats'
mempool_stats:
$ref: '#/components/schemas/MempoolStats'
scripthash:
type: string
Address:
type: object
properties:
Expand Down
Loading

0 comments on commit 07cb724

Please sign in to comment.