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

Algod compile api #1007

Merged
merged 17 commits into from May 27, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 74 additions & 1 deletion daemon/algod/api/algod.oas2.json
Expand Up @@ -668,7 +668,60 @@
"required": true
}
]
}
},
"/v2/teal/compile": {
"post": {
"description": "Given TEAL source code in plain text, return base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style).",
"consumes": [
"text/plain"
],
"produces": [
"application/json"
],
"schemes": [
"http"
],
"summary": "Compile TEAL source code to binary, produce its hash",
"operationId": "TealCompile",
"parameters": [
{
"description": "TEAL source code to be compiled",
"name": "source",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/PostCompileResponse"
},
"400": {
"description": "Bad Request - Teal Compile Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"401": {
"description": "Invalid API Token",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"default": {
"description": "Unknown Error"
}
}
}
}
},
"definitions": {
"Account": {
Expand Down Expand Up @@ -1359,6 +1412,26 @@
},
"x-go-package": "github.com/algorand/go-algorand/daemon/algod/api/spec/v1"
}
},
"PostCompileResponse": {
"description": "Teal compile Result",
"schema": {
"type": "object",
"required": [
"hash",
"result"
],
"properties": {
"hash": {
"description": "base32 SHA512_256 of program bytes (Address style)",
"type": "string"
},
"result":{
"description": "base64 encoded program bytes",
"type": "string"
}
}
}
}
},
"securityDefinitions": {
Expand Down
103 changes: 103 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Expand Up @@ -382,6 +382,30 @@
},
"description": "A potentially truncated list of transactions currently in the node's transaction pool. You can compute whether or not the list is truncated if the number of elements in the **top-transactions** array is fewer than **total-transactions**."
},
"PostCompileResponse": {
"content": {
"application/json": {
"schema": {
"properties": {
"hash": {
"description": "base32 SHA512_256 of program bytes (Address style)",
"type": "string"
},
"result": {
"description": "base64 encoded program bytes",
"type": "string"
}
},
"required": [
"hash",
"result"
],
"type": "object"
}
}
},
"description": "Teal compile Result"
},
"PostTransactionsResponse": {
"content": {
"application/json": {
Expand Down Expand Up @@ -1536,6 +1560,85 @@
"summary": "Gets the node status after waiting for the given round."
}
},
"/v2/teal/compile": {
"post": {
"description": "Given TEAL source code in plain text, return base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style).",
"operationId": "TealCompile",
"requestBody": {
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
},
"description": "TEAL source code to be compiled",
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"hash": {
"description": "base32 SHA512_256 of program bytes (Address style)",
"type": "string"
},
"result": {
"description": "base64 encoded program bytes",
"type": "string"
}
},
"required": [
"hash",
"result"
],
"type": "object"
}
}
},
"description": "Teal compile Result"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Bad Request - Teal Compile Error"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Invalid API Token"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Error"
},
"default": {
"content": {},
"description": "Unknown Error"
}
},
"summary": "Compile TEAL source code to binary, produce its hash",
"x-codegen-request-body-name": "source"
}
},
"/v2/transactions": {
"post": {
"operationId": "RawTransaction",
Expand Down