Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

fix(docs): add body to api req #432

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
48 changes: 48 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ const docTemplate = `{
],
"summary": "Try to accept a block proof assignment",
"operationId": "create-assignment",
"parameters": [
{
"description": "assignment request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/prover_server.CreateAssignmentRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK",
Expand Down Expand Up @@ -72,6 +83,43 @@ const docTemplate = `{
}
},
"definitions": {
"big.Int": {
"type": "object"
},
"github_com_taikoxyz_taiko-client_bindings_encoding.TierFee": {
"type": "object",
"properties": {
"fee": {
"$ref": "#/definitions/big.Int"
},
"tier": {
"type": "integer"
}
}
},
"prover_server.CreateAssignmentRequestBody": {
"type": "object",
"properties": {
"expiry": {
"type": "integer"
},
"feeToken": {
"type": "string"
},
"tierFees": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_taikoxyz_taiko-client_bindings_encoding.TierFee"
}
},
"txListHash": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"prover_server.ProposeBlockResponse": {
"type": "object",
"properties": {
Expand Down
48 changes: 48 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
],
"summary": "Try to accept a block proof assignment",
"operationId": "create-assignment",
"parameters": [
{
"description": "assignment request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/prover_server.CreateAssignmentRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK",
Expand Down Expand Up @@ -63,6 +74,43 @@
}
},
"definitions": {
"big.Int": {
"type": "object"
},
"github_com_taikoxyz_taiko-client_bindings_encoding.TierFee": {
"type": "object",
"properties": {
"fee": {
"$ref": "#/definitions/big.Int"
},
"tier": {
"type": "integer"
}
}
},
"prover_server.CreateAssignmentRequestBody": {
"type": "object",
"properties": {
"expiry": {
"type": "integer"
},
"feeToken": {
"type": "string"
},
"tierFees": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_taikoxyz_taiko-client_bindings_encoding.TierFee"
}
},
"txListHash": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"prover_server.ProposeBlockResponse": {
"type": "object",
"properties": {
Expand Down
31 changes: 31 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
definitions:
big.Int:
type: object
github_com_taikoxyz_taiko-client_bindings_encoding.TierFee:
properties:
fee:
$ref: '#/definitions/big.Int'
tier:
type: integer
type: object
prover_server.CreateAssignmentRequestBody:
properties:
expiry:
type: integer
feeToken:
type: string
tierFees:
items:
$ref: '#/definitions/github_com_taikoxyz_taiko-client_bindings_encoding.TierFee'
type: array
txListHash:
items:
type: integer
type: array
type: object
prover_server.ProposeBlockResponse:
properties:
prover:
Expand Down Expand Up @@ -38,6 +62,13 @@ paths:
consumes:
- application/json
operationId: create-assignment
parameters:
- description: assignment request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/prover_server.CreateAssignmentRequestBody'
produces:
- application/json
responses:
Expand Down
25 changes: 13 additions & 12 deletions prover/server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,19 @@ type ProposeBlockResponse struct {
// handle this block, and if so, returns a signed payload the proposer
// can submit onchain.
//
// @Summary Try to accept a block proof assignment
// @ID create-assignment
// @Accept json
// @Produce json
// @Success 200 {object} ProposeBlockResponse
// @Failure 422 {string} string "invalid txList hash"
// @Failure 422 {string} string "only receive ETH"
// @Failure 422 {string} string "insufficient prover balance"
// @Failure 422 {string} string "proof fee too low"
// @Failure 422 {string} string "expiry too long"
// @Failure 422 {string} string "prover does not have capacity"
// @Router /assignment [post]
// @Summary Try to accept a block proof assignment
// @ID create-assignment
// @Param body body CreateAssignmentRequestBody true "assignment request body"
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved
// @Accept json
// @Produce json
// @Success 200 {object} ProposeBlockResponse
// @Failure 422 {string} string "invalid txList hash"
// @Failure 422 {string} string "only receive ETH"
// @Failure 422 {string} string "insufficient prover balance"
// @Failure 422 {string} string "proof fee too low"
// @Failure 422 {string} string "expiry too long"
// @Failure 422 {string} string "prover does not have capacity"
// @Router /assignment [post]
func (srv *ProverServer) CreateAssignment(c echo.Context) error {
req := new(CreateAssignmentRequestBody)
if err := c.Bind(req); err != nil {
Expand Down