-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Theoros validators stuff (#24)
* feat(theoros_validators): Theoros validators stuff * feat(theoros_validators): theoros storage * feat(theoros_validators): Som docssss * feat(theoros_validators): Hyperlane rpc stuff * feat(theoros_validators): Storage stuff * feat(theoros_validators): Stufff * feat(theoros_validators): docs * feat(theoros_validators): Storages -> Storage * feat(theoros_validators): latest toolchain * feat(theoros_validators): Docs' * feat(theoros_validators):
- Loading branch information
Showing
36 changed files
with
667 additions
and
297 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[toolchain] | ||
channel = "1.80.0" | ||
channel = "1.81.0" | ||
components = ["rustfmt", "clippy", "rust-analyzer"] | ||
targets = ["wasm32-unknown-unknown"] | ||
profile = "minimal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,141 @@ | ||
{"openapi":"3.0.3","info":{"title":"theoros","description":"","license":{"name":""},"version":"0.1.0"},"paths":{"/v1/calldata":{"get":{"tags":["crate::handlers::get_calldata"],"operationId":"get_calldata","parameters":[],"responses":{"200":{"description":"Get the calldata","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GetCalldataResponse"}}}}}}}}},"components":{"schemas":{"GetCalldataError":{"type":"string","enum":["InternalServerError","DatabaseConnection"]},"GetCalldataQuery":{"type":"object"},"GetCalldataResponse":{"type":"object","required":["hash"],"properties":{"hash":{"type":"string"}}}},"responses":{"GetCalldataResponse":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["hash"],"properties":{"hash":{"type":"string"}}}}}}}},"tags":[{"name":"theoros","description":"Theoros - the Pragma Consultant"}]} | ||
{ | ||
"openapi": "3.0.3", | ||
"info": { | ||
"title": "theoros", | ||
"description": "", | ||
"license": { | ||
"name": "" | ||
}, | ||
"version": "0.1.0" | ||
}, | ||
"paths": { | ||
"/v1/calldata": { | ||
"get": { | ||
"tags": [ | ||
"crate::handlers::get_data_feeds" | ||
], | ||
"operationId": "get_data_feeds", | ||
"parameters": [], | ||
"responses": { | ||
"200": { | ||
"description": "Get all the available data feeds", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/components/schemas/GetDataFeedsResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/v1/calldata/{data_feed_id}": { | ||
"get": { | ||
"tags": [ | ||
"crate::handlers::get_calldata" | ||
], | ||
"operationId": "get_calldata", | ||
"parameters": [], | ||
"responses": { | ||
"200": { | ||
"description": "Constructs the calldata used to update the data feed id specified", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/components/schemas/GetCalldataResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"GetCalldataError": { | ||
"type": "string", | ||
"enum": [ | ||
"InternalServerError", | ||
"DatabaseConnection" | ||
] | ||
}, | ||
"GetCalldataQuery": { | ||
"type": "object" | ||
}, | ||
"GetCalldataResponse": { | ||
"type": "object", | ||
"required": [ | ||
"hash" | ||
], | ||
"properties": { | ||
"hash": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"GetDataFeedsError": { | ||
"type": "string", | ||
"enum": [ | ||
"InternalServerError", | ||
"DatabaseConnection" | ||
] | ||
}, | ||
"GetDataFeedsQuery": { | ||
"type": "object" | ||
}, | ||
"GetDataFeedsResponse": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"GetCalldataResponse": { | ||
"description": "", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"hash" | ||
], | ||
"properties": { | ||
"hash": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"GetDataFeedsResponse": { | ||
"description": "", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"tags": [ | ||
{ | ||
"name": "theoros", | ||
"description": "Theoros - the Pragma Consultant" | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use axum::{http::StatusCode, response::IntoResponse, Json}; | ||
use serde_json::json; | ||
use utoipa::ToSchema; | ||
|
||
#[derive(Debug, thiserror::Error, ToSchema)] | ||
#[allow(unused)] | ||
pub enum GetDataFeedsError { | ||
#[error("internal server error")] | ||
InternalServerError, | ||
#[error("could not establish a connection with the database")] | ||
DatabaseConnection, | ||
} | ||
|
||
impl IntoResponse for GetDataFeedsError { | ||
fn into_response(self) -> axum::response::Response { | ||
let (status, err_msg) = match self { | ||
Self::DatabaseConnection => { | ||
(StatusCode::SERVICE_UNAVAILABLE, "Could not establish a connection with the Database".to_string()) | ||
} | ||
_ => (StatusCode::INTERNAL_SERVER_ERROR, String::from("Internal server error")), | ||
}; | ||
(status, Json(json!({"resource":"Calldata", "message": err_msg, "happened_at" : chrono::Utc::now() }))) | ||
.into_response() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
pub mod app_error; | ||
pub mod calldata_error; | ||
pub mod data_feeds_error; | ||
|
||
pub use app_error::AppError; | ||
pub use calldata_error::GetCalldataError; | ||
pub use data_feeds_error::GetDataFeedsError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use axum::extract::{Query, State}; | ||
use axum::Json; | ||
use serde::{Deserialize, Serialize}; | ||
use utoipa::{IntoParams, ToResponse, ToSchema}; | ||
|
||
use crate::errors::GetDataFeedsError; | ||
use crate::AppState; | ||
|
||
#[derive(Default, Deserialize, IntoParams, ToSchema)] | ||
pub struct GetDataFeedsQuery {} | ||
|
||
#[derive(Debug, Default, Serialize, Deserialize, ToResponse, ToSchema)] | ||
pub struct GetDataFeedsResponse(pub Vec<String>); | ||
|
||
#[utoipa::path( | ||
get, | ||
// TODO: path | ||
path = "/v1/calldata", | ||
responses( | ||
(status = 200, description = "Get all the available data feeds", body = [GetDataFeedsResponse]) | ||
), | ||
params( | ||
GetDataFeedsQuery | ||
), | ||
)] | ||
pub async fn get_data_feeds( | ||
State(_state): State<AppState>, | ||
Query(_params): Query<GetDataFeedsQuery>, | ||
) -> Result<Json<GetDataFeedsResponse>, GetDataFeedsError> { | ||
tracing::info!("Received get calldata request"); | ||
Ok(Json(GetDataFeedsResponse::default())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod get_calldata; | ||
pub mod get_data_feeds; | ||
pub mod subscribe_to_calldata; |
Oops, something went wrong.