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

feat: add gio endpoint doc & update definitions #15

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unrelesed
## Unreleased

## [0.8.0] - 2024-04-23

### Added

- GIO endpoint documentation

### Changed

- Update Advance and Voucher formats

## [0.7.3] - 2024-04-17

Expand Down Expand Up @@ -81,7 +91,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [0.2.0]
- [0.1.0]

[unreleased]: https://github.com/cartesi/openapi-interfaces/compare/v0.7.3...HEAD
[unreleased]: https://github.com/cartesi/openapi-interfaces/compare/v0.8.0...HEAD
[0.8.0]: https://github.com/cartesi/openapi-interfaces/releases/tag/v0.8.0
[0.7.3]: https://github.com/cartesi/openapi-interfaces/releases/tag/v0.7.3
[0.7.2]: https://github.com/cartesi/openapi-interfaces/releases/tag/v0.7.2
[0.7.1]: https://github.com/cartesi/openapi-interfaces/releases/tag/v0.7.1
Expand Down
113 changes: 98 additions & 15 deletions rollup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.0

info:
title: Cartesi Rollup HTTP API
version: 0.7.1
version: 0.8.0
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
Expand Down Expand Up @@ -221,6 +221,35 @@ paths:
schema:
$ref: "#/components/schemas/Error"

/gio:
post:
operationId: gio
summary: Generic Input/Output
description: |
The DApp can call this method to perform a generic input/output request.

requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/GioRequest"
required: true

responses:
"200":
description: Request performed successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/GioResponse"

default:
description: Error response.
content:
text/plain:
schema:
$ref: "#/components/schemas/Error"

/exception:
post:
operationId: registerException
Expand Down Expand Up @@ -284,17 +313,17 @@ components:
Advance:
type: object
properties:
metadata:
$ref: "#/components/schemas/Metadata"
payload:
$ref: "#/components/schemas/Payload"
required:
- metadata
- payload

Metadata:
type: object
properties:
chain_id:
type: integer
format: uint64
description: Network identifier.
example: 42
app_contract:
type: string
description: 20-byte address of the application contract.
example: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
pattern: "^0x([0-9a-fA-F]{40})$"
format: address
msg_sender:
type: string
description: 20-byte address of the account that submitted the input.
Expand All @@ -316,17 +345,22 @@ components:
format: uint64
description: Block number when input was posted.
example: 10000000
timestamp:
block_timestamp:
type: integer
format: uint64
description: Unix timestamp of block in milliseconds.
example: 1588598533000
payload:
$ref: "#/components/schemas/Payload"
required:
- chain_id
- app_contract
- msg_sender
- epoch_index
- input_index
- block_number
- timestamp
- block_timestamp
- payload

Payload:
type: string
Expand All @@ -343,7 +377,15 @@ components:
type: object
properties:
payload:
$ref: "#/components/schemas/Payload"
type: string
description: |
The payload contains arbitrary hex-encoded binary data.
The first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.
For instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.
An empty payload is represented by the string '0x'.
example: "0xdeadbeef"
pattern: "^0x([0-9a-fA-F]{2})*$"
format: hex
required:
- payload

Expand All @@ -356,6 +398,12 @@ components:
example: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
pattern: "^0x([0-9a-fA-F]{40})$"
format: address
value:
type: string
description: A big-endian 32-byte unsigned integer in hex.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this parameter deserved a better description.
It is the amount of Wei to be passed to the destination.
Most notably, it can be used for Ether withdrawals.

example: "0x0000000000000000000000000000000000000000000000000000000000000001"
pattern: "^0x([0-9a-fA-F]{64})$"
format: hex
payload:
type: string
description: |
Expand All @@ -369,6 +417,7 @@ components:
format: hex
required:
- destination
- value
- payload

Notice:
Expand All @@ -387,6 +436,40 @@ components:
required:
- payload

GioRequest:
type: object
properties:
domain:
type: integer
format: uint16
description: An arbitrary number representing the request domain.
example: 8
id:
type: string
format: hex
description: Domain-specific information identifying the request.
example: "0xdeadbeef"
required:
- domain
- id

GioResponse:
type: object
properties:
code:
type: integer
format: uint16
description: A number representing the response code.
example: 8
data:
type: string
format: hex
description: The response data.
example: "0xdeadbeef"
required:
- code
- data

Exception:
type: object
properties:
Expand Down
Loading