Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(proto): add serde trait generation #34

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
584 changes: 366 additions & 218 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ categories = [
keywords = ["archway", "blockchain", "cosmwasm", "proto", "smart-contracts"]

[dependencies]
serde = "1.0"
prost = "0.12.4"
pbjson = "0.6.0"
pbjson-types = "0.6.0"
prost-types = "0.12.4"
tonic = { version = "0.11.0", optional = true, default-features = false, features = [
"codegen",
Expand Down
34 changes: 33 additions & 1 deletion packages/proto/src/gen/archway.callback.v1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @generated
/// Callback defines the callback structure.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Callback {
Expand Down Expand Up @@ -30,6 +31,7 @@ impl ::prost::Name for Callback {
}
}
/// CallbackFeesFeeSplit is the breakdown of all the fees that need to be paid by the contract to reserve a callback
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CallbackFeesFeeSplit {
Expand All @@ -56,6 +58,7 @@ impl ::prost::Name for CallbackFeesFeeSplit {
}
}
/// Params defines the module parameters.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Params {
Expand Down Expand Up @@ -83,7 +86,19 @@ impl ::prost::Name for Params {
}
}
/// ModuleErrors defines the module level error codes
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[derive(
::serde::Serialize,
::serde::Deserialize,
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum ModuleErrors {
/// ERR_UNKNOWN is the default error code
Expand Down Expand Up @@ -116,6 +131,7 @@ impl ModuleErrors {
}
}
/// CallbackRegisteredEvent is emitted when a callback is registered.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CallbackRegisteredEvent {
Expand Down Expand Up @@ -143,6 +159,7 @@ impl ::prost::Name for CallbackRegisteredEvent {
}
}
/// CallbackCancelledEvent is emitted when a callback is cancelled.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CallbackCancelledEvent {
Expand Down Expand Up @@ -170,6 +187,7 @@ impl ::prost::Name for CallbackCancelledEvent {
}
}
/// CallbackExecutedSuccessEvent is emitted when a callback is executed successfully.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CallbackExecutedSuccessEvent {
Expand All @@ -194,6 +212,7 @@ impl ::prost::Name for CallbackExecutedSuccessEvent {
}
}
/// CallbackExecutedFailedEvent is emitted when a callback execution fails.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CallbackExecutedFailedEvent {
Expand Down Expand Up @@ -221,6 +240,7 @@ impl ::prost::Name for CallbackExecutedFailedEvent {
}
}
/// GenesisState defines the initial state of the callback module.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenesisState {
Expand All @@ -239,6 +259,7 @@ impl ::prost::Name for GenesisState {
}
}
/// QueryParamsRequest is the request for Query.Params.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsRequest {}
Expand All @@ -250,6 +271,7 @@ impl ::prost::Name for QueryParamsRequest {
}
}
/// QueryParamsResponse is the response for Query.Params.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsResponse {
Expand All @@ -265,6 +287,7 @@ impl ::prost::Name for QueryParamsResponse {
}
}
/// QueryEstimateCallbackFeesRequest is the request for Query.EstimateCallbackFees.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryEstimateCallbackFeesRequest {
Expand All @@ -280,6 +303,7 @@ impl ::prost::Name for QueryEstimateCallbackFeesRequest {
}
}
/// QueryEstimateCallbackFeesResponse is the response for Query.EstimateCallbackFees.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryEstimateCallbackFeesResponse {
Expand All @@ -298,6 +322,7 @@ impl ::prost::Name for QueryEstimateCallbackFeesResponse {
}
}
/// QueryCallbacksRequest is the request for Query.Callbacks.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryCallbacksRequest {
Expand All @@ -313,6 +338,7 @@ impl ::prost::Name for QueryCallbacksRequest {
}
}
/// QueryCallbacksResponse is the response for Query.Callbacks.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryCallbacksResponse {
Expand All @@ -328,6 +354,7 @@ impl ::prost::Name for QueryCallbacksResponse {
}
}
/// MsgUpdateParams is the Msg/UpdateParams request type.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgUpdateParams {
Expand All @@ -348,6 +375,7 @@ impl ::prost::Name for MsgUpdateParams {
}
}
/// MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgUpdateParamsResponse {}
Expand All @@ -359,6 +387,7 @@ impl ::prost::Name for MsgUpdateParamsResponse {
}
}
/// MsgRequestCallback is the Msg/RequestCallback request type.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgRequestCallback {
Expand Down Expand Up @@ -386,6 +415,7 @@ impl ::prost::Name for MsgRequestCallback {
}
}
/// MsgRequestCallbackResponse defines the response structure for executing a MsgRequestCallback message.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgRequestCallbackResponse {}
Expand All @@ -397,6 +427,7 @@ impl ::prost::Name for MsgRequestCallbackResponse {
}
}
/// MsgCancelCallback is the Msg/CancelCallback request type.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgCancelCallback {
Expand All @@ -421,6 +452,7 @@ impl ::prost::Name for MsgCancelCallback {
}
}
/// MsgCancelCallbackResponse defines the response structure for executing a MsgCancelCallback message.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgCancelCallbackResponse {
Expand Down
31 changes: 30 additions & 1 deletion packages/proto/src/gen/archway.cwerrors.v1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @generated
/// SudoError defines the sudo message for the error callback
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SudoError {
Expand Down Expand Up @@ -28,7 +29,19 @@ impl ::prost::Name for SudoError {
}
}
/// ModuleErrors defines the module level error codes
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[derive(
::serde::Serialize,
::serde::Deserialize,
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum ModuleErrors {
/// ERR_UNKNOWN is the default error code
Expand Down Expand Up @@ -57,6 +70,7 @@ impl ModuleErrors {
}
}
/// Params defines the set of parameters for the cwerrors module.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Params {
Expand All @@ -79,6 +93,7 @@ impl ::prost::Name for Params {
}
/// ParamsUpdatedEvent defines the event which is thrown when the module
/// parameters are updated
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ParamsUpdatedEvent {
Expand All @@ -98,6 +113,7 @@ impl ::prost::Name for ParamsUpdatedEvent {
}
/// SubscribedToErrorsEvent defines the event which is thrown when a contract
/// subscribes to errors
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribedToErrorsEvent {
Expand All @@ -124,6 +140,7 @@ impl ::prost::Name for SubscribedToErrorsEvent {
}
}
/// StoringErrorEvent defines the event which is thrown when an error is stored
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoringErrorEvent {
Expand All @@ -144,6 +161,7 @@ impl ::prost::Name for StoringErrorEvent {
}
/// SudoErrorCallbackFailedEvent defines the event which is thrown when a sudo
/// error callback fails
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SudoErrorCallbackFailedEvent {
Expand All @@ -162,6 +180,7 @@ impl ::prost::Name for SudoErrorCallbackFailedEvent {
}
}
/// GenesisState defines the cwerrors module's genesis state.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenesisState {
Expand All @@ -180,6 +199,7 @@ impl ::prost::Name for GenesisState {
}
}
/// QueryParamsRequest is the request for Query.Params.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsRequest {}
Expand All @@ -191,6 +211,7 @@ impl ::prost::Name for QueryParamsRequest {
}
}
/// QueryParamsResponse is the response for Query.Params.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsResponse {
Expand All @@ -206,6 +227,7 @@ impl ::prost::Name for QueryParamsResponse {
}
}
/// QueryErrorsRequest is the request for Query.Errors.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryErrorsRequest {
Expand All @@ -221,6 +243,7 @@ impl ::prost::Name for QueryErrorsRequest {
}
}
/// QueryErrorsResponse is the response for Query.Errors.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryErrorsResponse {
Expand All @@ -236,6 +259,7 @@ impl ::prost::Name for QueryErrorsResponse {
}
}
/// QueryIsSubscribedRequest is the request for Query.IsSubscribed.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryIsSubscribedRequest {
Expand All @@ -251,6 +275,7 @@ impl ::prost::Name for QueryIsSubscribedRequest {
}
}
/// QueryIsSubscribedResponse is the response for Query.IsSubscribed.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryIsSubscribedResponse {
Expand All @@ -270,6 +295,7 @@ impl ::prost::Name for QueryIsSubscribedResponse {
}
}
/// MsgUpdateParams is the Msg/UpdateParams request type.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgUpdateParams {
Expand All @@ -292,6 +318,7 @@ impl ::prost::Name for MsgUpdateParams {
}
/// MsgUpdateParamsResponse defines the response structure for executing a
/// MsgUpdateParams message.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgUpdateParamsResponse {}
Expand All @@ -303,6 +330,7 @@ impl ::prost::Name for MsgUpdateParamsResponse {
}
}
/// MsgSubscribeToError is the Msg/SubscribeToError request type.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgSubscribeToError {
Expand All @@ -327,6 +355,7 @@ impl ::prost::Name for MsgSubscribeToError {
}
/// MsgSubscribeToErrorResponse defines the response structure for executing a
/// MsgSubscribeToError message.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgSubscribeToErrorResponse {
Expand Down
Loading
Loading