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(textual): Add Enum value renderer #13853

Merged
merged 10 commits into from
Nov 23, 2022
Next Next commit
feat(textual): Add Enum value renderer
  • Loading branch information
amaury1093 committed Nov 14, 2022
commit d282348d2b12acc9a5b68f810cb88e380e2843fb
7 changes: 7 additions & 0 deletions tx/textual/internal/testdata/enum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{ "proto": { "ee": 1 }, "text": "Two" },
{ "proto": { "ee": 2 }, "text": "Three" },
{ "proto": { "ie": 1 }, "text": "Baz.Five" },
{ "proto": { "option": 1 }, "text": "Yes" },
{ "proto": { "option": 4 }, "text": "No with veto" }
]
33 changes: 28 additions & 5 deletions tx/textual/internal/testpb/1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ import "google/protobuf/timestamp.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";

enum Enumeration {
One = 0;
Two = 1;
}

// A is used for testing value renderers.
message A {
// Fields that are parseable by SIGN_MODE_TEXTUAL.
Expand All @@ -27,6 +22,7 @@ message A {
bytes BYTES = 9;
google.protobuf.Timestamp TIMESTAMP = 10;
google.protobuf.Duration DURATION = 11;
ExternalEnum ENUM = 12;

// Fields that are not handled by SIGN_MODE_TEXTUAL.
sint32 SINT32 = 101;
Expand Down Expand Up @@ -55,3 +51,30 @@ message Bar {
string bar_id = 1;
bytes data = 2;
}

enum ExternalEnum {
One = 0;
Two = 1;
EXTERNAL_ENUM_THREE = 2;
}

// Baz is a sampel message type used for testing enum rendering.
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
message Baz {
enum Internal_Enum {
Four = 0;
Five = 1;
}

ExternalEnum ee = 1;
Internal_Enum ie = 2;
BallotOption option = 3;

}

enum BallotOption {
BALLOT_OPTION_UNSPECIFIED = 0;
BALLOT_OPTION_YES = 1;
BALLOT_OPTION_ABSTAIN = 2;
BALLOT_OPTION_NO = 3;
BALLOT_OPTION_NO_WITH_VETO = 4;
}
Loading