Update proto files and regenerate bindings

This commit is contained in:
Prathamesh Musale 2024-07-25 16:47:18 +05:30
parent 022c55268c
commit 651ea33ec5
6 changed files with 160 additions and 34 deletions

View File

@ -4,13 +4,14 @@
Run following scripts when [proto files](./proto/) are updated. Run following scripts when [proto files](./proto/) are updated.
1. Install dependencies * Install dependencies:
```bash
yarn
```
2. Generate typescript code for the proto files ```bash
yarn
```
```bash * Generate typescript bindings for the proto files:
./scripts/proto-gen.sh
``` ```bash
./scripts/proto-gen.sh
```

View File

@ -8,28 +8,50 @@ option go_package = "git.vdb.to/cerc-io/laconicd/x/onboarding";
// Params defines the parameters of the onboarding module. // Params defines the parameters of the onboarding module.
message Params { message Params {
bool onboarding_enabled = 1 [ bool onboarding_enabled = 1
(gogoproto.moretags) = "json:\"onboarding_enabled\" yaml:\"onboarding_enabled\"" [ (gogoproto.moretags) =
]; "json:\"onboarding_enabled\" yaml:\"onboarding_enabled\"" ];
} }
// Participant defines the data that will be stored for each enrolled participant // Participant defines the data that will be stored for each enrolled
// participant
message Participant { message Participant {
string cosmos_address = 1 [ // participant's cosmos (laconic) address
(gogoproto.moretags) = "json:\"cosmos_address\" yaml:\"cosmos_address\"" string cosmos_address = 1
]; [ (gogoproto.moretags) =
"json:\"cosmos_address\" yaml:\"cosmos_address\"" ];
string nitro_address = 2 [ // participant's Nitro address
(gogoproto.moretags) = "json:\"nitro_address\" yaml:\"nitro_address\"" string nitro_address = 2
]; [ (gogoproto.moretags) =
"json:\"nitro_address\" yaml:\"nitro_address\"" ];
// participant's role (participant | validator)
Role role = 3 [ (gogoproto.moretags) = "json:\"role\" yaml:\"role\"" ];
// participant's KYC receipt ID
string kyc_id = 4
[ (gogoproto.moretags) = "json:\"kyc_id\" yaml:\"kyc_id\"" ];
} }
// EthPayload defines the payload that is signed by the ethereum private key // EthPayload defines the payload that is signed by the ethereum private key
message EthPayload { message EthPayload {
string address = 1 [ string address = 1
(gogoproto.moretags) = "json:\"address\" yaml:\"address\"" [ (gogoproto.moretags) = "json:\"address\" yaml:\"address\"" ];
];
string msg = 2 [ string msg = 2 [ (gogoproto.moretags) = "json:\"msg\" yaml:\"msg\"" ];
(gogoproto.moretags) = "json:\"msg\" yaml:\"msg\"" }
];
// Participant Role
enum Role {
option (gogoproto.goproto_enum_prefix) = false;
// ROLE_UNSPECIFIED indicates unknown role.
ROLE_UNSPECIFIED = 0;
// ROLE_PARTICIPANT indicates the participant role.
ROLE_PARTICIPANT = 1;
// ROLE_VALIDATOR indicates user participating as a validator.
ROLE_VALIDATOR = 2;
} }

View File

@ -12,7 +12,8 @@ option go_package = "git.vdb.to/cerc-io/laconicd/x/onboarding";
// Query defines the gRPC querier service for onboarding module // Query defines the gRPC querier service for onboarding module
service Query { service Query {
// Participants queries Participants list // Participants queries Participants list
rpc Participants(QueryParticipantsRequest) returns (QueryParticipantsResponse) { rpc Participants(QueryParticipantsRequest)
returns (QueryParticipantsResponse) {
option (google.api.http).get = "/cerc/onboarding/v1/participants"; option (google.api.http).get = "/cerc/onboarding/v1/participants";
} }
} }

View File

@ -15,9 +15,9 @@ service Msg {
// OnboardParticipant defines a method for enrolling a new validator. // OnboardParticipant defines a method for enrolling a new validator.
rpc OnboardParticipant(MsgOnboardParticipant) rpc OnboardParticipant(MsgOnboardParticipant)
returns (MsgOnboardParticipantResponse) { returns (MsgOnboardParticipantResponse) {
option (google.api.http).post = "/cerc/onboarding/v1/onboard_participant"; option (google.api.http).post = "/cerc/onboarding/v1/onboard_participant";
}; };
} }
// MsgOnboardParticipant defines a SDK message for enrolling a new validator. // MsgOnboardParticipant defines a SDK message for enrolling a new validator.
@ -28,7 +28,10 @@ message MsgOnboardParticipant {
string participant = 1; string participant = 1;
EthPayload eth_payload = 2 [ (gogoproto.nullable) = false ]; EthPayload eth_payload = 2 [ (gogoproto.nullable) = false ];
string eth_signature = 3; string eth_signature = 3;
Role role = 4;
string kyc_id = 5;
} }
// MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response type. // MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response
// type.
message MsgOnboardParticipantResponse {} message MsgOnboardParticipantResponse {}

View File

@ -4,15 +4,67 @@ import _m0 from "protobufjs/minimal";
export const protobufPackage = "cerc.onboarding.v1"; export const protobufPackage = "cerc.onboarding.v1";
/** Participant Role */
export enum Role {
/** ROLE_UNSPECIFIED - ROLE_UNSPECIFIED indicates unknown role. */
ROLE_UNSPECIFIED = 0,
/** ROLE_PARTICIPANT - ROLE_PARTICIPANT indicates the participant role. */
ROLE_PARTICIPANT = 1,
/** ROLE_VALIDATOR - ROLE_VALIDATOR indicates user participating as a validator. */
ROLE_VALIDATOR = 2,
UNRECOGNIZED = -1,
}
export function roleFromJSON(object: any): Role {
switch (object) {
case 0:
case "ROLE_UNSPECIFIED":
return Role.ROLE_UNSPECIFIED;
case 1:
case "ROLE_PARTICIPANT":
return Role.ROLE_PARTICIPANT;
case 2:
case "ROLE_VALIDATOR":
return Role.ROLE_VALIDATOR;
case -1:
case "UNRECOGNIZED":
default:
return Role.UNRECOGNIZED;
}
}
export function roleToJSON(object: Role): string {
switch (object) {
case Role.ROLE_UNSPECIFIED:
return "ROLE_UNSPECIFIED";
case Role.ROLE_PARTICIPANT:
return "ROLE_PARTICIPANT";
case Role.ROLE_VALIDATOR:
return "ROLE_VALIDATOR";
case Role.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** Params defines the parameters of the onboarding module. */ /** Params defines the parameters of the onboarding module. */
export interface Params { export interface Params {
onboardingEnabled: boolean; onboardingEnabled: boolean;
} }
/** Participant defines the data that will be stored for each enrolled participant */ /**
* Participant defines the data that will be stored for each enrolled
* participant
*/
export interface Participant { export interface Participant {
/** participant's cosmos (laconic) address */
cosmosAddress: string; cosmosAddress: string;
/** participant's Nitro address */
nitroAddress: string; nitroAddress: string;
/** participant's role (participant | validator) */
role: Role;
/** participant's KYC receipt ID */
kycId: string;
} }
/** EthPayload defines the payload that is signed by the ethereum private key */ /** EthPayload defines the payload that is signed by the ethereum private key */
@ -77,7 +129,7 @@ export const Params = {
}; };
function createBaseParticipant(): Participant { function createBaseParticipant(): Participant {
return { cosmosAddress: "", nitroAddress: "" }; return { cosmosAddress: "", nitroAddress: "", role: 0, kycId: "" };
} }
export const Participant = { export const Participant = {
@ -91,6 +143,12 @@ export const Participant = {
if (message.nitroAddress !== "") { if (message.nitroAddress !== "") {
writer.uint32(18).string(message.nitroAddress); writer.uint32(18).string(message.nitroAddress);
} }
if (message.role !== 0) {
writer.uint32(24).int32(message.role);
}
if (message.kycId !== "") {
writer.uint32(34).string(message.kycId);
}
return writer; return writer;
}, },
@ -107,6 +165,12 @@ export const Participant = {
case 2: case 2:
message.nitroAddress = reader.string(); message.nitroAddress = reader.string();
break; break;
case 3:
message.role = reader.int32() as any;
break;
case 4:
message.kycId = reader.string();
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;
@ -123,6 +187,8 @@ export const Participant = {
nitroAddress: isSet(object.nitroAddress) nitroAddress: isSet(object.nitroAddress)
? String(object.nitroAddress) ? String(object.nitroAddress)
: "", : "",
role: isSet(object.role) ? roleFromJSON(object.role) : 0,
kycId: isSet(object.kycId) ? String(object.kycId) : "",
}; };
}, },
@ -132,6 +198,8 @@ export const Participant = {
(obj.cosmosAddress = message.cosmosAddress); (obj.cosmosAddress = message.cosmosAddress);
message.nitroAddress !== undefined && message.nitroAddress !== undefined &&
(obj.nitroAddress = message.nitroAddress); (obj.nitroAddress = message.nitroAddress);
message.role !== undefined && (obj.role = roleToJSON(message.role));
message.kycId !== undefined && (obj.kycId = message.kycId);
return obj; return obj;
}, },
@ -141,6 +209,8 @@ export const Participant = {
const message = createBaseParticipant(); const message = createBaseParticipant();
message.cosmosAddress = object.cosmosAddress ?? ""; message.cosmosAddress = object.cosmosAddress ?? "";
message.nitroAddress = object.nitroAddress ?? ""; message.nitroAddress = object.nitroAddress ?? "";
message.role = object.role ?? 0;
message.kycId = object.kycId ?? "";
return message; return message;
}, },
}; };

View File

@ -1,5 +1,5 @@
/* eslint-disable */ /* eslint-disable */
import { EthPayload } from "./onboarding"; import { EthPayload, Role, roleFromJSON, roleToJSON } from "./onboarding";
import Long from "long"; import Long from "long";
import _m0 from "protobufjs/minimal"; import _m0 from "protobufjs/minimal";
@ -11,13 +11,24 @@ export interface MsgOnboardParticipant {
participant: string; participant: string;
ethPayload?: EthPayload; ethPayload?: EthPayload;
ethSignature: string; ethSignature: string;
role: Role;
kycId: string;
} }
/** MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response type. */ /**
* MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response
* type.
*/
export interface MsgOnboardParticipantResponse {} export interface MsgOnboardParticipantResponse {}
function createBaseMsgOnboardParticipant(): MsgOnboardParticipant { function createBaseMsgOnboardParticipant(): MsgOnboardParticipant {
return { participant: "", ethPayload: undefined, ethSignature: "" }; return {
participant: "",
ethPayload: undefined,
ethSignature: "",
role: 0,
kycId: "",
};
} }
export const MsgOnboardParticipant = { export const MsgOnboardParticipant = {
@ -34,6 +45,12 @@ export const MsgOnboardParticipant = {
if (message.ethSignature !== "") { if (message.ethSignature !== "") {
writer.uint32(26).string(message.ethSignature); writer.uint32(26).string(message.ethSignature);
} }
if (message.role !== 0) {
writer.uint32(32).int32(message.role);
}
if (message.kycId !== "") {
writer.uint32(42).string(message.kycId);
}
return writer; return writer;
}, },
@ -56,6 +73,12 @@ export const MsgOnboardParticipant = {
case 3: case 3:
message.ethSignature = reader.string(); message.ethSignature = reader.string();
break; break;
case 4:
message.role = reader.int32() as any;
break;
case 5:
message.kycId = reader.string();
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;
@ -73,6 +96,8 @@ export const MsgOnboardParticipant = {
ethSignature: isSet(object.ethSignature) ethSignature: isSet(object.ethSignature)
? String(object.ethSignature) ? String(object.ethSignature)
: "", : "",
role: isSet(object.role) ? roleFromJSON(object.role) : 0,
kycId: isSet(object.kycId) ? String(object.kycId) : "",
}; };
}, },
@ -86,6 +111,8 @@ export const MsgOnboardParticipant = {
: undefined); : undefined);
message.ethSignature !== undefined && message.ethSignature !== undefined &&
(obj.ethSignature = message.ethSignature); (obj.ethSignature = message.ethSignature);
message.role !== undefined && (obj.role = roleToJSON(message.role));
message.kycId !== undefined && (obj.kycId = message.kycId);
return obj; return obj;
}, },
@ -99,6 +126,8 @@ export const MsgOnboardParticipant = {
? EthPayload.fromPartial(object.ethPayload) ? EthPayload.fromPartial(object.ethPayload)
: undefined; : undefined;
message.ethSignature = object.ethSignature ?? ""; message.ethSignature = object.ethSignature ?? "";
message.role = object.role ?? 0;
message.kycId = object.kycId ?? "";
return message; return message;
}, },
}; };