Calindra / cartesi-lambada-guest-tools

Apache License 2.0
1 stars 0 forks source link

[Co-Processor/Lambada] Documentation/Tutorial #1

Open fabiooshiro opened 3 weeks ago

fabiooshiro commented 3 weeks ago

HTTP API Documentation

This API provides endpoints for managing state, interacting with IPFS, and communicating with a rollup server. It supports operations such as setting, deleting, and fetching state, as well as interacting with metadata and externalizing state.

Endpoints

DELETE /delete_state/{key}

Deletes the state associated with a specific key.

POST /set_state/{key}

Sets a state with the given key and associated data.

GET /get_state/{key}

Retrieves the state associated with a specific key.

GET /open_state

Requests and opens the current state based on a GIO request.

GET /commit_state

Commits the current state by sending a GIO request to a rollup server.

GET /metadata/{text}

Fetches metadata associated with the provided text.

PUT /ipfs/put/{cid}

Uploads data to IPFS and externalizes the state.

HEAD /ipfs/has/{cid}

Checks if a specific CID exists on IPFS.

GET /ipfs/get/{cid}

Fetches data from IPFS by CID.

GET /get_data/{namespace}/{data_id}

Fetches data based on a namespace and data ID.

GET /get_app

Fetches the current app state using a GIO request.

Configuration

The HTTP server can be configured via a Config struct that defines the HTTP address and port. The server is created using the create_server function and run asynchronously with the run function.

sandhilt commented 3 weeks ago

OpenAPI specification: https://github.com/Calindra/salsa/blob/ce17d6a0bc8ae028a51c36302e244a4407d7cd07/lambda.yaml