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): Proto API v2 [DEV-1786] #398

Merged
merged 28 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4dd86b4
Duplicate cheqd proto
askolesov Sep 30, 2022
494ccb7
Proto design
askolesov Sep 30, 2022
12a37c8
Merge branch 'develop' into proto-v2
askolesov Sep 30, 2022
08041a4
New proto proposal
askolesov Oct 1, 2022
48898f8
Scetch for resource api v2
askolesov Oct 1, 2022
38dd325
Update tx.proto
askolesov Oct 2, 2022
9359e4c
Restore context
askolesov Oct 5, 2022
fa27334
Add version and also known as properties to resource model
askolesov Oct 5, 2022
7ec40be
Temporary switch go packages
askolesov Oct 5, 2022
978ec5d
Improve namespaces and file structure
askolesov Oct 5, 2022
3ce1c0b
Update buf.yaml
askolesov Oct 5, 2022
7a616ff
Added `FeeParams` definitions & genesis state
Eengineer1 Oct 5, 2022
a04c8d5
Merge branch 'proto-v2' of https://github.com/cheqd/cheqd-node into p…
Eengineer1 Oct 5, 2022
74f4833
Fixed package paths
Eengineer1 Oct 5, 2022
1cf4919
Make service_endpoint repeated string
askolesov Oct 5, 2022
89e0ef3
Fix query paths
askolesov Oct 5, 2022
01b819c
Switched `FeeParams` definition to typed map
Eengineer1 Oct 7, 2022
54ee24e
Fixed order
Eengineer1 Oct 7, 2022
0ce740c
Added versioin references to diddoc metadata
askolesov Oct 13, 2022
d80cec5
Removed AllResourceVersions query
askolesov Oct 13, 2022
dc84d56
ci: Add linting for proto files [DEV-1786] (#405)
Oct 14, 2022
d859900
Merge branch 'develop' into proto-v2
ankurdotb Oct 21, 2022
b3531d9
Update dispatch.yml
ankurdotb Oct 21, 2022
2a3eaf3
Fix proto lint stage
ankurdotb Oct 21, 2022
984759a
Merge branch 'main' into main-backmerge
askolesov Oct 26, 2022
f393d8b
Add deactivation transaction
askolesov Oct 26, 2022
86db3e0
Remove unused messages
askolesov Oct 26, 2022
805ad9e
Merge branch 'develop' into proto-v2
askolesov Oct 26, 2022
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
5 changes: 4 additions & 1 deletion proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ breaking:
- FILE

lint:
ignore:
- cheqd/did/v1
- cheqd/resource/v1
use:
- DEFAULT
- COMMENTS
except:
- SERVICE_SUFFIX
- RPC_REQUEST_STANDARD_NAME
- RPC_RESPONSE_STANDARD_NAME
File renamed without changes.
2 changes: 1 addition & 1 deletion proto/cheqd/v1/did.proto → proto/cheqd/did/v1/did.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package cheqdid.cheqdnode.cheqd.v1;
option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types";

import "google/protobuf/any.proto";
import "cheqd/v1/common.proto";
import "cheqd/did/v1/common.proto";

message Did {
repeated string context = 1; // optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cheqdid.cheqdnode.cheqd.v1;

option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types";

import "cheqd/v1/stateValue.proto";
import "cheqd/did/v1/stateValue.proto";

// GenesisState defines the cheqd module's genesis state.
message GenesisState {
Expand Down
4 changes: 2 additions & 2 deletions proto/cheqd/v1/query.proto → proto/cheqd/did/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package cheqdid.cheqdnode.cheqd.v1;
option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types";

import "google/api/annotations.proto";
import "cheqd/v1/did.proto";
import "cheqd/v1/stateValue.proto";
import "cheqd/did/v1/did.proto";
import "cheqd/did/v1/stateValue.proto";


// Query defines the gRPC querier service.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion proto/cheqd/v1/tx.proto → proto/cheqd/did/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package cheqdid.cheqdnode.cheqd.v1;
option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types";

import "google/protobuf/any.proto";
import "cheqd/v1/did.proto";
import "cheqd/did/v1/did.proto";

// Msg defines the Msg service.
service Msg {
Expand Down
44 changes: 44 additions & 0 deletions proto/cheqd/did/v2/diddoc.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax = "proto3";

package cheqd.did.v2;

option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types/v2";

message DidDoc {
repeated string context = 1;
string id = 2;
repeated string controller = 3;
repeated VerificationMethod verification_method = 4;
repeated string authentication = 5;
repeated string assertion_method = 6;
repeated string capability_invocation = 7;
repeated string capability_delegation = 8;
repeated string key_agreement = 9;
repeated Service service = 10;
repeated string also_known_as = 11;
}

message VerificationMethod {
string id = 1;
string type = 2;
string controller = 3;
string verification_material = 4;
}

message Service {
string id = 1;
string type = 2;
repeated string service_endpoint = 3;
}

message DidDocWithMetadata {
DidDoc did_doc = 1;
Metadata metadata = 2;
}

message Metadata {
string created = 1;
string updated = 2;
bool deactivated = 3;
string version_id = 4;
}
22 changes: 22 additions & 0 deletions proto/cheqd/did/v2/fee.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";
package cheqd.did.v2;

option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types/v2";
option (gogoproto.equal_all) = true;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";

// FeeParams defines the parameters for the `cheqd` module fixed fee.
message FeeParams {
// Tx types define the fixed fee each for the `cheqd` module.
cosmos.base.v1beta1.Coin create_did = 1 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin update_did = 2 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin deactivate_did = 3 [(gogoproto.nullable) = false];
string burn_factor = 4 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
14 changes: 14 additions & 0 deletions proto/cheqd/did/v2/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";

package cheqd.did.v2;

import "cheqd/did/v2/diddoc.proto";
import "cheqd/did/v2/fee.proto";

option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types/v2";

message GenesisState {
string did_namespace = 1;
repeated DidDocWithMetadata did_docs = 2;
FeeParams fee_params = 3;
}
22 changes: 22 additions & 0 deletions proto/cheqd/did/v2/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";

package cheqd.did.v2;

import "google/api/annotations.proto";
import "cheqd/did/v2/diddoc.proto";

option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types/v2";

service Query {
rpc DidDoc(QueryGetDidDocRequest) returns (QueryGetDidDocResponse) {
option (google.api.http).get = "/cheqd/did/v2/diddoc/{id}";
}
}

message QueryGetDidDocRequest {
string id = 1;
}

message QueryGetDidDocResponse {
DidDocWithMetadata value = 1;
}
64 changes: 64 additions & 0 deletions proto/cheqd/did/v2/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
syntax = "proto3";

package cheqd.did.v2;

import "cheqd/did/v2/diddoc.proto";

option go_package = "github.com/cheqd/cheqd-node/x/cheqd/types/v2";

service Msg {
rpc CreateDidDoc(MsgCreateDidDoc) returns (MsgCreateDidDocResponse);
rpc UpdateDidDoc(MsgUpdateDidDoc) returns (MsgUpdateDidDocResponse);
}

message MsgCreateDidDoc {
MsgCreateDidDocPayload payload = 1;
repeated SignInfo signatures = 2;
}

message MsgUpdateDidDoc {
MsgUpdateDidDocPayload payload = 1;
repeated SignInfo signatures = 2;
}

message SignInfo {
string verification_method_id = 1;
bytes signature = 2;
}

message MsgCreateDidDocPayload {
repeated string context = 1;
string id = 2;
repeated string controller = 3;
repeated VerificationMethod verification_method = 4;
repeated string authentication = 5;
repeated string assertion_method = 6;
repeated string capability_invocation = 7;
repeated string capability_delegation = 8;
repeated string key_agreement = 9;
repeated string also_known_as = 10;
repeated Service service = 11;
}

message MsgCreateDidDocResponse {
DidDocWithMetadata value = 1;
}

message MsgUpdateDidDocPayload {
repeated string context = 1;
string id = 2;
repeated string controller = 3;
repeated VerificationMethod verification_method = 4;
repeated string authentication = 5;
repeated string assertion_method = 6;
repeated string capability_invocation = 7;
repeated string capability_delegation = 8;
repeated string key_agreement = 9;
repeated string also_known_as = 10;
repeated Service service = 11;
string version_id = 12;
}

message MsgUpdateDidDocResponse {
DidDocWithMetadata value = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cheqdid.cheqdnode.resource.v1;

option go_package = "github.com/cheqd/cheqd-node/x/resource/types";

import "resource/v1/resource.proto";
import "cheqd/resource/v1/resource.proto";

// GenesisState defines the cheqd module's genesis state.
message GenesisState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package cheqdid.cheqdnode.resource.v1;
option go_package = "github.com/cheqd/cheqd-node/x/resource/types";

import "google/api/annotations.proto";
import "resource/v1/resource.proto";
import "cheqd/resource/v1/resource.proto";


// Query defines the gRPC querier service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cheqdid.cheqdnode.resource.v1;

option go_package = "github.com/cheqd/cheqd-node/x/resource/types";

import "cheqd/v1/tx.proto";
import "resource/v1/resource.proto";
import "cheqd/did/v1/tx.proto";
import "cheqd/resource/v1/resource.proto";

// Msg defines the Msg service.
service Msg {
Expand Down
22 changes: 22 additions & 0 deletions proto/cheqd/resource/v2/fee.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";
package cheqd.resource.v2;

option go_package = "github.com/cheqd/cheqd-node/x/resource/types/v2";
option (gogoproto.equal_all) = true;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";

// FeeParams defines the parameters for the `resource` module fixed fee.
message FeeParams {
// Media types define the fixed fee each for the `resource` module.
cosmos.base.v1beta1.Coin image = 1 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin json = 2 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin default = 3 [(gogoproto.nullable) = false];
string burn_factor = 4 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
13 changes: 13 additions & 0 deletions proto/cheqd/resource/v2/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

package cheqd.resource.v2;

import "cheqd/resource/v2/resource.proto";
import "cheqd/resource/v2/fee.proto";

option go_package = "github.com/cheqd/cheqd-node/x/resource/types/v2";

message GenesisState {
repeated ResourceWithMetadata resources = 1;
FeeParams fee_params = 2;
}
58 changes: 58 additions & 0 deletions proto/cheqd/resource/v2/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
syntax = "proto3";

package cheqd.resource.v2;

import "google/api/annotations.proto";
import "cheqd/resource/v2/resource.proto";

option go_package = "github.com/cheqd/cheqd-node/x/resource/types/v2";

service Query {
rpc Resource(QueryGetResourceRequest) returns (QueryGetResourceResponse) {
option (google.api.http).get = "/cheqd/resource/v2/collection/{collection_id}/resources/{id}";
}
rpc ResourceMetadata(QueryGetResourceMetadataRequest) returns (QueryGetResourceMetadataResponse) {
option (google.api.http).get = "/cheqd/resource/v2/collection/{collection_id}/resources/{id}/metadata";
}
rpc CollectionResources(QueryGetCollectionResourcesRequest) returns (QueryGetCollectionResourcesResponse) {
option (google.api.http).get = "/cheqd/resource/v2/collection/{collection_id}/resources";
}
rpc AllResourceVersions(QueryGetAllResourceVersionsRequest) returns (QueryGetAllResourceVersionsResponse) {
option (google.api.http).get = "/cheqd/resource/v2/collection/{collection_id}/resources/versions/{name}";
}
}

message QueryGetResourceRequest {
string collection_id = 1;
string id = 2;
}

message QueryGetResourceResponse {
ResourceWithMetadata resource = 1;
}

message QueryGetResourceMetadataRequest {
string collection_id = 1;
string id = 2;
}

message QueryGetResourceMetadataResponse {
Metadata resource = 1;
}

message QueryGetCollectionResourcesRequest {
string collection_id = 1;
}

message QueryGetCollectionResourcesResponse {
repeated Metadata resources = 1;
}

message QueryGetAllResourceVersionsRequest {
string collection_id = 1;
string name = 2;
}

message QueryGetAllResourceVersionsResponse {
repeated Metadata resources = 1;
}
29 changes: 29 additions & 0 deletions proto/cheqd/resource/v2/resource.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package cheqd.resource.v2;

option go_package = "github.com/cheqd/cheqd-node/x/resource/types/v2";

message Resource {
bytes data = 1;
}

message ResourceWithMetadata {
Resource resource = 1;
Metadata metadata = 2;
}

message Metadata {
string collection_id = 1;
string id = 2;
string name = 3;
string version = 4;
string resource_type = 5;
repeated string also_known_as = 6;

string media_type = 7;
string created = 8;
bytes checksum = 9;
string previous_version_id = 10;
string next_version_id = 11;
}
Loading