Skip to content

Commit

Permalink
rename method for shards
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron committed Nov 2, 2023
1 parent 0dda578 commit 821985e
Show file tree
Hide file tree
Showing 13 changed files with 395 additions and 315 deletions.
5 changes: 4 additions & 1 deletion api/example.http
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ GET {{host}}/v2/blockchain/config
GET {{host}}/v2/blockchain/messages/81C7CC0C66452E5F1BC26A5D89B2B30AAB49B3B88EC9D035921B7DD3F343276F/transaction

###
GET {{host}}/v2/staking/pools?available_for=0%3A366c84f5b37224e0220a1d05a620deca0197544e2c94a928181a38e5dbbd33f5
GET {{host}}/v2/staking/pools?available_for=0%3A366c84f5b37224e0220a1d05a620deca0197544e2c94a928181a38e5dbbd33f5

###
GET {{host}}/v2/blockchain/masterchain/27578880/shards
66 changes: 37 additions & 29 deletions api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5907,35 +5907,6 @@
]
}
},
"/v2/blockchain/blocks/{block_id}/shards": {
"get": {
"description": "Get blockchain block shards",
"operationId": "getBlockchainBlockShards",
"parameters": [
{
"$ref": "#/components/parameters/blockchainBlockIDParameter"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BlockchainBlockShards"
}
}
},
"description": "blockchain block shards"
},
"default": {
"$ref": "#/components/responses/Error"
}
},
"tags": [
"Blockchain"
]
}
},
"/v2/blockchain/blocks/{block_id}/transactions": {
"get": {
"description": "Get transactions from block",
Expand Down Expand Up @@ -6037,6 +6008,43 @@
]
}
},
"/v2/blockchain/masterchain/{masterchain_seqno}/shards": {
"get": {
"description": "Get blockchain block shards",
"operationId": "getBlockchainMasterchainShards",
"parameters": [
{
"description": "masterchain block seqno",
"in": "path",
"name": "masterchain_seqno",
"required": true,
"schema": {
"example": 123456,
"format": "int32",
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BlockchainBlockShards"
}
}
},
"description": "blockchain block shards"
},
"default": {
"$ref": "#/components/responses/Error"
}
},
"tags": [
"Blockchain"
]
}
},
"/v2/blockchain/message": {
"post": {
"description": "Send message to blockchain",
Expand Down
13 changes: 10 additions & 3 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ paths:
$ref: '#/components/schemas/BlockchainBlock'
'default':
$ref: '#/components/responses/Error'
/v2/blockchain/blocks/{block_id}/shards:
/v2/blockchain/masterchain/{masterchain_seqno}/shards:
get:
description: Get blockchain block shards
operationId: getBlockchainBlockShards
operationId: getBlockchainMasterchainShards
tags:
- Blockchain
parameters:
- $ref: '#/components/parameters/blockchainBlockIDParameter'
- name: masterchain_seqno
in: path
required: true
description: "masterchain block seqno"
schema:
type: integer
format: int32
example: 123456
responses:
'200':
description: blockchain block shards
Expand Down
8 changes: 2 additions & 6 deletions pkg/api/blockchain_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ func (h *Handler) GetBlockchainBlock(ctx context.Context, params oas.GetBlockcha
return &res, nil
}

func (h *Handler) GetBlockchainBlockShards(ctx context.Context, params oas.GetBlockchainBlockShardsParams) (r *oas.BlockchainBlockShards, _ error) {
blockID, err := ton.ParseBlockID(params.BlockID)
if err != nil {
return nil, toError(http.StatusBadRequest, err)
}
shards, err := h.storage.GetBlockShards(ctx, blockID)
func (h *Handler) GetBlockchainMasterchainShards(ctx context.Context, params oas.GetBlockchainMasterchainShardsParams) (r *oas.BlockchainBlockShards, _ error) {
shards, err := h.storage.GetBlockShards(ctx, ton.BlockID{Shard: 0x8000000000000000, Seqno: uint32(params.MasterchainSeqno), Workchain: -1})
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
Expand Down
Loading

0 comments on commit 821985e

Please sign in to comment.