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

Docusaurus v3 changes #241

Open
wants to merge 37 commits into
base: release-v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2b5bb92
admonition
jorka Dec 2, 2024
7bc5244
announcement bar
jorka Dec 2, 2024
a376187
api item
jorka Dec 2, 2024
d9d3cd3
api tabs
jorka Dec 2, 2024
9587157
code block
jorka Dec 2, 2024
98f4df5
doc breadcrumbs
jorka Dec 2, 2024
44436da
doc card
jorka Dec 2, 2024
bd9009b
doc generated index
jorka Dec 2, 2024
d7a09f9
dic item
jorka Dec 9, 2024
6c84b69
edit this page, custom icons
jorka Dec 9, 2024
39d9029
footer
jorka Dec 10, 2024
aebec60
heading
jorka Dec 10, 2024
bde379d
edit meta row
jorka Dec 10, 2024
955655d
last updated
jorka Dec 10, 2024
dc28603
tag
jorka Dec 10, 2024
cfd6de0
edit icon fix
jorka Dec 11, 2024
941e8e2
edit icon fix
jorka Dec 11, 2024
e631d5c
remove console log
jorka Dec 12, 2024
7fe1552
sidebar version
jorka Dec 12, 2024
01eb14b
sidebar version
jorka Dec 12, 2024
5616d68
toc
jorka Dec 12, 2024
6fafdd3
tabs
jorka Dec 12, 2024
4854fe2
mdx components tooltip
jorka Dec 12, 2024
d751e0d
config and deps
jorka Dec 12, 2024
a0b477b
remove DocVersionBadge
jorka Dec 12, 2024
08433f4
announcement bar - fix useEffect
jorka Dec 13, 2024
0040b17
fix docs/earn-ctsi/staking-faq.md mdx
jorka Dec 13, 2024
4825e41
open api config - enable generation of previos versions
jorka Dec 13, 2024
b29fa0a
generate prev versions open api
jorka Dec 13, 2024
e931b59
yarn lock
jorka Dec 13, 2024
4c40305
remove log
jorka Dec 13, 2024
f3363ca
fix mdx
jorka Dec 13, 2024
dbef53b
add deps
jorka Dec 13, 2024
d82fff7
fix tabs inside openapi - remove border:
jorka Dec 13, 2024
243a043
fix mdx
jorka Dec 18, 2024
2adf80f
add missing page to fix broken links
jorka Dec 18, 2024
7c1e472
fix api folder for v2, comment missing redirects, switch to v2
jorka Dec 18, 2024
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
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
---
id: inspect-state-http-api-for-cartesi-rollups
title: "Inspect-state HTTP API for Cartesi Rollups"
description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend.
"
description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend."
sidebar_label: Introduction
sidebar_position: 0
hide_title: true
custom_edit_url: null
---

import ApiLogo from "@theme/ApiLogo";
import Tabs from "@theme/Tabs";
import Heading from "@theme/Heading";
import SchemaTabs from "@theme/SchemaTabs";
import TabItem from "@theme/TabItem";
import Export from "@theme/ApiExplorer/Export";

<span className={"theme-doc-version-badge badge badge--secondary"}>
Version: 0.4.0
<span
className={"theme-doc-version-badge badge badge--secondary"}
children={"Version: 0.4.0"}
>
</span>

# Inspect-state HTTP API for Cartesi Rollups
<Heading
as={"h1"}
className={"openapi__heading"}
children={"Inspect-state HTTP API for Cartesi Rollups"}
>
</Heading>



API that allows the dApp frontend to make inspect-state requests to the dApp backend.

<div style={{ marginBottom: "var(--ifm-paragraph-margin-bottom)" }}>
<h3 style={{ marginBottom: "0.25rem" }}>License</h3>
<a href={"https://www.apache.org/licenses/LICENSE-2.0.html"}>Apache-2.0</a>

<div
style={{"marginBottom":"var(--ifm-paragraph-margin-bottom)"}}
>
<h3
style={{"marginBottom":"0.25rem"}}
>
License
</h3><a
href={"https://www.apache.org/licenses/LICENSE-2.0.html"}
>
Apache-2.0
</a>
</div>

100 changes: 59 additions & 41 deletions cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect.api.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
---
id: add-notice
title: "Add a new notice"
description: "The dApp backend can call this method to add a new notice when processing advance-state request.
A notice describes any changes to the internal state of the dApp that may be relevant to the blockchain.
Between calls to the finish method, the notice method can be called at least 32k times.

The returned value is the index of the notice for the current advance request.
In other words, the index counting restarts at every request.
"
sidebar_label: Add a new notice
description: "The dApp backend can call this method to add a new notice when processing advance-state request."
sidebar_label: "Add a new notice"
hide_title: true
hide_table_of_contents: true
api: {"operationId":"addNotice","description":"The dApp backend can call this method to add a new notice when processing advance-state request.\nA notice describes any changes to the internal state of the dApp that may be relevant to the blockchain.\nBetween calls to the finish method, the notice method can be called at least 32k times.\n\nThe returned value is the index of the notice for the current advance request.\nIn other words, the index counting restarts at every request.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"string","description":"Payload in the Ethereum hex binary format.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.\nAn empty payload is represented by the string '0x'.\n","example":"0xdeadbeef"}}}}}},"responses":{"200":{"description":"Created the notice.","content":{"application/json":{"schema":{"type":"object","properties":{"index":{"type":"integer","format":"uint64","description":"Position in the Merkle tree.","example":123}}}}}},"default":{"description":"Error response.","content":{"text/plain":{"schema":{"type":"string","description":"Detailed error message.","example":"The request could not be understood by the server due to malformed syntax"}}}}},"method":"post","path":"/notice","servers":[{"url":"https://<dapp_rollup_url>"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"payload":"0xdeadbeef"},"info":{"title":"Cartesi Rollup HTTP API","version":"0.4.0","license":{"name":"Apache-2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"description":"API that the Cartesi Rollup HTTP Server implements.\n\nIn the box below, there is an example of a dApp backend that uses the Rollup HTTP API.\n\n```\nimport requests\nimport sys\n\nrollup = sys.argv[1]\n\ndef check_status_code(response):\n if response.status_code not in range(200, 300):\n print(f'Error: invalid status code {response.status_code}')\n sys.exit(1)\n return response\n\nfinish = {'status': 'accept'}\nwhile True:\n print('Sending finish')\n r = check_status_code(requests.post(rollup + '/finish', json=finish))\n if r.status_code == 202:\n print('No pending rollup request, trying again')\n continue\n\n rollup_request = r.json()\n if rollup_request['request_type'] == 'advance_state':\n print('Sending voucher')\n voucher = {\n 'address': rollup_request['data']['metadata']['msg_sender'],\n 'payload': rollup_request['data']['payload']\n }\n check_status_code(requests.post(rollup + '/voucher', json=voucher))\n\n print('Sending notice')\n notice = {'payload': rollup_request['data']['payload']}\n check_status_code(requests.post(rollup + '/notice', json=notice))\n\n print('Sending report')\n report = {'payload': rollup_request['data']['payload']}\n check_status_code(requests.post(rollup + '/report', json=report))\n\n finish['status'] = 'accept'\n\n elif rollup_request['request_type'] == 'inspect_state':\n print('Sending report per inspect request')\n report = {'payload': rollup_request['data']['payload']}\n check_status_code(requests.post(rollup + '/report', json=report))\n\n else:\n print('Throwing rollup exception')\n exception = {'payload': rollup_request['data']['payload']}\n requests.post(rollup + '/exception', json=exception)\n break\n```\n"},"postman":{"name":"Add a new notice","description":{"content":"The dApp backend can call this method to add a new notice when processing advance-state request.\nA notice describes any changes to the internal state of the dApp that may be relevant to the blockchain.\nBetween calls to the finish method, the notice method can be called at least 32k times.\n\nThe returned value is the index of the notice for the current advance request.\nIn other words, the index counting restarts at every request.\n","type":"text/plain"},"url":{"path":["notice"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}}
api: eJztWG1v2zYQ/iuEvijBXNtx2g0LlgFpl2EBti5osk+OkdLS2VIjkxpJxTEM//c9R1K24qRd94JhA2YgNnU6Hp977ng8Zp3omox0pVYXeXKSyDx/q12ZUdJLcrKZKWt+hzfXBYn8rK7FVGZ3pHKRSYW/qhKuKK1YkCt0LpwWMCGkULQUylsS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/fsbhdW0cW0a2a3ArizrhKCIU37uSzO/Hx9NWI6tgLJK2d0tn56Nvc10TgftDjg8uVECn3K22xQdPZ+m2J6Gz+MDFJeeOB4O20n8qbEn3MEs9dl4Al0cgGUugg3hbayfs7xJD3dGGDI9lO7gKArDcbqFxH7Es/pUrNNgJj0Rqcwyql26uVHLAntQXJuGIrgALL0Cw1xvw/R2UQM7z5ESqO3zJjqIhH4h0kGc3BOc7qfh6fBwx9wjyk5PxWg4ekJR+laLOoKJpuN6yBOz8l3SHKWnywvXplI13n8PO2zStpKcYmVGdNCB8khjnMbBLZewdMLY0thweM8pfYqzZexeN6DIdPFEEQdhJ+QPjOYIFsdkH0EunUwn4xQVSm7Hdn6LUxGlL5309izFuvEJS63GZDdz0+Hs88PaehjjGh85sB8lJdTTLiexreO8/APQ/xzguHrEG54+CRf9B0pEF26Q/DNw4+oRbnh6DDdspXG7o5Gg2z3dqlH1eWmN3q5Gf/K7aR0JqMm3gzyl3Yf/TpqosvTUm+vC6GWnlNADk4bjq+vEVvgX/Pgo6t2KEfhW0EEwRed5F88vPmfZyEKq7gG+d3Xcb686t5f/76P/1ftobKA7/fUmdmvr2KmOkxh+9JTcaLJkvZ5KS7+YarNhMewZXGfHGN5LU8opt4/jCSwVaC9x4+DW9o5W3FOGlHlxzeuyOjjg/3TsX3O40Q0zznzR+aTupNNlX/58dQ3labxgL7C/ITVyyZdvfJ8kGGifwv6S5GXrpEIaNbgc4H2wyZ/fAIpfDIM=
sidebar_class_name: "post api-method"
info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api
info_path: cartesi-rollups/_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api
custom_edit_url: null
---

import ApiTabs from "@theme/ApiTabs";
import MimeTabs from "@theme/MimeTabs";
import ParamsItem from "@theme/ParamsItem";
import ResponseSamples from "@theme/ResponseSamples";
import SchemaItem from "@theme/SchemaItem";
import SchemaTabs from "@theme/SchemaTabs";
import DiscriminatorTabs from "@theme/DiscriminatorTabs";
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
import RequestSchema from "@theme/RequestSchema";
import StatusCodes from "@theme/StatusCodes";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
import Heading from "@theme/Heading";

<Heading
as={"h1"}
className={"openapi__heading"}
children={"Add a new notice"}
>
</Heading>

<MethodEndpoint
method={"post"}
path={"/notice"}
context={"endpoint"}
>

</MethodEndpoint>


## Add a new notice

The dApp backend can call this method to add a new notice when processing advance-state request.
A notice describes any changes to the internal state of the dApp that may be relevant to the blockchain.
Expand All @@ -34,16 +43,35 @@ Between calls to the finish method, the notice method can be called at least 32k
The returned value is the index of the notice for the current advance request.
In other words, the index counting restarts at every request.

<MimeTabs><TabItem label={"application/json"} value={"application/json-schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Request Body</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"payload"} required={false} schemaDescription={"Payload in the Ethereum hex binary format.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.\nAn empty payload is represented by the string '0x'.\n"} schemaName={"string"} qualifierMessage={undefined} defaultValue={undefined}></SchemaItem></ul></details></TabItem></MimeTabs><div><ApiTabs><TabItem label={"200"} value={"200"}><div>

Created the notice.
<Heading
id={"request"}
as={"h2"}
className={"openapi-tabs__heading"}
children={"Request"}
>
</Heading>

</div><div><MimeTabs groupId={"mime-type"}><TabItem label={"application/json"} value={"application/json"}><SchemaTabs groupId={"schema-tabs"}><TabItem label={"Schema"} value={"Schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Schema</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"index"} required={false} schemaDescription={"Position in the Merkle tree."} schemaName={"uint64"} qualifierMessage={undefined} defaultValue={undefined}></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"index\": 0\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"default"} value={"default"}><div>
<ParamsDetails
parameters={undefined}
>

</ParamsDetails>

Error response.
<RequestSchema
title={"Body"}
body={{"content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"string","description":"Payload in the Ethereum hex binary format.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.\nAn empty payload is represented by the string '0x'.\n","example":"0xdeadbeef","title":"Payload"}},"title":"Notice"}}}}}
>

</RequestSchema>

</div><div><MimeTabs groupId={"mime-type"}><TabItem label={"text/plain"} value={"text/plain"}><SchemaTabs groupId={"schema-tabs"}><TabItem label={"Schema"} value={"Schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Schema</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><li><div><strong>string</strong><div style={{"marginTop":"var(--ifm-table-cell-padding)"}}>
<StatusCodes
id={undefined}
label={undefined}
responses={{"200":{"description":"Created the notice.","content":{"application/json":{"schema":{"type":"object","properties":{"index":{"type":"integer","format":"uint64","description":"Position in the Merkle tree.","example":123,"title":"Index"}},"title":"IndexResponse"}}}},"default":{"description":"Error response.","content":{"text/plain":{"schema":{"type":"string","description":"Detailed error message.","example":"The request could not be understood by the server due to malformed syntax","title":"Error"}}}}}}
>

</StatusCodes>

Detailed error message.

</div></div></li></ul></details></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem></ApiTabs></div>
Loading