Skip to content

Commit

Permalink
Merge pull request #422 from alchemyplatform/getblockwithreceipts
Browse files Browse the repository at this point in the history
add starknet_getBlockWithReceipts
  • Loading branch information
SahilAujla authored Nov 4, 2024
2 parents e902518 + 373c0a3 commit 41252a0
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/sync-apis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2284,6 +2284,12 @@ jobs:
working-directory: ./starknet
run: rdme openapi starknet_addDeclareTransaction.yaml --key=$README_API_KEY --id=64406faac2d7740059213a4f

- name: Update Starknet API - starknet_getBlockWithReceipts
env:
README_API_KEY: ${{ secrets.README_API_KEY }}
working-directory: ./starknet
run: rdme openapi starknet_getBlockWithReceipts.yaml --key=$README_API_KEY --id=6727ed186d9aab001314179d

- name: Update Starknet API - starknet_getClassAt
env:
README_API_KEY: ${{ secrets.README_API_KEY }}
Expand Down
45 changes: 45 additions & 0 deletions components/starknet/schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ BlockBodyWithTxs:
required:
- transactions

BlockBodyWithReceipts:
type: object
description: Block body with transactions and receipts
properties:
transactions:
type: array
items:
$ref: '#/Txn'
receipts:
type: array
items:
$ref: '#/TxnReceipt'
required:
- transactions
- receipts

BlockHeader:
type: object
properties:
Expand Down Expand Up @@ -365,6 +381,18 @@ BlockWithTxs:
- $ref: '#/BlockHeader'
- $ref: '#/BlockBodyWithTxs'

BlockWithReceipts:
title: The block object
allOf:
- type: object
properties:
status:
$ref: '#/BlockStatus'
required:
- status
- $ref: '#/BlockHeader'
- $ref: '#/BlockBodyWithReceipts'

PendingBlockWithTxHashes:
title: Pending block object with tx hashes
description: The dynamic block being constructed by the sequencer. Note that this object will be deprecated upon decentralization.
Expand Down Expand Up @@ -400,6 +428,23 @@ PendingBlockWithTxs:
description: The hash of this block's parent
$ref: '#/BlockHash'

PendingBlockWithReceipts:
description: The dynamic block being constructed by the sequencer. Note that this object will be deprecated upon decentralization.
allOf:
- $ref: '#/BlockBodyWithReceipts'
- type: object
properties:
timestamp:
description: The time in which the block was created, encoded in Unix time
type: integer
minimum: 0
sequencer_address:
description: The StarkNet identity of the sequencer submitting this block
$ref: '#/Felt'
parent_hash:
description: The hash of this block's parent
$ref: '#/BlockHash'

DeployedContractItem:
type: object
properties:
Expand Down
88 changes: 88 additions & 0 deletions starknet/starknet_getBlockWithReceipts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
openapi: 3.1.0
info:
title: starknet_getBlockWithReceipts
description: Get block information with full transactions and receipts given the block id
version: '1.0'
servers:
- url: 'https://{network}.g.alchemy.com/starknet/version/rpc/{version}/'
variables:
network:
enum:
- starknet-mainnet
- starknet-sepolia
default: starknet-mainnet
version:
enum:
- v0_7
- v0.6
- v0.5
- v0.4
default: v0_7
x-sandbox:
category:
type:
$ref: '../components/sandbox.yaml#/Category'
value: core
paths:
/{apiKey}:
$ref: '#/components/pathItems/path'
components:
pathItems:
path:
post:
operationId: starknet-getBlockWithReceipts
summary: starknet_getBlockWithReceipts
description: Get block information with full transactions and receipts given the block id
parameters:
- name: apiKey
in: path
schema:
type: string
default: docs-demo
description: |
<style>
.custom-style {
color: #048FF4;
}
</style>
For higher throughput, <span class="custom-style"><a href="https://alchemy.com/?a=docs-demo" target="_blank">create your own API key</a></span>
required: true
requestBody:
description: Request Body
content:
application/json:
schema:
allOf:
- $ref: '../evm_body.yaml#/common_request_fields'
- type: object
properties:
method:
$ref: ../components/schemas.yaml#/Method
default: starknet_getBlockWithTxs
params:
type: array
title: block_id
items:
$ref: '../components/starknet/schemas.yaml#/BlockId'
description: The hash of the requested block, or number (height) of the requested block, or a block tag
minItems: 1
maxItems: 1
x-readme:
samples-languages:
- curl
- javascript
- python
responses:
'200':
description: The resulting block information with full transactions
content:
application/json:
schema:
allOf:
- $ref: '../evm_responses.yaml#/common_response_fields'
- type: object
properties:
result:
oneOf:
- $ref: '../components/starknet/schemas.yaml#/BlockWithReceipts'
- $ref: '../components/starknet/schemas.yaml#/PendingBlockWithReceipts'

0 comments on commit 41252a0

Please sign in to comment.