From f38a70215f77a6e8b9be4ae0f55a516efe4119df Mon Sep 17 00:00:00 2001 From: Alex Mikhalevich <2990126+alexmikhalevich@users.noreply.github.com> Date: Tue, 23 Apr 2024 15:28:14 +0200 Subject: [PATCH 1/2] feat: add gio endpoint doc & update definitions --- rollup.yaml | 113 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 98 insertions(+), 15 deletions(-) diff --git a/rollup.yaml b/rollup.yaml index 7568470..ea2f71d 100644 --- a/rollup.yaml +++ b/rollup.yaml @@ -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 @@ -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 @@ -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. @@ -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 @@ -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 @@ -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. + example: "0x0000000000000000000000000000000000000000000000000000000000000001" + pattern: "^0x([0-9a-fA-F]{64})$" + format: hex payload: type: string description: | @@ -369,6 +417,7 @@ components: format: hex required: - destination + - value - payload Notice: @@ -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: From 71cbd207b7027995ee63239709a0b14d67d5f354 Mon Sep 17 00:00:00 2001 From: Alex Mikhalevich <2990126+alexmikhalevich@users.noreply.github.com> Date: Tue, 23 Apr 2024 18:08:25 +0200 Subject: [PATCH 2/2] chore: update changelog --- CHANGELOG.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 202ebff..2083a33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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