diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml new file mode 100644 index 0000000..6034bbe --- /dev/null +++ b/.github/workflows/ci-cd.yaml @@ -0,0 +1,43 @@ +name: CI/CD +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + repository_dispatch: + types: [remote-build] + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + RUSTFLAGS: "--deny warnings" + RUST_TOOLCHAIN: nightly-2023-02-27 + RUST_WORKING_DIRECTORY: ./rust + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + rust-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: "recursive" + ref: ${{ github.event.client_payload.ref }} + - run: echo ${{ github.event.client_payload.sha }} + - uses: arduino/setup-protoc@v2 + with: + version: "23.2" + repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: Swatinem/rust-cache@v2 + with: + shared-key: "rust-build" + save-if: ${{ github.ref == 'refs/heads/main' }} + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - run: cargo build --release --all-features + working-directory: ${{ env.RUST_WORKING_DIRECTORY }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a7b57c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.direnv +.DS_Store +.envrc +.idea +.vscode +.fleet +/gen diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..08b093b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "massa-proto"] + path = massa-proto + url = https://github.com/massalabs/massa-proto.git diff --git a/README.md b/README.md index 11fa841..581ce4c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,54 @@ -# massa-proto-bindings +# MASSA PROTO BINDINGS + Generated source code from protobuf files for Massa blockchain. + +Requirements +------------ + +Make sure you have the following latest versions of the required tools: + +- [protoc](https://grpc.io/docs/protoc-installation/): `3.21.12+`. + +Please ensure that you have the required versions or newer to guarantee compatibility and access to the latest features. + +Project build +------------- + +You can generate source code from protobuf files by running: +```bash +./build.sh +``` + +For Windows users run: +```powershell +./build.bat +``` + +Postman integration +------------------- +You can easily import APIs collections from [Massa's Postman workspace](https://www.postman.com/massalabs) and start testing and exploring the provided functionalities by Massa API's. + +VSCode settings +------------------ + +1- Install [vscode-proto3](https://marketplace.visualstudio.com/items?itemName=zxh404.vscode-proto3) extension. + +2- The following settings contain a `protoc` configuration block with Java generation output: + +```json +{ + "protoc": { // Specifies the configuration for the protoc plugin. + "path": "/PATH/TO/PROTOC", // Sets the path to the protoc binary that will be used to compile the protobuf files. + "compile_on_save": true, // Enables automatic compilation of protobuf files when they are saved. + "options": [ // Specifies the command line options that will be passed to protoc. + "{workspaceRoot}/massa-proto/proto/**/*.proto", // Specifies the path to the protobuf files that should be compiled. + "--proto_path=${workspaceRoot}/massa-proto/proto/", // Specifies the directory to search for imported protobuf files. + "--proto_path=${workspaceRoot}/massa-proto/proto/commons", // Specifies the directory to search for imported common protobuf files. + "--proto_path=${workspaceRoot}/massa-proto/proto/third_party", // Specifies the directory to search for imported third_party protobuf files. + "--java_out=${workspaceRoot}/massa-proto/gen/", // Generates Java code from the protobuf files. + ] + } +} +``` + +3- Add the snippet above to `.vscode/settings.json`. diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..92403d6 --- /dev/null +++ b/build.bat @@ -0,0 +1,10 @@ +@echo off +echo Building Massa proto bindings... + +rem Generate ABI documentation +echo Generating RUST bindings... +cd ./rust +cargo build --release +echo RUST bindings generated successfully. + +echo Massa proto bindings build finished! diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..988deb6 --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Building Massa proto bindings..." + +# Generate ABI documentation +echo "Generating RUST bindings..." +cd ./rust && cargo build --release +echo "RUST bindings generated successfully." + +echo "Massa proto bindings build finished!" diff --git a/massa-proto b/massa-proto new file mode 160000 index 0000000..45b2472 --- /dev/null +++ b/massa-proto @@ -0,0 +1 @@ +Subproject commit 45b2472d6342d49df12a8a8a12035fd672d91b0e diff --git a/rust/.gitignore b/rust/.gitignore new file mode 100644 index 0000000..7baf8fc --- /dev/null +++ b/rust/.gitignore @@ -0,0 +1,13 @@ +.direnv +.DS_Store +.envrc +.idea +.vscode +.fleet +*.swp* +**/Cargo.lock +**/target +lcov.info +shell.nix +docs/_build +massa-proto-bindings.iml diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..affa626 --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,23 @@ +# Copyright (c) 2023 MASSA LABS + +[package] +name = "massa_proto_bindings" +version = "0.1.0" +edition = "2021" +description = "Protobuf rust bindings for the Massa blockchain" +repository = "https://github.com/massalabs/massa-proto-bindings/" +homepage = "https://massa.net" +documentation = "https://docs.massa.net/" + +[lib] +name = "massa_proto_bindings" + +[dependencies] +prost = "=0.11.9" +prost-types = "=0.11.9" +tonic = "=0.9.2" + +[build-dependencies] +glob = "0.3.1" +prost-build = "=0.11.9" +tonic-build = "=0.9.2" diff --git a/rust/build.rs b/rust/build.rs new file mode 100644 index 0000000..60d2faa --- /dev/null +++ b/rust/build.rs @@ -0,0 +1,82 @@ +// Copyright (c) 2023 MASSA LABS + +fn main() -> Result<(), Box> { + tonic::build()?; + + Ok(()) +} + +mod tonic { + use glob::glob; + use std::{ + env, + path::{Path, PathBuf}, + }; + + /// This function is responsible for building the Massa protobuf + pub fn build() -> Result<(), Box> { + let current_dir = env::current_dir()?; + let parent_dir = current_dir.parent().ok_or("no parent directory found")?; + + // Generate ABI bindings + let protos_path = parent_dir.join("massa-proto/proto/abis"); + let protos = find_protos(protos_path)?; + let proto_include_paths = [ + parent_dir.join("massa-proto/proto/abis"), + parent_dir.join("massa-proto/proto/commons"), + parent_dir.join("massa-proto/proto/third_party"), + ]; + + tonic_build::configure() + .build_server(false) + .build_transport(false) + .build_client(false) + .include_file("_abi_includes.rs") + .out_dir("src/") + .compile(&protos, &proto_include_paths) + .map_err(|e| format!("ABI protobuf compilation error: {:?}", e))?; + + // Generate API bindings + let protos_path = parent_dir.join("massa-proto/proto/apis"); + let protos = find_protos(protos_path)?; + let proto_include_paths = [ + parent_dir.join("massa-proto/proto/apis"), + parent_dir.join("massa-proto/proto/commons"), + parent_dir.join("massa-proto/proto/third_party"), + ]; + + tonic_build::configure() + .build_server(true) + .build_transport(true) + .build_client(true) + .type_attribute( + ".google.api.HttpRule", + "#[cfg(not(doctest))]\n\ + #[allow(dead_code)]\n\ + pub struct HttpRuleComment{}\n\ + /// HACK: see docs in [`HttpRuleComment`] ignored in doctest pass", + ) + .include_file("_api_includes.rs") + .file_descriptor_set_path("src/api.bin") + .out_dir("src/") + .compile(&protos, &proto_include_paths) + .map_err(|e| format!("API protobuf compilation error: {:?}", e))?; + + Ok(()) + } + + fn find_protos(dir_path: impl AsRef) -> Result, Box> { + let glob_pattern = format!("{}/**/*.proto", dir_path.as_ref().display()); + let paths: Vec<_> = glob(&glob_pattern)?.filter_map(Result::ok).collect(); + + if paths.is_empty() { + return Err(format!( + "no .proto files found in the specified directory: {}", + dir_path.as_ref().display() + ) + .into()); + } + + Ok(paths) + } +} diff --git a/rust/src/_abi_includes.rs b/rust/src/_abi_includes.rs new file mode 100644 index 0000000..1a2fffc --- /dev/null +++ b/rust/src/_abi_includes.rs @@ -0,0 +1,7 @@ +pub mod massa { + pub mod abi { + pub mod v1 { + include!("massa.abi.v1.rs"); + } + } +} diff --git a/rust/src/_api_includes.rs b/rust/src/_api_includes.rs new file mode 100644 index 0000000..0351859 --- /dev/null +++ b/rust/src/_api_includes.rs @@ -0,0 +1,20 @@ +pub mod google { + pub mod api { + include!("google.api.rs"); + } + pub mod rpc { + include!("google.rpc.rs"); + } +} +pub mod massa { + pub mod api { + pub mod v1 { + include!("massa.api.v1.rs"); + } + } + pub mod model { + pub mod v1 { + include!("massa.model.v1.rs"); + } + } +} diff --git a/rust/src/api.bin b/rust/src/api.bin new file mode 100644 index 0000000..51876d5 Binary files /dev/null and b/rust/src/api.bin differ diff --git a/rust/src/google.api.rs b/rust/src/google.api.rs new file mode 100644 index 0000000..e486e0b --- /dev/null +++ b/rust/src/google.api.rs @@ -0,0 +1,379 @@ +/// Defines the HTTP configuration for an API service. It contains a list of +/// \[HttpRule][google.api.HttpRule\], each specifying the mapping of an RPC method +/// to one or more HTTP REST API methods. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Http { + /// A list of HTTP configuration rules that apply to individual API methods. + /// + /// **NOTE:** All service configuration rules follow "last one wins" order. + #[prost(message, repeated, tag = "1")] + pub rules: ::prost::alloc::vec::Vec, + /// When set to true, URL path parameters will be fully URI-decoded except in + /// cases of single segment matches in reserved expansion, where "%2F" will be + /// left encoded. + /// + /// The default behavior is to not decode RFC 6570 reserved characters in multi + /// segment matches. + #[prost(bool, tag = "2")] + pub fully_decode_reserved_expansion: bool, +} +/// # gRPC Transcoding +/// +/// gRPC Transcoding is a feature for mapping between a gRPC method and one or +/// more HTTP REST endpoints. It allows developers to build a single API service +/// that supports both gRPC APIs and REST APIs. Many systems, including [Google +/// APIs](), +/// [Cloud Endpoints](), [gRPC +/// Gateway](), +/// and \[Envoy\]() proxy support this feature +/// and use it for large scale production services. +/// +/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies +/// how different portions of the gRPC request message are mapped to the URL +/// path, URL query parameters, and HTTP request body. It also controls how the +/// gRPC response message is mapped to the HTTP response body. `HttpRule` is +/// typically specified as an `google.api.http` annotation on the gRPC method. +/// +/// Each mapping specifies a URL path template and an HTTP method. The path +/// template may refer to one or more fields in the gRPC request message, as long +/// as each field is a non-repeated field with a primitive (non-message) type. +/// The path template controls how fields of the request message are mapped to +/// the URL path. +/// +/// Example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get: "/v1/{name=messages/*}" +/// }; +/// } +/// } +/// message GetMessageRequest { +/// string name = 1; // Mapped to URL path. +/// } +/// message Message { +/// string text = 1; // The resource content. +/// } +/// +/// This enables an HTTP REST to gRPC mapping as below: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` +/// +/// Any fields in the request message which are not bound by the path template +/// automatically become HTTP query parameters if there is no HTTP request body. +/// For example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get:"/v1/messages/{message_id}" +/// }; +/// } +/// } +/// message GetMessageRequest { +/// message SubMessage { +/// string subfield = 1; +/// } +/// string message_id = 1; // Mapped to URL path. +/// int64 revision = 2; // Mapped to URL query parameter `revision`. +/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. +/// } +/// +/// This enables a HTTP JSON to RPC mapping as below: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | +/// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: +/// "foo"))` +/// +/// Note that fields which are mapped to URL query parameters must have a +/// primitive type or a repeated primitive type or a non-repeated message type. +/// In the case of a repeated type, the parameter can be repeated in the URL +/// as `...?param=A¶m=B`. In the case of a message type, each field of the +/// message is mapped to a separate parameter, such as +/// `...?foo.a=A&foo.b=B&foo.c=C`. +/// +/// For HTTP methods that allow a request body, the `body` field +/// specifies the mapping. Consider a REST update method on the +/// message resource collection: +/// +/// service Messaging { +/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// patch: "/v1/messages/{message_id}" +/// body: "message" +/// }; +/// } +/// } +/// message UpdateMessageRequest { +/// string message_id = 1; // mapped to the URL +/// Message message = 2; // mapped to the body +/// } +/// +/// The following HTTP JSON to RPC mapping is enabled, where the +/// representation of the JSON in the request body is determined by +/// protos JSON encoding: +/// +/// HTTP | gRPC +/// -----|----- +/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +/// "123456" message { text: "Hi!" })` +/// +/// The special name `*` can be used in the body mapping to define that +/// every field not bound by the path template should be mapped to the +/// request body. This enables the following alternative definition of +/// the update method: +/// +/// service Messaging { +/// rpc UpdateMessage(Message) returns (Message) { +/// option (google.api.http) = { +/// patch: "/v1/messages/{message_id}" +/// body: "*" +/// }; +/// } +/// } +/// message Message { +/// string message_id = 1; +/// string text = 2; +/// } +/// +/// +/// The following HTTP JSON to RPC mapping is enabled: +/// +/// HTTP | gRPC +/// -----|----- +/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +/// "123456" text: "Hi!")` +/// +/// Note that when using `*` in the body mapping, it is not possible to +/// have HTTP parameters, as all fields not bound by the path end in +/// the body. This makes this option more rarely used in practice when +/// defining REST APIs. The commons usage of `*` is in custom methods +/// which don't use the URL at all for transferring data. +/// +/// It is possible to define multiple HTTP methods for one RPC by using +/// the `additional_bindings` option. Example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get: "/v1/messages/{message_id}" +/// additional_bindings { +/// get: "/v1/users/{user_id}/messages/{message_id}" +/// } +/// }; +/// } +/// } +/// message GetMessageRequest { +/// string message_id = 1; +/// string user_id = 2; +/// } +/// +/// This enables the following two alternative HTTP JSON to RPC mappings: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +/// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: +/// "123456")` +/// +/// ## Rules for HTTP mapping +/// +/// 1. Leaf request fields (recursive expansion nested messages in the request +/// message) are classified into three categories: +/// - Fields referred by the path template. They are passed via the URL path. +/// - Fields referred by the \[HttpRule.body][google.api.HttpRule.body\]. They +/// are passed via the HTTP +/// request body. +/// - All other fields are passed via the URL query parameters, and the +/// parameter name is the field path in the request message. A repeated +/// field can be represented as multiple query parameters under the same +/// name. +/// 2. If \[HttpRule.body][google.api.HttpRule.body\] is "*", there is no URL +/// query parameter, all fields +/// are passed via URL path and HTTP request body. +/// 3. If \[HttpRule.body][google.api.HttpRule.body\] is omitted, there is no HTTP +/// request body, all +/// fields are passed via URL path and URL query parameters. +/// +/// ### Path template syntax +/// +/// Template = "/" Segments [ Verb ] ; +/// Segments = Segment { "/" Segment } ; +/// Segment = "*" | "**" | LITERAL | Variable ; +/// Variable = "{" FieldPath [ "=" Segments ] "}" ; +/// FieldPath = IDENT { "." IDENT } ; +/// Verb = ":" LITERAL ; +/// +/// The syntax `*` matches a single URL path segment. The syntax `**` matches +/// zero or more URL path segments, which must be the last part of the URL path +/// except the `Verb`. +/// +/// The syntax `Variable` matches part of the URL path as specified by its +/// template. A variable template must not contain other variables. If a variable +/// matches a single path segment, its template may be omitted, e.g. `{var}` +/// is equivalent to `{var=*}`. +/// +/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` +/// contains any reserved character, such characters should be percent-encoded +/// before the matching. +/// +/// If a variable contains exactly one path segment, such as `"{var}"` or +/// `"{var=*}"`, when such a variable is expanded into a URL path on the client +/// side, all characters except `\[-_.~0-9a-zA-Z\]` are percent-encoded. The +/// server side does the reverse decoding. Such variables show up in the +/// [Discovery +/// Document]() as +/// `{var}`. +/// +/// If a variable contains multiple path segments, such as `"{var=foo/*}"` +/// or `"{var=**}"`, when such a variable is expanded into a URL path on the +/// client side, all characters except `\[-_.~/0-9a-zA-Z\]` are percent-encoded. +/// The server side does the reverse decoding, except "%2F" and "%2f" are left +/// unchanged. Such variables show up in the +/// [Discovery +/// Document]() as +/// `{+var}`. +/// +/// ## Using gRPC API Service Configuration +/// +/// gRPC API Service Configuration (service config) is a configuration language +/// for configuring a gRPC service to become a user-facing product. The +/// service config is simply the YAML representation of the `google.api.Service` +/// proto message. +/// +/// As an alternative to annotating your proto file, you can configure gRPC +/// transcoding in your service config YAML files. You do this by specifying a +/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same +/// effect as the proto annotation. This can be particularly useful if you +/// have a proto that is reused in multiple services. Note that any transcoding +/// specified in the service config will override any matching transcoding +/// configuration in the proto. +/// +/// Example: +/// +/// http: +/// rules: +/// # Selects a gRPC method and applies HttpRule to it. +/// - selector: example.v1.Messaging.GetMessage +/// get: /v1/messages/{message_id}/{sub.subfield} +/// +/// ## Special notes +/// +/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the +/// proto to JSON conversion must follow the [proto3 +/// specification](). +/// +/// While the single segment variable follows the semantics of +/// [RFC 6570]() Section 3.2.2 Simple String +/// Expansion, the multi segment variable **does not** follow RFC 6570 Section +/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion +/// does not expand special characters like `?` and `#`, which would lead +/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding +/// for multi segment variables. +/// +/// The path variables **must not** refer to any repeated or mapped field, +/// because client libraries are not capable of handling such variable expansion. +/// +/// The path variables **must not** capture the leading "/" character. The reason +/// is that the most commons use case "{var}" does not capture the leading "/" +/// character. For consistency, all path variables must share the same behavior. +/// +/// Repeated message fields must not be mapped to URL query parameters, because +/// no client library can support such complicated mapping. +/// +/// If an API needs to use a JSON array for request or response body, it can map +/// the request or response body to a repeated field. However, some gRPC +/// Transcoding implementations may not support this feature. +#[cfg(not(doctest))] +#[allow(dead_code)] +pub struct HttpRuleComment {} +/// HACK: see docs in [`HttpRuleComment`] ignored in doctest pass +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HttpRule { + /// Selects a method to which this rule applies. + /// + /// Refer to \[selector][google.api.DocumentationRule.selector\] for syntax + /// details. + #[prost(string, tag = "1")] + pub selector: ::prost::alloc::string::String, + /// The name of the request field whose value is mapped to the HTTP request + /// body, or `*` for mapping all request fields not captured by the path + /// pattern to the HTTP body, or omitted for not having any HTTP request body. + /// + /// NOTE: the referred field must be present at the top-level of the request + /// message type. + #[prost(string, tag = "7")] + pub body: ::prost::alloc::string::String, + /// Optional. The name of the response field whose value is mapped to the HTTP + /// response body. When omitted, the entire response message will be used + /// as the HTTP response body. + /// + /// NOTE: The referred field must be present at the top-level of the response + /// message type. + #[prost(string, tag = "12")] + pub response_body: ::prost::alloc::string::String, + /// Additional HTTP bindings for the selector. Nested bindings must + /// not contain an `additional_bindings` field themselves (that is, + /// the nesting may only be one level deep). + #[prost(message, repeated, tag = "11")] + pub additional_bindings: ::prost::alloc::vec::Vec, + /// Determines the URL pattern is matched by this rules. This pattern can be + /// used with any of the {get|put|post|delete|patch} methods. A custom method + /// can be defined using the 'custom' field. + #[prost(oneof = "http_rule::Pattern", tags = "2, 3, 4, 5, 6, 8")] + pub pattern: ::core::option::Option, +} +/// Nested message and enum types in `HttpRule`. +pub mod http_rule { + /// Determines the URL pattern is matched by this rules. This pattern can be + /// used with any of the {get|put|post|delete|patch} methods. A custom method + /// can be defined using the 'custom' field. + #[cfg(not(doctest))] + #[allow(dead_code)] + pub struct HttpRuleComment {} + /// HACK: see docs in [`HttpRuleComment`] ignored in doctest pass + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Pattern { + /// Maps to HTTP GET. Used for listing and getting information about + /// resources. + #[prost(string, tag = "2")] + Get(::prost::alloc::string::String), + /// Maps to HTTP PUT. Used for replacing a resource. + #[prost(string, tag = "3")] + Put(::prost::alloc::string::String), + /// Maps to HTTP POST. Used for creating a resource or performing an action. + #[prost(string, tag = "4")] + Post(::prost::alloc::string::String), + /// Maps to HTTP DELETE. Used for deleting a resource. + #[prost(string, tag = "5")] + Delete(::prost::alloc::string::String), + /// Maps to HTTP PATCH. Used for updating a resource. + #[prost(string, tag = "6")] + Patch(::prost::alloc::string::String), + /// The custom pattern is used for specifying an HTTP method that is not + /// included in the `pattern` field, such as HEAD, or "*" to leave the + /// HTTP method unspecified for this rule. The wild-card rule is useful + /// for services that provide content to Web (HTML) clients. + #[prost(message, tag = "8")] + Custom(super::CustomHttpPattern), + } +} +/// A custom pattern is used for defining custom HTTP verb. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CustomHttpPattern { + /// The name of this custom HTTP verb. + #[prost(string, tag = "1")] + pub kind: ::prost::alloc::string::String, + /// The path matched by this custom verb. + #[prost(string, tag = "2")] + pub path: ::prost::alloc::string::String, +} diff --git a/rust/src/google.rpc.rs b/rust/src/google.rpc.rs new file mode 100644 index 0000000..3930c68 --- /dev/null +++ b/rust/src/google.rpc.rs @@ -0,0 +1,25 @@ +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by \[gRPC\](). Each `Status` message contains +/// three pieces of data: error code, error message, and error details. +/// +/// You can find out more about this error model and how to work with it in the +/// [API Design Guide](). +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Status { + /// The status code, which should be an enum value of + /// \[google.rpc.Code][google.rpc.Code\]. + #[prost(int32, tag = "1")] + pub code: i32, + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// \[google.rpc.Status.details][google.rpc.Status.details\] field, or localized + /// by the client. + #[prost(string, tag = "2")] + pub message: ::prost::alloc::string::String, + /// A list of messages that carry the error details. There is a commons set of + /// message types for APIs to use. + #[prost(message, repeated, tag = "3")] + pub details: ::prost::alloc::vec::Vec<::prost_types::Any>, +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs new file mode 100644 index 0000000..27535ea --- /dev/null +++ b/rust/src/lib.rs @@ -0,0 +1,62 @@ +// Copyright (c) 2023 MASSA LABS +// +//! ## **Overview** +//! +//! This module contains the generated source code from protobuf files for Massa blockchain. +//! It uses utilizes the `tonic-build` tool to generate Rust code from the Protobuf definitions. +//! +//! ## **Structure** +//! +//! * `build.rs`: This file contains build instructions for generating Rust code from the Protobuf definitions using the `tonic-build` tool. +//! * `massa-proto/`: This directory contains the Protobuf message definitions for the Massa blockchain API +//! * `src/`: This directory contains the generated Rust code for the Protobuf message definitions. +//! It also includes a `_XXX_includes.rs` files for importing the generated Rust modules and an `api.bin` file for gRPC server reflection protocol. +//! +//! ## **Usage** +//! To use this module, simply include it as a dependency in your Rust project's `Cargo.toml` file. +//! You can then import the necessary Rust modules for the Massa API and use the Protobuf messages as needed. +//! +#![warn(unused_crate_dependencies)] + +// mod _abi_includes; +// mod _api_includes; + +/// Google protos Module +pub mod google { + /// Google API Module + pub mod api { + include!("google.api.rs"); + } + /// Google RPC Module + pub mod rpc { + include!("google.rpc.rs"); + } +} + +/// Massa protos Module +pub mod massa { + /// Massa ABI Module + pub mod abi { + /// Version 1 of the Massa ABI protos + pub mod v1 { + include!("massa.abi.v1.rs"); + } + } + /// Massa API Module + pub mod api { + /// Version 1 of the Massa API protos + pub mod v1 { + include!("massa.api.v1.rs"); + /// Compiled file descriptor set for the Massa protos + pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("api.bin"); + } + } + + /// Massa Model Module + pub mod model { + /// Version 1 of the Massa Model protos + pub mod v1 { + include!("massa.model.v1.rs"); + } + } +} diff --git a/rust/src/massa.abi.v1.rs b/rust/src/massa.abi.v1.rs new file mode 100644 index 0000000..35840a7 --- /dev/null +++ b/rust/src/massa.abi.v1.rs @@ -0,0 +1,121 @@ +/// Address +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Address { + /// Address is a string representation of the address + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, +} +/// Amount +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Amount { + /// Amount is a 64-bit unsigned integer + #[prost(fixed64, tag = "1")] + pub amount: u64, +} +/// Empty +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Empty {} +/// CreateSC +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateScRequest { + /// Bytecode is the compiled code of the smart contract + #[prost(bytes = "vec", tag = "1")] + pub bytecode: ::prost::alloc::vec::Vec, +} +/// CreateSCResponse +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateScResponse { + /// Address is a string representation of the address + #[prost(message, optional, tag = "1")] + pub address: ::core::option::Option
, +} +/// CallSC +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CallRequest { + /// Address is the address of the smart contract + #[prost(message, optional, tag = "1")] + pub address: ::core::option::Option
, + /// Function is the name of the function to call + #[prost(string, tag = "2")] + pub function: ::prost::alloc::string::String, + /// Arg is the argument to the function + #[prost(bytes = "vec", tag = "3")] + pub arg: ::prost::alloc::vec::Vec, + /// call_coins is the amount of coins to pay for the call + #[prost(message, optional, tag = "4")] + pub call_coins: ::core::option::Option, +} +/// CallResponse +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CallResponse { + /// Return_data is the return value of the function + #[prost(bytes = "vec", tag = "1")] + pub return_data: ::prost::alloc::vec::Vec, +} +/// LocalCall +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LocalCallRequest { + /// Address is the address of the smart contract + #[prost(message, optional, tag = "1")] + pub address: ::core::option::Option
, + /// Function is the name of the function to call + #[prost(string, tag = "2")] + pub function: ::prost::alloc::string::String, + /// Arg is the argument to the function + #[prost(bytes = "vec", tag = "3")] + pub arg: ::prost::alloc::vec::Vec, +} +/// LocalCallResponse +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LocalCallResponse { + /// Return_data is the return value of the function + #[prost(bytes = "vec", tag = "1")] + pub return_data: ::prost::alloc::vec::Vec, +} +/// GenerateEventRequest +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenerateEventRequest { + /// Event + #[prost(string, tag = "1")] + pub event: ::prost::alloc::string::String, +} +/// TransferCoins +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransferCoinsRequest { + /// To_address is the address to transfer coins to + #[prost(message, optional, tag = "1")] + pub to_address: ::core::option::Option
, + /// Amount is the amount of coins to transfer + #[prost(message, optional, tag = "2")] + pub raw_amount: ::core::option::Option, +} +/// FunctionExists +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FunctionExistsRequest { + /// Address is the address of the smart contract + #[prost(message, optional, tag = "1")] + pub address: ::core::option::Option
, + /// Function is the name of the function to call + #[prost(string, tag = "2")] + pub function: ::prost::alloc::string::String, +} +/// FunctionExistsResponse +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FunctionExistsResponse { + /// Exists is true if the function exists + #[prost(bool, tag = "1")] + pub exists: bool, +} diff --git a/rust/src/massa.api.v1.rs b/rust/src/massa.api.v1.rs new file mode 100644 index 0000000..68238b8 --- /dev/null +++ b/rust/src/massa.api.v1.rs @@ -0,0 +1,2739 @@ +/// GetBlocksRequest holds request for GetBlocks +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetBlocksRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Queries + #[prost(message, repeated, tag = "2")] + pub queries: ::prost::alloc::vec::Vec, +} +/// GetBlocks Query +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetBlocksQuery { + /// Filter + #[prost(message, optional, tag = "1")] + pub filter: ::core::option::Option, +} +/// GetBlocks Filter +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetBlocksFilter { + /// Block id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// GetBlocksResponse holds response from GetBlocks +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetBlocksResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Context + #[prost(message, optional, tag = "2")] + pub context: ::core::option::Option, + /// Blocks wrappers + #[prost(message, repeated, tag = "3")] + pub blocks: ::prost::alloc::vec::Vec, +} +/// Blocks context +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlocksContext { + /// Slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, +} +/// GetBlocksBySlotsRequest holds request for GetBlocksBySlots +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetBlocksBySlotsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Slots + #[prost(message, repeated, tag = "2")] + pub slots: ::prost::alloc::vec::Vec, +} +/// GetBlocksBySlotsResponse holds response from GetBlocksBySlots +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetBlocksBySlotsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Blocks + #[prost(message, repeated, tag = "2")] + pub blocks: ::prost::alloc::vec::Vec, +} +/// GetDatastoreEntriesRequest holds request from GetDatastoreEntries +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDatastoreEntriesRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Queries + #[prost(message, repeated, tag = "2")] + pub queries: ::prost::alloc::vec::Vec, +} +/// DatastoreEntries Query +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatastoreEntriesQuery { + /// Filter + #[prost(message, optional, tag = "1")] + pub filter: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatastoreEntryFilter { + /// / Associated address of the entry + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// Datastore key + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, +} +/// GetDatastoreEntriesResponse holds response from GetDatastoreEntries +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDatastoreEntriesResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Datastore entries + #[prost(message, repeated, tag = "2")] + pub entries: ::prost::alloc::vec::Vec, +} +/// DatastoreEntry +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatastoreEntry { + /// final datastore entry value + #[prost(bytes = "vec", tag = "1")] + pub final_value: ::prost::alloc::vec::Vec, + /// candidate_value datastore entry value + #[prost(bytes = "vec", tag = "2")] + pub candidate_value: ::prost::alloc::vec::Vec, +} +/// GetLargestStakersRequest holds request from GetLargestStakers +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetLargestStakersRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Query + #[prost(message, optional, tag = "2")] + pub query: ::core::option::Option, +} +/// LargestStakers Query +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LargestStakersQuery { + /// Starting offset for the list of stakers. Defaults to 1 + #[prost(fixed64, tag = "1")] + pub offset: u64, + /// Limits the number of stakers to return. Defaults to 50 + #[prost(fixed64, tag = "2")] + pub limit: u64, + /// Filter + #[prost(message, optional, tag = "3")] + pub filter: ::core::option::Option, +} +/// LargestStakers Filter +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LargestStakersFilter { + /// Minimum rolls (Optional) + #[prost(fixed64, optional, tag = "1")] + pub min_rolls: ::core::option::Option, + /// Maximum rolls (Optional) + #[prost(fixed64, optional, tag = "2")] + pub max_rolls: ::core::option::Option, +} +/// GetLargestStakersResponse holds response from GetLargestStakers +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetLargestStakersResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Context + #[prost(message, optional, tag = "2")] + pub context: ::core::option::Option, + /// Largest stakers + #[prost(message, repeated, tag = "3")] + pub stakers: ::prost::alloc::vec::Vec, +} +/// LargestStakers context +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LargestStakersContext { + /// Slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, +} +/// LargestStakerEntry +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LargestStakerEntry { + /// Address + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// Rolls + #[prost(fixed64, tag = "2")] + pub rolls: u64, +} +/// GetNextBlockBestParentsRequest holds request for GetNextBlockBestParents +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetNextBlockBestParentsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// GetNextBlockBestParentsResponse holds response from GetNextBlockBestParents +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetNextBlockBestParentsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Best parents + #[prost(message, repeated, tag = "2")] + pub parents: ::prost::alloc::vec::Vec, +} +/// Block parent tuple +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockParent { + /// Block id + #[prost(string, tag = "1")] + pub block_id: ::prost::alloc::string::String, + /// Period + #[prost(fixed64, tag = "2")] + pub period: u64, +} +/// GetOperationsRequest holds request for GetOperations +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetOperationsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Queries + #[prost(message, repeated, tag = "2")] + pub queries: ::prost::alloc::vec::Vec, +} +/// GetOperations Query +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetOperationsQuery { + /// Filter + #[prost(message, optional, tag = "1")] + pub filter: ::core::option::Option, +} +/// GetOperations Filter +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetOperationsFilter { + /// Operation id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// GetOperationsResponse holds response from GetOperations +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetOperationsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Context + #[prost(message, optional, tag = "2")] + pub context: ::core::option::Option, + /// Operations wrappers + #[prost(message, repeated, tag = "3")] + pub operations: ::prost::alloc::vec::Vec, +} +/// Operations context +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OperationsContext { + /// Slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, +} +/// GetScExecutionEventsRequest holds request for GetScExecutionEvents +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetScExecutionEventsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Query + #[prost(message, optional, tag = "2")] + pub query: ::core::option::Option, +} +/// GetScExecutionEvents Query +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetScExecutionEventsQuery { + /// Filter + #[prost(message, optional, tag = "1")] + pub filter: ::core::option::Option, +} +/// GetScExecutionEvents Filter +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetScExecutionEventsFilter { + /// Start slot (Optional) + #[prost(message, optional, tag = "1")] + pub start_slot: ::core::option::Option, + /// End slot (Optional) + #[prost(message, optional, tag = "2")] + pub end_slot: ::core::option::Option, + /// Caller address + #[prost(string, optional, tag = "3")] + pub caller_address: ::core::option::Option<::prost::alloc::string::String>, + /// Emitter address (Optional) + #[prost(string, optional, tag = "4")] + pub emitter_address: ::core::option::Option<::prost::alloc::string::String>, + /// Original operation id (Optional) + #[prost(string, optional, tag = "5")] + pub original_operation_id: ::core::option::Option<::prost::alloc::string::String>, + /// Status + #[prost( + enumeration = "super::super::model::v1::ScExecutionEventStatus", + repeated, + tag = "6" + )] + pub status: ::prost::alloc::vec::Vec, +} +/// GetScExecutionEventsResponse holds response from GetScExecutionEvents +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetScExecutionEventsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Context + #[prost(message, optional, tag = "2")] + pub context: ::core::option::Option, + /// ScExecutionEvents + #[prost(message, repeated, tag = "3")] + pub events: ::prost::alloc::vec::Vec, +} +/// ScExecutionEvents context +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetScExecutionEventsContext { + /// Slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, +} +/// GetSelectorDrawsRequest holds request from GetSelectorDraws +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSelectorDrawsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Queries + #[prost(message, repeated, tag = "2")] + pub queries: ::prost::alloc::vec::Vec, +} +/// SelectorDraws Query +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SelectorDrawsQuery { + /// Filter + #[prost(message, optional, tag = "1")] + pub filter: ::core::option::Option, +} +/// SelectorDraws Filter +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SelectorDrawsFilter { + /// Address + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, +} +/// GetSelectorDrawsResponse holds response from GetSelectorDraws +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSelectorDrawsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Selector draws + #[prost(message, repeated, tag = "2")] + pub selector_draws: ::prost::alloc::vec::Vec, +} +/// GetTransactionsThroughputRequest holds request for GetTransactionsThroughput +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTransactionsThroughputRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// GetTransactionsThroughputResponse holds response from GetTransactionsThroughput +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTransactionsThroughputResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Transactions throughput + #[prost(fixed32, tag = "2")] + pub throughput: u32, +} +/// GetVersionRequest holds request from GetVersion +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetVersionRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// GetVersionResponse holds response from GetVersion +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetVersionResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Version + #[prost(string, tag = "2")] + pub version: ::prost::alloc::string::String, +} +/// NewBlocksRequest holds request for NewBlocks +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewBlocksRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// NewBlocksResponse holds response from NewBlocks +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewBlocksResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Signed block + #[prost(message, optional, tag = "2")] + pub block: ::core::option::Option, +} +/// NewBlocksHeadersRequest holds request for NewBlocksHeaders +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewBlocksHeadersRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// NewBlocksHeadersResponse holds response from NewBlocksHeaders +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewBlocksHeadersResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Signed block header + #[prost(message, optional, tag = "2")] + pub block_header: ::core::option::Option, +} +/// NewEndorsementsRequest holds request for NewEndorsements +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewEndorsementsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// NewEndorsementsResponse holds response from NewEndorsements +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewEndorsementsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Signed endorsement + #[prost(message, optional, tag = "2")] + pub endorsement: ::core::option::Option, +} +/// NewFilledBlocksRequest holds request for NewFilledBlocks +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewFilledBlocksRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// NewFilledBlocksResponse holds response from NewFilledBlocks +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewFilledBlocksResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Block with operations content + #[prost(message, optional, tag = "2")] + pub filled_block: ::core::option::Option, +} +/// NewOperationsRequest holds request for NewOperations +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewOperationsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Query + #[prost(message, optional, tag = "2")] + pub query: ::core::option::Option, +} +/// NewOperations Query +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewOperationsQuery { + /// Filter + #[prost(message, optional, tag = "1")] + pub filter: ::core::option::Option, +} +/// NewOperations Filter +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewOperationsFilter { + /// Operation type enum + #[prost(enumeration = "OpType", repeated, tag = "1")] + pub types: ::prost::alloc::vec::Vec, +} +/// NewOperationsResponse holds response from NewOperations +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewOperationsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Signed operation + #[prost(message, optional, tag = "2")] + pub operation: ::core::option::Option, +} +/// NewSlotExecutionOutputsRequest holds request for NewSlotExecutionOutputs +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewSlotExecutionOutputsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Query + #[prost(message, optional, tag = "2")] + pub query: ::core::option::Option, +} +/// NewSlotExecutionOutputs Query +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewSlotExecutionOutputsQuery { + /// Filter + #[prost(message, optional, tag = "1")] + pub filter: ::core::option::Option, +} +/// NewSlotExecutionOutputs Filter +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewSlotExecutionOutputsFilter { + /// Execution output status enum + #[prost( + enumeration = "super::super::model::v1::ExecutionOutputStatus", + repeated, + tag = "1" + )] + pub status: ::prost::alloc::vec::Vec, +} +/// NewSlotExecutionOutputsResponse holds response from NewSlotExecutionOutputs +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewSlotExecutionOutputsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Slot execution output + #[prost(message, optional, tag = "2")] + pub output: ::core::option::Option, +} +/// SendBlocksRequest holds parameters to SendBlocks +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SendBlocksRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Secure shared block + #[prost(message, optional, tag = "2")] + pub block: ::core::option::Option, +} +/// SendBlocksResponse holds response from SendBlocks +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SendBlocksResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Block result or a gRPC status + #[prost(oneof = "send_blocks_response::Message", tags = "2, 3")] + pub message: ::core::option::Option, +} +/// Nested message and enum types in `SendBlocksResponse`. +pub mod send_blocks_response { + /// Block result or a gRPC status + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Message { + /// Block result + #[prost(message, tag = "2")] + Result(super::BlockResult), + /// gRPC error(status) + #[prost(message, tag = "3")] + Error(super::super::super::super::google::rpc::Status), + } +} +/// Holds Block response +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockResult { + /// Block id + #[prost(string, tag = "1")] + pub block_id: ::prost::alloc::string::String, +} +/// SendEndorsementsRequest holds parameters to SendEndorsements +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SendEndorsementsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Secure shared endorsements + #[prost(message, repeated, tag = "2")] + pub endorsements: ::prost::alloc::vec::Vec, +} +/// SendEndorsementsResponse holds response from SendEndorsements +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SendEndorsementsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Endorsement result or gRPC status + #[prost(oneof = "send_endorsements_response::Message", tags = "2, 3")] + pub message: ::core::option::Option, +} +/// Nested message and enum types in `SendEndorsementsResponse`. +pub mod send_endorsements_response { + /// Endorsement result or gRPC status + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Message { + /// Endorsement result + #[prost(message, tag = "2")] + Result(super::EndorsementResult), + /// gRPC error(status) + #[prost(message, tag = "3")] + Error(super::super::super::super::google::rpc::Status), + } +} +/// Holds Endorsement response +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EndorsementResult { + /// Endorsements ids + #[prost(string, repeated, tag = "1")] + pub endorsements_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// SendOperationsRequest holds parameters to SendOperations +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SendOperationsRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Secured shared operations + #[prost(message, repeated, tag = "2")] + pub operations: ::prost::alloc::vec::Vec, +} +/// SendOperationsResponse holds response from SendOperations +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SendOperationsResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Operation result or gRPC status + #[prost(oneof = "send_operations_response::Message", tags = "2, 3")] + pub message: ::core::option::Option, +} +/// Nested message and enum types in `SendOperationsResponse`. +pub mod send_operations_response { + /// Operation result or gRPC status + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Message { + /// Operation result + #[prost(message, tag = "2")] + Result(super::OperationResult), + /// gRPC error(status) + #[prost(message, tag = "3")] + Error(super::super::super::super::google::rpc::Status), + } +} +/// Holds Operation response +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OperationResult { + /// Operations ids + #[prost(string, repeated, tag = "1")] + pub operations_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// TransactionsThroughputRequest holds request for TransactionsThroughput +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionsThroughputRequest { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Timer interval in seconds (Optional). Defaults to 10s + #[prost(fixed64, optional, tag = "2")] + pub interval: ::core::option::Option, +} +/// TransactionsThroughputResponse holds response from TransactionsThroughput +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionsThroughputResponse { + /// Request id + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Transactions throughput + #[prost(fixed32, tag = "2")] + pub throughput: u32, +} +/// Operation type enum +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum OpType { + /// Default enum value + Unspecified = 0, + /// Transaction + Transaction = 1, + /// Roll buy + RollBuy = 2, + /// Roll sell + RollSell = 3, + /// Execute smart contract + ExecuteSc = 4, + /// Call smart contract + CallSc = 5, +} +impl OpType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OpType::Unspecified => "OP_TYPE_UNSPECIFIED", + OpType::Transaction => "OP_TYPE_TRANSACTION", + OpType::RollBuy => "OP_TYPE_ROLL_BUY", + OpType::RollSell => "OP_TYPE_ROLL_SELL", + OpType::ExecuteSc => "OP_TYPE_EXECUTE_SC", + OpType::CallSc => "OP_TYPE_CALL_SC", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "OP_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "OP_TYPE_TRANSACTION" => Some(Self::Transaction), + "OP_TYPE_ROLL_BUY" => Some(Self::RollBuy), + "OP_TYPE_ROLL_SELL" => Some(Self::RollSell), + "OP_TYPE_EXECUTE_SC" => Some(Self::ExecuteSc), + "OP_TYPE_CALL_SC" => Some(Self::CallSc), + _ => None, + } + } +} +/// Generated client implementations. +pub mod massa_service_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Massa gRPC service + #[derive(Debug, Clone)] + pub struct MassaServiceClient { + inner: tonic::client::Grpc, + } + impl MassaServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MassaServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MassaServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MassaServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Get blocks by ids + pub async fn get_blocks( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetBlocks", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "GetBlocks")); + self.inner.unary(req, path, codec).await + } + /// Get blocks by slots + pub async fn get_blocks_by_slots( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetBlocksBySlots", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("massa.api.v1.MassaService", "GetBlocksBySlots"), + ); + self.inner.unary(req, path, codec).await + } + /// Get datastore entries + pub async fn get_datastore_entries( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetDatastoreEntries", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("massa.api.v1.MassaService", "GetDatastoreEntries"), + ); + self.inner.unary(req, path, codec).await + } + /// Get largest stakers + pub async fn get_largest_stakers( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetLargestStakers", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("massa.api.v1.MassaService", "GetLargestStakers"), + ); + self.inner.unary(req, path, codec).await + } + /// Get next block best parents + pub async fn get_next_block_best_parents( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetNextBlockBestParents", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "massa.api.v1.MassaService", + "GetNextBlockBestParents", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Get operations + pub async fn get_operations( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetOperations", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "GetOperations")); + self.inner.unary(req, path, codec).await + } + /// Get smart contracts execution events + pub async fn get_sc_execution_events( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetScExecutionEvents", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("massa.api.v1.MassaService", "GetScExecutionEvents"), + ); + self.inner.unary(req, path, codec).await + } + /// Get selector draws + pub async fn get_selector_draws( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetSelectorDraws", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("massa.api.v1.MassaService", "GetSelectorDraws"), + ); + self.inner.unary(req, path, codec).await + } + /// Get transactions throughput + pub async fn get_transactions_throughput( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetTransactionsThroughput", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "massa.api.v1.MassaService", + "GetTransactionsThroughput", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Get node version + pub async fn get_version( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/GetVersion", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "GetVersion")); + self.inner.unary(req, path, codec).await + } + /// New received and produced blocks + pub async fn new_blocks( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/NewBlocks", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "NewBlocks")); + self.inner.streaming(req, path, codec).await + } + /// New received and produced blocks headers + pub async fn new_blocks_headers( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::NewBlocksHeadersRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/NewBlocksHeaders", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("massa.api.v1.MassaService", "NewBlocksHeaders"), + ); + self.inner.streaming(req, path, codec).await + } + /// New received and produced endorsements + pub async fn new_endorsements( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::NewEndorsementsRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/NewEndorsements", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "NewEndorsements")); + self.inner.streaming(req, path, codec).await + } + /// New received and produced blocks with operations + pub async fn new_filled_blocks( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::NewFilledBlocksRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/NewFilledBlocks", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "NewFilledBlocks")); + self.inner.streaming(req, path, codec).await + } + /// New received and produced operations + pub async fn new_operations( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::NewOperationsRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/NewOperations", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "NewOperations")); + self.inner.streaming(req, path, codec).await + } + /// New received and slot execution events + pub async fn new_slot_execution_outputs( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::NewSlotExecutionOutputsRequest, + >, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/NewSlotExecutionOutputs", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "massa.api.v1.MassaService", + "NewSlotExecutionOutputs", + ), + ); + self.inner.streaming(req, path, codec).await + } + /// Send blocks + pub async fn send_blocks( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/SendBlocks", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "SendBlocks")); + self.inner.streaming(req, path, codec).await + } + /// Send endorsements + pub async fn send_endorsements( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::SendEndorsementsRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/SendEndorsements", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("massa.api.v1.MassaService", "SendEndorsements"), + ); + self.inner.streaming(req, path, codec).await + } + /// Send operations + pub async fn send_operations( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::SendOperationsRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/SendOperations", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("massa.api.v1.MassaService", "SendOperations")); + self.inner.streaming(req, path, codec).await + } + /// Transactions throughput + pub async fn transactions_throughput( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::TransactionsThroughputRequest, + >, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/massa.api.v1.MassaService/TransactionsThroughput", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "massa.api.v1.MassaService", + "TransactionsThroughput", + ), + ); + self.inner.streaming(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod massa_service_server { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with MassaServiceServer. + #[async_trait] + pub trait MassaService: Send + Sync + 'static { + /// Get blocks by ids + async fn get_blocks( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get blocks by slots + async fn get_blocks_by_slots( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get datastore entries + async fn get_datastore_entries( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get largest stakers + async fn get_largest_stakers( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get next block best parents + async fn get_next_block_best_parents( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get operations + async fn get_operations( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get smart contracts execution events + async fn get_sc_execution_events( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get selector draws + async fn get_selector_draws( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get transactions throughput + async fn get_transactions_throughput( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get node version + async fn get_version( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the NewBlocks method. + type NewBlocksStream: futures_core::Stream< + Item = std::result::Result, + > + + Send + + 'static; + /// New received and produced blocks + async fn new_blocks( + &self, + request: tonic::Request>, + ) -> std::result::Result, tonic::Status>; + /// Server streaming response type for the NewBlocksHeaders method. + type NewBlocksHeadersStream: futures_core::Stream< + Item = std::result::Result< + super::NewBlocksHeadersResponse, + tonic::Status, + >, + > + + Send + + 'static; + /// New received and produced blocks headers + async fn new_blocks_headers( + &self, + request: tonic::Request>, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the NewEndorsements method. + type NewEndorsementsStream: futures_core::Stream< + Item = std::result::Result, + > + + Send + + 'static; + /// New received and produced endorsements + async fn new_endorsements( + &self, + request: tonic::Request>, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the NewFilledBlocks method. + type NewFilledBlocksStream: futures_core::Stream< + Item = std::result::Result, + > + + Send + + 'static; + /// New received and produced blocks with operations + async fn new_filled_blocks( + &self, + request: tonic::Request>, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the NewOperations method. + type NewOperationsStream: futures_core::Stream< + Item = std::result::Result, + > + + Send + + 'static; + /// New received and produced operations + async fn new_operations( + &self, + request: tonic::Request>, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the NewSlotExecutionOutputs method. + type NewSlotExecutionOutputsStream: futures_core::Stream< + Item = std::result::Result< + super::NewSlotExecutionOutputsResponse, + tonic::Status, + >, + > + + Send + + 'static; + /// New received and slot execution events + async fn new_slot_execution_outputs( + &self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the SendBlocks method. + type SendBlocksStream: futures_core::Stream< + Item = std::result::Result, + > + + Send + + 'static; + /// Send blocks + async fn send_blocks( + &self, + request: tonic::Request>, + ) -> std::result::Result, tonic::Status>; + /// Server streaming response type for the SendEndorsements method. + type SendEndorsementsStream: futures_core::Stream< + Item = std::result::Result< + super::SendEndorsementsResponse, + tonic::Status, + >, + > + + Send + + 'static; + /// Send endorsements + async fn send_endorsements( + &self, + request: tonic::Request>, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the SendOperations method. + type SendOperationsStream: futures_core::Stream< + Item = std::result::Result, + > + + Send + + 'static; + /// Send operations + async fn send_operations( + &self, + request: tonic::Request>, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the TransactionsThroughput method. + type TransactionsThroughputStream: futures_core::Stream< + Item = std::result::Result< + super::TransactionsThroughputResponse, + tonic::Status, + >, + > + + Send + + 'static; + /// Transactions throughput + async fn transactions_throughput( + &self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Massa gRPC service + #[derive(Debug)] + pub struct MassaServiceServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MassaServiceServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MassaServiceServer + where + T: MassaService, + B: Body + Send + 'static, + B::Error: Into + Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + let inner = self.inner.clone(); + match req.uri().path() { + "/massa.api.v1.MassaService/GetBlocks" => { + #[allow(non_camel_case_types)] + struct GetBlocksSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetBlocksSvc { + type Response = super::GetBlocksResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).get_blocks(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetBlocksSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetBlocksBySlots" => { + #[allow(non_camel_case_types)] + struct GetBlocksBySlotsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetBlocksBySlotsSvc { + type Response = super::GetBlocksBySlotsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).get_blocks_by_slots(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetBlocksBySlotsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetDatastoreEntries" => { + #[allow(non_camel_case_types)] + struct GetDatastoreEntriesSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetDatastoreEntriesSvc { + type Response = super::GetDatastoreEntriesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).get_datastore_entries(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetDatastoreEntriesSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetLargestStakers" => { + #[allow(non_camel_case_types)] + struct GetLargestStakersSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetLargestStakersSvc { + type Response = super::GetLargestStakersResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).get_largest_stakers(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetLargestStakersSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetNextBlockBestParents" => { + #[allow(non_camel_case_types)] + struct GetNextBlockBestParentsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetNextBlockBestParentsSvc { + type Response = super::GetNextBlockBestParentsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::GetNextBlockBestParentsRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).get_next_block_best_parents(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetNextBlockBestParentsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetOperations" => { + #[allow(non_camel_case_types)] + struct GetOperationsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetOperationsSvc { + type Response = super::GetOperationsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).get_operations(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetOperationsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetScExecutionEvents" => { + #[allow(non_camel_case_types)] + struct GetScExecutionEventsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetScExecutionEventsSvc { + type Response = super::GetScExecutionEventsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).get_sc_execution_events(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetScExecutionEventsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetSelectorDraws" => { + #[allow(non_camel_case_types)] + struct GetSelectorDrawsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetSelectorDrawsSvc { + type Response = super::GetSelectorDrawsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).get_selector_draws(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetSelectorDrawsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetTransactionsThroughput" => { + #[allow(non_camel_case_types)] + struct GetTransactionsThroughputSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService< + super::GetTransactionsThroughputRequest, + > for GetTransactionsThroughputSvc { + type Response = super::GetTransactionsThroughputResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::GetTransactionsThroughputRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).get_transactions_throughput(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetTransactionsThroughputSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/GetVersion" => { + #[allow(non_camel_case_types)] + struct GetVersionSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::UnaryService + for GetVersionSvc { + type Response = super::GetVersionResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).get_version(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetVersionSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/NewBlocks" => { + #[allow(non_camel_case_types)] + struct NewBlocksSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService + for NewBlocksSvc { + type Response = super::NewBlocksResponse; + type ResponseStream = T::NewBlocksStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).new_blocks(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = NewBlocksSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/NewBlocksHeaders" => { + #[allow(non_camel_case_types)] + struct NewBlocksHeadersSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService + for NewBlocksHeadersSvc { + type Response = super::NewBlocksHeadersResponse; + type ResponseStream = T::NewBlocksHeadersStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).new_blocks_headers(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = NewBlocksHeadersSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/NewEndorsements" => { + #[allow(non_camel_case_types)] + struct NewEndorsementsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService + for NewEndorsementsSvc { + type Response = super::NewEndorsementsResponse; + type ResponseStream = T::NewEndorsementsStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).new_endorsements(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = NewEndorsementsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/NewFilledBlocks" => { + #[allow(non_camel_case_types)] + struct NewFilledBlocksSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService + for NewFilledBlocksSvc { + type Response = super::NewFilledBlocksResponse; + type ResponseStream = T::NewFilledBlocksStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).new_filled_blocks(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = NewFilledBlocksSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/NewOperations" => { + #[allow(non_camel_case_types)] + struct NewOperationsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService + for NewOperationsSvc { + type Response = super::NewOperationsResponse; + type ResponseStream = T::NewOperationsStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).new_operations(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = NewOperationsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/NewSlotExecutionOutputs" => { + #[allow(non_camel_case_types)] + struct NewSlotExecutionOutputsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService< + super::NewSlotExecutionOutputsRequest, + > for NewSlotExecutionOutputsSvc { + type Response = super::NewSlotExecutionOutputsResponse; + type ResponseStream = T::NewSlotExecutionOutputsStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).new_slot_execution_outputs(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = NewSlotExecutionOutputsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/SendBlocks" => { + #[allow(non_camel_case_types)] + struct SendBlocksSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService + for SendBlocksSvc { + type Response = super::SendBlocksResponse; + type ResponseStream = T::SendBlocksStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).send_blocks(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SendBlocksSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/SendEndorsements" => { + #[allow(non_camel_case_types)] + struct SendEndorsementsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService + for SendEndorsementsSvc { + type Response = super::SendEndorsementsResponse; + type ResponseStream = T::SendEndorsementsStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).send_endorsements(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SendEndorsementsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/SendOperations" => { + #[allow(non_camel_case_types)] + struct SendOperationsSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService + for SendOperationsSvc { + type Response = super::SendOperationsResponse; + type ResponseStream = T::SendOperationsStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).send_operations(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SendOperationsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/massa.api.v1.MassaService/TransactionsThroughput" => { + #[allow(non_camel_case_types)] + struct TransactionsThroughputSvc(pub Arc); + impl< + T: MassaService, + > tonic::server::StreamingService< + super::TransactionsThroughputRequest, + > for TransactionsThroughputSvc { + type Response = super::TransactionsThroughputResponse; + type ResponseStream = T::TransactionsThroughputStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).transactions_throughput(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = TransactionsThroughputSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + Ok( + http::Response::builder() + .status(200) + .header("grpc-status", "12") + .header("content-type", "application/grpc") + .body(empty_body()) + .unwrap(), + ) + }) + } + } + } + } + impl Clone for MassaServiceServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + impl std::fmt::Debug for _Inner { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self.0) + } + } + impl tonic::server::NamedService for MassaServiceServer { + const NAME: &'static str = "massa.api.v1.MassaService"; + } +} diff --git a/rust/src/massa.model.v1.rs b/rust/src/massa.model.v1.rs new file mode 100644 index 0000000..d265cd2 --- /dev/null +++ b/rust/src/massa.model.v1.rs @@ -0,0 +1,1012 @@ +/// When an address is drawn to create an endorsement it is selected for a specific index +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexedSlot { + /// Slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, + /// Endorsement index in the slot + #[prost(fixed64, tag = "2")] + pub index: u64, +} +/// A point in time where a block is expected +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Slot { + /// Period + #[prost(fixed64, tag = "1")] + pub period: u64, + /// Thread + #[prost(fixed32, tag = "2")] + pub thread: u32, +} +/// An endorsement, as sent in the network +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Endorsement { + /// Slot in which the endorsement can be included + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, + /// Endorsement index inside the including block + #[prost(fixed32, tag = "2")] + pub index: u32, + /// Hash of endorsed block + /// This is the parent in thread `self.slot.thread` of the block in which the endorsement is included + #[prost(string, tag = "3")] + pub endorsed_block: ::prost::alloc::string::String, +} +/// Signed endorsement +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignedEndorsement { + /// Endorsement + #[prost(message, optional, tag = "1")] + pub content: ::core::option::Option, + /// A cryptographically generated value using `serialized_data` and a public key. + #[prost(string, tag = "2")] + pub signature: ::prost::alloc::string::String, + /// The public-key component used in the generation of the signature + #[prost(string, tag = "3")] + pub content_creator_pub_key: ::prost::alloc::string::String, + /// Derived from the same public key used to generate the signature + #[prost(string, tag = "4")] + pub content_creator_address: ::prost::alloc::string::String, + /// A secure hash of the data. See also \[massa_hash::Hash\] + #[prost(string, tag = "5")] + pub id: ::prost::alloc::string::String, +} +/// BytesMapFieldEntry +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BytesMapFieldEntry { + /// bytes key + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// bytes key + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, +} +/// Packages a type such that it can be securely sent and received in a trust-free network +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SecureShare { + /// Content in sharable, deserializable form. Is used in the secure verification protocols + #[prost(bytes = "vec", tag = "1")] + pub serialized_data: ::prost::alloc::vec::Vec, + /// A cryptographically generated value using `serialized_data` and a public key. + #[prost(string, tag = "2")] + pub signature: ::prost::alloc::string::String, + /// The public-key component used in the generation of the signature + #[prost(string, tag = "3")] + pub content_creator_pub_key: ::prost::alloc::string::String, + /// Derived from the same public key used to generate the signature + #[prost(string, tag = "4")] + pub content_creator_address: ::prost::alloc::string::String, + /// A secure hash of the data. See also \[massa_hash::Hash\] + #[prost(string, tag = "5")] + pub id: ::prost::alloc::string::String, +} +/// The operation as sent in the network +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Operation { + /// The fee they have decided for this operation + #[prost(fixed64, tag = "1")] + pub fee: u64, + /// After `expire_period` slot the operation won't be included in a block + #[prost(fixed64, tag = "2")] + pub expire_period: u64, + /// The type specific operation part + #[prost(message, optional, tag = "3")] + pub op: ::core::option::Option, +} +/// Type specific operation content +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OperationType { + /// Transfer coins from sender to recipient + #[prost(message, optional, tag = "1")] + pub transaction: ::core::option::Option, + /// The sender buys `roll_count` rolls. Roll price is defined in configuration + #[prost(message, optional, tag = "2")] + pub roll_buy: ::core::option::Option, + /// The sender sells `roll_count` rolls. Roll price is defined in configuration + #[prost(message, optional, tag = "3")] + pub roll_sell: ::core::option::Option, + /// Execute a smart contract + #[prost(message, optional, tag = "4")] + pub execut_sc: ::core::option::Option, + /// Calls an exported function from a stored smart contract + #[prost(message, optional, tag = "5")] + pub call_sc: ::core::option::Option, +} +/// Transfer coins from sender to recipient +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Transaction { + /// Recipient address + #[prost(string, tag = "1")] + pub recipient_address: ::prost::alloc::string::String, + /// Amount + #[prost(fixed64, tag = "2")] + pub amount: u64, +} +/// The sender buys `roll_count` rolls. Roll price is defined in configuration +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RollBuy { + /// Roll count + #[prost(fixed64, tag = "1")] + pub roll_count: u64, +} +/// The sender sells `roll_count` rolls. Roll price is defined in configuration +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RollSell { + /// Roll count + #[prost(fixed64, tag = "1")] + pub roll_count: u64, +} +/// Execute a smart contract +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExecuteSc { + /// Smart contract bytecode. + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, + /// The maximum of coins that could be spent by the operation sender + #[prost(fixed64, tag = "2")] + pub max_coins: u64, + /// The maximum amount of gas that the execution of the contract is allowed to cost + #[prost(fixed64, tag = "3")] + pub max_gas: u64, + /// A key-value store associating a hash to arbitrary bytes + #[prost(message, repeated, tag = "4")] + pub datastore: ::prost::alloc::vec::Vec, +} +/// Calls an exported function from a stored smart contract +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CallSc { + /// Target smart contract address + #[prost(string, tag = "1")] + pub target_addr: ::prost::alloc::string::String, + /// Target function name. No function is called if empty + #[prost(string, tag = "2")] + pub target_func: ::prost::alloc::string::String, + /// Parameter to pass to the target function + #[prost(bytes = "vec", tag = "3")] + pub param: ::prost::alloc::vec::Vec, + /// The maximum amount of gas that the execution of the contract is allowed to cost + #[prost(fixed64, tag = "4")] + pub max_gas: u64, + /// Extra coins that are spent from the caller's balance and transferred to the target + #[prost(fixed64, tag = "5")] + pub coins: u64, +} +/// Signed operation +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignedOperation { + /// Operation + #[prost(message, optional, tag = "1")] + pub content: ::core::option::Option, + /// A cryptographically generated value using `serialized_data` and a public key. + #[prost(string, tag = "2")] + pub signature: ::prost::alloc::string::String, + /// The public-key component used in the generation of the signature + #[prost(string, tag = "3")] + pub content_creator_pub_key: ::prost::alloc::string::String, + /// Derived from the same public key used to generate the signature + #[prost(string, tag = "4")] + pub content_creator_address: ::prost::alloc::string::String, + /// A secure hash of the data. See also \[massa_hash::Hash\] + #[prost(string, tag = "5")] + pub id: ::prost::alloc::string::String, +} +/// A wrapper around an operation with its metadata +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OperationWrapper { + /// The unique ID of the operation. + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// The IDs of the blocks in which the operation appears + #[prost(string, repeated, tag = "3")] + pub block_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// The thread in which the operation can be included + #[prost(fixed32, tag = "5")] + pub thread: u32, + /// The operation object itself + #[prost(message, optional, tag = "6")] + pub operation: ::core::option::Option, + /// The execution statuses of the operation + #[prost(enumeration = "OperationStatus", repeated, tag = "7")] + pub status: ::prost::alloc::vec::Vec, +} +/// Possible statuses for an operation +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum OperationStatus { + /// Default enum value + Unspecified = 0, + /// The operation is still pending + Pending = 1, + /// The operation is final + Final = 2, + /// The operation was executed successfully + Success = 3, + /// The operation failed to execute + Failure = 4, + /// The status of the operation is unknown + Unknown = 5, +} +impl OperationStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OperationStatus::Unspecified => "OPERATION_STATUS_UNSPECIFIED", + OperationStatus::Pending => "OPERATION_STATUS_PENDING", + OperationStatus::Final => "OPERATION_STATUS_FINAL", + OperationStatus::Success => "OPERATION_STATUS_SUCCESS", + OperationStatus::Failure => "OPERATION_STATUS_FAILURE", + OperationStatus::Unknown => "OPERATION_STATUS_UNKNOWN", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "OPERATION_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "OPERATION_STATUS_PENDING" => Some(Self::Pending), + "OPERATION_STATUS_FINAL" => Some(Self::Final), + "OPERATION_STATUS_SUCCESS" => Some(Self::Success), + "OPERATION_STATUS_FAILURE" => Some(Self::Failure), + "OPERATION_STATUS_UNKNOWN" => Some(Self::Unknown), + _ => None, + } + } +} +/// Block +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Block { + /// Signed header + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// Operations ids + #[prost(string, repeated, tag = "2")] + pub operations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// Filled block +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FilledBlock { + /// Signed header + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// Operations + #[prost(message, repeated, tag = "2")] + pub operations: ::prost::alloc::vec::Vec, +} +/// Block header +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockHeader { + /// Slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, + /// parents + #[prost(string, repeated, tag = "2")] + pub parents: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// All operations hash + #[prost(string, tag = "3")] + pub operation_merkle_root: ::prost::alloc::string::String, + /// Signed endorsements + #[prost(message, repeated, tag = "4")] + pub endorsements: ::prost::alloc::vec::Vec, +} +/// Filled Operation Tuple +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FilledOperationTuple { + /// Operation id + #[prost(string, tag = "1")] + pub operation_id: ::prost::alloc::string::String, + /// Signed operation + #[prost(message, optional, tag = "2")] + pub operation: ::core::option::Option, +} +/// Signed block +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignedBlock { + /// Block + #[prost(message, optional, tag = "1")] + pub content: ::core::option::Option, + /// A cryptographically generated value using `serialized_data` and a public key. + #[prost(string, tag = "2")] + pub signature: ::prost::alloc::string::String, + /// The public-key component used in the generation of the signature + #[prost(string, tag = "3")] + pub content_creator_pub_key: ::prost::alloc::string::String, + /// Derived from the same public key used to generate the signature + #[prost(string, tag = "4")] + pub content_creator_address: ::prost::alloc::string::String, + /// A secure hash of the data. See also \[massa_hash::Hash\] + #[prost(string, tag = "5")] + pub id: ::prost::alloc::string::String, +} +/// Signed block header +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignedBlockHeader { + /// BlockHeader + #[prost(message, optional, tag = "1")] + pub content: ::core::option::Option, + /// A cryptographically generated value using `serialized_data` and a public key. + #[prost(string, tag = "2")] + pub signature: ::prost::alloc::string::String, + /// The public-key component used in the generation of the signature + #[prost(string, tag = "3")] + pub content_creator_pub_key: ::prost::alloc::string::String, + /// Derived from the same public key used to generate the signature + #[prost(string, tag = "4")] + pub content_creator_address: ::prost::alloc::string::String, + /// A secure hash of the data. See also \[massa_hash::Hash\] + #[prost(string, tag = "5")] + pub id: ::prost::alloc::string::String, +} +/// A wrapper around a block with its metadata +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockWrapper { + /// The unique ID of the block. + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// The block object itself + #[prost(message, optional, tag = "2")] + pub block: ::core::option::Option, + /// The execution statuses of the block + #[prost(enumeration = "BlockStatus", repeated, tag = "3")] + pub status: ::prost::alloc::vec::Vec, +} +/// Possible statuses for a block +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum BlockStatus { + /// Default enum value + Unspecified = 0, + /// The block is in the greatest clique (and not final) + InBlockclique = 1, + /// The block is final + Final = 2, + /// The block is candidate (active any clique but not final) + Candidate = 3, + /// The block is discarded + Discarded = 4, +} +impl BlockStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + BlockStatus::Unspecified => "BLOCK_STATUS_UNSPECIFIED", + BlockStatus::InBlockclique => "BLOCK_STATUS_IN_BLOCKCLIQUE", + BlockStatus::Final => "BLOCK_STATUS_FINAL", + BlockStatus::Candidate => "BLOCK_STATUS_CANDIDATE", + BlockStatus::Discarded => "BLOCK_STATUS_DISCARDED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "BLOCK_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "BLOCK_STATUS_IN_BLOCKCLIQUE" => Some(Self::InBlockclique), + "BLOCK_STATUS_FINAL" => Some(Self::Final), + "BLOCK_STATUS_CANDIDATE" => Some(Self::Candidate), + "BLOCK_STATUS_DISCARDED" => Some(Self::Discarded), + _ => None, + } + } +} +/// Selector draws +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SelectorDraws { + /// Address + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// Next block draws + #[prost(message, repeated, tag = "2")] + pub next_block_draws: ::prost::alloc::vec::Vec, + /// Next endorsements draws + #[prost(message, repeated, tag = "3")] + pub next_endorsement_draws: ::prost::alloc::vec::Vec, +} +/// SlotExecutionOutput +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SlotExecutionOutput { + /// Status + #[prost(enumeration = "ExecutionOutputStatus", repeated, tag = "1")] + pub status: ::prost::alloc::vec::Vec, + /// Executed slot output + #[prost(message, optional, tag = "2")] + pub execution_output: ::core::option::Option, +} +/// FinalizedExecutionOutput +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FinalizedExecutionOutput { + /// Slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, +} +/// ExecutionOutput +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExecutionOutput { + /// Slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, + /// Block id at that slot (optional) + #[prost(string, optional, tag = "2")] + pub block_id: ::core::option::Option<::prost::alloc::string::String>, + /// Events emitted by the execution step + #[prost(message, repeated, tag = "3")] + pub events: ::prost::alloc::vec::Vec, + /// State changes caused by the execution step + #[prost(message, optional, tag = "4")] + pub state_changes: ::core::option::Option, +} +/// ScExecutionEvent +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScExecutionEvent { + /// Sc execution context + #[prost(message, optional, tag = "1")] + pub context: ::core::option::Option, + /// json data string + #[prost(string, tag = "2")] + pub data: ::prost::alloc::string::String, +} +/// ScExecutionEvent context +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScExecutionEventContext { + /// base58 encoded slot(period + thread) + index_in_slot + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// When was it generated + #[prost(message, optional, tag = "2")] + pub origin_slot: ::core::option::Option, + /// Block id if there was a block at that slot (optional) + #[prost(string, optional, tag = "3")] + pub block_id: ::core::option::Option<::prost::alloc::string::String>, + /// Index of the event in the slot + #[prost(fixed64, tag = "4")] + pub index_in_slot: u64, + /// Call stack addresses. most recent at the end + #[prost(string, repeated, tag = "5")] + pub call_stack: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Origin operation id (optional) + #[prost(string, optional, tag = "6")] + pub origin_operation_id: ::core::option::Option<::prost::alloc::string::String>, + /// Status + #[prost(enumeration = "ScExecutionEventStatus", repeated, tag = "7")] + pub status: ::prost::alloc::vec::Vec, +} +/// StateChanges +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StateChanges { + /// Ledger changes + #[prost(message, repeated, tag = "1")] + pub ledger_changes: ::prost::alloc::vec::Vec, + /// Asynchronous pool changes + #[prost(message, repeated, tag = "2")] + pub async_pool_changes: ::prost::alloc::vec::Vec, + /// Executed operations changes + #[prost(message, repeated, tag = "4")] + pub executed_ops_changes: ::prost::alloc::vec::Vec, + /// Executed denunciations changes + #[prost(message, repeated, tag = "5")] + pub executed_denunciations_changes: ::prost::alloc::vec::Vec, +} +/// ExecutedOpsChangeEntry +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExecutedOpsChangeEntry { + /// OperationId + #[prost(string, tag = "1")] + pub operation_id: ::prost::alloc::string::String, + /// ExecutedOpsChangeValue + #[prost(message, optional, tag = "2")] + pub value: ::core::option::Option, +} +/// ExecutedOpsChangeValue +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExecutedOpsChangeValue { + /// The status of the execution of the operation + #[prost(enumeration = "OperationExecutionStatus", repeated, tag = "1")] + pub status: ::prost::alloc::vec::Vec, + /// Slot until which the operation remains valid (included) + #[prost(message, optional, tag = "2")] + pub slot: ::core::option::Option, +} +/// AsyncPoolChange Entry +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AsyncPoolChangeEntry { + /// Async message id + #[prost(string, tag = "1")] + pub async_message_id: ::prost::alloc::string::String, + /// AsyncPool message + #[prost(message, optional, tag = "2")] + pub value: ::core::option::Option, +} +/// AsyncPoolChangeValue +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AsyncPoolChangeValue { + /// The type of the change + #[prost(enumeration = "AsyncPoolChangeType", tag = "1")] + pub r#type: i32, + /// AsyncPool message + #[prost(message, optional, tag = "2")] + pub async_message: ::core::option::Option, +} +/// Asynchronous smart contract message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AsyncMessage { + /// Slot at which the message was emitted + #[prost(message, optional, tag = "1")] + pub emission_slot: ::core::option::Option, + /// Index of the emitted message within the `emission_slot`. + /// This is used for disambiguate the emission of multiple messages at the same slot. + #[prost(fixed64, tag = "2")] + pub emission_index: u64, + /// The address that sent the message + #[prost(string, tag = "3")] + pub sender: ::prost::alloc::string::String, + /// The address towards which the message is being sent + #[prost(string, tag = "4")] + pub destination: ::prost::alloc::string::String, + /// the handler function name within the destination address' bytecode + #[prost(string, tag = "5")] + pub handler: ::prost::alloc::string::String, + /// Maximum gas to use when processing the message + #[prost(fixed64, tag = "6")] + pub max_gas: u64, + /// Fee paid by the sender when the message is processed. + #[prost(fixed64, tag = "7")] + pub fee: u64, + /// Coins sent from the sender to the target address of the message. + /// Those coins are spent by the sender address when the message is sent, + /// and credited to the destination address when receiving the message. + /// In case of failure or discard, those coins are reimbursed to the sender. + #[prost(fixed64, tag = "8")] + pub coins: u64, + /// Slot at which the message starts being valid (bound included in the validity range) + #[prost(message, optional, tag = "9")] + pub validity_start: ::core::option::Option, + /// Slot at which the message stops being valid (bound not included in the validity range) + #[prost(message, optional, tag = "10")] + pub validity_end: ::core::option::Option, + /// Raw payload data of the message + #[prost(bytes = "vec", tag = "11")] + pub data: ::prost::alloc::vec::Vec, + /// Trigger that define whenever a message can be executed + #[prost(message, optional, tag = "12")] + pub trigger: ::core::option::Option, + /// Boolean that determine if the message can be executed. For messages without filter this boolean is always true. + /// For messages with filter, this boolean is true if the filter has been matched between `validity_start` and current slot. + #[prost(bool, tag = "13")] + pub can_be_executed: bool, + /// Hash of the message + #[prost(string, tag = "14")] + pub hash: ::prost::alloc::string::String, +} +/// Structure defining a trigger for an asynchronous message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AsyncMessageTrigger { + /// Filter on the address + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// Filter on the datastore key (optional) + #[prost(bytes = "vec", optional, tag = "2")] + pub datastore_key: ::core::option::Option<::prost::alloc::vec::Vec>, +} +/// LedgerChangeEntry +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LedgerChangeEntry { + /// Address + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// Ledger message + #[prost(message, optional, tag = "2")] + pub value: ::core::option::Option, +} +/// LedgerChangeValue +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LedgerChangeValue { + /// The type of the change + #[prost(enumeration = "LedgerChangeType", tag = "1")] + pub r#type: i32, + /// LedgerEntry or LedgerEntryUpdate + #[prost(oneof = "ledger_change_value::Entry", tags = "2, 3")] + pub entry: ::core::option::Option, +} +/// Nested message and enum types in `LedgerChangeValue`. +pub mod ledger_change_value { + /// LedgerEntry or LedgerEntryUpdate + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Entry { + /// Created ledger entry + #[prost(message, tag = "2")] + CreatedEntry(super::LedgerEntry), + /// Update ledger entry + #[prost(message, tag = "3")] + UpdatedEntry(super::LedgerEntryUpdate), + } +} +/// An entry associated to an address in the `FinalLedger` +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LedgerEntry { + /// The balance of that entry + #[prost(fixed64, tag = "1")] + pub balance: u64, + /// Executable bytecode + #[prost(bytes = "vec", tag = "2")] + pub bytecode: ::prost::alloc::vec::Vec, + /// A key-value store associating a hash to arbitrary bytes + #[prost(message, repeated, tag = "3")] + pub entries: ::prost::alloc::vec::Vec, +} +/// Represents an update to one or more fields of a `LedgerEntry` +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LedgerEntryUpdate { + /// Change the balance + #[prost(message, optional, tag = "1")] + pub balance: ::core::option::Option, + /// Change the executable bytecode + #[prost(message, optional, tag = "2")] + pub bytecode: ::core::option::Option, + /// / Change datastore entries + #[prost(message, repeated, tag = "3")] + pub datastore: ::prost::alloc::vec::Vec, +} +/// Set or Keep Balance +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetOrKeepBalance { + /// The type of the change + #[prost(enumeration = "SetOrKeepType", tag = "1")] + pub r#type: i32, + /// The balance of that entry (optional) + #[prost(fixed64, optional, tag = "2")] + pub balance: ::core::option::Option, +} +/// Set or Keep Bytecode +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetOrKeepBytecode { + /// The type of the change + #[prost(enumeration = "SetOrKeepType", tag = "1")] + pub r#type: i32, + /// Executable bytecode (optional) + #[prost(bytes = "vec", optional, tag = "2")] + pub bytecode: ::core::option::Option<::prost::alloc::vec::Vec>, +} +/// Set or Delete DatastoreEntry +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetOrDeleteDatastoreEntry { + /// The type of the change + #[prost(enumeration = "SetOrDeleteType", tag = "1")] + pub r#type: i32, + /// The balance of that entry (optioal) + #[prost(message, optional, tag = "2")] + pub datastore_entry: ::core::option::Option, +} +/// Index for Denunciations in collections (e.g. like a HashMap...) +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DenunciationIndex { + /// DenunciationBlockHeader or DenunciationEndorsement + #[prost(oneof = "denunciation_index::Entry", tags = "1, 2")] + pub entry: ::core::option::Option, +} +/// Nested message and enum types in `DenunciationIndex`. +pub mod denunciation_index { + /// DenunciationBlockHeader or DenunciationEndorsement + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Entry { + /// Denunciation block header + #[prost(message, tag = "1")] + BlockHeader(super::DenunciationBlockHeader), + /// Denunciation endorsement + #[prost(message, tag = "2")] + Endorsement(super::DenunciationEndorsement), + } +} +/// Variant for Block header denunciation index +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DenunciationBlockHeader { + /// Denounciation slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, +} +/// Variant for Endorsement denunciation index +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DenunciationEndorsement { + /// Denounciation slot + #[prost(message, optional, tag = "1")] + pub slot: ::core::option::Option, + /// Denounciation index + #[prost(fixed32, tag = "2")] + pub index: u32, +} +/// ScExecutionEventStatus type enum +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ScExecutionEventStatus { + /// Default enum value + Unspecified = 0, + /// Final status + Final = 1, + /// Read only status + ReadOnly = 2, + /// Failure status + Failure = 3, +} +impl ScExecutionEventStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ScExecutionEventStatus::Unspecified => { + "SC_EXECUTION_EVENT_STATUS_UNSPECIFIED" + } + ScExecutionEventStatus::Final => "SC_EXECUTION_EVENT_STATUS_FINAL", + ScExecutionEventStatus::ReadOnly => "SC_EXECUTION_EVENT_STATUS_READ_ONLY", + ScExecutionEventStatus::Failure => "SC_EXECUTION_EVENT_STATUS_FAILURE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SC_EXECUTION_EVENT_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "SC_EXECUTION_EVENT_STATUS_FINAL" => Some(Self::Final), + "SC_EXECUTION_EVENT_STATUS_READ_ONLY" => Some(Self::ReadOnly), + "SC_EXECUTION_EVENT_STATUS_FAILURE" => Some(Self::Failure), + _ => None, + } + } +} +/// ExecutionOutputStatus type enum +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ExecutionOutputStatus { + /// Default enum value + Unspecified = 0, + /// Candidate status + Candidate = 1, + /// Final status + Final = 2, +} +impl ExecutionOutputStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ExecutionOutputStatus::Unspecified => "EXECUTION_OUTPUT_STATUS_UNSPECIFIED", + ExecutionOutputStatus::Candidate => "EXECUTION_OUTPUT_STATUS_CANDIDATE", + ExecutionOutputStatus::Final => "EXECUTION_OUTPUT_STATUS_FINAL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "EXECUTION_OUTPUT_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "EXECUTION_OUTPUT_STATUS_CANDIDATE" => Some(Self::Candidate), + "EXECUTION_OUTPUT_STATUS_FINAL" => Some(Self::Final), + _ => None, + } + } +} +/// OperationExecutionStatus type enum +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum OperationExecutionStatus { + /// Default enum value + Unspecified = 0, + /// Success status + Success = 1, + /// Failed only status + Failed = 2, +} +impl OperationExecutionStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OperationExecutionStatus::Unspecified => { + "OPERATION_EXECUTION_STATUS_UNSPECIFIED" + } + OperationExecutionStatus::Success => "OPERATION_EXECUTION_STATUS_SUCCESS", + OperationExecutionStatus::Failed => "OPERATION_EXECUTION_STATUS_FAILED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "OPERATION_EXECUTION_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "OPERATION_EXECUTION_STATUS_SUCCESS" => Some(Self::Success), + "OPERATION_EXECUTION_STATUS_FAILED" => Some(Self::Failed), + _ => None, + } + } +} +/// AsyncPoolChangeType type enum +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AsyncPoolChangeType { + /// Default enum value + Unspecified = 0, + /// Add type + Add = 1, + /// Activate only type + Activate = 2, + /// Delete only type + Delete = 3, +} +impl AsyncPoolChangeType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + AsyncPoolChangeType::Unspecified => "ASYNC_POOL_CHANGE_TYPE_UNSPECIFIED", + AsyncPoolChangeType::Add => "ASYNC_POOL_CHANGE_TYPE_ADD", + AsyncPoolChangeType::Activate => "ASYNC_POOL_CHANGE_TYPE_ACTIVATE", + AsyncPoolChangeType::Delete => "ASYNC_POOL_CHANGE_TYPE_DELETE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ASYNC_POOL_CHANGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "ASYNC_POOL_CHANGE_TYPE_ADD" => Some(Self::Add), + "ASYNC_POOL_CHANGE_TYPE_ACTIVATE" => Some(Self::Activate), + "ASYNC_POOL_CHANGE_TYPE_DELETE" => Some(Self::Delete), + _ => None, + } + } +} +/// LedgerChangeType type enum +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum LedgerChangeType { + /// Default enum value + Unspecified = 0, + /// Set type + Set = 1, + /// Update type + Update = 2, + /// Delete type + Delete = 3, +} +impl LedgerChangeType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + LedgerChangeType::Unspecified => "LEDGER_CHANGE_TYPE_UNSPECIFIED", + LedgerChangeType::Set => "LEDGER_CHANGE_TYPE_SET", + LedgerChangeType::Update => "LEDGER_CHANGE_TYPE_UPDATE", + LedgerChangeType::Delete => "LEDGER_CHANGE_TYPE_DELETE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "LEDGER_CHANGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "LEDGER_CHANGE_TYPE_SET" => Some(Self::Set), + "LEDGER_CHANGE_TYPE_UPDATE" => Some(Self::Update), + "LEDGER_CHANGE_TYPE_DELETE" => Some(Self::Delete), + _ => None, + } + } +} +/// SetOrKeepType type enum +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SetOrKeepType { + /// Default enum value + Unspecified = 0, + /// Sets a new absolute value + Set = 1, + /// Keeps the existing value + Keep = 2, +} +impl SetOrKeepType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SetOrKeepType::Unspecified => "SET_OR_KEEP_TYPE_UNSPECIFIED", + SetOrKeepType::Set => "SET_OR_KEEP_TYPE_SET", + SetOrKeepType::Keep => "SET_OR_KEEP_TYPE_KEEP", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SET_OR_KEEP_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "SET_OR_KEEP_TYPE_SET" => Some(Self::Set), + "SET_OR_KEEP_TYPE_KEEP" => Some(Self::Keep), + _ => None, + } + } +} +/// SetOrDeleteType type enum +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SetOrDeleteType { + /// Default enum value + Unspecified = 0, + /// Sets a new absolute value + Set = 1, + /// Deletes the existing value + Delete = 2, +} +impl SetOrDeleteType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SetOrDeleteType::Unspecified => "SET_OR_DELETE_TYPE_UNSPECIFIED", + SetOrDeleteType::Set => "SET_OR_DELETE_TYPE_SET", + SetOrDeleteType::Delete => "SET_OR_DELETE_TYPE_DELETE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SET_OR_DELETE_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "SET_OR_DELETE_TYPE_SET" => Some(Self::Set), + "SET_OR_DELETE_TYPE_DELETE" => Some(Self::Delete), + _ => None, + } + } +}