diff --git a/Cargo.toml b/Cargo.toml index 83dc8e2c..6177d9a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ members = [ "packages/caviarnine-adapter-v1", # Libraries "libraries/package-loader", + "libraries/gateway-client", "libraries/scrypto-interface", "libraries/adapters-interface", # Tools diff --git a/Makefile.toml b/Makefile.toml index 5cfa1fc5..8951fc6c 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -15,6 +15,9 @@ install_crate = "rustfmt" command = "cargo" args = ["fmt"] +[tasks.fmt] +alias = "format" + [tasks.publish-stokenet] command = "cargo" args = [ diff --git a/libraries/gateway-client/Cargo.toml b/libraries/gateway-client/Cargo.toml new file mode 100644 index 00000000..29b47c91 --- /dev/null +++ b/libraries/gateway-client/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "gateway-client" +description = "An auto-generated gateway client used by the various Ignition tools." +version.workspace = true +edition.workspace = true + +[dependencies] +serde = { version = "1.0.195", features = ["derive"] } +serde_with = { version = "3.5.1" } +serde_json = { version = "1.0.111" } +url = { version = "2.5.0" } +uuid = { version = "1.7.0", features = ["serde", "v4"] } +reqwest = { version = "0.11.23", features = ["json", "blocking", "multipart"] } diff --git a/libraries/gateway-client/src/apis/configuration.rs b/libraries/gateway-client/src/apis/configuration.rs new file mode 100644 index 00000000..9e0df6d2 --- /dev/null +++ b/libraries/gateway-client/src/apis/configuration.rs @@ -0,0 +1,38 @@ +#[derive(Debug, Clone)] +pub struct Configuration { + pub base_path: String, + pub user_agent: Option, + pub client: reqwest::blocking::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub bearer_access_token: Option, + pub api_key: Option, +} + +pub type BasicAuth = (String, Option); + +#[derive(Debug, Clone)] +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + +impl Configuration { + pub fn new() -> Configuration { + Configuration::default() + } +} + +impl Default for Configuration { + fn default() -> Self { + Configuration { + base_path: "http://localhost".to_owned(), + user_agent: Some("OpenAPI-Generator/v1.2.2/rust".to_owned()), + client: reqwest::blocking::Client::new(), + basic_auth: None, + oauth_access_token: None, + bearer_access_token: None, + api_key: None, + } + } +} diff --git a/libraries/gateway-client/src/apis/mod.rs b/libraries/gateway-client/src/apis/mod.rs new file mode 100644 index 00000000..a9ebf3e9 --- /dev/null +++ b/libraries/gateway-client/src/apis/mod.rs @@ -0,0 +1,109 @@ +use std::error; +use std::fmt; + +#[derive(Debug, Clone)] +pub struct ResponseContent { + pub status: reqwest::StatusCode, + pub content: String, + pub entity: Option, +} + +#[derive(Debug)] +pub enum Error { + Reqwest(reqwest::Error), + Serde(serde_json::Error), + Io(std::io::Error), + ResponseError(ResponseContent), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let (module, e) = match self { + Error::Reqwest(e) => ("reqwest", e.to_string()), + Error::Serde(e) => ("serde", e.to_string()), + Error::Io(e) => ("IO", e.to_string()), + Error::ResponseError(e) => { + ("response", format!("status code {}", e.status)) + } + }; + write!(f, "error in {}: {}", module, e) + } +} + +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + Some(match self { + Error::Reqwest(e) => e, + Error::Serde(e) => e, + Error::Io(e) => e, + Error::ResponseError(_) => return None, + }) + } +} + +impl From for Error { + fn from(e: reqwest::Error) -> Self { + Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + Error::Serde(e) + } +} + +impl From for Error { + fn from(e: std::io::Error) -> Self { + Error::Io(e) + } +} + +pub fn urlencode>(s: T) -> String { + ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() +} + +pub fn parse_deep_object( + prefix: &str, + value: &serde_json::Value, +) -> Vec<(String, String)> { + if let serde_json::Value::Object(object) = value { + let mut params = vec![]; + + for (key, value) in object { + match value { + serde_json::Value::Object(_) => { + params.append(&mut parse_deep_object( + &format!("{}[{}]", prefix, key), + value, + )) + } + serde_json::Value::Array(array) => { + for (i, value) in array.iter().enumerate() { + params.append(&mut parse_deep_object( + &format!("{}[{}][{}]", prefix, key, i), + value, + )); + } + } + serde_json::Value::String(s) => { + params.push((format!("{}[{}]", prefix, key), s.clone())) + } + _ => params + .push((format!("{}[{}]", prefix, key), value.to_string())), + } + } + + return params; + } + + unimplemented!("Only objects are supported with style=deepObject") +} + +pub mod state_api; +pub mod statistics_api; +pub mod status_api; +pub mod stream_api; +pub mod transaction_api; + +pub mod configuration; diff --git a/libraries/gateway-client/src/apis/state_api.rs b/libraries/gateway-client/src/apis/state_api.rs new file mode 100644 index 00000000..72ba9c7d --- /dev/null +++ b/libraries/gateway-client/src/apis/state_api.rs @@ -0,0 +1,650 @@ +use reqwest; + +use super::{configuration, Error}; +use crate::apis::ResponseContent; + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum EntityFungibleResourceVaultPageError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum EntityFungiblesPageError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum EntityMetadataPageError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum EntityNonFungibleIdsPageError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum EntityNonFungibleResourceVaultPageError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum EntityNonFungiblesPageError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum KeyValueStoreDataError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum NonFungibleDataError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum NonFungibleIdsError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum NonFungibleLocationError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum StateEntityDetailsError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum StateValidatorsListError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +pub fn entity_fungible_resource_vault_page( + configuration: &configuration::Configuration, + state_entity_fungible_resource_vaults_page_request: crate::models::StateEntityFungibleResourceVaultsPageRequest, +) -> Result< + crate::models::StateEntityFungibleResourceVaultsPageResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/entity/page/fungible-vaults/", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = local_var_req_builder + .json(&state_entity_fungible_resource_vaults_page_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn entity_fungibles_page( + configuration: &configuration::Configuration, + state_entity_fungibles_page_request: crate::models::StateEntityFungiblesPageRequest, +) -> Result< + crate::models::StateEntityFungiblesPageResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/entity/page/fungibles/", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_entity_fungibles_page_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn entity_metadata_page( + configuration: &configuration::Configuration, + state_entity_metadata_page_request: crate::models::StateEntityMetadataPageRequest, +) -> Result< + crate::models::StateEntityMetadataPageResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/entity/page/metadata", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_entity_metadata_page_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn entity_non_fungible_ids_page( + configuration: &configuration::Configuration, + state_entity_non_fungible_ids_page_request: crate::models::StateEntityNonFungibleIdsPageRequest, +) -> Result< + crate::models::StateEntityNonFungibleIdsPageResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/entity/page/non-fungible-vault/ids", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_entity_non_fungible_ids_page_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn entity_non_fungible_resource_vault_page( + configuration: &configuration::Configuration, + state_entity_non_fungible_resource_vaults_page_request: crate::models::StateEntityNonFungibleResourceVaultsPageRequest, +) -> Result< + crate::models::StateEntityNonFungibleResourceVaultsPageResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/entity/page/non-fungible-vaults/", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = local_var_req_builder + .json(&state_entity_non_fungible_resource_vaults_page_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn entity_non_fungibles_page( + configuration: &configuration::Configuration, + state_entity_non_fungibles_page_request: crate::models::StateEntityNonFungiblesPageRequest, +) -> Result< + crate::models::StateEntityNonFungiblesPageResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/entity/page/non-fungibles/", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_entity_non_fungibles_page_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn key_value_store_data( + configuration: &configuration::Configuration, + state_key_value_store_data_request: crate::models::StateKeyValueStoreDataRequest, +) -> Result< + crate::models::StateKeyValueStoreDataResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/key-value-store/data", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_key_value_store_data_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn non_fungible_data( + configuration: &configuration::Configuration, + state_non_fungible_data_request: crate::models::StateNonFungibleDataRequest, +) -> Result< + crate::models::StateNonFungibleDataResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/non-fungible/data", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_non_fungible_data_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn non_fungible_ids( + configuration: &configuration::Configuration, + state_non_fungible_ids_request: crate::models::StateNonFungibleIdsRequest, +) -> Result< + crate::models::StateNonFungibleIdsResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/non-fungible/ids", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_non_fungible_ids_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn non_fungible_location( + configuration: &configuration::Configuration, + state_non_fungible_location_request: crate::models::StateNonFungibleLocationRequest, +) -> Result< + crate::models::StateNonFungibleLocationResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/non-fungible/location", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_non_fungible_location_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn state_entity_details( + configuration: &configuration::Configuration, + state_entity_details_request: crate::models::StateEntityDetailsRequest, +) -> Result< + crate::models::StateEntityDetailsResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = + format!("{}/state/entity/details", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_entity_details_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn state_validators_list( + configuration: &configuration::Configuration, + state_validators_list_request: crate::models::StateValidatorsListRequest, +) -> Result< + crate::models::StateValidatorsListResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/state/validators/list", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&state_validators_list_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} diff --git a/libraries/gateway-client/src/apis/statistics_api.rs b/libraries/gateway-client/src/apis/statistics_api.rs new file mode 100644 index 00000000..66d92e6f --- /dev/null +++ b/libraries/gateway-client/src/apis/statistics_api.rs @@ -0,0 +1,56 @@ +use reqwest; + +use super::{configuration, Error}; +use crate::apis::ResponseContent; + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum ValidatorsUptimeError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +pub fn validators_uptime( + configuration: &configuration::Configuration, + validators_uptime_request: crate::models::ValidatorsUptimeRequest, +) -> Result> +{ + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/statistics/validators/uptime", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&validators_uptime_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} diff --git a/libraries/gateway-client/src/apis/status_api.rs b/libraries/gateway-client/src/apis/status_api.rs new file mode 100644 index 00000000..8fee4a44 --- /dev/null +++ b/libraries/gateway-client/src/apis/status_api.rs @@ -0,0 +1,101 @@ +use reqwest; + +use super::{configuration, Error}; +use crate::apis::ResponseContent; + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum GatewayStatusError { + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum NetworkConfigurationError { + UnknownValue(serde_json::Value), +} + +pub fn gateway_status( + configuration: &configuration::Configuration, +) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/status/gateway-status", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn network_configuration( + configuration: &configuration::Configuration, +) -> Result< + crate::models::NetworkConfigurationResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/status/network-configuration", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} diff --git a/libraries/gateway-client/src/apis/stream_api.rs b/libraries/gateway-client/src/apis/stream_api.rs new file mode 100644 index 00000000..dae72fda --- /dev/null +++ b/libraries/gateway-client/src/apis/stream_api.rs @@ -0,0 +1,56 @@ +use reqwest; + +use super::{configuration, Error}; +use crate::apis::ResponseContent; + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum StreamTransactionsError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +pub fn stream_transactions( + configuration: &configuration::Configuration, + stream_transactions_request: crate::models::StreamTransactionsRequest, +) -> Result< + crate::models::StreamTransactionsResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = + format!("{}/stream/transactions", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&stream_transactions_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} diff --git a/libraries/gateway-client/src/apis/transaction_api.rs b/libraries/gateway-client/src/apis/transaction_api.rs new file mode 100644 index 00000000..ed3cc3db --- /dev/null +++ b/libraries/gateway-client/src/apis/transaction_api.rs @@ -0,0 +1,264 @@ +use reqwest; + +use super::{configuration, Error}; +use crate::apis::ResponseContent; + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum TransactionCommittedDetailsError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum TransactionConstructionError { + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum TransactionPreviewError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum TransactionStatusError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum TransactionSubmitError { + Status4XX(crate::models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +pub fn transaction_committed_details( + configuration: &configuration::Configuration, + transaction_committed_details_request: crate::models::TransactionCommittedDetailsRequest, +) -> Result< + crate::models::TransactionCommittedDetailsResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/transaction/committed-details", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&transaction_committed_details_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn transaction_construction( + configuration: &configuration::Configuration, +) -> Result< + crate::models::TransactionConstructionResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!( + "{}/transaction/construction", + local_var_configuration.base_path + ); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn transaction_preview( + configuration: &configuration::Configuration, + transaction_preview_request: crate::models::TransactionPreviewRequest, +) -> Result< + crate::models::TransactionPreviewResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = + format!("{}/transaction/preview", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&transaction_preview_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn transaction_status( + configuration: &configuration::Configuration, + transaction_status_request: crate::models::TransactionStatusRequest, +) -> Result< + crate::models::TransactionStatusResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = + format!("{}/transaction/status", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&transaction_status_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn transaction_submit( + configuration: &configuration::Configuration, + transaction_submit_request: crate::models::TransactionSubmitRequest, +) -> Result< + crate::models::TransactionSubmitResponse, + Error, +> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = + format!("{}/transaction/submit", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client + .request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder + .header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = + local_var_req_builder.json(&transaction_submit_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() + && !local_var_status.is_server_error() + { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} diff --git a/libraries/gateway-client/src/lib.rs b/libraries/gateway-client/src/lib.rs new file mode 100644 index 00000000..3ce6649f --- /dev/null +++ b/libraries/gateway-client/src/lib.rs @@ -0,0 +1,9 @@ +#![allow(clippy::too_many_arguments)] + +extern crate reqwest; +extern crate serde; +extern crate serde_json; +extern crate url; + +pub mod apis; +pub mod models; diff --git a/libraries/gateway-client/src/models/at_ledger_state_mixin.rs b/libraries/gateway-client/src/models/at_ledger_state_mixin.rs new file mode 100644 index 00000000..41feda68 --- /dev/null +++ b/libraries/gateway-client/src/models/at_ledger_state_mixin.rs @@ -0,0 +1,25 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct AtLedgerStateMixin { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, +} + +impl Default for AtLedgerStateMixin { + fn default() -> Self { + Self::new() + } +} + +impl AtLedgerStateMixin { + pub fn new() -> AtLedgerStateMixin { + AtLedgerStateMixin { + at_ledger_state: None, + } + } +} diff --git a/libraries/gateway-client/src/models/committed_transaction_info.rs b/libraries/gateway-client/src/models/committed_transaction_info.rs new file mode 100644 index 00000000..2c4f2281 --- /dev/null +++ b/libraries/gateway-client/src/models/committed_transaction_info.rs @@ -0,0 +1,85 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct CommittedTransactionInfo { + #[serde(rename = "state_version")] + pub state_version: i64, + #[serde(rename = "epoch")] + pub epoch: i64, + #[serde(rename = "round")] + pub round: i64, + #[serde(rename = "round_timestamp")] + pub round_timestamp: String, + #[serde(rename = "transaction_status")] + pub transaction_status: crate::models::TransactionStatus, + + #[serde(rename = "payload_hash", skip_serializing_if = "Option::is_none")] + pub payload_hash: Option, + + #[serde(rename = "intent_hash", skip_serializing_if = "Option::is_none")] + pub intent_hash: Option, + + #[serde(rename = "fee_paid", skip_serializing_if = "Option::is_none")] + pub fee_paid: Option, + #[serde( + rename = "affected_global_entities", + skip_serializing_if = "Option::is_none" + )] + pub affected_global_entities: Option>, + #[serde( + rename = "confirmed_at", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub confirmed_at: Option>, + #[serde( + rename = "error_message", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub error_message: Option>, + + #[serde(rename = "raw_hex", skip_serializing_if = "Option::is_none")] + pub raw_hex: Option, + #[serde(rename = "receipt", skip_serializing_if = "Option::is_none")] + pub receipt: Option>, + + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde( + rename = "balance_changes", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub balance_changes: + Option>>, +} + +impl CommittedTransactionInfo { + pub fn new( + state_version: i64, + epoch: i64, + round: i64, + round_timestamp: String, + transaction_status: crate::models::TransactionStatus, + ) -> CommittedTransactionInfo { + CommittedTransactionInfo { + state_version, + epoch, + round, + round_timestamp, + transaction_status, + payload_hash: None, + intent_hash: None, + fee_paid: None, + affected_global_entities: None, + confirmed_at: None, + error_message: None, + raw_hex: None, + receipt: None, + message: None, + balance_changes: None, + } + } +} diff --git a/libraries/gateway-client/src/models/component_entity_role_assignment_entry.rs b/libraries/gateway-client/src/models/component_entity_role_assignment_entry.rs new file mode 100644 index 00000000..ccbcda5d --- /dev/null +++ b/libraries/gateway-client/src/models/component_entity_role_assignment_entry.rs @@ -0,0 +1,23 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ComponentEntityRoleAssignmentEntry { + #[serde(rename = "role_key")] + pub role_key: Box, + #[serde(rename = "assignment")] + pub assignment: + Box, + #[serde(rename = "updater_roles", skip_serializing_if = "Option::is_none")] + pub updater_roles: Option>, +} + +impl ComponentEntityRoleAssignmentEntry { + pub fn new( + role_key: crate::models::RoleKey, + assignment: crate::models::ComponentEntityRoleAssignmentEntryAssignment, + ) -> ComponentEntityRoleAssignmentEntry { + ComponentEntityRoleAssignmentEntry { + role_key: Box::new(role_key), + assignment: Box::new(assignment), + updater_roles: None, + } + } +} diff --git a/libraries/gateway-client/src/models/component_entity_role_assignment_entry_assignment.rs b/libraries/gateway-client/src/models/component_entity_role_assignment_entry_assignment.rs new file mode 100644 index 00000000..cb0fae03 --- /dev/null +++ b/libraries/gateway-client/src/models/component_entity_role_assignment_entry_assignment.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ComponentEntityRoleAssignmentEntryAssignment { + #[serde(rename = "resolution")] + pub resolution: crate::models::RoleAssignmentResolution, + + #[serde(rename = "explicit_rule", skip_serializing_if = "Option::is_none")] + pub explicit_rule: Option, +} + +impl ComponentEntityRoleAssignmentEntryAssignment { + pub fn new( + resolution: crate::models::RoleAssignmentResolution, + ) -> ComponentEntityRoleAssignmentEntryAssignment { + ComponentEntityRoleAssignmentEntryAssignment { + resolution, + explicit_rule: None, + } + } +} diff --git a/libraries/gateway-client/src/models/component_entity_role_assignments.rs b/libraries/gateway-client/src/models/component_entity_role_assignments.rs new file mode 100644 index 00000000..04ba0a6f --- /dev/null +++ b/libraries/gateway-client/src/models/component_entity_role_assignments.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ComponentEntityRoleAssignments { + #[serde(rename = "owner")] + pub owner: serde_json::Value, + #[serde(rename = "entries")] + pub entries: Vec, +} + +impl ComponentEntityRoleAssignments { + pub fn new( + owner: serde_json::Value, + entries: Vec, + ) -> ComponentEntityRoleAssignments { + ComponentEntityRoleAssignments { owner, entries } + } +} diff --git a/libraries/gateway-client/src/models/cursor_limit_mixin.rs b/libraries/gateway-client/src/models/cursor_limit_mixin.rs new file mode 100644 index 00000000..73a905c5 --- /dev/null +++ b/libraries/gateway-client/src/models/cursor_limit_mixin.rs @@ -0,0 +1,33 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct CursorLimitMixin { + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, +} + +impl Default for CursorLimitMixin { + fn default() -> Self { + Self::new() + } +} + +impl CursorLimitMixin { + pub fn new() -> CursorLimitMixin { + CursorLimitMixin { + cursor: None, + limit_per_page: None, + } + } +} diff --git a/libraries/gateway-client/src/models/entity_metadata_collection.rs b/libraries/gateway-client/src/models/entity_metadata_collection.rs new file mode 100644 index 00000000..8e178b8a --- /dev/null +++ b/libraries/gateway-client/src/models/entity_metadata_collection.rs @@ -0,0 +1,32 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct EntityMetadataCollection { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, +} + +impl EntityMetadataCollection { + pub fn new( + items: Vec, + ) -> EntityMetadataCollection { + EntityMetadataCollection { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/entity_metadata_item.rs b/libraries/gateway-client/src/models/entity_metadata_item.rs new file mode 100644 index 00000000..4b3a52c9 --- /dev/null +++ b/libraries/gateway-client/src/models/entity_metadata_item.rs @@ -0,0 +1,28 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct EntityMetadataItem { + #[serde(rename = "key")] + pub key: String, + #[serde(rename = "value")] + pub value: Box, + #[serde(rename = "is_locked")] + pub is_locked: bool, + + #[serde(rename = "last_updated_at_state_version")] + pub last_updated_at_state_version: i64, +} + +impl EntityMetadataItem { + pub fn new( + key: String, + value: crate::models::EntityMetadataItemValue, + is_locked: bool, + last_updated_at_state_version: i64, + ) -> EntityMetadataItem { + EntityMetadataItem { + key, + value: Box::new(value), + is_locked, + last_updated_at_state_version, + } + } +} diff --git a/libraries/gateway-client/src/models/entity_metadata_item_value.rs b/libraries/gateway-client/src/models/entity_metadata_item_value.rs new file mode 100644 index 00000000..b078aaff --- /dev/null +++ b/libraries/gateway-client/src/models/entity_metadata_item_value.rs @@ -0,0 +1,23 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct EntityMetadataItemValue { + #[serde(rename = "raw_hex")] + pub raw_hex: String, + #[serde(rename = "programmatic_json")] + pub programmatic_json: Box, + #[serde(rename = "typed")] + pub typed: Box, +} + +impl EntityMetadataItemValue { + pub fn new( + raw_hex: String, + programmatic_json: crate::models::ProgrammaticScryptoSborValue, + typed: crate::models::MetadataTypedValue, + ) -> EntityMetadataItemValue { + EntityMetadataItemValue { + raw_hex, + programmatic_json: Box::new(programmatic_json), + typed: Box::new(typed), + } + } +} diff --git a/libraries/gateway-client/src/models/entity_not_found_error.rs b/libraries/gateway-client/src/models/entity_not_found_error.rs new file mode 100644 index 00000000..317b2335 --- /dev/null +++ b/libraries/gateway-client/src/models/entity_not_found_error.rs @@ -0,0 +1,14 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct EntityNotFoundError { + #[serde(rename = "type")] + pub r#type: String, + + #[serde(rename = "address")] + pub address: String, +} + +impl EntityNotFoundError { + pub fn new(r#type: String, address: String) -> EntityNotFoundError { + EntityNotFoundError { r#type, address } + } +} diff --git a/libraries/gateway-client/src/models/error_response.rs b/libraries/gateway-client/src/models/error_response.rs new file mode 100644 index 00000000..0288265f --- /dev/null +++ b/libraries/gateway-client/src/models/error_response.rs @@ -0,0 +1,24 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ErrorResponse { + #[serde(rename = "message")] + pub message: String, + + #[serde(rename = "code", skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(rename = "details", skip_serializing_if = "Option::is_none")] + pub details: Option>, + + #[serde(rename = "trace_id", skip_serializing_if = "Option::is_none")] + pub trace_id: Option, +} + +impl ErrorResponse { + pub fn new(message: String) -> ErrorResponse { + ErrorResponse { + message, + code: None, + details: None, + trace_id: None, + } + } +} diff --git a/libraries/gateway-client/src/models/events_item.rs b/libraries/gateway-client/src/models/events_item.rs new file mode 100644 index 00000000..9e6b786a --- /dev/null +++ b/libraries/gateway-client/src/models/events_item.rs @@ -0,0 +1,24 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct EventsItem { + #[serde(rename = "name")] + pub name: String, + + #[serde(rename = "emitter")] + pub emitter: serde_json::Value, + #[serde(rename = "data")] + pub data: Box, +} + +impl EventsItem { + pub fn new( + name: String, + emitter: serde_json::Value, + data: crate::models::ProgrammaticScryptoSborValue, + ) -> EventsItem { + EventsItem { + name, + emitter, + data: Box::new(data), + } + } +} diff --git a/libraries/gateway-client/src/models/from_ledger_state_mixin.rs b/libraries/gateway-client/src/models/from_ledger_state_mixin.rs new file mode 100644 index 00000000..67e20943 --- /dev/null +++ b/libraries/gateway-client/src/models/from_ledger_state_mixin.rs @@ -0,0 +1,25 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct FromLedgerStateMixin { + #[serde( + rename = "from_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub from_ledger_state: + Option>>, +} + +impl Default for FromLedgerStateMixin { + fn default() -> Self { + Self::new() + } +} + +impl FromLedgerStateMixin { + pub fn new() -> FromLedgerStateMixin { + FromLedgerStateMixin { + from_ledger_state: None, + } + } +} diff --git a/libraries/gateway-client/src/models/fungible_resources_collection.rs b/libraries/gateway-client/src/models/fungible_resources_collection.rs new file mode 100644 index 00000000..01e1470d --- /dev/null +++ b/libraries/gateway-client/src/models/fungible_resources_collection.rs @@ -0,0 +1,32 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct FungibleResourcesCollection { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, +} + +impl FungibleResourcesCollection { + pub fn new( + items: Vec, + ) -> FungibleResourcesCollection { + FungibleResourcesCollection { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/fungible_resources_collection_item.rs b/libraries/gateway-client/src/models/fungible_resources_collection_item.rs new file mode 100644 index 00000000..3267c9f4 --- /dev/null +++ b/libraries/gateway-client/src/models/fungible_resources_collection_item.rs @@ -0,0 +1,3 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "")] +pub enum FungibleResourcesCollectionItem {} diff --git a/libraries/gateway-client/src/models/fungible_resources_collection_item_globally_aggregated.rs b/libraries/gateway-client/src/models/fungible_resources_collection_item_globally_aggregated.rs new file mode 100644 index 00000000..17660dc6 --- /dev/null +++ b/libraries/gateway-client/src/models/fungible_resources_collection_item_globally_aggregated.rs @@ -0,0 +1,36 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct FungibleResourcesCollectionItemGloballyAggregated { + #[serde(rename = "aggregation_level")] + pub aggregation_level: crate::models::ResourceAggregationLevel, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde( + rename = "explicit_metadata", + skip_serializing_if = "Option::is_none" + )] + pub explicit_metadata: Option>, + + #[serde(rename = "amount")] + pub amount: String, + + #[serde(rename = "last_updated_at_state_version")] + pub last_updated_at_state_version: i64, +} + +impl FungibleResourcesCollectionItemGloballyAggregated { + pub fn new( + aggregation_level: crate::models::ResourceAggregationLevel, + resource_address: String, + amount: String, + last_updated_at_state_version: i64, + ) -> FungibleResourcesCollectionItemGloballyAggregated { + FungibleResourcesCollectionItemGloballyAggregated { + aggregation_level, + resource_address, + explicit_metadata: None, + amount, + last_updated_at_state_version, + } + } +} diff --git a/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated.rs b/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated.rs new file mode 100644 index 00000000..a8fc4fe8 --- /dev/null +++ b/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated.rs @@ -0,0 +1,31 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct FungibleResourcesCollectionItemVaultAggregated { + #[serde(rename = "aggregation_level")] + pub aggregation_level: crate::models::ResourceAggregationLevel, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde( + rename = "explicit_metadata", + skip_serializing_if = "Option::is_none" + )] + pub explicit_metadata: Option>, + #[serde(rename = "vaults")] + pub vaults: + Box, +} + +impl FungibleResourcesCollectionItemVaultAggregated { + pub fn new( + aggregation_level: crate::models::ResourceAggregationLevel, + resource_address: String, + vaults: crate::models::FungibleResourcesCollectionItemVaultAggregatedVault, + ) -> FungibleResourcesCollectionItemVaultAggregated { + FungibleResourcesCollectionItemVaultAggregated { + aggregation_level, + resource_address, + explicit_metadata: None, + vaults: Box::new(vaults), + } + } +} diff --git a/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated_vault.rs b/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated_vault.rs new file mode 100644 index 00000000..5e13613f --- /dev/null +++ b/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated_vault.rs @@ -0,0 +1,34 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct FungibleResourcesCollectionItemVaultAggregatedVault { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec< + crate::models::FungibleResourcesCollectionItemVaultAggregatedVaultItem, + >, +} + +impl FungibleResourcesCollectionItemVaultAggregatedVault { + pub fn new( + items: Vec, + ) -> FungibleResourcesCollectionItemVaultAggregatedVault { + FungibleResourcesCollectionItemVaultAggregatedVault { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated_vault_item.rs b/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated_vault_item.rs new file mode 100644 index 00000000..583a5d2b --- /dev/null +++ b/libraries/gateway-client/src/models/fungible_resources_collection_item_vault_aggregated_vault_item.rs @@ -0,0 +1,25 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct FungibleResourcesCollectionItemVaultAggregatedVaultItem { + #[serde(rename = "vault_address")] + pub vault_address: String, + + #[serde(rename = "amount")] + pub amount: String, + + #[serde(rename = "last_updated_at_state_version")] + pub last_updated_at_state_version: i64, +} + +impl FungibleResourcesCollectionItemVaultAggregatedVaultItem { + pub fn new( + vault_address: String, + amount: String, + last_updated_at_state_version: i64, + ) -> FungibleResourcesCollectionItemVaultAggregatedVaultItem { + FungibleResourcesCollectionItemVaultAggregatedVaultItem { + vault_address, + amount, + last_updated_at_state_version, + } + } +} diff --git a/libraries/gateway-client/src/models/gateway_error.rs b/libraries/gateway-client/src/models/gateway_error.rs new file mode 100644 index 00000000..1f391a20 --- /dev/null +++ b/libraries/gateway-client/src/models/gateway_error.rs @@ -0,0 +1,3 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "")] +pub enum GatewayError {} diff --git a/libraries/gateway-client/src/models/gateway_info_response_known_target.rs b/libraries/gateway-client/src/models/gateway_info_response_known_target.rs new file mode 100644 index 00000000..a2469e25 --- /dev/null +++ b/libraries/gateway-client/src/models/gateway_info_response_known_target.rs @@ -0,0 +1,11 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct GatewayInfoResponseKnownTarget { + #[serde(rename = "state_version")] + pub state_version: i64, +} + +impl GatewayInfoResponseKnownTarget { + pub fn new(state_version: i64) -> GatewayInfoResponseKnownTarget { + GatewayInfoResponseKnownTarget { state_version } + } +} diff --git a/libraries/gateway-client/src/models/gateway_info_response_release_info.rs b/libraries/gateway-client/src/models/gateway_info_response_release_info.rs new file mode 100644 index 00000000..91f183f0 --- /dev/null +++ b/libraries/gateway-client/src/models/gateway_info_response_release_info.rs @@ -0,0 +1,25 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct GatewayInfoResponseReleaseInfo { + #[serde(rename = "release_version")] + pub release_version: String, + + #[serde(rename = "open_api_schema_version")] + pub open_api_schema_version: String, + + #[serde(rename = "image_tag")] + pub image_tag: String, +} + +impl GatewayInfoResponseReleaseInfo { + pub fn new( + release_version: String, + open_api_schema_version: String, + image_tag: String, + ) -> GatewayInfoResponseReleaseInfo { + GatewayInfoResponseReleaseInfo { + release_version, + open_api_schema_version, + image_tag, + } + } +} diff --git a/libraries/gateway-client/src/models/gateway_status_response.rs b/libraries/gateway-client/src/models/gateway_status_response.rs new file mode 100644 index 00000000..f9922fba --- /dev/null +++ b/libraries/gateway-client/src/models/gateway_status_response.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct GatewayStatusResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + #[serde(rename = "release_info")] + pub release_info: Box, +} + +impl GatewayStatusResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + release_info: crate::models::GatewayInfoResponseReleaseInfo, + ) -> GatewayStatusResponse { + GatewayStatusResponse { + ledger_state: Box::new(ledger_state), + release_info: Box::new(release_info), + } + } +} diff --git a/libraries/gateway-client/src/models/internal_server_error.rs b/libraries/gateway-client/src/models/internal_server_error.rs new file mode 100644 index 00000000..29a5e0bc --- /dev/null +++ b/libraries/gateway-client/src/models/internal_server_error.rs @@ -0,0 +1,25 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct InternalServerError { + #[serde(rename = "type")] + pub r#type: String, + + #[serde(rename = "exception")] + pub exception: String, + + #[serde(rename = "cause")] + pub cause: String, +} + +impl InternalServerError { + pub fn new( + r#type: String, + exception: String, + cause: String, + ) -> InternalServerError { + InternalServerError { + r#type, + exception, + cause, + } + } +} diff --git a/libraries/gateway-client/src/models/invalid_entity_error.rs b/libraries/gateway-client/src/models/invalid_entity_error.rs new file mode 100644 index 00000000..994cf367 --- /dev/null +++ b/libraries/gateway-client/src/models/invalid_entity_error.rs @@ -0,0 +1,14 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct InvalidEntityError { + #[serde(rename = "type")] + pub r#type: String, + + #[serde(rename = "address")] + pub address: String, +} + +impl InvalidEntityError { + pub fn new(r#type: String, address: String) -> InvalidEntityError { + InvalidEntityError { r#type, address } + } +} diff --git a/libraries/gateway-client/src/models/invalid_request_error.rs b/libraries/gateway-client/src/models/invalid_request_error.rs new file mode 100644 index 00000000..3d1bb659 --- /dev/null +++ b/libraries/gateway-client/src/models/invalid_request_error.rs @@ -0,0 +1,20 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct InvalidRequestError { + #[serde(rename = "type")] + pub r#type: String, + + #[serde(rename = "validation_errors")] + pub validation_errors: Vec, +} + +impl InvalidRequestError { + pub fn new( + r#type: String, + validation_errors: Vec, + ) -> InvalidRequestError { + InvalidRequestError { + r#type, + validation_errors, + } + } +} diff --git a/libraries/gateway-client/src/models/invalid_transaction_error.rs b/libraries/gateway-client/src/models/invalid_transaction_error.rs new file mode 100644 index 00000000..86821d9e --- /dev/null +++ b/libraries/gateway-client/src/models/invalid_transaction_error.rs @@ -0,0 +1,11 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct InvalidTransactionError { + #[serde(rename = "type")] + pub r#type: String, +} + +impl InvalidTransactionError { + pub fn new(r#type: String) -> InvalidTransactionError { + InvalidTransactionError { r#type } + } +} diff --git a/libraries/gateway-client/src/models/ledger_state.rs b/libraries/gateway-client/src/models/ledger_state.rs new file mode 100644 index 00000000..0b53c9ce --- /dev/null +++ b/libraries/gateway-client/src/models/ledger_state.rs @@ -0,0 +1,35 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct LedgerState { + #[serde(rename = "network")] + pub network: String, + + #[serde(rename = "state_version")] + pub state_version: i64, + + #[serde(rename = "proposer_round_timestamp")] + pub proposer_round_timestamp: String, + + #[serde(rename = "epoch")] + pub epoch: i64, + + #[serde(rename = "round")] + pub round: i64, +} + +impl LedgerState { + pub fn new( + network: String, + state_version: i64, + proposer_round_timestamp: String, + epoch: i64, + round: i64, + ) -> LedgerState { + LedgerState { + network, + state_version, + proposer_round_timestamp, + epoch, + round, + } + } +} diff --git a/libraries/gateway-client/src/models/ledger_state_mixin.rs b/libraries/gateway-client/src/models/ledger_state_mixin.rs new file mode 100644 index 00000000..3de000c1 --- /dev/null +++ b/libraries/gateway-client/src/models/ledger_state_mixin.rs @@ -0,0 +1,13 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct LedgerStateMixin { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, +} + +impl LedgerStateMixin { + pub fn new(ledger_state: crate::models::LedgerState) -> LedgerStateMixin { + LedgerStateMixin { + ledger_state: Box::new(ledger_state), + } + } +} diff --git a/libraries/gateway-client/src/models/ledger_state_selector.rs b/libraries/gateway-client/src/models/ledger_state_selector.rs new file mode 100644 index 00000000..c515c031 --- /dev/null +++ b/libraries/gateway-client/src/models/ledger_state_selector.rs @@ -0,0 +1,51 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct LedgerStateSelector { + #[serde( + rename = "state_version", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub state_version: Option>, + + #[serde( + rename = "timestamp", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub timestamp: Option>, + + #[serde( + rename = "epoch", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub epoch: Option>, + + #[serde( + rename = "round", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub round: Option>, +} + +impl Default for LedgerStateSelector { + fn default() -> Self { + Self::new() + } +} + +impl LedgerStateSelector { + pub fn new() -> LedgerStateSelector { + LedgerStateSelector { + state_version: None, + timestamp: None, + epoch: None, + round: None, + } + } +} diff --git a/libraries/gateway-client/src/models/metadata_bool_array_value.rs b/libraries/gateway-client/src/models/metadata_bool_array_value.rs new file mode 100644 index 00000000..e1b2d93b --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_bool_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataBoolArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataBoolArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataBoolArrayValue { + MetadataBoolArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_bool_value.rs b/libraries/gateway-client/src/models/metadata_bool_value.rs new file mode 100644 index 00000000..486e8758 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_bool_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataBoolValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: bool, +} + +impl MetadataBoolValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: bool, + ) -> MetadataBoolValue { + MetadataBoolValue { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_decimal_array_value.rs b/libraries/gateway-client/src/models/metadata_decimal_array_value.rs new file mode 100644 index 00000000..8c14a68c --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_decimal_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataDecimalArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataDecimalArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataDecimalArrayValue { + MetadataDecimalArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_decimal_value.rs b/libraries/gateway-client/src/models/metadata_decimal_value.rs new file mode 100644 index 00000000..1ab60d6b --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_decimal_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataDecimalValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataDecimalValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataDecimalValue { + MetadataDecimalValue { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_global_address_array_value.rs b/libraries/gateway-client/src/models/metadata_global_address_array_value.rs new file mode 100644 index 00000000..427ba5a5 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_global_address_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataGlobalAddressArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataGlobalAddressArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataGlobalAddressArrayValue { + MetadataGlobalAddressArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_global_address_value.rs b/libraries/gateway-client/src/models/metadata_global_address_value.rs new file mode 100644 index 00000000..00c4c415 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_global_address_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataGlobalAddressValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataGlobalAddressValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataGlobalAddressValue { + MetadataGlobalAddressValue { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_i32_array_value.rs b/libraries/gateway-client/src/models/metadata_i32_array_value.rs new file mode 100644 index 00000000..121c015b --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_i32_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataI32ArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataI32ArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataI32ArrayValue { + MetadataI32ArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_i32_value.rs b/libraries/gateway-client/src/models/metadata_i32_value.rs new file mode 100644 index 00000000..ebf07a51 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_i32_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataI32Value { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataI32Value { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataI32Value { + MetadataI32Value { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_i64_array_value.rs b/libraries/gateway-client/src/models/metadata_i64_array_value.rs new file mode 100644 index 00000000..6b2d648c --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_i64_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataI64ArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataI64ArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataI64ArrayValue { + MetadataI64ArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_i64_value.rs b/libraries/gateway-client/src/models/metadata_i64_value.rs new file mode 100644 index 00000000..6926f8cb --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_i64_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataI64Value { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataI64Value { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataI64Value { + MetadataI64Value { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_instant_array_value.rs b/libraries/gateway-client/src/models/metadata_instant_array_value.rs new file mode 100644 index 00000000..507ee704 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_instant_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataInstantArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataInstantArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataInstantArrayValue { + MetadataInstantArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_instant_value.rs b/libraries/gateway-client/src/models/metadata_instant_value.rs new file mode 100644 index 00000000..fcbc362e --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_instant_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataInstantValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataInstantValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataInstantValue { + MetadataInstantValue { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_non_fungible_global_id_array_value.rs b/libraries/gateway-client/src/models/metadata_non_fungible_global_id_array_value.rs new file mode 100644 index 00000000..389b8397 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_non_fungible_global_id_array_value.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataNonFungibleGlobalIdArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: + Vec, +} + +impl MetadataNonFungibleGlobalIdArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec< + crate::models::MetadataNonFungibleGlobalIdArrayValueAllOfValues, + >, + ) -> MetadataNonFungibleGlobalIdArrayValue { + MetadataNonFungibleGlobalIdArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_non_fungible_global_id_array_value_all_of_values.rs b/libraries/gateway-client/src/models/metadata_non_fungible_global_id_array_value_all_of_values.rs new file mode 100644 index 00000000..158f2ca7 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_non_fungible_global_id_array_value_all_of_values.rs @@ -0,0 +1,20 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataNonFungibleGlobalIdArrayValueAllOfValues { + #[serde(rename = "resource_address")] + pub resource_address: String, + + #[serde(rename = "non_fungible_id")] + pub non_fungible_id: String, +} + +impl MetadataNonFungibleGlobalIdArrayValueAllOfValues { + pub fn new( + resource_address: String, + non_fungible_id: String, + ) -> MetadataNonFungibleGlobalIdArrayValueAllOfValues { + MetadataNonFungibleGlobalIdArrayValueAllOfValues { + resource_address, + non_fungible_id, + } + } +} diff --git a/libraries/gateway-client/src/models/metadata_non_fungible_global_id_value.rs b/libraries/gateway-client/src/models/metadata_non_fungible_global_id_value.rs new file mode 100644 index 00000000..6a5d7859 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_non_fungible_global_id_value.rs @@ -0,0 +1,25 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataNonFungibleGlobalIdValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + + #[serde(rename = "resource_address")] + pub resource_address: String, + + #[serde(rename = "non_fungible_id")] + pub non_fungible_id: String, +} + +impl MetadataNonFungibleGlobalIdValue { + pub fn new( + r#type: crate::models::MetadataValueType, + resource_address: String, + non_fungible_id: String, + ) -> MetadataNonFungibleGlobalIdValue { + MetadataNonFungibleGlobalIdValue { + r#type, + resource_address, + non_fungible_id, + } + } +} diff --git a/libraries/gateway-client/src/models/metadata_non_fungible_local_id_array_value.rs b/libraries/gateway-client/src/models/metadata_non_fungible_local_id_array_value.rs new file mode 100644 index 00000000..4a8148d3 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_non_fungible_local_id_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataNonFungibleLocalIdArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataNonFungibleLocalIdArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataNonFungibleLocalIdArrayValue { + MetadataNonFungibleLocalIdArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_non_fungible_local_id_value.rs b/libraries/gateway-client/src/models/metadata_non_fungible_local_id_value.rs new file mode 100644 index 00000000..52aaf12a --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_non_fungible_local_id_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataNonFungibleLocalIdValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataNonFungibleLocalIdValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataNonFungibleLocalIdValue { + MetadataNonFungibleLocalIdValue { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_origin_array_value.rs b/libraries/gateway-client/src/models/metadata_origin_array_value.rs new file mode 100644 index 00000000..d44650be --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_origin_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataOriginArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataOriginArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataOriginArrayValue { + MetadataOriginArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_origin_value.rs b/libraries/gateway-client/src/models/metadata_origin_value.rs new file mode 100644 index 00000000..e71dbfff --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_origin_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataOriginValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataOriginValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataOriginValue { + MetadataOriginValue { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_public_key_array_value.rs b/libraries/gateway-client/src/models/metadata_public_key_array_value.rs new file mode 100644 index 00000000..37f326fa --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_public_key_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataPublicKeyArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataPublicKeyArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataPublicKeyArrayValue { + MetadataPublicKeyArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_public_key_hash_array_value.rs b/libraries/gateway-client/src/models/metadata_public_key_hash_array_value.rs new file mode 100644 index 00000000..ac5ddfbb --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_public_key_hash_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataPublicKeyHashArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataPublicKeyHashArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataPublicKeyHashArrayValue { + MetadataPublicKeyHashArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_public_key_hash_value.rs b/libraries/gateway-client/src/models/metadata_public_key_hash_value.rs new file mode 100644 index 00000000..4a73928c --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_public_key_hash_value.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataPublicKeyHashValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: Box, +} + +impl MetadataPublicKeyHashValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: crate::models::PublicKeyHash, + ) -> MetadataPublicKeyHashValue { + MetadataPublicKeyHashValue { + r#type, + value: Box::new(value), + } + } +} diff --git a/libraries/gateway-client/src/models/metadata_public_key_value.rs b/libraries/gateway-client/src/models/metadata_public_key_value.rs new file mode 100644 index 00000000..954807d6 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_public_key_value.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataPublicKeyValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: Box, +} + +impl MetadataPublicKeyValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: crate::models::PublicKey, + ) -> MetadataPublicKeyValue { + MetadataPublicKeyValue { + r#type, + value: Box::new(value), + } + } +} diff --git a/libraries/gateway-client/src/models/metadata_string_array_value.rs b/libraries/gateway-client/src/models/metadata_string_array_value.rs new file mode 100644 index 00000000..abd000f2 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_string_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataStringArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataStringArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataStringArrayValue { + MetadataStringArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_string_value.rs b/libraries/gateway-client/src/models/metadata_string_value.rs new file mode 100644 index 00000000..42f50f06 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_string_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataStringValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataStringValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataStringValue { + MetadataStringValue { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_typed_value.rs b/libraries/gateway-client/src/models/metadata_typed_value.rs new file mode 100644 index 00000000..33bc133e --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_typed_value.rs @@ -0,0 +1,3 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "")] +pub enum MetadataTypedValue {} diff --git a/libraries/gateway-client/src/models/metadata_u32_array_value.rs b/libraries/gateway-client/src/models/metadata_u32_array_value.rs new file mode 100644 index 00000000..66a00446 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_u32_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataU32ArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataU32ArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataU32ArrayValue { + MetadataU32ArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_u32_value.rs b/libraries/gateway-client/src/models/metadata_u32_value.rs new file mode 100644 index 00000000..4780010c --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_u32_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataU32Value { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataU32Value { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataU32Value { + MetadataU32Value { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_u64_array_value.rs b/libraries/gateway-client/src/models/metadata_u64_array_value.rs new file mode 100644 index 00000000..43bd8764 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_u64_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataU64ArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataU64ArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataU64ArrayValue { + MetadataU64ArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_u64_value.rs b/libraries/gateway-client/src/models/metadata_u64_value.rs new file mode 100644 index 00000000..5ad0d4e4 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_u64_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataU64Value { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataU64Value { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataU64Value { + MetadataU64Value { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_u8_array_value.rs b/libraries/gateway-client/src/models/metadata_u8_array_value.rs new file mode 100644 index 00000000..01379a84 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_u8_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataU8ArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value_hex")] + pub value_hex: String, +} + +impl MetadataU8ArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value_hex: String, + ) -> MetadataU8ArrayValue { + MetadataU8ArrayValue { r#type, value_hex } + } +} diff --git a/libraries/gateway-client/src/models/metadata_u8_value.rs b/libraries/gateway-client/src/models/metadata_u8_value.rs new file mode 100644 index 00000000..ae0310a2 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_u8_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataU8Value { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataU8Value { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataU8Value { + MetadataU8Value { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_url_array_value.rs b/libraries/gateway-client/src/models/metadata_url_array_value.rs new file mode 100644 index 00000000..b9ab6fc0 --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_url_array_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataUrlArrayValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "values")] + pub values: Vec, +} + +impl MetadataUrlArrayValue { + pub fn new( + r#type: crate::models::MetadataValueType, + values: Vec, + ) -> MetadataUrlArrayValue { + MetadataUrlArrayValue { r#type, values } + } +} diff --git a/libraries/gateway-client/src/models/metadata_url_value.rs b/libraries/gateway-client/src/models/metadata_url_value.rs new file mode 100644 index 00000000..0596401f --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_url_value.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct MetadataUrlValue { + #[serde(rename = "type")] + pub r#type: crate::models::MetadataValueType, + #[serde(rename = "value")] + pub value: String, +} + +impl MetadataUrlValue { + pub fn new( + r#type: crate::models::MetadataValueType, + value: String, + ) -> MetadataUrlValue { + MetadataUrlValue { r#type, value } + } +} diff --git a/libraries/gateway-client/src/models/metadata_value_type.rs b/libraries/gateway-client/src/models/metadata_value_type.rs new file mode 100644 index 00000000..c35e768c --- /dev/null +++ b/libraries/gateway-client/src/models/metadata_value_type.rs @@ -0,0 +1,127 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum MetadataValueType { + #[serde(rename = "String")] + String, + #[serde(rename = "Bool")] + Bool, + #[serde(rename = "U8")] + U8, + #[serde(rename = "U32")] + U32, + #[serde(rename = "U64")] + U64, + #[serde(rename = "I32")] + I32, + #[serde(rename = "I64")] + I64, + #[serde(rename = "Decimal")] + Decimal, + #[serde(rename = "GlobalAddress")] + GlobalAddress, + #[serde(rename = "PublicKey")] + PublicKey, + #[serde(rename = "NonFungibleGlobalId")] + NonFungibleGlobalId, + #[serde(rename = "NonFungibleLocalId")] + NonFungibleLocalId, + #[serde(rename = "Instant")] + Instant, + #[serde(rename = "Url")] + Url, + #[serde(rename = "Origin")] + Origin, + #[serde(rename = "PublicKeyHash")] + PublicKeyHash, + #[serde(rename = "StringArray")] + StringArray, + #[serde(rename = "BoolArray")] + BoolArray, + #[serde(rename = "U8Array")] + U8Array, + #[serde(rename = "U32Array")] + U32Array, + #[serde(rename = "U64Array")] + U64Array, + #[serde(rename = "I32Array")] + I32Array, + #[serde(rename = "I64Array")] + I64Array, + #[serde(rename = "DecimalArray")] + DecimalArray, + #[serde(rename = "GlobalAddressArray")] + GlobalAddressArray, + #[serde(rename = "PublicKeyArray")] + PublicKeyArray, + #[serde(rename = "NonFungibleGlobalIdArray")] + NonFungibleGlobalIdArray, + #[serde(rename = "NonFungibleLocalIdArray")] + NonFungibleLocalIdArray, + #[serde(rename = "InstantArray")] + InstantArray, + #[serde(rename = "UrlArray")] + UrlArray, + #[serde(rename = "OriginArray")] + OriginArray, + #[serde(rename = "PublicKeyHashArray")] + PublicKeyHashArray, +} + +impl ToString for MetadataValueType { + fn to_string(&self) -> String { + match self { + Self::String => String::from("String"), + Self::Bool => String::from("Bool"), + Self::U8 => String::from("U8"), + Self::U32 => String::from("U32"), + Self::U64 => String::from("U64"), + Self::I32 => String::from("I32"), + Self::I64 => String::from("I64"), + Self::Decimal => String::from("Decimal"), + Self::GlobalAddress => String::from("GlobalAddress"), + Self::PublicKey => String::from("PublicKey"), + Self::NonFungibleGlobalId => String::from("NonFungibleGlobalId"), + Self::NonFungibleLocalId => String::from("NonFungibleLocalId"), + Self::Instant => String::from("Instant"), + Self::Url => String::from("Url"), + Self::Origin => String::from("Origin"), + Self::PublicKeyHash => String::from("PublicKeyHash"), + Self::StringArray => String::from("StringArray"), + Self::BoolArray => String::from("BoolArray"), + Self::U8Array => String::from("U8Array"), + Self::U32Array => String::from("U32Array"), + Self::U64Array => String::from("U64Array"), + Self::I32Array => String::from("I32Array"), + Self::I64Array => String::from("I64Array"), + Self::DecimalArray => String::from("DecimalArray"), + Self::GlobalAddressArray => String::from("GlobalAddressArray"), + Self::PublicKeyArray => String::from("PublicKeyArray"), + Self::NonFungibleGlobalIdArray => { + String::from("NonFungibleGlobalIdArray") + } + Self::NonFungibleLocalIdArray => { + String::from("NonFungibleLocalIdArray") + } + Self::InstantArray => String::from("InstantArray"), + Self::UrlArray => String::from("UrlArray"), + Self::OriginArray => String::from("OriginArray"), + Self::PublicKeyHashArray => String::from("PublicKeyHashArray"), + } + } +} + +impl Default for MetadataValueType { + fn default() -> MetadataValueType { + Self::String + } +} diff --git a/libraries/gateway-client/src/models/mod.rs b/libraries/gateway-client/src/models/mod.rs new file mode 100644 index 00000000..7220f81b --- /dev/null +++ b/libraries/gateway-client/src/models/mod.rs @@ -0,0 +1,404 @@ +pub mod at_ledger_state_mixin; +pub use self::at_ledger_state_mixin::AtLedgerStateMixin; +pub mod committed_transaction_info; +pub use self::committed_transaction_info::CommittedTransactionInfo; +pub mod component_entity_role_assignment_entry; +pub use self::component_entity_role_assignment_entry::ComponentEntityRoleAssignmentEntry; +pub mod component_entity_role_assignment_entry_assignment; +pub use self::component_entity_role_assignment_entry_assignment::ComponentEntityRoleAssignmentEntryAssignment; +pub mod component_entity_role_assignments; +pub use self::component_entity_role_assignments::ComponentEntityRoleAssignments; +pub mod cursor_limit_mixin; +pub use self::cursor_limit_mixin::CursorLimitMixin; +pub mod entity_metadata_collection; +pub use self::entity_metadata_collection::EntityMetadataCollection; +pub mod entity_metadata_item; +pub use self::entity_metadata_item::EntityMetadataItem; +pub mod entity_metadata_item_value; +pub use self::entity_metadata_item_value::EntityMetadataItemValue; +pub mod entity_not_found_error; +pub use self::entity_not_found_error::EntityNotFoundError; +pub mod error_response; +pub use self::error_response::ErrorResponse; +pub mod events_item; +pub use self::events_item::EventsItem; +pub mod from_ledger_state_mixin; +pub use self::from_ledger_state_mixin::FromLedgerStateMixin; +pub mod fungible_resources_collection; +pub use self::fungible_resources_collection::FungibleResourcesCollection; +pub mod fungible_resources_collection_item; +pub use self::fungible_resources_collection_item::FungibleResourcesCollectionItem; +pub mod fungible_resources_collection_item_globally_aggregated; +pub use self::fungible_resources_collection_item_globally_aggregated::FungibleResourcesCollectionItemGloballyAggregated; +pub mod fungible_resources_collection_item_vault_aggregated; +pub use self::fungible_resources_collection_item_vault_aggregated::FungibleResourcesCollectionItemVaultAggregated; +pub mod fungible_resources_collection_item_vault_aggregated_vault; +pub use self::fungible_resources_collection_item_vault_aggregated_vault::FungibleResourcesCollectionItemVaultAggregatedVault; +pub mod fungible_resources_collection_item_vault_aggregated_vault_item; +pub use self::fungible_resources_collection_item_vault_aggregated_vault_item::FungibleResourcesCollectionItemVaultAggregatedVaultItem; +pub mod gateway_error; +pub use self::gateway_error::GatewayError; +pub mod gateway_info_response_known_target; +pub use self::gateway_info_response_known_target::GatewayInfoResponseKnownTarget; +pub mod gateway_info_response_release_info; +pub use self::gateway_info_response_release_info::GatewayInfoResponseReleaseInfo; +pub mod gateway_status_response; +pub use self::gateway_status_response::GatewayStatusResponse; +pub mod internal_server_error; +pub use self::internal_server_error::InternalServerError; +pub mod invalid_entity_error; +pub use self::invalid_entity_error::InvalidEntityError; +pub mod invalid_request_error; +pub use self::invalid_request_error::InvalidRequestError; +pub mod invalid_transaction_error; +pub use self::invalid_transaction_error::InvalidTransactionError; +pub mod ledger_state; +pub use self::ledger_state::LedgerState; +pub mod ledger_state_mixin; +pub use self::ledger_state_mixin::LedgerStateMixin; +pub mod ledger_state_selector; +pub use self::ledger_state_selector::LedgerStateSelector; +pub mod metadata_bool_array_value; +pub use self::metadata_bool_array_value::MetadataBoolArrayValue; +pub mod metadata_bool_value; +pub use self::metadata_bool_value::MetadataBoolValue; +pub mod metadata_decimal_array_value; +pub use self::metadata_decimal_array_value::MetadataDecimalArrayValue; +pub mod metadata_decimal_value; +pub use self::metadata_decimal_value::MetadataDecimalValue; +pub mod metadata_global_address_array_value; +pub use self::metadata_global_address_array_value::MetadataGlobalAddressArrayValue; +pub mod metadata_global_address_value; +pub use self::metadata_global_address_value::MetadataGlobalAddressValue; +pub mod metadata_i32_array_value; +pub use self::metadata_i32_array_value::MetadataI32ArrayValue; +pub mod metadata_i32_value; +pub use self::metadata_i32_value::MetadataI32Value; +pub mod metadata_i64_array_value; +pub use self::metadata_i64_array_value::MetadataI64ArrayValue; +pub mod metadata_i64_value; +pub use self::metadata_i64_value::MetadataI64Value; +pub mod metadata_instant_array_value; +pub use self::metadata_instant_array_value::MetadataInstantArrayValue; +pub mod metadata_instant_value; +pub use self::metadata_instant_value::MetadataInstantValue; +pub mod metadata_non_fungible_global_id_array_value; +pub use self::metadata_non_fungible_global_id_array_value::MetadataNonFungibleGlobalIdArrayValue; +pub mod metadata_non_fungible_global_id_array_value_all_of_values; +pub use self::metadata_non_fungible_global_id_array_value_all_of_values::MetadataNonFungibleGlobalIdArrayValueAllOfValues; +pub mod metadata_non_fungible_global_id_value; +pub use self::metadata_non_fungible_global_id_value::MetadataNonFungibleGlobalIdValue; +pub mod metadata_non_fungible_local_id_array_value; +pub use self::metadata_non_fungible_local_id_array_value::MetadataNonFungibleLocalIdArrayValue; +pub mod metadata_non_fungible_local_id_value; +pub use self::metadata_non_fungible_local_id_value::MetadataNonFungibleLocalIdValue; +pub mod metadata_origin_array_value; +pub use self::metadata_origin_array_value::MetadataOriginArrayValue; +pub mod metadata_origin_value; +pub use self::metadata_origin_value::MetadataOriginValue; +pub mod metadata_public_key_array_value; +pub use self::metadata_public_key_array_value::MetadataPublicKeyArrayValue; +pub mod metadata_public_key_hash_array_value; +pub use self::metadata_public_key_hash_array_value::MetadataPublicKeyHashArrayValue; +pub mod metadata_public_key_hash_value; +pub use self::metadata_public_key_hash_value::MetadataPublicKeyHashValue; +pub mod metadata_public_key_value; +pub use self::metadata_public_key_value::MetadataPublicKeyValue; +pub mod metadata_string_array_value; +pub use self::metadata_string_array_value::MetadataStringArrayValue; +pub mod metadata_string_value; +pub use self::metadata_string_value::MetadataStringValue; +pub mod metadata_typed_value; +pub use self::metadata_typed_value::MetadataTypedValue; +pub mod metadata_u32_array_value; +pub use self::metadata_u32_array_value::MetadataU32ArrayValue; +pub mod metadata_u32_value; +pub use self::metadata_u32_value::MetadataU32Value; +pub mod metadata_u64_array_value; +pub use self::metadata_u64_array_value::MetadataU64ArrayValue; +pub mod metadata_u64_value; +pub use self::metadata_u64_value::MetadataU64Value; +pub mod metadata_u8_array_value; +pub use self::metadata_u8_array_value::MetadataU8ArrayValue; +pub mod metadata_u8_value; +pub use self::metadata_u8_value::MetadataU8Value; +pub mod metadata_url_array_value; +pub use self::metadata_url_array_value::MetadataUrlArrayValue; +pub mod metadata_url_value; +pub use self::metadata_url_value::MetadataUrlValue; +pub mod metadata_value_type; +pub use self::metadata_value_type::MetadataValueType; +pub mod network_configuration_response; +pub use self::network_configuration_response::NetworkConfigurationResponse; +pub mod network_configuration_response_well_known_addresses; +pub use self::network_configuration_response_well_known_addresses::NetworkConfigurationResponseWellKnownAddresses; +pub mod non_fungible_id_type; +pub use self::non_fungible_id_type::NonFungibleIdType; +pub mod non_fungible_ids_collection; +pub use self::non_fungible_ids_collection::NonFungibleIdsCollection; +pub mod non_fungible_resources_collection; +pub use self::non_fungible_resources_collection::NonFungibleResourcesCollection; +pub mod non_fungible_resources_collection_item; +pub use self::non_fungible_resources_collection_item::NonFungibleResourcesCollectionItem; +pub mod non_fungible_resources_collection_item_globally_aggregated; +pub use self::non_fungible_resources_collection_item_globally_aggregated::NonFungibleResourcesCollectionItemGloballyAggregated; +pub mod non_fungible_resources_collection_item_vault_aggregated; +pub use self::non_fungible_resources_collection_item_vault_aggregated::NonFungibleResourcesCollectionItemVaultAggregated; +pub mod non_fungible_resources_collection_item_vault_aggregated_vault; +pub use self::non_fungible_resources_collection_item_vault_aggregated_vault::NonFungibleResourcesCollectionItemVaultAggregatedVault; +pub mod non_fungible_resources_collection_item_vault_aggregated_vault_item; +pub use self::non_fungible_resources_collection_item_vault_aggregated_vault_item::NonFungibleResourcesCollectionItemVaultAggregatedVaultItem; +pub mod not_synced_up_error; +pub use self::not_synced_up_error::NotSyncedUpError; +pub mod object_module_id; +pub use self::object_module_id::ObjectModuleId; +pub mod optional_non_fungible_ids_collection; +pub use self::optional_non_fungible_ids_collection::OptionalNonFungibleIdsCollection; +pub mod package_vm_type; +pub use self::package_vm_type::PackageVmType; +pub mod programmatic_scrypto_sbor_value; +pub use self::programmatic_scrypto_sbor_value::ProgrammaticScryptoSborValue; +pub mod programmatic_scrypto_sbor_value_array; +pub use self::programmatic_scrypto_sbor_value_array::ProgrammaticScryptoSborValueArray; +pub mod programmatic_scrypto_sbor_value_bool; +pub use self::programmatic_scrypto_sbor_value_bool::ProgrammaticScryptoSborValueBool; +pub mod programmatic_scrypto_sbor_value_bytes; +pub use self::programmatic_scrypto_sbor_value_bytes::ProgrammaticScryptoSborValueBytes; +pub mod programmatic_scrypto_sbor_value_decimal; +pub use self::programmatic_scrypto_sbor_value_decimal::ProgrammaticScryptoSborValueDecimal; +pub mod programmatic_scrypto_sbor_value_enum; +pub use self::programmatic_scrypto_sbor_value_enum::ProgrammaticScryptoSborValueEnum; +pub mod programmatic_scrypto_sbor_value_i128; +pub use self::programmatic_scrypto_sbor_value_i128::ProgrammaticScryptoSborValueI128; +pub mod programmatic_scrypto_sbor_value_i16; +pub use self::programmatic_scrypto_sbor_value_i16::ProgrammaticScryptoSborValueI16; +pub mod programmatic_scrypto_sbor_value_i32; +pub use self::programmatic_scrypto_sbor_value_i32::ProgrammaticScryptoSborValueI32; +pub mod programmatic_scrypto_sbor_value_i64; +pub use self::programmatic_scrypto_sbor_value_i64::ProgrammaticScryptoSborValueI64; +pub mod programmatic_scrypto_sbor_value_i8; +pub use self::programmatic_scrypto_sbor_value_i8::ProgrammaticScryptoSborValueI8; +pub mod programmatic_scrypto_sbor_value_kind; +pub use self::programmatic_scrypto_sbor_value_kind::ProgrammaticScryptoSborValueKind; +pub mod programmatic_scrypto_sbor_value_map; +pub use self::programmatic_scrypto_sbor_value_map::ProgrammaticScryptoSborValueMap; +pub mod programmatic_scrypto_sbor_value_map_entry; +pub use self::programmatic_scrypto_sbor_value_map_entry::ProgrammaticScryptoSborValueMapEntry; +pub mod programmatic_scrypto_sbor_value_non_fungible_local_id; +pub use self::programmatic_scrypto_sbor_value_non_fungible_local_id::ProgrammaticScryptoSborValueNonFungibleLocalId; +pub mod programmatic_scrypto_sbor_value_own; +pub use self::programmatic_scrypto_sbor_value_own::ProgrammaticScryptoSborValueOwn; +pub mod programmatic_scrypto_sbor_value_precise_decimal; +pub use self::programmatic_scrypto_sbor_value_precise_decimal::ProgrammaticScryptoSborValuePreciseDecimal; +pub mod programmatic_scrypto_sbor_value_reference; +pub use self::programmatic_scrypto_sbor_value_reference::ProgrammaticScryptoSborValueReference; +pub mod programmatic_scrypto_sbor_value_string; +pub use self::programmatic_scrypto_sbor_value_string::ProgrammaticScryptoSborValueString; +pub mod programmatic_scrypto_sbor_value_tuple; +pub use self::programmatic_scrypto_sbor_value_tuple::ProgrammaticScryptoSborValueTuple; +pub mod programmatic_scrypto_sbor_value_u128; +pub use self::programmatic_scrypto_sbor_value_u128::ProgrammaticScryptoSborValueU128; +pub mod programmatic_scrypto_sbor_value_u16; +pub use self::programmatic_scrypto_sbor_value_u16::ProgrammaticScryptoSborValueU16; +pub mod programmatic_scrypto_sbor_value_u32; +pub use self::programmatic_scrypto_sbor_value_u32::ProgrammaticScryptoSborValueU32; +pub mod programmatic_scrypto_sbor_value_u64; +pub use self::programmatic_scrypto_sbor_value_u64::ProgrammaticScryptoSborValueU64; +pub mod programmatic_scrypto_sbor_value_u8; +pub use self::programmatic_scrypto_sbor_value_u8::ProgrammaticScryptoSborValueU8; +pub mod public_key; +pub use self::public_key::PublicKey; +pub mod public_key_ecdsa_secp256k1; +pub use self::public_key_ecdsa_secp256k1::PublicKeyEcdsaSecp256k1; +pub mod public_key_eddsa_ed25519; +pub use self::public_key_eddsa_ed25519::PublicKeyEddsaEd25519; +pub mod public_key_hash; +pub use self::public_key_hash::PublicKeyHash; +pub mod public_key_hash_ecdsa_secp256k1; +pub use self::public_key_hash_ecdsa_secp256k1::PublicKeyHashEcdsaSecp256k1; +pub mod public_key_hash_eddsa_ed25519; +pub use self::public_key_hash_eddsa_ed25519::PublicKeyHashEddsaEd25519; +pub mod public_key_hash_type; +pub use self::public_key_hash_type::PublicKeyHashType; +pub mod public_key_type; +pub use self::public_key_type::PublicKeyType; +pub mod resource_aggregation_level; +pub use self::resource_aggregation_level::ResourceAggregationLevel; +pub mod result_set_cursor_mixin; +pub use self::result_set_cursor_mixin::ResultSetCursorMixin; +pub mod role_assignment_resolution; +pub use self::role_assignment_resolution::RoleAssignmentResolution; +pub mod role_key; +pub use self::role_key::RoleKey; +pub mod scrypto_sbor_value; +pub use self::scrypto_sbor_value::ScryptoSborValue; +pub mod state_entity_details_opt_ins; +pub use self::state_entity_details_opt_ins::StateEntityDetailsOptIns; +pub mod state_entity_details_request; +pub use self::state_entity_details_request::StateEntityDetailsRequest; +pub mod state_entity_details_response; +pub use self::state_entity_details_response::StateEntityDetailsResponse; +pub mod state_entity_details_response_component_details; +pub use self::state_entity_details_response_component_details::StateEntityDetailsResponseComponentDetails; +pub mod state_entity_details_response_fungible_resource_details; +pub use self::state_entity_details_response_fungible_resource_details::StateEntityDetailsResponseFungibleResourceDetails; +pub mod state_entity_details_response_fungible_vault_details; +pub use self::state_entity_details_response_fungible_vault_details::StateEntityDetailsResponseFungibleVaultDetails; +pub mod state_entity_details_response_item; +pub use self::state_entity_details_response_item::StateEntityDetailsResponseItem; +pub mod state_entity_details_response_item_ancestor_identities; +pub use self::state_entity_details_response_item_ancestor_identities::StateEntityDetailsResponseItemAncestorIdentities; +pub mod state_entity_details_response_item_details; +pub use self::state_entity_details_response_item_details::StateEntityDetailsResponseItemDetails; +pub mod state_entity_details_response_item_details_type; +pub use self::state_entity_details_response_item_details_type::StateEntityDetailsResponseItemDetailsType; +pub mod state_entity_details_response_non_fungible_resource_details; +pub use self::state_entity_details_response_non_fungible_resource_details::StateEntityDetailsResponseNonFungibleResourceDetails; +pub mod state_entity_details_response_non_fungible_vault_details; +pub use self::state_entity_details_response_non_fungible_vault_details::StateEntityDetailsResponseNonFungibleVaultDetails; +pub mod state_entity_details_response_package_details; +pub use self::state_entity_details_response_package_details::StateEntityDetailsResponsePackageDetails; +pub mod state_entity_details_response_package_details_blueprint_collection; +pub use self::state_entity_details_response_package_details_blueprint_collection::StateEntityDetailsResponsePackageDetailsBlueprintCollection; +pub mod state_entity_details_response_package_details_blueprint_item; +pub use self::state_entity_details_response_package_details_blueprint_item::StateEntityDetailsResponsePackageDetailsBlueprintItem; +pub mod state_entity_details_response_package_details_schema_collection; +pub use self::state_entity_details_response_package_details_schema_collection::StateEntityDetailsResponsePackageDetailsSchemaCollection; +pub mod state_entity_details_response_package_details_schema_item; +pub use self::state_entity_details_response_package_details_schema_item::StateEntityDetailsResponsePackageDetailsSchemaItem; +pub mod state_entity_fungible_resource_vaults_page_request; +pub use self::state_entity_fungible_resource_vaults_page_request::StateEntityFungibleResourceVaultsPageRequest; +pub mod state_entity_fungible_resource_vaults_page_response; +pub use self::state_entity_fungible_resource_vaults_page_response::StateEntityFungibleResourceVaultsPageResponse; +pub mod state_entity_fungibles_page_request; +pub use self::state_entity_fungibles_page_request::StateEntityFungiblesPageRequest; +pub mod state_entity_fungibles_page_request_opt_ins; +pub use self::state_entity_fungibles_page_request_opt_ins::StateEntityFungiblesPageRequestOptIns; +pub mod state_entity_fungibles_page_response; +pub use self::state_entity_fungibles_page_response::StateEntityFungiblesPageResponse; +pub mod state_entity_metadata_page_request; +pub use self::state_entity_metadata_page_request::StateEntityMetadataPageRequest; +pub mod state_entity_metadata_page_response; +pub use self::state_entity_metadata_page_response::StateEntityMetadataPageResponse; +pub mod state_entity_non_fungible_ids_page_request; +pub use self::state_entity_non_fungible_ids_page_request::StateEntityNonFungibleIdsPageRequest; +pub mod state_entity_non_fungible_ids_page_response; +pub use self::state_entity_non_fungible_ids_page_response::StateEntityNonFungibleIdsPageResponse; +pub mod state_entity_non_fungible_resource_vaults_page_opt_ins; +pub use self::state_entity_non_fungible_resource_vaults_page_opt_ins::StateEntityNonFungibleResourceVaultsPageOptIns; +pub mod state_entity_non_fungible_resource_vaults_page_request; +pub use self::state_entity_non_fungible_resource_vaults_page_request::StateEntityNonFungibleResourceVaultsPageRequest; +pub mod state_entity_non_fungible_resource_vaults_page_response; +pub use self::state_entity_non_fungible_resource_vaults_page_response::StateEntityNonFungibleResourceVaultsPageResponse; +pub mod state_entity_non_fungibles_page_request; +pub use self::state_entity_non_fungibles_page_request::StateEntityNonFungiblesPageRequest; +pub mod state_entity_non_fungibles_page_request_opt_ins; +pub use self::state_entity_non_fungibles_page_request_opt_ins::StateEntityNonFungiblesPageRequestOptIns; +pub mod state_entity_non_fungibles_page_response; +pub use self::state_entity_non_fungibles_page_response::StateEntityNonFungiblesPageResponse; +pub mod state_key_value_store_data_request; +pub use self::state_key_value_store_data_request::StateKeyValueStoreDataRequest; +pub mod state_key_value_store_data_request_key_item; +pub use self::state_key_value_store_data_request_key_item::StateKeyValueStoreDataRequestKeyItem; +pub mod state_key_value_store_data_response; +pub use self::state_key_value_store_data_response::StateKeyValueStoreDataResponse; +pub mod state_key_value_store_data_response_item; +pub use self::state_key_value_store_data_response_item::StateKeyValueStoreDataResponseItem; +pub mod state_non_fungible_data_request; +pub use self::state_non_fungible_data_request::StateNonFungibleDataRequest; +pub mod state_non_fungible_data_response; +pub use self::state_non_fungible_data_response::StateNonFungibleDataResponse; +pub mod state_non_fungible_details_response_item; +pub use self::state_non_fungible_details_response_item::StateNonFungibleDetailsResponseItem; +pub mod state_non_fungible_ids_request; +pub use self::state_non_fungible_ids_request::StateNonFungibleIdsRequest; +pub mod state_non_fungible_ids_response; +pub use self::state_non_fungible_ids_response::StateNonFungibleIdsResponse; +pub mod state_non_fungible_location_request; +pub use self::state_non_fungible_location_request::StateNonFungibleLocationRequest; +pub mod state_non_fungible_location_response; +pub use self::state_non_fungible_location_response::StateNonFungibleLocationResponse; +pub mod state_non_fungible_location_response_item; +pub use self::state_non_fungible_location_response_item::StateNonFungibleLocationResponseItem; +pub mod state_validators_list_request; +pub use self::state_validators_list_request::StateValidatorsListRequest; +pub mod state_validators_list_response; +pub use self::state_validators_list_response::StateValidatorsListResponse; +pub mod stream_transactions_request; +pub use self::stream_transactions_request::StreamTransactionsRequest; +pub mod stream_transactions_request_event_filter_item; +pub use self::stream_transactions_request_event_filter_item::StreamTransactionsRequestEventFilterItem; +pub mod stream_transactions_response; +pub use self::stream_transactions_response::StreamTransactionsResponse; +pub mod transaction_balance_changes; +pub use self::transaction_balance_changes::TransactionBalanceChanges; +pub mod transaction_committed_details_request; +pub use self::transaction_committed_details_request::TransactionCommittedDetailsRequest; +pub mod transaction_committed_details_response; +pub use self::transaction_committed_details_response::TransactionCommittedDetailsResponse; +pub mod transaction_construction_response; +pub use self::transaction_construction_response::TransactionConstructionResponse; +pub mod transaction_details_opt_ins; +pub use self::transaction_details_opt_ins::TransactionDetailsOptIns; +pub mod transaction_fungible_balance_changes; +pub use self::transaction_fungible_balance_changes::TransactionFungibleBalanceChanges; +pub mod transaction_fungible_fee_balance_change_type; +pub use self::transaction_fungible_fee_balance_change_type::TransactionFungibleFeeBalanceChangeType; +pub mod transaction_fungible_fee_balance_changes; +pub use self::transaction_fungible_fee_balance_changes::TransactionFungibleFeeBalanceChanges; +pub mod transaction_intent_status; +pub use self::transaction_intent_status::TransactionIntentStatus; +pub mod transaction_non_fungible_balance_changes; +pub use self::transaction_non_fungible_balance_changes::TransactionNonFungibleBalanceChanges; +pub mod transaction_not_found_error; +pub use self::transaction_not_found_error::TransactionNotFoundError; +pub mod transaction_payload_gateway_handling_status; +pub use self::transaction_payload_gateway_handling_status::TransactionPayloadGatewayHandlingStatus; +pub mod transaction_payload_status; +pub use self::transaction_payload_status::TransactionPayloadStatus; +pub mod transaction_preview_request; +pub use self::transaction_preview_request::TransactionPreviewRequest; +pub mod transaction_preview_request_flags; +pub use self::transaction_preview_request_flags::TransactionPreviewRequestFlags; +pub mod transaction_preview_response; +pub use self::transaction_preview_response::TransactionPreviewResponse; +pub mod transaction_preview_response_logs_inner; +pub use self::transaction_preview_response_logs_inner::TransactionPreviewResponseLogsInner; +pub mod transaction_receipt; +pub use self::transaction_receipt::TransactionReceipt; +pub mod transaction_status; +pub use self::transaction_status::TransactionStatus; +pub mod transaction_status_request; +pub use self::transaction_status_request::TransactionStatusRequest; +pub mod transaction_status_response; +pub use self::transaction_status_response::TransactionStatusResponse; +pub mod transaction_status_response_known_payload_item; +pub use self::transaction_status_response_known_payload_item::TransactionStatusResponseKnownPayloadItem; +pub mod transaction_submit_request; +pub use self::transaction_submit_request::TransactionSubmitRequest; +pub mod transaction_submit_response; +pub use self::transaction_submit_response::TransactionSubmitResponse; +pub mod validation_errors_at_path; +pub use self::validation_errors_at_path::ValidationErrorsAtPath; +pub mod validator_collection; +pub use self::validator_collection::ValidatorCollection; +pub mod validator_collection_item; +pub use self::validator_collection_item::ValidatorCollectionItem; +pub mod validator_collection_item_active_in_epoch; +pub use self::validator_collection_item_active_in_epoch::ValidatorCollectionItemActiveInEpoch; +pub mod validator_collection_item_effective_fee_factor; +pub use self::validator_collection_item_effective_fee_factor::ValidatorCollectionItemEffectiveFeeFactor; +pub mod validator_collection_item_effective_fee_factor_current; +pub use self::validator_collection_item_effective_fee_factor_current::ValidatorCollectionItemEffectiveFeeFactorCurrent; +pub mod validator_collection_item_effective_fee_factor_pending; +pub use self::validator_collection_item_effective_fee_factor_pending::ValidatorCollectionItemEffectiveFeeFactorPending; +pub mod validator_uptime_collection; +pub use self::validator_uptime_collection::ValidatorUptimeCollection; +pub mod validator_uptime_collection_item; +pub use self::validator_uptime_collection_item::ValidatorUptimeCollectionItem; +pub mod validator_vault_item; +pub use self::validator_vault_item::ValidatorVaultItem; +pub mod validators_uptime_request; +pub use self::validators_uptime_request::ValidatorsUptimeRequest; +pub mod validators_uptime_response; +pub use self::validators_uptime_response::ValidatorsUptimeResponse; diff --git a/libraries/gateway-client/src/models/network_configuration_response.rs b/libraries/gateway-client/src/models/network_configuration_response.rs new file mode 100644 index 00000000..3e646c61 --- /dev/null +++ b/libraries/gateway-client/src/models/network_configuration_response.rs @@ -0,0 +1,25 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NetworkConfigurationResponse { + #[serde(rename = "network_id")] + pub network_id: i32, + + #[serde(rename = "network_name")] + pub network_name: String, + #[serde(rename = "well_known_addresses")] + pub well_known_addresses: + Box, +} + +impl NetworkConfigurationResponse { + pub fn new( + network_id: i32, + network_name: String, + well_known_addresses: crate::models::NetworkConfigurationResponseWellKnownAddresses, + ) -> NetworkConfigurationResponse { + NetworkConfigurationResponse { + network_id, + network_name, + well_known_addresses: Box::new(well_known_addresses), + } + } +} diff --git a/libraries/gateway-client/src/models/network_configuration_response_well_known_addresses.rs b/libraries/gateway-client/src/models/network_configuration_response_well_known_addresses.rs new file mode 100644 index 00000000..7e59d87a --- /dev/null +++ b/libraries/gateway-client/src/models/network_configuration_response_well_known_addresses.rs @@ -0,0 +1,140 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NetworkConfigurationResponseWellKnownAddresses { + #[serde(rename = "xrd")] + pub xrd: String, + + #[serde(rename = "secp256k1_signature_virtual_badge")] + pub secp256k1_signature_virtual_badge: String, + + #[serde(rename = "ed25519_signature_virtual_badge")] + pub ed25519_signature_virtual_badge: String, + + #[serde(rename = "package_of_direct_caller_virtual_badge")] + pub package_of_direct_caller_virtual_badge: String, + + #[serde(rename = "global_caller_virtual_badge")] + pub global_caller_virtual_badge: String, + + #[serde(rename = "system_transaction_badge")] + pub system_transaction_badge: String, + + #[serde(rename = "package_owner_badge")] + pub package_owner_badge: String, + + #[serde(rename = "validator_owner_badge")] + pub validator_owner_badge: String, + + #[serde(rename = "account_owner_badge")] + pub account_owner_badge: String, + + #[serde(rename = "identity_owner_badge")] + pub identity_owner_badge: String, + + #[serde(rename = "package_package")] + pub package_package: String, + + #[serde(rename = "resource_package")] + pub resource_package: String, + + #[serde(rename = "account_package")] + pub account_package: String, + + #[serde(rename = "identity_package")] + pub identity_package: String, + + #[serde(rename = "consensus_manager_package")] + pub consensus_manager_package: String, + + #[serde(rename = "access_controller_package")] + pub access_controller_package: String, + + #[serde(rename = "transaction_processor_package")] + pub transaction_processor_package: String, + + #[serde(rename = "metadata_module_package")] + pub metadata_module_package: String, + + #[serde(rename = "royalty_module_package")] + pub royalty_module_package: String, + + #[serde(rename = "access_rules_package")] + pub access_rules_package: String, + + #[serde(rename = "genesis_helper_package")] + pub genesis_helper_package: String, + + #[serde(rename = "faucet_package")] + pub faucet_package: String, + + #[serde(rename = "consensus_manager")] + pub consensus_manager: String, + + #[serde(rename = "genesis_helper")] + pub genesis_helper: String, + + #[serde(rename = "faucet")] + pub faucet: String, + + #[serde(rename = "pool_package")] + pub pool_package: String, +} + +impl NetworkConfigurationResponseWellKnownAddresses { + pub fn new( + xrd: String, + secp256k1_signature_virtual_badge: String, + ed25519_signature_virtual_badge: String, + package_of_direct_caller_virtual_badge: String, + global_caller_virtual_badge: String, + system_transaction_badge: String, + package_owner_badge: String, + validator_owner_badge: String, + account_owner_badge: String, + identity_owner_badge: String, + package_package: String, + resource_package: String, + account_package: String, + identity_package: String, + consensus_manager_package: String, + access_controller_package: String, + transaction_processor_package: String, + metadata_module_package: String, + royalty_module_package: String, + access_rules_package: String, + genesis_helper_package: String, + faucet_package: String, + consensus_manager: String, + genesis_helper: String, + faucet: String, + pool_package: String, + ) -> NetworkConfigurationResponseWellKnownAddresses { + NetworkConfigurationResponseWellKnownAddresses { + xrd, + secp256k1_signature_virtual_badge, + ed25519_signature_virtual_badge, + package_of_direct_caller_virtual_badge, + global_caller_virtual_badge, + system_transaction_badge, + package_owner_badge, + validator_owner_badge, + account_owner_badge, + identity_owner_badge, + package_package, + resource_package, + account_package, + identity_package, + consensus_manager_package, + access_controller_package, + transaction_processor_package, + metadata_module_package, + royalty_module_package, + access_rules_package, + genesis_helper_package, + faucet_package, + consensus_manager, + genesis_helper, + faucet, + pool_package, + } + } +} diff --git a/libraries/gateway-client/src/models/non_fungible_id_type.rs b/libraries/gateway-client/src/models/non_fungible_id_type.rs new file mode 100644 index 00000000..ca9bd66e --- /dev/null +++ b/libraries/gateway-client/src/models/non_fungible_id_type.rs @@ -0,0 +1,39 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum NonFungibleIdType { + #[serde(rename = "String")] + String, + #[serde(rename = "Integer")] + Integer, + #[serde(rename = "Bytes")] + Bytes, + #[serde(rename = "Ruid")] + Ruid, +} + +impl ToString for NonFungibleIdType { + fn to_string(&self) -> String { + match self { + Self::String => String::from("String"), + Self::Integer => String::from("Integer"), + Self::Bytes => String::from("Bytes"), + Self::Ruid => String::from("Ruid"), + } + } +} + +impl Default for NonFungibleIdType { + fn default() -> NonFungibleIdType { + Self::String + } +} diff --git a/libraries/gateway-client/src/models/non_fungible_ids_collection.rs b/libraries/gateway-client/src/models/non_fungible_ids_collection.rs new file mode 100644 index 00000000..6a4730b0 --- /dev/null +++ b/libraries/gateway-client/src/models/non_fungible_ids_collection.rs @@ -0,0 +1,30 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NonFungibleIdsCollection { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, +} + +impl NonFungibleIdsCollection { + pub fn new(items: Vec) -> NonFungibleIdsCollection { + NonFungibleIdsCollection { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/non_fungible_resources_collection.rs b/libraries/gateway-client/src/models/non_fungible_resources_collection.rs new file mode 100644 index 00000000..60e0460f --- /dev/null +++ b/libraries/gateway-client/src/models/non_fungible_resources_collection.rs @@ -0,0 +1,32 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NonFungibleResourcesCollection { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, +} + +impl NonFungibleResourcesCollection { + pub fn new( + items: Vec, + ) -> NonFungibleResourcesCollection { + NonFungibleResourcesCollection { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/non_fungible_resources_collection_item.rs b/libraries/gateway-client/src/models/non_fungible_resources_collection_item.rs new file mode 100644 index 00000000..9139f899 --- /dev/null +++ b/libraries/gateway-client/src/models/non_fungible_resources_collection_item.rs @@ -0,0 +1,3 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "")] +pub enum NonFungibleResourcesCollectionItem {} diff --git a/libraries/gateway-client/src/models/non_fungible_resources_collection_item_globally_aggregated.rs b/libraries/gateway-client/src/models/non_fungible_resources_collection_item_globally_aggregated.rs new file mode 100644 index 00000000..6f552ec8 --- /dev/null +++ b/libraries/gateway-client/src/models/non_fungible_resources_collection_item_globally_aggregated.rs @@ -0,0 +1,36 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NonFungibleResourcesCollectionItemGloballyAggregated { + #[serde(rename = "aggregation_level")] + pub aggregation_level: crate::models::ResourceAggregationLevel, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde( + rename = "explicit_metadata", + skip_serializing_if = "Option::is_none" + )] + pub explicit_metadata: Option>, + + #[serde(rename = "amount")] + pub amount: i64, + + #[serde(rename = "last_updated_at_state_version")] + pub last_updated_at_state_version: i64, +} + +impl NonFungibleResourcesCollectionItemGloballyAggregated { + pub fn new( + aggregation_level: crate::models::ResourceAggregationLevel, + resource_address: String, + amount: i64, + last_updated_at_state_version: i64, + ) -> NonFungibleResourcesCollectionItemGloballyAggregated { + NonFungibleResourcesCollectionItemGloballyAggregated { + aggregation_level, + resource_address, + explicit_metadata: None, + amount, + last_updated_at_state_version, + } + } +} diff --git a/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated.rs b/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated.rs new file mode 100644 index 00000000..93b95973 --- /dev/null +++ b/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated.rs @@ -0,0 +1,32 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NonFungibleResourcesCollectionItemVaultAggregated { + #[serde(rename = "aggregation_level")] + pub aggregation_level: crate::models::ResourceAggregationLevel, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde( + rename = "explicit_metadata", + skip_serializing_if = "Option::is_none" + )] + pub explicit_metadata: Option>, + #[serde(rename = "vaults")] + pub vaults: Box< + crate::models::NonFungibleResourcesCollectionItemVaultAggregatedVault, + >, +} + +impl NonFungibleResourcesCollectionItemVaultAggregated { + pub fn new( + aggregation_level: crate::models::ResourceAggregationLevel, + resource_address: String, + vaults: crate::models::NonFungibleResourcesCollectionItemVaultAggregatedVault, + ) -> NonFungibleResourcesCollectionItemVaultAggregated { + NonFungibleResourcesCollectionItemVaultAggregated { + aggregation_level, + resource_address, + explicit_metadata: None, + vaults: Box::new(vaults), + } + } +} diff --git a/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated_vault.rs b/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated_vault.rs new file mode 100644 index 00000000..913b84f1 --- /dev/null +++ b/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated_vault.rs @@ -0,0 +1,23 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NonFungibleResourcesCollectionItemVaultAggregatedVault { + + #[serde(rename = "total_count", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub total_count: Option>, + + #[serde(rename = "next_cursor", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, +} + +impl NonFungibleResourcesCollectionItemVaultAggregatedVault { + pub fn new( + items: Vec, + ) -> NonFungibleResourcesCollectionItemVaultAggregatedVault { + NonFungibleResourcesCollectionItemVaultAggregatedVault { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated_vault_item.rs b/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated_vault_item.rs new file mode 100644 index 00000000..be0c743e --- /dev/null +++ b/libraries/gateway-client/src/models/non_fungible_resources_collection_item_vault_aggregated_vault_item.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NonFungibleResourcesCollectionItemVaultAggregatedVaultItem { + #[serde(rename = "total_count")] + pub total_count: i64, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items", skip_serializing_if = "Option::is_none")] + pub items: Option>, + + #[serde(rename = "vault_address")] + pub vault_address: String, + + #[serde(rename = "last_updated_at_state_version")] + pub last_updated_at_state_version: i64, +} + +impl NonFungibleResourcesCollectionItemVaultAggregatedVaultItem { + pub fn new( + total_count: i64, + vault_address: String, + last_updated_at_state_version: i64, + ) -> NonFungibleResourcesCollectionItemVaultAggregatedVaultItem { + NonFungibleResourcesCollectionItemVaultAggregatedVaultItem { + total_count, + next_cursor: None, + items: None, + vault_address, + last_updated_at_state_version, + } + } +} diff --git a/libraries/gateway-client/src/models/not_synced_up_error.rs b/libraries/gateway-client/src/models/not_synced_up_error.rs new file mode 100644 index 00000000..93e5d5bf --- /dev/null +++ b/libraries/gateway-client/src/models/not_synced_up_error.rs @@ -0,0 +1,30 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct NotSyncedUpError { + #[serde(rename = "type")] + pub r#type: String, + + #[serde(rename = "request_type")] + pub request_type: String, + + #[serde(rename = "current_sync_delay_seconds")] + pub current_sync_delay_seconds: i64, + + #[serde(rename = "max_allowed_sync_delay_seconds")] + pub max_allowed_sync_delay_seconds: i64, +} + +impl NotSyncedUpError { + pub fn new( + r#type: String, + request_type: String, + current_sync_delay_seconds: i64, + max_allowed_sync_delay_seconds: i64, + ) -> NotSyncedUpError { + NotSyncedUpError { + r#type, + request_type, + current_sync_delay_seconds, + max_allowed_sync_delay_seconds, + } + } +} diff --git a/libraries/gateway-client/src/models/object_module_id.rs b/libraries/gateway-client/src/models/object_module_id.rs new file mode 100644 index 00000000..d940c433 --- /dev/null +++ b/libraries/gateway-client/src/models/object_module_id.rs @@ -0,0 +1,39 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum ObjectModuleId { + #[serde(rename = "Main")] + Main, + #[serde(rename = "Metadata")] + Metadata, + #[serde(rename = "Royalty")] + Royalty, + #[serde(rename = "RoleAssignment")] + RoleAssignment, +} + +impl ToString for ObjectModuleId { + fn to_string(&self) -> String { + match self { + Self::Main => String::from("Main"), + Self::Metadata => String::from("Metadata"), + Self::Royalty => String::from("Royalty"), + Self::RoleAssignment => String::from("RoleAssignment"), + } + } +} + +impl Default for ObjectModuleId { + fn default() -> ObjectModuleId { + Self::Main + } +} diff --git a/libraries/gateway-client/src/models/optional_non_fungible_ids_collection.rs b/libraries/gateway-client/src/models/optional_non_fungible_ids_collection.rs new file mode 100644 index 00000000..36906743 --- /dev/null +++ b/libraries/gateway-client/src/models/optional_non_fungible_ids_collection.rs @@ -0,0 +1,36 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct OptionalNonFungibleIdsCollection { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items", skip_serializing_if = "Option::is_none")] + pub items: Option>, +} + +impl Default for OptionalNonFungibleIdsCollection { + fn default() -> Self { + Self::new() + } +} + +impl OptionalNonFungibleIdsCollection { + pub fn new() -> OptionalNonFungibleIdsCollection { + OptionalNonFungibleIdsCollection { + total_count: None, + next_cursor: None, + items: None, + } + } +} diff --git a/libraries/gateway-client/src/models/package_vm_type.rs b/libraries/gateway-client/src/models/package_vm_type.rs new file mode 100644 index 00000000..bb990329 --- /dev/null +++ b/libraries/gateway-client/src/models/package_vm_type.rs @@ -0,0 +1,33 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum PackageVmType { + #[serde(rename = "Native")] + Native, + #[serde(rename = "ScryptoV1")] + ScryptoV1, +} + +impl ToString for PackageVmType { + fn to_string(&self) -> String { + match self { + Self::Native => String::from("Native"), + Self::ScryptoV1 => String::from("ScryptoV1"), + } + } +} + +impl Default for PackageVmType { + fn default() -> PackageVmType { + Self::Native + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value.rs new file mode 100644 index 00000000..260cf8bc --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value.rs @@ -0,0 +1,3 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "")] +pub enum ProgrammaticScryptoSborValue {} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_array.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_array.rs new file mode 100644 index 00000000..a42b3e7e --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_array.rs @@ -0,0 +1,47 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueArray { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "element_kind")] + pub element_kind: crate::models::ProgrammaticScryptoSborValueKind, + #[serde( + rename = "element_type_name", + skip_serializing_if = "Option::is_none" + )] + pub element_type_name: Option, + #[serde(rename = "elements")] + pub elements: Vec, +} + +impl ProgrammaticScryptoSborValueArray { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + element_kind: crate::models::ProgrammaticScryptoSborValueKind, + elements: Vec, + ) -> ProgrammaticScryptoSborValueArray { + ProgrammaticScryptoSborValueArray { + kind, + type_name: None, + field_name: None, + element_kind, + element_type_name: None, + elements, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_bool.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_bool.rs new file mode 100644 index 00000000..e8c9adf6 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_bool.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueBool { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: bool, +} + +impl ProgrammaticScryptoSborValueBool { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: bool, + ) -> ProgrammaticScryptoSborValueBool { + ProgrammaticScryptoSborValueBool { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_bytes.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_bytes.rs new file mode 100644 index 00000000..1afc7c36 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_bytes.rs @@ -0,0 +1,48 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueBytes { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "element_kind")] + pub element_kind: crate::models::ProgrammaticScryptoSborValueKind, + #[serde( + rename = "element_type_name", + skip_serializing_if = "Option::is_none" + )] + pub element_type_name: Option, + + #[serde(rename = "hex")] + pub hex: String, +} + +impl ProgrammaticScryptoSborValueBytes { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + element_kind: crate::models::ProgrammaticScryptoSborValueKind, + hex: String, + ) -> ProgrammaticScryptoSborValueBytes { + ProgrammaticScryptoSborValueBytes { + kind, + type_name: None, + field_name: None, + element_kind, + element_type_name: None, + hex, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_decimal.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_decimal.rs new file mode 100644 index 00000000..a813f189 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_decimal.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueDecimal { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueDecimal { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueDecimal { + ProgrammaticScryptoSborValueDecimal { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_enum.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_enum.rs new file mode 100644 index 00000000..1fa9a290 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_enum.rs @@ -0,0 +1,44 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueEnum { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "variant_id")] + pub variant_id: i32, + #[serde(rename = "variant_name", skip_serializing_if = "Option::is_none")] + pub variant_name: Option, + #[serde(rename = "fields")] + pub fields: Vec, +} + +impl ProgrammaticScryptoSborValueEnum { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + variant_id: i32, + fields: Vec, + ) -> ProgrammaticScryptoSborValueEnum { + ProgrammaticScryptoSborValueEnum { + kind, + type_name: None, + field_name: None, + variant_id, + variant_name: None, + fields, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i128.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i128.rs new file mode 100644 index 00000000..8e29f78f --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i128.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueI128 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueI128 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueI128 { + ProgrammaticScryptoSborValueI128 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i16.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i16.rs new file mode 100644 index 00000000..0f75087b --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i16.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueI16 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueI16 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueI16 { + ProgrammaticScryptoSborValueI16 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i32.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i32.rs new file mode 100644 index 00000000..0865863e --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i32.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueI32 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueI32 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueI32 { + ProgrammaticScryptoSborValueI32 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i64.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i64.rs new file mode 100644 index 00000000..2e7c934f --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i64.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueI64 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueI64 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueI64 { + ProgrammaticScryptoSborValueI64 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i8.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i8.rs new file mode 100644 index 00000000..fa56cc58 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_i8.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueI8 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueI8 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueI8 { + ProgrammaticScryptoSborValueI8 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_kind.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_kind.rs new file mode 100644 index 00000000..4d19b7e0 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_kind.rs @@ -0,0 +1,93 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum ProgrammaticScryptoSborValueKind { + #[serde(rename = "Bool")] + Bool, + #[serde(rename = "I8")] + I8, + #[serde(rename = "I16")] + I16, + #[serde(rename = "I32")] + I32, + #[serde(rename = "I64")] + I64, + #[serde(rename = "I128")] + I128, + #[serde(rename = "U8")] + U8, + #[serde(rename = "U16")] + U16, + #[serde(rename = "U32")] + U32, + #[serde(rename = "U64")] + U64, + #[serde(rename = "U128")] + U128, + #[serde(rename = "String")] + String, + #[serde(rename = "Enum")] + Enum, + #[serde(rename = "Array")] + Array, + #[serde(rename = "Bytes")] + Bytes, + #[serde(rename = "Map")] + Map, + #[serde(rename = "Tuple")] + Tuple, + #[serde(rename = "Reference")] + Reference, + #[serde(rename = "Own")] + Own, + #[serde(rename = "Decimal")] + Decimal, + #[serde(rename = "PreciseDecimal")] + PreciseDecimal, + #[serde(rename = "NonFungibleLocalId")] + NonFungibleLocalId, +} + +impl ToString for ProgrammaticScryptoSborValueKind { + fn to_string(&self) -> String { + match self { + Self::Bool => String::from("Bool"), + Self::I8 => String::from("I8"), + Self::I16 => String::from("I16"), + Self::I32 => String::from("I32"), + Self::I64 => String::from("I64"), + Self::I128 => String::from("I128"), + Self::U8 => String::from("U8"), + Self::U16 => String::from("U16"), + Self::U32 => String::from("U32"), + Self::U64 => String::from("U64"), + Self::U128 => String::from("U128"), + Self::String => String::from("String"), + Self::Enum => String::from("Enum"), + Self::Array => String::from("Array"), + Self::Bytes => String::from("Bytes"), + Self::Map => String::from("Map"), + Self::Tuple => String::from("Tuple"), + Self::Reference => String::from("Reference"), + Self::Own => String::from("Own"), + Self::Decimal => String::from("Decimal"), + Self::PreciseDecimal => String::from("PreciseDecimal"), + Self::NonFungibleLocalId => String::from("NonFungibleLocalId"), + } + } +} + +impl Default for ProgrammaticScryptoSborValueKind { + fn default() -> ProgrammaticScryptoSborValueKind { + Self::Bool + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_map.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_map.rs new file mode 100644 index 00000000..2da55594 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_map.rs @@ -0,0 +1,54 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueMap { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "key_kind")] + pub key_kind: crate::models::ProgrammaticScryptoSborValueKind, + #[serde(rename = "key_type_name", skip_serializing_if = "Option::is_none")] + pub key_type_name: Option, + #[serde(rename = "value_kind")] + pub value_kind: crate::models::ProgrammaticScryptoSborValueKind, + #[serde( + rename = "value_type_name", + skip_serializing_if = "Option::is_none" + )] + pub value_type_name: Option, + #[serde(rename = "entries")] + pub entries: Vec, +} + +impl ProgrammaticScryptoSborValueMap { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + key_kind: crate::models::ProgrammaticScryptoSborValueKind, + value_kind: crate::models::ProgrammaticScryptoSborValueKind, + entries: Vec, + ) -> ProgrammaticScryptoSborValueMap { + ProgrammaticScryptoSborValueMap { + kind, + type_name: None, + field_name: None, + key_kind, + key_type_name: None, + value_kind, + value_type_name: None, + entries, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_map_entry.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_map_entry.rs new file mode 100644 index 00000000..b37dfaa3 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_map_entry.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueMapEntry { + #[serde(rename = "key")] + pub key: Box, + #[serde(rename = "value")] + pub value: Box, +} + +impl ProgrammaticScryptoSborValueMapEntry { + pub fn new( + key: crate::models::ProgrammaticScryptoSborValue, + value: crate::models::ProgrammaticScryptoSborValue, + ) -> ProgrammaticScryptoSborValueMapEntry { + ProgrammaticScryptoSborValueMapEntry { + key: Box::new(key), + value: Box::new(value), + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_non_fungible_local_id.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_non_fungible_local_id.rs new file mode 100644 index 00000000..50daa711 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_non_fungible_local_id.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueNonFungibleLocalId { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueNonFungibleLocalId { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueNonFungibleLocalId { + ProgrammaticScryptoSborValueNonFungibleLocalId { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_own.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_own.rs new file mode 100644 index 00000000..3a944eb7 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_own.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueOwn { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueOwn { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueOwn { + ProgrammaticScryptoSborValueOwn { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_precise_decimal.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_precise_decimal.rs new file mode 100644 index 00000000..9823e998 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_precise_decimal.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValuePreciseDecimal { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValuePreciseDecimal { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValuePreciseDecimal { + ProgrammaticScryptoSborValuePreciseDecimal { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_reference.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_reference.rs new file mode 100644 index 00000000..44078bc5 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_reference.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueReference { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueReference { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueReference { + ProgrammaticScryptoSborValueReference { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_string.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_string.rs new file mode 100644 index 00000000..277848ef --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_string.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueString { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueString { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueString { + ProgrammaticScryptoSborValueString { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_tuple.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_tuple.rs new file mode 100644 index 00000000..8c154c07 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_tuple.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueTuple { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "fields")] + pub fields: Vec, +} + +impl ProgrammaticScryptoSborValueTuple { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + fields: Vec, + ) -> ProgrammaticScryptoSborValueTuple { + ProgrammaticScryptoSborValueTuple { + kind, + type_name: None, + field_name: None, + fields, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u128.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u128.rs new file mode 100644 index 00000000..ad67cdca --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u128.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueU128 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueU128 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueU128 { + ProgrammaticScryptoSborValueU128 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u16.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u16.rs new file mode 100644 index 00000000..42a4d685 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u16.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueU16 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueU16 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueU16 { + ProgrammaticScryptoSborValueU16 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u32.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u32.rs new file mode 100644 index 00000000..81dec0d6 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u32.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueU32 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueU32 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueU32 { + ProgrammaticScryptoSborValueU32 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u64.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u64.rs new file mode 100644 index 00000000..52c1a2a6 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u64.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueU64 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueU64 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueU64 { + ProgrammaticScryptoSborValueU64 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u8.rs b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u8.rs new file mode 100644 index 00000000..77821ba8 --- /dev/null +++ b/libraries/gateway-client/src/models/programmatic_scrypto_sbor_value_u8.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ProgrammaticScryptoSborValueU8 { + #[serde(rename = "kind")] + pub kind: crate::models::ProgrammaticScryptoSborValueKind, + + #[serde( + rename = "type_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub type_name: Option>, + + #[serde( + rename = "field_name", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub field_name: Option>, + #[serde(rename = "value")] + pub value: String, +} + +impl ProgrammaticScryptoSborValueU8 { + pub fn new( + kind: crate::models::ProgrammaticScryptoSborValueKind, + value: String, + ) -> ProgrammaticScryptoSborValueU8 { + ProgrammaticScryptoSborValueU8 { + kind, + type_name: None, + field_name: None, + value, + } + } +} diff --git a/libraries/gateway-client/src/models/public_key.rs b/libraries/gateway-client/src/models/public_key.rs new file mode 100644 index 00000000..d5d29a17 --- /dev/null +++ b/libraries/gateway-client/src/models/public_key.rs @@ -0,0 +1,3 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "")] +pub enum PublicKey {} diff --git a/libraries/gateway-client/src/models/public_key_ecdsa_secp256k1.rs b/libraries/gateway-client/src/models/public_key_ecdsa_secp256k1.rs new file mode 100644 index 00000000..f3fee956 --- /dev/null +++ b/libraries/gateway-client/src/models/public_key_ecdsa_secp256k1.rs @@ -0,0 +1,17 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct PublicKeyEcdsaSecp256k1 { + #[serde(rename = "key_type")] + pub key_type: crate::models::PublicKeyType, + + #[serde(rename = "key_hex")] + pub key_hex: String, +} + +impl PublicKeyEcdsaSecp256k1 { + pub fn new( + key_type: crate::models::PublicKeyType, + key_hex: String, + ) -> PublicKeyEcdsaSecp256k1 { + PublicKeyEcdsaSecp256k1 { key_type, key_hex } + } +} diff --git a/libraries/gateway-client/src/models/public_key_eddsa_ed25519.rs b/libraries/gateway-client/src/models/public_key_eddsa_ed25519.rs new file mode 100644 index 00000000..57c534d7 --- /dev/null +++ b/libraries/gateway-client/src/models/public_key_eddsa_ed25519.rs @@ -0,0 +1,17 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct PublicKeyEddsaEd25519 { + #[serde(rename = "key_type")] + pub key_type: crate::models::PublicKeyType, + + #[serde(rename = "key_hex")] + pub key_hex: String, +} + +impl PublicKeyEddsaEd25519 { + pub fn new( + key_type: crate::models::PublicKeyType, + key_hex: String, + ) -> PublicKeyEddsaEd25519 { + PublicKeyEddsaEd25519 { key_type, key_hex } + } +} diff --git a/libraries/gateway-client/src/models/public_key_hash.rs b/libraries/gateway-client/src/models/public_key_hash.rs new file mode 100644 index 00000000..4d6417df --- /dev/null +++ b/libraries/gateway-client/src/models/public_key_hash.rs @@ -0,0 +1,3 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "")] +pub enum PublicKeyHash {} diff --git a/libraries/gateway-client/src/models/public_key_hash_ecdsa_secp256k1.rs b/libraries/gateway-client/src/models/public_key_hash_ecdsa_secp256k1.rs new file mode 100644 index 00000000..6c354791 --- /dev/null +++ b/libraries/gateway-client/src/models/public_key_hash_ecdsa_secp256k1.rs @@ -0,0 +1,20 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct PublicKeyHashEcdsaSecp256k1 { + #[serde(rename = "key_hash_type")] + pub key_hash_type: crate::models::PublicKeyHashType, + + #[serde(rename = "hash_hex")] + pub hash_hex: String, +} + +impl PublicKeyHashEcdsaSecp256k1 { + pub fn new( + key_hash_type: crate::models::PublicKeyHashType, + hash_hex: String, + ) -> PublicKeyHashEcdsaSecp256k1 { + PublicKeyHashEcdsaSecp256k1 { + key_hash_type, + hash_hex, + } + } +} diff --git a/libraries/gateway-client/src/models/public_key_hash_eddsa_ed25519.rs b/libraries/gateway-client/src/models/public_key_hash_eddsa_ed25519.rs new file mode 100644 index 00000000..ebd37009 --- /dev/null +++ b/libraries/gateway-client/src/models/public_key_hash_eddsa_ed25519.rs @@ -0,0 +1,20 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct PublicKeyHashEddsaEd25519 { + #[serde(rename = "key_hash_type")] + pub key_hash_type: crate::models::PublicKeyHashType, + + #[serde(rename = "hash_hex")] + pub hash_hex: String, +} + +impl PublicKeyHashEddsaEd25519 { + pub fn new( + key_hash_type: crate::models::PublicKeyHashType, + hash_hex: String, + ) -> PublicKeyHashEddsaEd25519 { + PublicKeyHashEddsaEd25519 { + key_hash_type, + hash_hex, + } + } +} diff --git a/libraries/gateway-client/src/models/public_key_hash_type.rs b/libraries/gateway-client/src/models/public_key_hash_type.rs new file mode 100644 index 00000000..d492e527 --- /dev/null +++ b/libraries/gateway-client/src/models/public_key_hash_type.rs @@ -0,0 +1,33 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum PublicKeyHashType { + #[serde(rename = "EcdsaSecp256k1")] + EcdsaSecp256k1, + #[serde(rename = "EddsaEd25519")] + EddsaEd25519, +} + +impl ToString for PublicKeyHashType { + fn to_string(&self) -> String { + match self { + Self::EcdsaSecp256k1 => String::from("EcdsaSecp256k1"), + Self::EddsaEd25519 => String::from("EddsaEd25519"), + } + } +} + +impl Default for PublicKeyHashType { + fn default() -> PublicKeyHashType { + Self::EcdsaSecp256k1 + } +} diff --git a/libraries/gateway-client/src/models/public_key_type.rs b/libraries/gateway-client/src/models/public_key_type.rs new file mode 100644 index 00000000..e3af59cb --- /dev/null +++ b/libraries/gateway-client/src/models/public_key_type.rs @@ -0,0 +1,33 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum PublicKeyType { + #[serde(rename = "EcdsaSecp256k1")] + EcdsaSecp256k1, + #[serde(rename = "EddsaEd25519")] + EddsaEd25519, +} + +impl ToString for PublicKeyType { + fn to_string(&self) -> String { + match self { + Self::EcdsaSecp256k1 => String::from("EcdsaSecp256k1"), + Self::EddsaEd25519 => String::from("EddsaEd25519"), + } + } +} + +impl Default for PublicKeyType { + fn default() -> PublicKeyType { + Self::EcdsaSecp256k1 + } +} diff --git a/libraries/gateway-client/src/models/resource_aggregation_level.rs b/libraries/gateway-client/src/models/resource_aggregation_level.rs new file mode 100644 index 00000000..184784df --- /dev/null +++ b/libraries/gateway-client/src/models/resource_aggregation_level.rs @@ -0,0 +1,33 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum ResourceAggregationLevel { + #[serde(rename = "Global")] + Global, + #[serde(rename = "Vault")] + Vault, +} + +impl ToString for ResourceAggregationLevel { + fn to_string(&self) -> String { + match self { + Self::Global => String::from("Global"), + Self::Vault => String::from("Vault"), + } + } +} + +impl Default for ResourceAggregationLevel { + fn default() -> ResourceAggregationLevel { + Self::Global + } +} diff --git a/libraries/gateway-client/src/models/result_set_cursor_mixin.rs b/libraries/gateway-client/src/models/result_set_cursor_mixin.rs new file mode 100644 index 00000000..fefbad69 --- /dev/null +++ b/libraries/gateway-client/src/models/result_set_cursor_mixin.rs @@ -0,0 +1,33 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ResultSetCursorMixin { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, +} + +impl Default for ResultSetCursorMixin { + fn default() -> Self { + Self::new() + } +} + +impl ResultSetCursorMixin { + pub fn new() -> ResultSetCursorMixin { + ResultSetCursorMixin { + total_count: None, + next_cursor: None, + } + } +} diff --git a/libraries/gateway-client/src/models/role_assignment_resolution.rs b/libraries/gateway-client/src/models/role_assignment_resolution.rs new file mode 100644 index 00000000..18292fb2 --- /dev/null +++ b/libraries/gateway-client/src/models/role_assignment_resolution.rs @@ -0,0 +1,33 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum RoleAssignmentResolution { + #[serde(rename = "Explicit")] + Explicit, + #[serde(rename = "Owner")] + Owner, +} + +impl ToString for RoleAssignmentResolution { + fn to_string(&self) -> String { + match self { + Self::Explicit => String::from("Explicit"), + Self::Owner => String::from("Owner"), + } + } +} + +impl Default for RoleAssignmentResolution { + fn default() -> RoleAssignmentResolution { + Self::Explicit + } +} diff --git a/libraries/gateway-client/src/models/role_key.rs b/libraries/gateway-client/src/models/role_key.rs new file mode 100644 index 00000000..3a856b32 --- /dev/null +++ b/libraries/gateway-client/src/models/role_key.rs @@ -0,0 +1,13 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct RoleKey { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "module")] + pub module: crate::models::ObjectModuleId, +} + +impl RoleKey { + pub fn new(name: String, module: crate::models::ObjectModuleId) -> RoleKey { + RoleKey { name, module } + } +} diff --git a/libraries/gateway-client/src/models/scrypto_sbor_value.rs b/libraries/gateway-client/src/models/scrypto_sbor_value.rs new file mode 100644 index 00000000..13a7c80c --- /dev/null +++ b/libraries/gateway-client/src/models/scrypto_sbor_value.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ScryptoSborValue { + #[serde(rename = "raw_hex")] + pub raw_hex: String, + #[serde(rename = "programmatic_json")] + pub programmatic_json: Box, +} + +impl ScryptoSborValue { + pub fn new( + raw_hex: String, + programmatic_json: crate::models::ProgrammaticScryptoSborValue, + ) -> ScryptoSborValue { + ScryptoSborValue { + raw_hex, + programmatic_json: Box::new(programmatic_json), + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_opt_ins.rs b/libraries/gateway-client/src/models/state_entity_details_opt_ins.rs new file mode 100644 index 00000000..26c4ad27 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_opt_ins.rs @@ -0,0 +1,50 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsOptIns { + #[serde( + rename = "ancestor_identities", + skip_serializing_if = "Option::is_none" + )] + pub ancestor_identities: Option, + + #[serde( + rename = "component_royalty_vault_balance", + skip_serializing_if = "Option::is_none" + )] + pub component_royalty_vault_balance: Option, + + #[serde( + rename = "package_royalty_vault_balance", + skip_serializing_if = "Option::is_none" + )] + pub package_royalty_vault_balance: Option, + + #[serde( + rename = "non_fungible_include_nfids", + skip_serializing_if = "Option::is_none" + )] + pub non_fungible_include_nfids: Option, + + #[serde( + rename = "explicit_metadata", + skip_serializing_if = "Option::is_none" + )] + pub explicit_metadata: Option>, +} + +impl Default for StateEntityDetailsOptIns { + fn default() -> Self { + Self::new() + } +} + +impl StateEntityDetailsOptIns { + pub fn new() -> StateEntityDetailsOptIns { + StateEntityDetailsOptIns { + ancestor_identities: None, + component_royalty_vault_balance: None, + package_royalty_vault_balance: None, + non_fungible_include_nfids: None, + explicit_metadata: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_request.rs b/libraries/gateway-client/src/models/state_entity_details_request.rs new file mode 100644 index 00000000..28d6568d --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_request.rs @@ -0,0 +1,32 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + #[serde(rename = "opt_ins", skip_serializing_if = "Option::is_none")] + pub opt_ins: Option>, + + #[serde(rename = "addresses")] + pub addresses: Vec, + #[serde( + rename = "aggregation_level", + skip_serializing_if = "Option::is_none" + )] + pub aggregation_level: Option, +} + +impl StateEntityDetailsRequest { + pub fn new(addresses: Vec) -> StateEntityDetailsRequest { + StateEntityDetailsRequest { + at_ledger_state: None, + opt_ins: None, + addresses, + aggregation_level: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response.rs b/libraries/gateway-client/src/models/state_entity_details_response.rs new file mode 100644 index 00000000..87da1fc5 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + #[serde(rename = "items")] + pub items: Vec, +} + +impl StateEntityDetailsResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + items: Vec, + ) -> StateEntityDetailsResponse { + StateEntityDetailsResponse { + ledger_state: Box::new(ledger_state), + items, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_component_details.rs b/libraries/gateway-client/src/models/state_entity_details_response_component_details.rs new file mode 100644 index 00000000..260973b7 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_component_details.rs @@ -0,0 +1,48 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponseComponentDetails { + #[serde(rename = "type")] + pub r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + + #[serde( + rename = "package_address", + skip_serializing_if = "Option::is_none" + )] + pub package_address: Option, + #[serde(rename = "blueprint_name")] + pub blueprint_name: String, + #[serde(rename = "blueprint_version")] + pub blueprint_version: String, + + #[serde(rename = "state", skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde( + rename = "role_assignments", + skip_serializing_if = "Option::is_none" + )] + pub role_assignments: + Option>, + + #[serde( + rename = "royalty_vault_balance", + skip_serializing_if = "Option::is_none" + )] + pub royalty_vault_balance: Option, +} + +impl StateEntityDetailsResponseComponentDetails { + pub fn new( + r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + blueprint_name: String, + blueprint_version: String, + ) -> StateEntityDetailsResponseComponentDetails { + StateEntityDetailsResponseComponentDetails { + r#type, + package_address: None, + blueprint_name, + blueprint_version, + state: None, + role_assignments: None, + royalty_vault_balance: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_fungible_resource_details.rs b/libraries/gateway-client/src/models/state_entity_details_response_fungible_resource_details.rs new file mode 100644 index 00000000..a236386f --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_fungible_resource_details.rs @@ -0,0 +1,38 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponseFungibleResourceDetails { + #[serde(rename = "type")] + pub r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + #[serde(rename = "role_assignments")] + pub role_assignments: Box, + #[serde(rename = "divisibility")] + pub divisibility: i32, + + #[serde(rename = "total_supply")] + pub total_supply: String, + + #[serde(rename = "total_minted")] + pub total_minted: String, + + #[serde(rename = "total_burned")] + pub total_burned: String, +} + +impl StateEntityDetailsResponseFungibleResourceDetails { + pub fn new( + r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + role_assignments: crate::models::ComponentEntityRoleAssignments, + divisibility: i32, + total_supply: String, + total_minted: String, + total_burned: String, + ) -> StateEntityDetailsResponseFungibleResourceDetails { + StateEntityDetailsResponseFungibleResourceDetails { + r#type, + role_assignments: Box::new(role_assignments), + divisibility, + total_supply, + total_minted, + total_burned, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_fungible_vault_details.rs b/libraries/gateway-client/src/models/state_entity_details_response_fungible_vault_details.rs new file mode 100644 index 00000000..b6a5793e --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_fungible_vault_details.rs @@ -0,0 +1,26 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponseFungibleVaultDetails { + #[serde(rename = "type")] + pub r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde(rename = "balance")] + pub balance: Box< + crate::models::FungibleResourcesCollectionItemVaultAggregatedVaultItem, + >, +} + +impl StateEntityDetailsResponseFungibleVaultDetails { + pub fn new( + r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + resource_address: String, + balance: crate::models::FungibleResourcesCollectionItemVaultAggregatedVaultItem, + ) -> StateEntityDetailsResponseFungibleVaultDetails { + StateEntityDetailsResponseFungibleVaultDetails { + r#type, + resource_address, + balance: Box::new(balance), + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_item.rs b/libraries/gateway-client/src/models/state_entity_details_response_item.rs new file mode 100644 index 00000000..c74fb398 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_item.rs @@ -0,0 +1,51 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponseItem { + #[serde(rename = "address")] + pub address: String, + #[serde( + rename = "fungible_resources", + skip_serializing_if = "Option::is_none" + )] + pub fungible_resources: + Option>, + #[serde( + rename = "non_fungible_resources", + skip_serializing_if = "Option::is_none" + )] + pub non_fungible_resources: + Option>, + #[serde( + rename = "ancestor_identities", + skip_serializing_if = "Option::is_none" + )] + pub ancestor_identities: Option< + Box, + >, + #[serde(rename = "metadata")] + pub metadata: Box, + #[serde( + rename = "explicit_metadata", + skip_serializing_if = "Option::is_none" + )] + pub explicit_metadata: Option>, + #[serde(rename = "details", skip_serializing_if = "Option::is_none")] + pub details: + Option>, +} + +impl StateEntityDetailsResponseItem { + pub fn new( + address: String, + metadata: crate::models::EntityMetadataCollection, + ) -> StateEntityDetailsResponseItem { + StateEntityDetailsResponseItem { + address, + fungible_resources: None, + non_fungible_resources: None, + ancestor_identities: None, + metadata: Box::new(metadata), + explicit_metadata: None, + details: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_item_ancestor_identities.rs b/libraries/gateway-client/src/models/state_entity_details_response_item_ancestor_identities.rs new file mode 100644 index 00000000..37a9ae4a --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_item_ancestor_identities.rs @@ -0,0 +1,33 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponseItemAncestorIdentities { + #[serde( + rename = "parent_address", + skip_serializing_if = "Option::is_none" + )] + pub parent_address: Option, + + #[serde(rename = "owner_address", skip_serializing_if = "Option::is_none")] + pub owner_address: Option, + + #[serde( + rename = "global_address", + skip_serializing_if = "Option::is_none" + )] + pub global_address: Option, +} + +impl Default for StateEntityDetailsResponseItemAncestorIdentities { + fn default() -> Self { + Self::new() + } +} + +impl StateEntityDetailsResponseItemAncestorIdentities { + pub fn new() -> StateEntityDetailsResponseItemAncestorIdentities { + StateEntityDetailsResponseItemAncestorIdentities { + parent_address: None, + owner_address: None, + global_address: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_item_details.rs b/libraries/gateway-client/src/models/state_entity_details_response_item_details.rs new file mode 100644 index 00000000..c00e665a --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_item_details.rs @@ -0,0 +1,3 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "")] +pub enum StateEntityDetailsResponseItemDetails {} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_item_details_type.rs b/libraries/gateway-client/src/models/state_entity_details_response_item_details_type.rs new file mode 100644 index 00000000..92bcbb96 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_item_details_type.rs @@ -0,0 +1,45 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum StateEntityDetailsResponseItemDetailsType { + #[serde(rename = "FungibleResource")] + FungibleResource, + #[serde(rename = "NonFungibleResource")] + NonFungibleResource, + #[serde(rename = "FungibleVault")] + FungibleVault, + #[serde(rename = "NonFungibleVault")] + NonFungibleVault, + #[serde(rename = "Package")] + Package, + #[serde(rename = "Component")] + Component, +} + +impl ToString for StateEntityDetailsResponseItemDetailsType { + fn to_string(&self) -> String { + match self { + Self::FungibleResource => String::from("FungibleResource"), + Self::NonFungibleResource => String::from("NonFungibleResource"), + Self::FungibleVault => String::from("FungibleVault"), + Self::NonFungibleVault => String::from("NonFungibleVault"), + Self::Package => String::from("Package"), + Self::Component => String::from("Component"), + } + } +} + +impl Default for StateEntityDetailsResponseItemDetailsType { + fn default() -> StateEntityDetailsResponseItemDetailsType { + Self::FungibleResource + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_non_fungible_resource_details.rs b/libraries/gateway-client/src/models/state_entity_details_response_non_fungible_resource_details.rs new file mode 100644 index 00000000..0ab65bec --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_non_fungible_resource_details.rs @@ -0,0 +1,38 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponseNonFungibleResourceDetails { + #[serde(rename = "type")] + pub r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + #[serde(rename = "role_assignments")] + pub role_assignments: Box, + #[serde(rename = "non_fungible_id_type")] + pub non_fungible_id_type: crate::models::NonFungibleIdType, + + #[serde(rename = "total_supply")] + pub total_supply: String, + + #[serde(rename = "total_minted")] + pub total_minted: String, + + #[serde(rename = "total_burned")] + pub total_burned: String, +} + +impl StateEntityDetailsResponseNonFungibleResourceDetails { + pub fn new( + r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + role_assignments: crate::models::ComponentEntityRoleAssignments, + non_fungible_id_type: crate::models::NonFungibleIdType, + total_supply: String, + total_minted: String, + total_burned: String, + ) -> StateEntityDetailsResponseNonFungibleResourceDetails { + StateEntityDetailsResponseNonFungibleResourceDetails { + r#type, + role_assignments: Box::new(role_assignments), + non_fungible_id_type, + total_supply, + total_minted, + total_burned, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_non_fungible_vault_details.rs b/libraries/gateway-client/src/models/state_entity_details_response_non_fungible_vault_details.rs new file mode 100644 index 00000000..df8edc2f --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_non_fungible_vault_details.rs @@ -0,0 +1,24 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponseNonFungibleVaultDetails { + #[serde(rename = "type")] + pub r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde(rename = "balance")] + pub balance: Box, +} + +impl StateEntityDetailsResponseNonFungibleVaultDetails { + pub fn new( + r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + resource_address: String, + balance: crate::models::NonFungibleResourcesCollectionItemVaultAggregatedVaultItem, + ) -> StateEntityDetailsResponseNonFungibleVaultDetails { + StateEntityDetailsResponseNonFungibleVaultDetails { + r#type, + resource_address, + balance: Box::new(balance), + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_package_details.rs b/libraries/gateway-client/src/models/state_entity_details_response_package_details.rs new file mode 100644 index 00000000..28de3148 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_package_details.rs @@ -0,0 +1,39 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponsePackageDetails { + #[serde(rename = "type")] + pub r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + #[serde(rename = "vm_type")] + pub vm_type: crate::models::PackageVmType, + + #[serde(rename = "code_hash_hex")] + pub code_hash_hex: String, + + #[serde(rename = "code_hex")] + pub code_hex: String, + + #[serde(rename = "royalty_vault_balance", skip_serializing_if = "Option::is_none")] + pub royalty_vault_balance: Option, + #[serde(rename = "blueprints", skip_serializing_if = "Option::is_none")] + pub blueprints: Option>, + #[serde(rename = "schemas", skip_serializing_if = "Option::is_none")] + pub schemas: Option>, +} + +impl StateEntityDetailsResponsePackageDetails { + pub fn new( + r#type: crate::models::StateEntityDetailsResponseItemDetailsType, + vm_type: crate::models::PackageVmType, + code_hash_hex: String, + code_hex: String, + ) -> StateEntityDetailsResponsePackageDetails { + StateEntityDetailsResponsePackageDetails { + r#type, + vm_type, + code_hash_hex, + code_hex, + royalty_vault_balance: None, + blueprints: None, + schemas: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_package_details_blueprint_collection.rs b/libraries/gateway-client/src/models/state_entity_details_response_package_details_blueprint_collection.rs new file mode 100644 index 00000000..34a12cfc --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_package_details_blueprint_collection.rs @@ -0,0 +1,34 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponsePackageDetailsBlueprintCollection { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec< + crate::models::StateEntityDetailsResponsePackageDetailsBlueprintItem, + >, +} + +impl StateEntityDetailsResponsePackageDetailsBlueprintCollection { + pub fn new( + items: Vec, + ) -> StateEntityDetailsResponsePackageDetailsBlueprintCollection { + StateEntityDetailsResponsePackageDetailsBlueprintCollection { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_package_details_blueprint_item.rs b/libraries/gateway-client/src/models/state_entity_details_response_package_details_blueprint_item.rs new file mode 100644 index 00000000..edc13682 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_package_details_blueprint_item.rs @@ -0,0 +1,57 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponsePackageDetailsBlueprintItem { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "version")] + pub version: String, + + #[serde(rename = "definition")] + pub definition: serde_json::Value, + #[serde( + rename = "dependant_entities", + skip_serializing_if = "Option::is_none" + )] + pub dependant_entities: Option>, + + #[serde(rename = "auth_template", skip_serializing_if = "Option::is_none")] + pub auth_template: Option, + #[serde( + rename = "auth_template_is_locked", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub auth_template_is_locked: Option>, + + #[serde( + rename = "royalty_config", + skip_serializing_if = "Option::is_none" + )] + pub royalty_config: Option, + #[serde( + rename = "royalty_config_is_locked", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub royalty_config_is_locked: Option>, +} + +impl StateEntityDetailsResponsePackageDetailsBlueprintItem { + pub fn new( + name: String, + version: String, + definition: serde_json::Value, + ) -> StateEntityDetailsResponsePackageDetailsBlueprintItem { + StateEntityDetailsResponsePackageDetailsBlueprintItem { + name, + version, + definition, + dependant_entities: None, + auth_template: None, + auth_template_is_locked: None, + royalty_config: None, + royalty_config_is_locked: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_package_details_schema_collection.rs b/libraries/gateway-client/src/models/state_entity_details_response_package_details_schema_collection.rs new file mode 100644 index 00000000..a4005e8d --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_package_details_schema_collection.rs @@ -0,0 +1,35 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponsePackageDetailsSchemaCollection { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: + Vec, +} + +impl StateEntityDetailsResponsePackageDetailsSchemaCollection { + pub fn new( + items: Vec< + crate::models::StateEntityDetailsResponsePackageDetailsSchemaItem, + >, + ) -> StateEntityDetailsResponsePackageDetailsSchemaCollection { + StateEntityDetailsResponsePackageDetailsSchemaCollection { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_details_response_package_details_schema_item.rs b/libraries/gateway-client/src/models/state_entity_details_response_package_details_schema_item.rs new file mode 100644 index 00000000..c46e3012 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_details_response_package_details_schema_item.rs @@ -0,0 +1,20 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityDetailsResponsePackageDetailsSchemaItem { + #[serde(rename = "schema_hash_hex")] + pub schema_hash_hex: String, + + #[serde(rename = "schema_hex")] + pub schema_hex: String, +} + +impl StateEntityDetailsResponsePackageDetailsSchemaItem { + pub fn new( + schema_hash_hex: String, + schema_hex: String, + ) -> StateEntityDetailsResponsePackageDetailsSchemaItem { + StateEntityDetailsResponsePackageDetailsSchemaItem { + schema_hash_hex, + schema_hex, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_fungible_resource_vaults_page_request.rs b/libraries/gateway-client/src/models/state_entity_fungible_resource_vaults_page_request.rs new file mode 100644 index 00000000..357f5463 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_fungible_resource_vaults_page_request.rs @@ -0,0 +1,48 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityFungibleResourceVaultsPageRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, + + #[serde(rename = "address")] + pub address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, +} + +impl StateEntityFungibleResourceVaultsPageRequest { + pub fn new( + address: String, + resource_address: String, + ) -> StateEntityFungibleResourceVaultsPageRequest { + StateEntityFungibleResourceVaultsPageRequest { + at_ledger_state: None, + cursor: None, + limit_per_page: None, + address, + resource_address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_fungible_resource_vaults_page_response.rs b/libraries/gateway-client/src/models/state_entity_fungible_resource_vaults_page_response.rs new file mode 100644 index 00000000..ac5f6219 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_fungible_resource_vaults_page_response.rs @@ -0,0 +1,49 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityFungibleResourceVaultsPageResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec< + crate::models::FungibleResourcesCollectionItemVaultAggregatedVaultItem, + >, + + #[serde(rename = "address")] + pub address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, +} + +impl StateEntityFungibleResourceVaultsPageResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + items: Vec, + address: String, + resource_address: String, + ) -> StateEntityFungibleResourceVaultsPageResponse { + StateEntityFungibleResourceVaultsPageResponse { + ledger_state: Box::new(ledger_state), + total_count: None, + next_cursor: None, + items, + address, + resource_address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_fungibles_page_request.rs b/libraries/gateway-client/src/models/state_entity_fungibles_page_request.rs new file mode 100644 index 00000000..9c7a8496 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_fungibles_page_request.rs @@ -0,0 +1,51 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityFungiblesPageRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, + + #[serde(rename = "address")] + pub address: String, + #[serde( + rename = "aggregation_level", + skip_serializing_if = "Option::is_none" + )] + pub aggregation_level: Option, + #[serde(rename = "opt_ins", skip_serializing_if = "Option::is_none")] + pub opt_ins: + Option>, +} + +impl StateEntityFungiblesPageRequest { + pub fn new(address: String) -> StateEntityFungiblesPageRequest { + StateEntityFungiblesPageRequest { + at_ledger_state: None, + cursor: None, + limit_per_page: None, + address, + aggregation_level: None, + opt_ins: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_fungibles_page_request_opt_ins.rs b/libraries/gateway-client/src/models/state_entity_fungibles_page_request_opt_ins.rs new file mode 100644 index 00000000..adfaa2fd --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_fungibles_page_request_opt_ins.rs @@ -0,0 +1,22 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityFungiblesPageRequestOptIns { + #[serde( + rename = "explicit_metadata", + skip_serializing_if = "Option::is_none" + )] + pub explicit_metadata: Option>, +} + +impl Default for StateEntityFungiblesPageRequestOptIns { + fn default() -> Self { + Self::new() + } +} + +impl StateEntityFungiblesPageRequestOptIns { + pub fn new() -> StateEntityFungiblesPageRequestOptIns { + StateEntityFungiblesPageRequestOptIns { + explicit_metadata: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_fungibles_page_response.rs b/libraries/gateway-client/src/models/state_entity_fungibles_page_response.rs new file mode 100644 index 00000000..dd85a64e --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_fungibles_page_response.rs @@ -0,0 +1,42 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityFungiblesPageResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, + + #[serde(rename = "address")] + pub address: String, +} + +impl StateEntityFungiblesPageResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + items: Vec, + address: String, + ) -> StateEntityFungiblesPageResponse { + StateEntityFungiblesPageResponse { + ledger_state: Box::new(ledger_state), + total_count: None, + next_cursor: None, + items, + address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_metadata_page_request.rs b/libraries/gateway-client/src/models/state_entity_metadata_page_request.rs new file mode 100644 index 00000000..9e25a347 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_metadata_page_request.rs @@ -0,0 +1,41 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityMetadataPageRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, + + #[serde(rename = "address")] + pub address: String, +} + +impl StateEntityMetadataPageRequest { + pub fn new(address: String) -> StateEntityMetadataPageRequest { + StateEntityMetadataPageRequest { + at_ledger_state: None, + cursor: None, + limit_per_page: None, + address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_metadata_page_response.rs b/libraries/gateway-client/src/models/state_entity_metadata_page_response.rs new file mode 100644 index 00000000..cfb1a31d --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_metadata_page_response.rs @@ -0,0 +1,42 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityMetadataPageResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, + + #[serde(rename = "address")] + pub address: String, +} + +impl StateEntityMetadataPageResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + items: Vec, + address: String, + ) -> StateEntityMetadataPageResponse { + StateEntityMetadataPageResponse { + ledger_state: Box::new(ledger_state), + total_count: None, + next_cursor: None, + items, + address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_non_fungible_ids_page_request.rs b/libraries/gateway-client/src/models/state_entity_non_fungible_ids_page_request.rs new file mode 100644 index 00000000..56bc430f --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_non_fungible_ids_page_request.rs @@ -0,0 +1,53 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityNonFungibleIdsPageRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, + + #[serde(rename = "address")] + pub address: String, + + #[serde(rename = "vault_address")] + pub vault_address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, +} + +impl StateEntityNonFungibleIdsPageRequest { + pub fn new( + address: String, + vault_address: String, + resource_address: String, + ) -> StateEntityNonFungibleIdsPageRequest { + StateEntityNonFungibleIdsPageRequest { + at_ledger_state: None, + cursor: None, + limit_per_page: None, + address, + vault_address, + resource_address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_non_fungible_ids_page_response.rs b/libraries/gateway-client/src/models/state_entity_non_fungible_ids_page_response.rs new file mode 100644 index 00000000..09b4731c --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_non_fungible_ids_page_response.rs @@ -0,0 +1,47 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityNonFungibleIdsPageResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, + + #[serde(rename = "address")] + pub address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, +} + +impl StateEntityNonFungibleIdsPageResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + items: Vec, + address: String, + resource_address: String, + ) -> StateEntityNonFungibleIdsPageResponse { + StateEntityNonFungibleIdsPageResponse { + ledger_state: Box::new(ledger_state), + total_count: None, + next_cursor: None, + items, + address, + resource_address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_opt_ins.rs b/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_opt_ins.rs new file mode 100644 index 00000000..18fe96bc --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_opt_ins.rs @@ -0,0 +1,22 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityNonFungibleResourceVaultsPageOptIns { + #[serde( + rename = "non_fungible_include_nfids", + skip_serializing_if = "Option::is_none" + )] + pub non_fungible_include_nfids: Option, +} + +impl Default for StateEntityNonFungibleResourceVaultsPageOptIns { + fn default() -> Self { + Self::new() + } +} + +impl StateEntityNonFungibleResourceVaultsPageOptIns { + pub fn new() -> StateEntityNonFungibleResourceVaultsPageOptIns { + StateEntityNonFungibleResourceVaultsPageOptIns { + non_fungible_include_nfids: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_request.rs b/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_request.rs new file mode 100644 index 00000000..aff096bc --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_request.rs @@ -0,0 +1,53 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityNonFungibleResourceVaultsPageRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, + + #[serde(rename = "address")] + pub address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde(rename = "opt_ins", skip_serializing_if = "Option::is_none")] + pub opt_ins: Option< + Box, + >, +} + +impl StateEntityNonFungibleResourceVaultsPageRequest { + pub fn new( + address: String, + resource_address: String, + ) -> StateEntityNonFungibleResourceVaultsPageRequest { + StateEntityNonFungibleResourceVaultsPageRequest { + at_ledger_state: None, + cursor: None, + limit_per_page: None, + address, + resource_address, + opt_ins: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_response.rs b/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_response.rs new file mode 100644 index 00000000..5587a241 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_non_fungible_resource_vaults_page_response.rs @@ -0,0 +1,37 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityNonFungibleResourceVaultsPageResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde(rename = "total_count", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub total_count: Option>, + + #[serde(rename = "next_cursor", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, + + #[serde(rename = "address")] + pub address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, +} + +impl StateEntityNonFungibleResourceVaultsPageResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + items: Vec, + address: String, + resource_address: String, + ) -> StateEntityNonFungibleResourceVaultsPageResponse { + StateEntityNonFungibleResourceVaultsPageResponse { + ledger_state: Box::new(ledger_state), + total_count: None, + next_cursor: None, + items, + address, + resource_address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_non_fungibles_page_request.rs b/libraries/gateway-client/src/models/state_entity_non_fungibles_page_request.rs new file mode 100644 index 00000000..0a39eee7 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_non_fungibles_page_request.rs @@ -0,0 +1,51 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityNonFungiblesPageRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, + + #[serde(rename = "address")] + pub address: String, + #[serde( + rename = "aggregation_level", + skip_serializing_if = "Option::is_none" + )] + pub aggregation_level: Option, + #[serde(rename = "opt_ins", skip_serializing_if = "Option::is_none")] + pub opt_ins: + Option>, +} + +impl StateEntityNonFungiblesPageRequest { + pub fn new(address: String) -> StateEntityNonFungiblesPageRequest { + StateEntityNonFungiblesPageRequest { + at_ledger_state: None, + cursor: None, + limit_per_page: None, + address, + aggregation_level: None, + opt_ins: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_non_fungibles_page_request_opt_ins.rs b/libraries/gateway-client/src/models/state_entity_non_fungibles_page_request_opt_ins.rs new file mode 100644 index 00000000..b47440f1 --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_non_fungibles_page_request_opt_ins.rs @@ -0,0 +1,29 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityNonFungiblesPageRequestOptIns { + #[serde( + rename = "non_fungible_include_nfids", + skip_serializing_if = "Option::is_none" + )] + pub non_fungible_include_nfids: Option, + + #[serde( + rename = "explicit_metadata", + skip_serializing_if = "Option::is_none" + )] + pub explicit_metadata: Option>, +} + +impl Default for StateEntityNonFungiblesPageRequestOptIns { + fn default() -> Self { + Self::new() + } +} + +impl StateEntityNonFungiblesPageRequestOptIns { + pub fn new() -> StateEntityNonFungiblesPageRequestOptIns { + StateEntityNonFungiblesPageRequestOptIns { + non_fungible_include_nfids: None, + explicit_metadata: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_entity_non_fungibles_page_response.rs b/libraries/gateway-client/src/models/state_entity_non_fungibles_page_response.rs new file mode 100644 index 00000000..e1d2f71f --- /dev/null +++ b/libraries/gateway-client/src/models/state_entity_non_fungibles_page_response.rs @@ -0,0 +1,42 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateEntityNonFungiblesPageResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, + + #[serde(rename = "address")] + pub address: String, +} + +impl StateEntityNonFungiblesPageResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + items: Vec, + address: String, + ) -> StateEntityNonFungiblesPageResponse { + StateEntityNonFungiblesPageResponse { + ledger_state: Box::new(ledger_state), + total_count: None, + next_cursor: None, + items, + address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_key_value_store_data_request.rs b/libraries/gateway-client/src/models/state_key_value_store_data_request.rs new file mode 100644 index 00000000..e91977c0 --- /dev/null +++ b/libraries/gateway-client/src/models/state_key_value_store_data_request.rs @@ -0,0 +1,30 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateKeyValueStoreDataRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde(rename = "key_value_store_address")] + pub key_value_store_address: String, + + #[serde(rename = "keys")] + pub keys: Vec, +} + +impl StateKeyValueStoreDataRequest { + pub fn new( + key_value_store_address: String, + keys: Vec, + ) -> StateKeyValueStoreDataRequest { + StateKeyValueStoreDataRequest { + at_ledger_state: None, + key_value_store_address, + keys, + } + } +} diff --git a/libraries/gateway-client/src/models/state_key_value_store_data_request_key_item.rs b/libraries/gateway-client/src/models/state_key_value_store_data_request_key_item.rs new file mode 100644 index 00000000..e124af3a --- /dev/null +++ b/libraries/gateway-client/src/models/state_key_value_store_data_request_key_item.rs @@ -0,0 +1,22 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateKeyValueStoreDataRequestKeyItem { + #[serde(rename = "key_hex", skip_serializing_if = "Option::is_none")] + pub key_hex: Option, + #[serde(rename = "key_json", skip_serializing_if = "Option::is_none")] + pub key_json: Option>, +} + +impl Default for StateKeyValueStoreDataRequestKeyItem { + fn default() -> Self { + Self::new() + } +} + +impl StateKeyValueStoreDataRequestKeyItem { + pub fn new() -> StateKeyValueStoreDataRequestKeyItem { + StateKeyValueStoreDataRequestKeyItem { + key_hex: None, + key_json: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_key_value_store_data_response.rs b/libraries/gateway-client/src/models/state_key_value_store_data_response.rs new file mode 100644 index 00000000..06b9fbce --- /dev/null +++ b/libraries/gateway-client/src/models/state_key_value_store_data_response.rs @@ -0,0 +1,24 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateKeyValueStoreDataResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde(rename = "key_value_store_address")] + pub key_value_store_address: String, + #[serde(rename = "entries")] + pub entries: Vec, +} + +impl StateKeyValueStoreDataResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + key_value_store_address: String, + entries: Vec, + ) -> StateKeyValueStoreDataResponse { + StateKeyValueStoreDataResponse { + ledger_state: Box::new(ledger_state), + key_value_store_address, + entries, + } + } +} diff --git a/libraries/gateway-client/src/models/state_key_value_store_data_response_item.rs b/libraries/gateway-client/src/models/state_key_value_store_data_response_item.rs new file mode 100644 index 00000000..0dc38f11 --- /dev/null +++ b/libraries/gateway-client/src/models/state_key_value_store_data_response_item.rs @@ -0,0 +1,28 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateKeyValueStoreDataResponseItem { + #[serde(rename = "key")] + pub key: Box, + #[serde(rename = "value")] + pub value: Box, + + #[serde(rename = "last_updated_at_state_version")] + pub last_updated_at_state_version: i64, + #[serde(rename = "is_locked")] + pub is_locked: bool, +} + +impl StateKeyValueStoreDataResponseItem { + pub fn new( + key: crate::models::ScryptoSborValue, + value: crate::models::ScryptoSborValue, + last_updated_at_state_version: i64, + is_locked: bool, + ) -> StateKeyValueStoreDataResponseItem { + StateKeyValueStoreDataResponseItem { + key: Box::new(key), + value: Box::new(value), + last_updated_at_state_version, + is_locked, + } + } +} diff --git a/libraries/gateway-client/src/models/state_non_fungible_data_request.rs b/libraries/gateway-client/src/models/state_non_fungible_data_request.rs new file mode 100644 index 00000000..970d7a16 --- /dev/null +++ b/libraries/gateway-client/src/models/state_non_fungible_data_request.rs @@ -0,0 +1,30 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateNonFungibleDataRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde(rename = "resource_address")] + pub resource_address: String, + + #[serde(rename = "non_fungible_ids")] + pub non_fungible_ids: Vec, +} + +impl StateNonFungibleDataRequest { + pub fn new( + resource_address: String, + non_fungible_ids: Vec, + ) -> StateNonFungibleDataRequest { + StateNonFungibleDataRequest { + at_ledger_state: None, + resource_address, + non_fungible_ids, + } + } +} diff --git a/libraries/gateway-client/src/models/state_non_fungible_data_response.rs b/libraries/gateway-client/src/models/state_non_fungible_data_response.rs new file mode 100644 index 00000000..2718ee7f --- /dev/null +++ b/libraries/gateway-client/src/models/state_non_fungible_data_response.rs @@ -0,0 +1,31 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateNonFungibleDataResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde(rename = "non_fungible_id_type")] + pub non_fungible_id_type: crate::models::NonFungibleIdType, + #[serde(rename = "non_fungible_ids")] + pub non_fungible_ids: + Vec, +} + +impl StateNonFungibleDataResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + resource_address: String, + non_fungible_id_type: crate::models::NonFungibleIdType, + non_fungible_ids: Vec< + crate::models::StateNonFungibleDetailsResponseItem, + >, + ) -> StateNonFungibleDataResponse { + StateNonFungibleDataResponse { + ledger_state: Box::new(ledger_state), + resource_address, + non_fungible_id_type, + non_fungible_ids, + } + } +} diff --git a/libraries/gateway-client/src/models/state_non_fungible_details_response_item.rs b/libraries/gateway-client/src/models/state_non_fungible_details_response_item.rs new file mode 100644 index 00000000..55d9955f --- /dev/null +++ b/libraries/gateway-client/src/models/state_non_fungible_details_response_item.rs @@ -0,0 +1,28 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateNonFungibleDetailsResponseItem { + #[serde(rename = "is_burned")] + pub is_burned: bool, + + #[serde(rename = "non_fungible_id")] + pub non_fungible_id: String, + #[serde(rename = "data", skip_serializing_if = "Option::is_none")] + pub data: Option>, + + #[serde(rename = "last_updated_at_state_version")] + pub last_updated_at_state_version: i64, +} + +impl StateNonFungibleDetailsResponseItem { + pub fn new( + is_burned: bool, + non_fungible_id: String, + last_updated_at_state_version: i64, + ) -> StateNonFungibleDetailsResponseItem { + StateNonFungibleDetailsResponseItem { + is_burned, + non_fungible_id, + data: None, + last_updated_at_state_version, + } + } +} diff --git a/libraries/gateway-client/src/models/state_non_fungible_ids_request.rs b/libraries/gateway-client/src/models/state_non_fungible_ids_request.rs new file mode 100644 index 00000000..4eb6e9bd --- /dev/null +++ b/libraries/gateway-client/src/models/state_non_fungible_ids_request.rs @@ -0,0 +1,41 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateNonFungibleIdsRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, + + #[serde(rename = "resource_address")] + pub resource_address: String, +} + +impl StateNonFungibleIdsRequest { + pub fn new(resource_address: String) -> StateNonFungibleIdsRequest { + StateNonFungibleIdsRequest { + at_ledger_state: None, + cursor: None, + limit_per_page: None, + resource_address, + } + } +} diff --git a/libraries/gateway-client/src/models/state_non_fungible_ids_response.rs b/libraries/gateway-client/src/models/state_non_fungible_ids_response.rs new file mode 100644 index 00000000..6a246c14 --- /dev/null +++ b/libraries/gateway-client/src/models/state_non_fungible_ids_response.rs @@ -0,0 +1,24 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateNonFungibleIdsResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde(rename = "non_fungible_ids")] + pub non_fungible_ids: Box, +} + +impl StateNonFungibleIdsResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + resource_address: String, + non_fungible_ids: crate::models::NonFungibleIdsCollection, + ) -> StateNonFungibleIdsResponse { + StateNonFungibleIdsResponse { + ledger_state: Box::new(ledger_state), + resource_address, + non_fungible_ids: Box::new(non_fungible_ids), + } + } +} diff --git a/libraries/gateway-client/src/models/state_non_fungible_location_request.rs b/libraries/gateway-client/src/models/state_non_fungible_location_request.rs new file mode 100644 index 00000000..2b40a13b --- /dev/null +++ b/libraries/gateway-client/src/models/state_non_fungible_location_request.rs @@ -0,0 +1,30 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateNonFungibleLocationRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde(rename = "resource_address")] + pub resource_address: String, + + #[serde(rename = "non_fungible_ids")] + pub non_fungible_ids: Vec, +} + +impl StateNonFungibleLocationRequest { + pub fn new( + resource_address: String, + non_fungible_ids: Vec, + ) -> StateNonFungibleLocationRequest { + StateNonFungibleLocationRequest { + at_ledger_state: None, + resource_address, + non_fungible_ids, + } + } +} diff --git a/libraries/gateway-client/src/models/state_non_fungible_location_response.rs b/libraries/gateway-client/src/models/state_non_fungible_location_response.rs new file mode 100644 index 00000000..ce985042 --- /dev/null +++ b/libraries/gateway-client/src/models/state_non_fungible_location_response.rs @@ -0,0 +1,27 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateNonFungibleLocationResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde(rename = "non_fungible_ids")] + pub non_fungible_ids: + Vec, +} + +impl StateNonFungibleLocationResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + resource_address: String, + non_fungible_ids: Vec< + crate::models::StateNonFungibleLocationResponseItem, + >, + ) -> StateNonFungibleLocationResponse { + StateNonFungibleLocationResponse { + ledger_state: Box::new(ledger_state), + resource_address, + non_fungible_ids, + } + } +} diff --git a/libraries/gateway-client/src/models/state_non_fungible_location_response_item.rs b/libraries/gateway-client/src/models/state_non_fungible_location_response_item.rs new file mode 100644 index 00000000..041ea836 --- /dev/null +++ b/libraries/gateway-client/src/models/state_non_fungible_location_response_item.rs @@ -0,0 +1,31 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateNonFungibleLocationResponseItem { + #[serde(rename = "non_fungible_id")] + pub non_fungible_id: String, + + #[serde( + rename = "owning_vault_address", + skip_serializing_if = "Option::is_none" + )] + pub owning_vault_address: Option, + #[serde(rename = "is_burned")] + pub is_burned: bool, + + #[serde(rename = "last_updated_at_state_version")] + pub last_updated_at_state_version: i64, +} + +impl StateNonFungibleLocationResponseItem { + pub fn new( + non_fungible_id: String, + is_burned: bool, + last_updated_at_state_version: i64, + ) -> StateNonFungibleLocationResponseItem { + StateNonFungibleLocationResponseItem { + non_fungible_id, + owning_vault_address: None, + is_burned, + last_updated_at_state_version, + } + } +} diff --git a/libraries/gateway-client/src/models/state_validators_list_request.rs b/libraries/gateway-client/src/models/state_validators_list_request.rs new file mode 100644 index 00000000..ec58b9c5 --- /dev/null +++ b/libraries/gateway-client/src/models/state_validators_list_request.rs @@ -0,0 +1,34 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateValidatorsListRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, +} + +impl Default for StateValidatorsListRequest { + fn default() -> Self { + Self::new() + } +} + +impl StateValidatorsListRequest { + pub fn new() -> StateValidatorsListRequest { + StateValidatorsListRequest { + at_ledger_state: None, + cursor: None, + } + } +} diff --git a/libraries/gateway-client/src/models/state_validators_list_response.rs b/libraries/gateway-client/src/models/state_validators_list_response.rs new file mode 100644 index 00000000..a0c45506 --- /dev/null +++ b/libraries/gateway-client/src/models/state_validators_list_response.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StateValidatorsListResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + #[serde(rename = "validators")] + pub validators: Box, +} + +impl StateValidatorsListResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + validators: crate::models::ValidatorCollection, + ) -> StateValidatorsListResponse { + StateValidatorsListResponse { + ledger_state: Box::new(ledger_state), + validators: Box::new(validators), + } + } +} diff --git a/libraries/gateway-client/src/models/stream_transactions_request.rs b/libraries/gateway-client/src/models/stream_transactions_request.rs new file mode 100644 index 00000000..05388dcd --- /dev/null +++ b/libraries/gateway-client/src/models/stream_transactions_request.rs @@ -0,0 +1,143 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StreamTransactionsRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + #[serde( + rename = "from_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub from_ledger_state: + Option>>, + + #[serde( + rename = "cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub cursor: Option>, + + #[serde( + rename = "limit_per_page", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub limit_per_page: Option>, + + #[serde(rename = "kind_filter", skip_serializing_if = "Option::is_none")] + pub kind_filter: Option, + #[serde( + rename = "manifest_accounts_withdrawn_from_filter", + skip_serializing_if = "Option::is_none" + )] + pub manifest_accounts_withdrawn_from_filter: Option>, + #[serde( + rename = "manifest_accounts_deposited_into_filter", + skip_serializing_if = "Option::is_none" + )] + pub manifest_accounts_deposited_into_filter: Option>, + #[serde( + rename = "manifest_resources_filter", + skip_serializing_if = "Option::is_none" + )] + pub manifest_resources_filter: Option>, + #[serde( + rename = "affected_global_entities_filter", + skip_serializing_if = "Option::is_none" + )] + pub affected_global_entities_filter: Option>, + #[serde(rename = "events_filter", skip_serializing_if = "Option::is_none")] + pub events_filter: + Option>, + + #[serde(rename = "order", skip_serializing_if = "Option::is_none")] + pub order: Option, + #[serde(rename = "opt_ins", skip_serializing_if = "Option::is_none")] + pub opt_ins: Option>, +} + +impl Default for StreamTransactionsRequest { + fn default() -> Self { + Self::new() + } +} + +impl StreamTransactionsRequest { + pub fn new() -> StreamTransactionsRequest { + StreamTransactionsRequest { + at_ledger_state: None, + from_ledger_state: None, + cursor: None, + limit_per_page: None, + kind_filter: None, + manifest_accounts_withdrawn_from_filter: None, + manifest_accounts_deposited_into_filter: None, + manifest_resources_filter: None, + affected_global_entities_filter: None, + events_filter: None, + order: None, + opt_ins: None, + } + } +} + +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum KindFilter { + #[serde(rename = "User")] + User, + #[serde(rename = "EpochChange")] + EpochChange, + #[serde(rename = "All")] + All, +} + +impl Default for KindFilter { + fn default() -> KindFilter { + Self::User + } +} + +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum Order { + #[serde(rename = "Asc")] + Asc, + #[serde(rename = "Desc")] + Desc, +} + +impl Default for Order { + fn default() -> Order { + Self::Asc + } +} diff --git a/libraries/gateway-client/src/models/stream_transactions_request_event_filter_item.rs b/libraries/gateway-client/src/models/stream_transactions_request_event_filter_item.rs new file mode 100644 index 00000000..a75122e7 --- /dev/null +++ b/libraries/gateway-client/src/models/stream_transactions_request_event_filter_item.rs @@ -0,0 +1,52 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StreamTransactionsRequestEventFilterItem { + #[serde(rename = "event")] + pub event: Event, + + #[serde( + rename = "emitter_address", + skip_serializing_if = "Option::is_none" + )] + pub emitter_address: Option, + + #[serde( + rename = "resource_address", + skip_serializing_if = "Option::is_none" + )] + pub resource_address: Option, +} + +impl StreamTransactionsRequestEventFilterItem { + pub fn new(event: Event) -> StreamTransactionsRequestEventFilterItem { + StreamTransactionsRequestEventFilterItem { + event, + emitter_address: None, + resource_address: None, + } + } +} + +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum Event { + #[serde(rename = "Deposit")] + Deposit, + #[serde(rename = "Withdrawal")] + Withdrawal, +} + +impl Default for Event { + fn default() -> Event { + Self::Deposit + } +} diff --git a/libraries/gateway-client/src/models/stream_transactions_response.rs b/libraries/gateway-client/src/models/stream_transactions_response.rs new file mode 100644 index 00000000..c2eba096 --- /dev/null +++ b/libraries/gateway-client/src/models/stream_transactions_response.rs @@ -0,0 +1,38 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct StreamTransactionsResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + + #[serde(rename = "items")] + pub items: Vec, +} + +impl StreamTransactionsResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + items: Vec, + ) -> StreamTransactionsResponse { + StreamTransactionsResponse { + ledger_state: Box::new(ledger_state), + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_balance_changes.rs b/libraries/gateway-client/src/models/transaction_balance_changes.rs new file mode 100644 index 00000000..af57b2e2 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_balance_changes.rs @@ -0,0 +1,34 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionBalanceChanges { + #[serde(rename = "fungible_fee_balance_changes")] + pub fungible_fee_balance_changes: + Vec, + + #[serde(rename = "fungible_balance_changes")] + pub fungible_balance_changes: + Vec, + + #[serde(rename = "non_fungible_balance_changes")] + pub non_fungible_balance_changes: + Vec, +} + +impl TransactionBalanceChanges { + pub fn new( + fungible_fee_balance_changes: Vec< + crate::models::TransactionFungibleFeeBalanceChanges, + >, + fungible_balance_changes: Vec< + crate::models::TransactionFungibleBalanceChanges, + >, + non_fungible_balance_changes: Vec< + crate::models::TransactionNonFungibleBalanceChanges, + >, + ) -> TransactionBalanceChanges { + TransactionBalanceChanges { + fungible_fee_balance_changes, + fungible_balance_changes, + non_fungible_balance_changes, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_committed_details_request.rs b/libraries/gateway-client/src/models/transaction_committed_details_request.rs new file mode 100644 index 00000000..8586c9c3 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_committed_details_request.rs @@ -0,0 +1,26 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionCommittedDetailsRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + + #[serde(rename = "intent_hash")] + pub intent_hash: String, + #[serde(rename = "opt_ins", skip_serializing_if = "Option::is_none")] + pub opt_ins: Option>, +} + +impl TransactionCommittedDetailsRequest { + pub fn new(intent_hash: String) -> TransactionCommittedDetailsRequest { + TransactionCommittedDetailsRequest { + at_ledger_state: None, + intent_hash, + opt_ins: None, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_committed_details_response.rs b/libraries/gateway-client/src/models/transaction_committed_details_response.rs new file mode 100644 index 00000000..1ae08770 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_committed_details_response.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionCommittedDetailsResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + #[serde(rename = "transaction")] + pub transaction: Box, +} + +impl TransactionCommittedDetailsResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + transaction: crate::models::CommittedTransactionInfo, + ) -> TransactionCommittedDetailsResponse { + TransactionCommittedDetailsResponse { + ledger_state: Box::new(ledger_state), + transaction: Box::new(transaction), + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_construction_response.rs b/libraries/gateway-client/src/models/transaction_construction_response.rs new file mode 100644 index 00000000..e82addc4 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_construction_response.rs @@ -0,0 +1,15 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionConstructionResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, +} + +impl TransactionConstructionResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + ) -> TransactionConstructionResponse { + TransactionConstructionResponse { + ledger_state: Box::new(ledger_state), + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_details_opt_ins.rs b/libraries/gateway-client/src/models/transaction_details_opt_ins.rs new file mode 100644 index 00000000..579c7400 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_details_opt_ins.rs @@ -0,0 +1,82 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionDetailsOptIns { + #[serde(rename = "raw_hex", skip_serializing_if = "Option::is_none")] + pub raw_hex: Option, + + #[serde( + rename = "receipt_state_changes", + skip_serializing_if = "Option::is_none" + )] + pub receipt_state_changes: Option, + + #[serde( + rename = "receipt_fee_summary", + skip_serializing_if = "Option::is_none" + )] + pub receipt_fee_summary: Option, + + #[serde( + rename = "receipt_fee_source", + skip_serializing_if = "Option::is_none" + )] + pub receipt_fee_source: Option, + + #[serde( + rename = "receipt_fee_destination", + skip_serializing_if = "Option::is_none" + )] + pub receipt_fee_destination: Option, + + #[serde( + rename = "receipt_costing_parameters", + skip_serializing_if = "Option::is_none" + )] + pub receipt_costing_parameters: Option, + + #[serde( + rename = "receipt_events", + skip_serializing_if = "Option::is_none" + )] + pub receipt_events: Option, + + #[serde( + rename = "receipt_output", + skip_serializing_if = "Option::is_none" + )] + pub receipt_output: Option, + + #[serde( + rename = "affected_global_entities", + skip_serializing_if = "Option::is_none" + )] + pub affected_global_entities: Option, + + #[serde( + rename = "balance_changes", + skip_serializing_if = "Option::is_none" + )] + pub balance_changes: Option, +} + +impl Default for TransactionDetailsOptIns { + fn default() -> Self { + Self::new() + } +} + +impl TransactionDetailsOptIns { + pub fn new() -> TransactionDetailsOptIns { + TransactionDetailsOptIns { + raw_hex: None, + receipt_state_changes: None, + receipt_fee_summary: None, + receipt_fee_source: None, + receipt_fee_destination: None, + receipt_costing_parameters: None, + receipt_events: None, + receipt_output: None, + affected_global_entities: None, + balance_changes: None, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_fungible_balance_changes.rs b/libraries/gateway-client/src/models/transaction_fungible_balance_changes.rs new file mode 100644 index 00000000..f8dcf2ce --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_fungible_balance_changes.rs @@ -0,0 +1,25 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionFungibleBalanceChanges { + #[serde(rename = "entity_address")] + pub entity_address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, + + #[serde(rename = "balance_change")] + pub balance_change: String, +} + +impl TransactionFungibleBalanceChanges { + pub fn new( + entity_address: String, + resource_address: String, + balance_change: String, + ) -> TransactionFungibleBalanceChanges { + TransactionFungibleBalanceChanges { + entity_address, + resource_address, + balance_change, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_fungible_fee_balance_change_type.rs b/libraries/gateway-client/src/models/transaction_fungible_fee_balance_change_type.rs new file mode 100644 index 00000000..a22f71e1 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_fungible_fee_balance_change_type.rs @@ -0,0 +1,39 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum TransactionFungibleFeeBalanceChangeType { + #[serde(rename = "FeePayment")] + FeePayment, + #[serde(rename = "FeeDistributed")] + FeeDistributed, + #[serde(rename = "TipDistributed")] + TipDistributed, + #[serde(rename = "RoyaltyDistributed")] + RoyaltyDistributed, +} + +impl ToString for TransactionFungibleFeeBalanceChangeType { + fn to_string(&self) -> String { + match self { + Self::FeePayment => String::from("FeePayment"), + Self::FeeDistributed => String::from("FeeDistributed"), + Self::TipDistributed => String::from("TipDistributed"), + Self::RoyaltyDistributed => String::from("RoyaltyDistributed"), + } + } +} + +impl Default for TransactionFungibleFeeBalanceChangeType { + fn default() -> TransactionFungibleFeeBalanceChangeType { + Self::FeePayment + } +} diff --git a/libraries/gateway-client/src/models/transaction_fungible_fee_balance_changes.rs b/libraries/gateway-client/src/models/transaction_fungible_fee_balance_changes.rs new file mode 100644 index 00000000..add6b6e2 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_fungible_fee_balance_changes.rs @@ -0,0 +1,30 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionFungibleFeeBalanceChanges { + #[serde(rename = "type")] + pub r#type: crate::models::TransactionFungibleFeeBalanceChangeType, + + #[serde(rename = "entity_address")] + pub entity_address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, + + #[serde(rename = "balance_change")] + pub balance_change: String, +} + +impl TransactionFungibleFeeBalanceChanges { + pub fn new( + r#type: crate::models::TransactionFungibleFeeBalanceChangeType, + entity_address: String, + resource_address: String, + balance_change: String, + ) -> TransactionFungibleFeeBalanceChanges { + TransactionFungibleFeeBalanceChanges { + r#type, + entity_address, + resource_address, + balance_change, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_intent_status.rs b/libraries/gateway-client/src/models/transaction_intent_status.rs new file mode 100644 index 00000000..b839d827 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_intent_status.rs @@ -0,0 +1,52 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum TransactionIntentStatus { + #[serde(rename = "Unknown")] + Unknown, + #[serde(rename = "CommittedSuccess")] + CommittedSuccess, + #[serde(rename = "CommittedFailure")] + CommittedFailure, + #[serde(rename = "CommitPendingOutcomeUnknown")] + CommitPendingOutcomeUnknown, + #[serde(rename = "PermanentlyRejected")] + PermanentlyRejected, + #[serde(rename = "LikelyButNotCertainRejection")] + LikelyButNotCertainRejection, + #[serde(rename = "Pending")] + Pending, +} + +impl ToString for TransactionIntentStatus { + fn to_string(&self) -> String { + match self { + Self::Unknown => String::from("Unknown"), + Self::CommittedSuccess => String::from("CommittedSuccess"), + Self::CommittedFailure => String::from("CommittedFailure"), + Self::CommitPendingOutcomeUnknown => { + String::from("CommitPendingOutcomeUnknown") + } + Self::PermanentlyRejected => String::from("PermanentlyRejected"), + Self::LikelyButNotCertainRejection => { + String::from("LikelyButNotCertainRejection") + } + Self::Pending => String::from("Pending"), + } + } +} + +impl Default for TransactionIntentStatus { + fn default() -> TransactionIntentStatus { + Self::Unknown + } +} diff --git a/libraries/gateway-client/src/models/transaction_non_fungible_balance_changes.rs b/libraries/gateway-client/src/models/transaction_non_fungible_balance_changes.rs new file mode 100644 index 00000000..c676edcf --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_non_fungible_balance_changes.rs @@ -0,0 +1,28 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionNonFungibleBalanceChanges { + #[serde(rename = "entity_address")] + pub entity_address: String, + + #[serde(rename = "resource_address")] + pub resource_address: String, + #[serde(rename = "added")] + pub added: Vec, + #[serde(rename = "removed")] + pub removed: Vec, +} + +impl TransactionNonFungibleBalanceChanges { + pub fn new( + entity_address: String, + resource_address: String, + added: Vec, + removed: Vec, + ) -> TransactionNonFungibleBalanceChanges { + TransactionNonFungibleBalanceChanges { + entity_address, + resource_address, + added, + removed, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_not_found_error.rs b/libraries/gateway-client/src/models/transaction_not_found_error.rs new file mode 100644 index 00000000..1fd2a634 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_not_found_error.rs @@ -0,0 +1,20 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionNotFoundError { + #[serde(rename = "type")] + pub r#type: String, + + #[serde(rename = "intent_hash")] + pub intent_hash: String, +} + +impl TransactionNotFoundError { + pub fn new( + r#type: String, + intent_hash: String, + ) -> TransactionNotFoundError { + TransactionNotFoundError { + r#type, + intent_hash, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_payload_gateway_handling_status.rs b/libraries/gateway-client/src/models/transaction_payload_gateway_handling_status.rs new file mode 100644 index 00000000..af0573bc --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_payload_gateway_handling_status.rs @@ -0,0 +1,33 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum TransactionPayloadGatewayHandlingStatus { + #[serde(rename = "HandlingSubmission")] + HandlingSubmission, + #[serde(rename = "Concluded")] + Concluded, +} + +impl ToString for TransactionPayloadGatewayHandlingStatus { + fn to_string(&self) -> String { + match self { + Self::HandlingSubmission => String::from("HandlingSubmission"), + Self::Concluded => String::from("Concluded"), + } + } +} + +impl Default for TransactionPayloadGatewayHandlingStatus { + fn default() -> TransactionPayloadGatewayHandlingStatus { + Self::HandlingSubmission + } +} diff --git a/libraries/gateway-client/src/models/transaction_payload_status.rs b/libraries/gateway-client/src/models/transaction_payload_status.rs new file mode 100644 index 00000000..56454832 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_payload_status.rs @@ -0,0 +1,50 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum TransactionPayloadStatus { + #[serde(rename = "Unknown")] + Unknown, + #[serde(rename = "CommittedSuccess")] + CommittedSuccess, + #[serde(rename = "CommittedFailure")] + CommittedFailure, + #[serde(rename = "CommitPendingOutcomeUnknown")] + CommitPendingOutcomeUnknown, + #[serde(rename = "PermanentlyRejected")] + PermanentlyRejected, + #[serde(rename = "TemporarilyRejected")] + TemporarilyRejected, + #[serde(rename = "Pending")] + Pending, +} + +impl ToString for TransactionPayloadStatus { + fn to_string(&self) -> String { + match self { + Self::Unknown => String::from("Unknown"), + Self::CommittedSuccess => String::from("CommittedSuccess"), + Self::CommittedFailure => String::from("CommittedFailure"), + Self::CommitPendingOutcomeUnknown => { + String::from("CommitPendingOutcomeUnknown") + } + Self::PermanentlyRejected => String::from("PermanentlyRejected"), + Self::TemporarilyRejected => String::from("TemporarilyRejected"), + Self::Pending => String::from("Pending"), + } + } +} + +impl Default for TransactionPayloadStatus { + fn default() -> TransactionPayloadStatus { + Self::Unknown + } +} diff --git a/libraries/gateway-client/src/models/transaction_preview_request.rs b/libraries/gateway-client/src/models/transaction_preview_request.rs new file mode 100644 index 00000000..19bd8995 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_preview_request.rs @@ -0,0 +1,61 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionPreviewRequest { + #[serde(rename = "manifest")] + pub manifest: String, + + #[serde(rename = "blobs_hex", skip_serializing_if = "Option::is_none")] + pub blobs_hex: Option>, + + #[serde(rename = "start_epoch_inclusive")] + pub start_epoch_inclusive: i64, + + #[serde(rename = "end_epoch_exclusive")] + pub end_epoch_exclusive: i64, + #[serde( + rename = "notary_public_key", + skip_serializing_if = "Option::is_none" + )] + pub notary_public_key: Option>, + + #[serde( + rename = "notary_is_signatory", + skip_serializing_if = "Option::is_none" + )] + pub notary_is_signatory: Option, + + #[serde(rename = "tip_percentage")] + pub tip_percentage: i32, + + #[serde(rename = "nonce")] + pub nonce: i64, + + #[serde(rename = "signer_public_keys")] + pub signer_public_keys: Vec, + #[serde(rename = "flags")] + pub flags: Box, +} + +impl TransactionPreviewRequest { + pub fn new( + manifest: String, + start_epoch_inclusive: i64, + end_epoch_exclusive: i64, + tip_percentage: i32, + nonce: i64, + signer_public_keys: Vec, + flags: crate::models::TransactionPreviewRequestFlags, + ) -> TransactionPreviewRequest { + TransactionPreviewRequest { + manifest, + blobs_hex: None, + start_epoch_inclusive, + end_epoch_exclusive, + notary_public_key: None, + notary_is_signatory: None, + tip_percentage, + nonce, + signer_public_keys, + flags: Box::new(flags), + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_preview_request_flags.rs b/libraries/gateway-client/src/models/transaction_preview_request_flags.rs new file mode 100644 index 00000000..81a281f4 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_preview_request_flags.rs @@ -0,0 +1,23 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionPreviewRequestFlags { + #[serde(rename = "use_free_credit")] + pub use_free_credit: bool, + #[serde(rename = "assume_all_signature_proofs")] + pub assume_all_signature_proofs: bool, + #[serde(rename = "skip_epoch_check")] + pub skip_epoch_check: bool, +} + +impl TransactionPreviewRequestFlags { + pub fn new( + use_free_credit: bool, + assume_all_signature_proofs: bool, + skip_epoch_check: bool, + ) -> TransactionPreviewRequestFlags { + TransactionPreviewRequestFlags { + use_free_credit, + assume_all_signature_proofs, + skip_epoch_check, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_preview_response.rs b/libraries/gateway-client/src/models/transaction_preview_response.rs new file mode 100644 index 00000000..a9c31bc4 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_preview_response.rs @@ -0,0 +1,28 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionPreviewResponse { + #[serde(rename = "encoded_receipt")] + pub encoded_receipt: String, + + #[serde(rename = "receipt")] + pub receipt: serde_json::Value, + #[serde(rename = "resource_changes")] + pub resource_changes: Vec, + #[serde(rename = "logs")] + pub logs: Vec, +} + +impl TransactionPreviewResponse { + pub fn new( + encoded_receipt: String, + receipt: serde_json::Value, + resource_changes: Vec, + logs: Vec, + ) -> TransactionPreviewResponse { + TransactionPreviewResponse { + encoded_receipt, + receipt, + resource_changes, + logs, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_preview_response_logs_inner.rs b/libraries/gateway-client/src/models/transaction_preview_response_logs_inner.rs new file mode 100644 index 00000000..d3423dfe --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_preview_response_logs_inner.rs @@ -0,0 +1,16 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionPreviewResponseLogsInner { + #[serde(rename = "level")] + pub level: String, + #[serde(rename = "message")] + pub message: String, +} + +impl TransactionPreviewResponseLogsInner { + pub fn new( + level: String, + message: String, + ) -> TransactionPreviewResponseLogsInner { + TransactionPreviewResponseLogsInner { level, message } + } +} diff --git a/libraries/gateway-client/src/models/transaction_receipt.rs b/libraries/gateway-client/src/models/transaction_receipt.rs new file mode 100644 index 00000000..5f6c2487 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_receipt.rs @@ -0,0 +1,65 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionReceipt { + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, + + #[serde(rename = "fee_summary", skip_serializing_if = "Option::is_none")] + pub fee_summary: Option, + #[serde( + rename = "costing_parameters", + skip_serializing_if = "Option::is_none" + )] + pub costing_parameters: Option, + + #[serde( + rename = "fee_destination", + skip_serializing_if = "Option::is_none" + )] + pub fee_destination: Option, + + #[serde(rename = "fee_source", skip_serializing_if = "Option::is_none")] + pub fee_source: Option, + + #[serde(rename = "state_updates", skip_serializing_if = "Option::is_none")] + pub state_updates: Option, + + #[serde(rename = "next_epoch", skip_serializing_if = "Option::is_none")] + pub next_epoch: Option, + + #[serde(rename = "output", skip_serializing_if = "Option::is_none")] + pub output: Option, + + #[serde(rename = "events", skip_serializing_if = "Option::is_none")] + pub events: Option>, + + #[serde( + rename = "error_message", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub error_message: Option>, +} + +impl Default for TransactionReceipt { + fn default() -> Self { + Self::new() + } +} + +impl TransactionReceipt { + pub fn new() -> TransactionReceipt { + TransactionReceipt { + status: None, + fee_summary: None, + costing_parameters: None, + fee_destination: None, + fee_source: None, + state_updates: None, + next_epoch: None, + output: None, + events: None, + error_message: None, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_status.rs b/libraries/gateway-client/src/models/transaction_status.rs new file mode 100644 index 00000000..5ab066e0 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_status.rs @@ -0,0 +1,42 @@ +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + serde::Serialize, + serde::Deserialize, +)] +pub enum TransactionStatus { + #[serde(rename = "Unknown")] + Unknown, + #[serde(rename = "CommittedSuccess")] + CommittedSuccess, + #[serde(rename = "CommittedFailure")] + CommittedFailure, + #[serde(rename = "Pending")] + Pending, + #[serde(rename = "Rejected")] + Rejected, +} + +impl ToString for TransactionStatus { + fn to_string(&self) -> String { + match self { + Self::Unknown => String::from("Unknown"), + Self::CommittedSuccess => String::from("CommittedSuccess"), + Self::CommittedFailure => String::from("CommittedFailure"), + Self::Pending => String::from("Pending"), + Self::Rejected => String::from("Rejected"), + } + } +} + +impl Default for TransactionStatus { + fn default() -> TransactionStatus { + Self::Unknown + } +} diff --git a/libraries/gateway-client/src/models/transaction_status_request.rs b/libraries/gateway-client/src/models/transaction_status_request.rs new file mode 100644 index 00000000..965c32fb --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_status_request.rs @@ -0,0 +1,11 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionStatusRequest { + #[serde(rename = "intent_hash")] + pub intent_hash: String, +} + +impl TransactionStatusRequest { + pub fn new(intent_hash: String) -> TransactionStatusRequest { + TransactionStatusRequest { intent_hash } + } +} diff --git a/libraries/gateway-client/src/models/transaction_status_response.rs b/libraries/gateway-client/src/models/transaction_status_response.rs new file mode 100644 index 00000000..c012907a --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_status_response.rs @@ -0,0 +1,53 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionStatusResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + #[serde(rename = "status")] + pub status: crate::models::TransactionStatus, + #[serde(rename = "intent_status")] + pub intent_status: crate::models::TransactionIntentStatus, + + #[serde(rename = "intent_status_description")] + pub intent_status_description: String, + #[serde(rename = "known_payloads")] + pub known_payloads: + Vec, + + #[serde( + rename = "committed_state_version", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub committed_state_version: Option>, + + #[serde( + rename = "error_message", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub error_message: Option>, +} + +impl TransactionStatusResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + status: crate::models::TransactionStatus, + intent_status: crate::models::TransactionIntentStatus, + intent_status_description: String, + known_payloads: Vec< + crate::models::TransactionStatusResponseKnownPayloadItem, + >, + ) -> TransactionStatusResponse { + TransactionStatusResponse { + ledger_state: Box::new(ledger_state), + status, + intent_status, + intent_status_description, + known_payloads, + committed_state_version: None, + error_message: None, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_status_response_known_payload_item.rs b/libraries/gateway-client/src/models/transaction_status_response_known_payload_item.rs new file mode 100644 index 00000000..85ab71d2 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_status_response_known_payload_item.rs @@ -0,0 +1,75 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionStatusResponseKnownPayloadItem { + #[serde(rename = "payload_hash")] + pub payload_hash: String, + #[serde(rename = "status")] + pub status: crate::models::TransactionStatus, + #[serde( + rename = "payload_status", + skip_serializing_if = "Option::is_none" + )] + pub payload_status: Option, + + #[serde( + rename = "payload_status_description", + skip_serializing_if = "Option::is_none" + )] + pub payload_status_description: Option, + + #[serde( + rename = "error_message", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub error_message: Option>, + + #[serde( + rename = "latest_error_message", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub latest_error_message: Option>, + #[serde( + rename = "handling_status", + skip_serializing_if = "Option::is_none" + )] + pub handling_status: + Option, + + #[serde( + rename = "handling_status_reason", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub handling_status_reason: Option>, + + #[serde( + rename = "submission_error", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub submission_error: Option>, +} + +impl TransactionStatusResponseKnownPayloadItem { + pub fn new( + payload_hash: String, + status: crate::models::TransactionStatus, + ) -> TransactionStatusResponseKnownPayloadItem { + TransactionStatusResponseKnownPayloadItem { + payload_hash, + status, + payload_status: None, + payload_status_description: None, + error_message: None, + latest_error_message: None, + handling_status: None, + handling_status_reason: None, + submission_error: None, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_submit_request.rs b/libraries/gateway-client/src/models/transaction_submit_request.rs new file mode 100644 index 00000000..7f41dd45 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_submit_request.rs @@ -0,0 +1,13 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionSubmitRequest { + #[serde(rename = "notarized_transaction_hex")] + pub notarized_transaction_hex: String, +} + +impl TransactionSubmitRequest { + pub fn new(notarized_transaction_hex: String) -> TransactionSubmitRequest { + TransactionSubmitRequest { + notarized_transaction_hex, + } + } +} diff --git a/libraries/gateway-client/src/models/transaction_submit_response.rs b/libraries/gateway-client/src/models/transaction_submit_response.rs new file mode 100644 index 00000000..f96345b7 --- /dev/null +++ b/libraries/gateway-client/src/models/transaction_submit_response.rs @@ -0,0 +1,11 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TransactionSubmitResponse { + #[serde(rename = "duplicate")] + pub duplicate: bool, +} + +impl TransactionSubmitResponse { + pub fn new(duplicate: bool) -> TransactionSubmitResponse { + TransactionSubmitResponse { duplicate } + } +} diff --git a/libraries/gateway-client/src/models/validation_errors_at_path.rs b/libraries/gateway-client/src/models/validation_errors_at_path.rs new file mode 100644 index 00000000..735d8f5b --- /dev/null +++ b/libraries/gateway-client/src/models/validation_errors_at_path.rs @@ -0,0 +1,13 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidationErrorsAtPath { + #[serde(rename = "path")] + pub path: String, + #[serde(rename = "errors")] + pub errors: Vec, +} + +impl ValidationErrorsAtPath { + pub fn new(path: String, errors: Vec) -> ValidationErrorsAtPath { + ValidationErrorsAtPath { path, errors } + } +} diff --git a/libraries/gateway-client/src/models/validator_collection.rs b/libraries/gateway-client/src/models/validator_collection.rs new file mode 100644 index 00000000..0ed841e4 --- /dev/null +++ b/libraries/gateway-client/src/models/validator_collection.rs @@ -0,0 +1,32 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorCollection { + #[serde( + rename = "total_count", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub total_count: Option>, + + #[serde( + rename = "next_cursor", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub next_cursor: Option>, + #[serde(rename = "items")] + pub items: Vec, +} + +impl ValidatorCollection { + pub fn new( + items: Vec, + ) -> ValidatorCollection { + ValidatorCollection { + total_count: None, + next_cursor: None, + items, + } + } +} diff --git a/libraries/gateway-client/src/models/validator_collection_item.rs b/libraries/gateway-client/src/models/validator_collection_item.rs new file mode 100644 index 00000000..2a916a77 --- /dev/null +++ b/libraries/gateway-client/src/models/validator_collection_item.rs @@ -0,0 +1,57 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorCollectionItem { + #[serde(rename = "address")] + pub address: String, + #[serde(rename = "stake_vault")] + pub stake_vault: Box, + #[serde(rename = "pending_xrd_withdraw_vault")] + pub pending_xrd_withdraw_vault: Box, + #[serde(rename = "locked_owner_stake_unit_vault")] + pub locked_owner_stake_unit_vault: Box, + #[serde(rename = "pending_owner_stake_unit_unlock_vault")] + pub pending_owner_stake_unit_unlock_vault: + Box, + + #[serde(rename = "state", deserialize_with = "Option::deserialize")] + pub state: Option, + #[serde( + rename = "active_in_epoch", + skip_serializing_if = "Option::is_none" + )] + pub active_in_epoch: + Option>, + #[serde(rename = "metadata")] + pub metadata: Box, + #[serde(rename = "effective_fee_factor")] + pub effective_fee_factor: + Box, +} + +impl ValidatorCollectionItem { + pub fn new( + address: String, + stake_vault: crate::models::ValidatorVaultItem, + pending_xrd_withdraw_vault: crate::models::ValidatorVaultItem, + locked_owner_stake_unit_vault: crate::models::ValidatorVaultItem, + pending_owner_stake_unit_unlock_vault: crate::models::ValidatorVaultItem, + state: Option, + metadata: crate::models::EntityMetadataCollection, + effective_fee_factor: crate::models::ValidatorCollectionItemEffectiveFeeFactor, + ) -> ValidatorCollectionItem { + ValidatorCollectionItem { + address, + stake_vault: Box::new(stake_vault), + pending_xrd_withdraw_vault: Box::new(pending_xrd_withdraw_vault), + locked_owner_stake_unit_vault: Box::new( + locked_owner_stake_unit_vault, + ), + pending_owner_stake_unit_unlock_vault: Box::new( + pending_owner_stake_unit_unlock_vault, + ), + state, + active_in_epoch: None, + metadata: Box::new(metadata), + effective_fee_factor: Box::new(effective_fee_factor), + } + } +} diff --git a/libraries/gateway-client/src/models/validator_collection_item_active_in_epoch.rs b/libraries/gateway-client/src/models/validator_collection_item_active_in_epoch.rs new file mode 100644 index 00000000..2a72f879 --- /dev/null +++ b/libraries/gateway-client/src/models/validator_collection_item_active_in_epoch.rs @@ -0,0 +1,23 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorCollectionItemActiveInEpoch { + #[serde(rename = "stake")] + pub stake: String, + #[serde(rename = "stake_percentage")] + pub stake_percentage: f64, + #[serde(rename = "key")] + pub key: Box, +} + +impl ValidatorCollectionItemActiveInEpoch { + pub fn new( + stake: String, + stake_percentage: f64, + key: crate::models::PublicKey, + ) -> ValidatorCollectionItemActiveInEpoch { + ValidatorCollectionItemActiveInEpoch { + stake, + stake_percentage, + key: Box::new(key), + } + } +} diff --git a/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor.rs b/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor.rs new file mode 100644 index 00000000..16eacb0c --- /dev/null +++ b/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor.rs @@ -0,0 +1,30 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorCollectionItemEffectiveFeeFactor { + #[serde(rename = "current")] + pub current: + Box, + #[serde( + rename = "pending", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub pending: Option< + Option< + Box< + crate::models::ValidatorCollectionItemEffectiveFeeFactorPending, + >, + >, + >, +} + +impl ValidatorCollectionItemEffectiveFeeFactor { + pub fn new( + current: crate::models::ValidatorCollectionItemEffectiveFeeFactorCurrent, + ) -> ValidatorCollectionItemEffectiveFeeFactor { + ValidatorCollectionItemEffectiveFeeFactor { + current: Box::new(current), + pending: None, + } + } +} diff --git a/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor_current.rs b/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor_current.rs new file mode 100644 index 00000000..c1df6e6a --- /dev/null +++ b/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor_current.rs @@ -0,0 +1,13 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorCollectionItemEffectiveFeeFactorCurrent { + #[serde(rename = "fee_factor")] + pub fee_factor: String, +} + +impl ValidatorCollectionItemEffectiveFeeFactorCurrent { + pub fn new( + fee_factor: String, + ) -> ValidatorCollectionItemEffectiveFeeFactorCurrent { + ValidatorCollectionItemEffectiveFeeFactorCurrent { fee_factor } + } +} diff --git a/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor_pending.rs b/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor_pending.rs new file mode 100644 index 00000000..29952739 --- /dev/null +++ b/libraries/gateway-client/src/models/validator_collection_item_effective_fee_factor_pending.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorCollectionItemEffectiveFeeFactorPending { + #[serde(rename = "fee_factor")] + pub fee_factor: String, + #[serde(rename = "effective_at_epoch")] + pub effective_at_epoch: i64, +} + +impl ValidatorCollectionItemEffectiveFeeFactorPending { + pub fn new( + fee_factor: String, + effective_at_epoch: i64, + ) -> ValidatorCollectionItemEffectiveFeeFactorPending { + ValidatorCollectionItemEffectiveFeeFactorPending { + fee_factor, + effective_at_epoch, + } + } +} diff --git a/libraries/gateway-client/src/models/validator_uptime_collection.rs b/libraries/gateway-client/src/models/validator_uptime_collection.rs new file mode 100644 index 00000000..15388c13 --- /dev/null +++ b/libraries/gateway-client/src/models/validator_uptime_collection.rs @@ -0,0 +1,13 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorUptimeCollection { + #[serde(rename = "items")] + pub items: Vec, +} + +impl ValidatorUptimeCollection { + pub fn new( + items: Vec, + ) -> ValidatorUptimeCollection { + ValidatorUptimeCollection { items } + } +} diff --git a/libraries/gateway-client/src/models/validator_uptime_collection_item.rs b/libraries/gateway-client/src/models/validator_uptime_collection_item.rs new file mode 100644 index 00000000..bed9a665 --- /dev/null +++ b/libraries/gateway-client/src/models/validator_uptime_collection_item.rs @@ -0,0 +1,38 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorUptimeCollectionItem { + #[serde(rename = "address")] + pub address: String, + + #[serde( + rename = "proposals_made", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub proposals_made: Option>, + + #[serde( + rename = "proposals_missed", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub proposals_missed: Option>, + + #[serde(rename = "epochs_active_in")] + pub epochs_active_in: i64, +} + +impl ValidatorUptimeCollectionItem { + pub fn new( + address: String, + epochs_active_in: i64, + ) -> ValidatorUptimeCollectionItem { + ValidatorUptimeCollectionItem { + address, + proposals_made: None, + proposals_missed: None, + epochs_active_in, + } + } +} diff --git a/libraries/gateway-client/src/models/validator_vault_item.rs b/libraries/gateway-client/src/models/validator_vault_item.rs new file mode 100644 index 00000000..b43c2fbd --- /dev/null +++ b/libraries/gateway-client/src/models/validator_vault_item.rs @@ -0,0 +1,24 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorVaultItem { + #[serde(rename = "balance")] + pub balance: String, + #[serde(rename = "last_changed_at_state_version")] + pub last_changed_at_state_version: i64, + + #[serde(rename = "address")] + pub address: String, +} + +impl ValidatorVaultItem { + pub fn new( + balance: String, + last_changed_at_state_version: i64, + address: String, + ) -> ValidatorVaultItem { + ValidatorVaultItem { + balance, + last_changed_at_state_version, + address, + } + } +} diff --git a/libraries/gateway-client/src/models/validators_uptime_request.rs b/libraries/gateway-client/src/models/validators_uptime_request.rs new file mode 100644 index 00000000..291adcc3 --- /dev/null +++ b/libraries/gateway-client/src/models/validators_uptime_request.rs @@ -0,0 +1,40 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorsUptimeRequest { + #[serde( + rename = "at_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub at_ledger_state: + Option>>, + #[serde( + rename = "from_ledger_state", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub from_ledger_state: + Option>>, + #[serde( + rename = "validator_addresses", + skip_serializing_if = "Option::is_none" + )] + pub validator_addresses: Option>, +} + +impl Default for ValidatorsUptimeRequest { + fn default() -> Self { + Self::new() + } +} + +impl ValidatorsUptimeRequest { + pub fn new() -> ValidatorsUptimeRequest { + ValidatorsUptimeRequest { + at_ledger_state: None, + from_ledger_state: None, + validator_addresses: None, + } + } +} diff --git a/libraries/gateway-client/src/models/validators_uptime_response.rs b/libraries/gateway-client/src/models/validators_uptime_response.rs new file mode 100644 index 00000000..f8539b84 --- /dev/null +++ b/libraries/gateway-client/src/models/validators_uptime_response.rs @@ -0,0 +1,19 @@ +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ValidatorsUptimeResponse { + #[serde(rename = "ledger_state")] + pub ledger_state: Box, + #[serde(rename = "validators")] + pub validators: Box, +} + +impl ValidatorsUptimeResponse { + pub fn new( + ledger_state: crate::models::LedgerState, + validators: crate::models::ValidatorUptimeCollection, + ) -> ValidatorsUptimeResponse { + ValidatorsUptimeResponse { + ledger_state: Box::new(ledger_state), + validators: Box::new(validators), + } + } +} diff --git a/tests/tests/caviarnine.rs b/tests/tests/caviarnine.rs index 65e7a45a..69d41e2e 100644 --- a/tests/tests/caviarnine.rs +++ b/tests/tests/caviarnine.rs @@ -415,4 +415,3 @@ fn liquidity_receipt_includes_the_amount_of_liquidity_positions_we_expect_to_see Ok(()) } -