From 63681ab2aa3a8898da62023512f1522241f1f8c9 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Thu, 15 Aug 2024 19:01:41 +0800 Subject: [PATCH] fix(grpc): change enum type to numeric for documentation --- Makefile | 2 +- www/grpc/buf/grpc-md.tmpl | 8 +- www/grpc/buf/json-rpc-md.tmpl | 8 +- www/grpc/gen/docs/grpc.md | 85 ++++++++------- www/grpc/gen/docs/json-rpc.md | 103 +++++++++--------- www/grpc/gen/go/wallet.pb.go | 8 +- .../java/pactus/wallet/WalletOuterClass.java | 26 +++++ www/grpc/gen/rust/pactus.rs | 4 + www/grpc/proto/wallet.proto | 4 + www/grpc/swagger-ui/pactus.swagger.json | 4 +- 10 files changed, 146 insertions(+), 106 deletions(-) diff --git a/Makefile b/Makefile index e0d85b568..42dbd216b 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ devtools: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.4 go install github.com/NathanBaulch/protoc-gen-cobra@v1.2 - go install github.com/pactus-project/protoc-gen-doc/cmd/protoc-gen-doc@v0.0.0-20240619124021-76fc28241eb6 + go install github.com/pactus-project/protoc-gen-doc/cmd/protoc-gen-doc@v0.0.0-20240815105130-84e89d0170e4 go install github.com/bufbuild/buf/cmd/buf@v1.34 go install mvdan.cc/gofumpt@latest go install github.com/rakyll/statik@v0.1.7 diff --git a/www/grpc/buf/grpc-md.tmpl b/www/grpc/buf/grpc-md.tmpl index ee82bf3ce..5d68bf4ca 100644 --- a/www/grpc/buf/grpc-md.tmpl +++ b/www/grpc/buf/grpc-md.tmpl @@ -64,7 +64,7 @@ Each PAC is equivalent to 1,000,000,000 or 109 NanoPACs. {{with getEnum .LongType }}{{- print "" -}}
Available values: {{end}}{{- print "" -}} @@ -99,7 +99,7 @@ Message has no fields. {{with getEnum .LongType }}{{- print "" -}}
Available values: {{end}}{{- print "" -}} @@ -119,7 +119,7 @@ Message has no fields. {{with getEnum .LongType }}{{- print "" -}}
Available values: {{end}}{{- print "" -}} @@ -139,7 +139,7 @@ Message has no fields. {{with getEnum .LongType }}{{- print "" -}}
Available values: {{end}}{{- print "" -}} diff --git a/www/grpc/buf/json-rpc-md.tmpl b/www/grpc/buf/json-rpc-md.tmpl index bf2f37433..61e84f968 100644 --- a/www/grpc/buf/json-rpc-md.tmpl +++ b/www/grpc/buf/json-rpc-md.tmpl @@ -115,7 +115,7 @@ curl --location 'http://localhost:8545/' \ {{with getEnum .LongType }}{{- print "" -}}
Available values: {{end}}{{- print "" -}} @@ -150,7 +150,7 @@ Parameters has no fields. {{with getEnum .LongType }}{{- print "" -}}
Available values: {{end}}{{- print "" -}} @@ -170,7 +170,7 @@ Parameters has no fields. {{with getEnum .LongType }}{{- print "" -}}
Available values: {{end}}{{- print "" -}} @@ -190,7 +190,7 @@ Parameters has no fields. {{with getEnum .LongType }}{{- print "" -}}
Available values: {{end}}{{- print "" -}} diff --git a/www/grpc/gen/docs/grpc.md b/www/grpc/gen/docs/grpc.md index 4a5202701..583f0ef30 100644 --- a/www/grpc/gen/docs/grpc.md +++ b/www/grpc/gen/docs/grpc.md @@ -196,8 +196,8 @@ parameters.

(Enum) The verbosity level for transaction details.
Available values: @@ -279,12 +279,12 @@ parameters.

(Enum) The type of transaction payload.
Available values: @@ -456,12 +456,12 @@ and payload type.

(Enum) The type of transaction payload.
Available values: @@ -842,9 +842,9 @@ parameters.

(Enum) The verbosity level for block information.
Available values: @@ -1025,12 +1025,12 @@ BLOCK_TRANSACTIONS. (Enum) The type of transaction payload.
Available values: @@ -1471,10 +1471,10 @@ committee. (Enum) The type of the vote.
Available values: @@ -1885,12 +1885,12 @@ address.

(Enum) The type of transactions to retrieve from the transaction pool. 0 means all types.
Available values: @@ -1958,12 +1958,12 @@ types. (Enum) The type of transaction payload.
Available values: @@ -2885,9 +2885,10 @@ public key.

(Enum) The type of address to generate.
Available values: diff --git a/www/grpc/gen/docs/json-rpc.md b/www/grpc/gen/docs/json-rpc.md index af07bb94d..800aa3dc7 100644 --- a/www/grpc/gen/docs/json-rpc.md +++ b/www/grpc/gen/docs/json-rpc.md @@ -243,12 +243,12 @@ parameters.

verbosity - string + numeric (Enum) The verbosity level for transaction details.
Available values: @@ -326,16 +326,16 @@ parameters.

transaction.payload_type - string + numeric (Enum) The type of transaction payload.
Available values: @@ -503,16 +503,16 @@ and payload type.

payload_type - string + numeric (Enum) The type of transaction payload.
Available values: @@ -889,13 +889,13 @@ parameters.

verbosity - string + numeric (Enum) The verbosity level for block information.
Available values: @@ -1072,16 +1072,16 @@ BLOCK_TRANSACTIONS. txs[].payload_type - string + numeric (Enum) The type of transaction payload.
Available values: @@ -1518,14 +1518,14 @@ committee. instances[].votes[].type - string + numeric (Enum) The type of the vote.
Available values: @@ -1931,17 +1931,17 @@ address.

payload_type - string + numeric (Enum) The type of transactions to retrieve from the transaction pool. 0 means all types.
Available values: @@ -2005,16 +2005,16 @@ types. txs[].payload_type - string + numeric (Enum) The type of transaction payload.
Available values: @@ -2932,13 +2932,14 @@ public key.

address_type - string + numeric (Enum) The type of address to generate.
Available values: diff --git a/www/grpc/gen/go/wallet.pb.go b/www/grpc/gen/go/wallet.pb.go index 30c89c687..61a05eba7 100644 --- a/www/grpc/gen/go/wallet.pb.go +++ b/www/grpc/gen/go/wallet.pb.go @@ -26,8 +26,12 @@ const ( type AddressType int32 const ( - AddressType_ADDRESS_TYPE_TREASURY AddressType = 0 - AddressType_ADDRESS_TYPE_VALIDATOR AddressType = 1 + // Treasury address type. + // Should not be used to generate new addresses. + AddressType_ADDRESS_TYPE_TREASURY AddressType = 0 + // Validator address type. + AddressType_ADDRESS_TYPE_VALIDATOR AddressType = 1 + // Account address type with BLS signature scheme. AddressType_ADDRESS_TYPE_BLS_ACCOUNT AddressType = 2 ) diff --git a/www/grpc/gen/java/pactus/wallet/WalletOuterClass.java b/www/grpc/gen/java/pactus/wallet/WalletOuterClass.java index 57746fdb6..9cf8b97d7 100644 --- a/www/grpc/gen/java/pactus/wallet/WalletOuterClass.java +++ b/www/grpc/gen/java/pactus/wallet/WalletOuterClass.java @@ -24,14 +24,27 @@ public static void registerAllExtensions( public enum AddressType implements com.google.protobuf.ProtocolMessageEnum { /** + *
+     * Treasury address type.
+     * Should not be used to generate new addresses.
+     * 
+ * * ADDRESS_TYPE_TREASURY = 0; */ ADDRESS_TYPE_TREASURY(0), /** + *
+     * Validator address type.
+     * 
+ * * ADDRESS_TYPE_VALIDATOR = 1; */ ADDRESS_TYPE_VALIDATOR(1), /** + *
+     * Account address type with BLS signature scheme.
+     * 
+ * * ADDRESS_TYPE_BLS_ACCOUNT = 2; */ ADDRESS_TYPE_BLS_ACCOUNT(2), @@ -39,14 +52,27 @@ public enum AddressType ; /** + *
+     * Treasury address type.
+     * Should not be used to generate new addresses.
+     * 
+ * * ADDRESS_TYPE_TREASURY = 0; */ public static final int ADDRESS_TYPE_TREASURY_VALUE = 0; /** + *
+     * Validator address type.
+     * 
+ * * ADDRESS_TYPE_VALIDATOR = 1; */ public static final int ADDRESS_TYPE_VALIDATOR_VALUE = 1; /** + *
+     * Account address type with BLS signature scheme.
+     * 
+ * * ADDRESS_TYPE_BLS_ACCOUNT = 2; */ public static final int ADDRESS_TYPE_BLS_ACCOUNT_VALUE = 2; diff --git a/www/grpc/gen/rust/pactus.rs b/www/grpc/gen/rust/pactus.rs index 897e4a1b0..0ee61993b 100644 --- a/www/grpc/gen/rust/pactus.rs +++ b/www/grpc/gen/rust/pactus.rs @@ -1218,8 +1218,12 @@ pub struct SignMessageResponse { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum AddressType { + /// Treasury address type. + /// Should not be used to generate new addresses. Treasury = 0, + /// Validator address type. Validator = 1, + /// Account address type with BLS signature scheme. BlsAccount = 2, } impl AddressType { diff --git a/www/grpc/proto/wallet.proto b/www/grpc/proto/wallet.proto index b6dd88b1b..9deaa99bb 100644 --- a/www/grpc/proto/wallet.proto +++ b/www/grpc/proto/wallet.proto @@ -48,8 +48,12 @@ service Wallet { // Enum for the address type. enum AddressType { + // Treasury address type. + // Should not be used to generate new addresses. ADDRESS_TYPE_TREASURY = 0; + // Validator address type. ADDRESS_TYPE_VALIDATOR = 1; + // Account address type with BLS signature scheme. ADDRESS_TYPE_BLS_ACCOUNT = 2; } diff --git a/www/grpc/swagger-ui/pactus.swagger.json b/www/grpc/swagger-ui/pactus.swagger.json index c7a3d6e1e..fb438593b 100644 --- a/www/grpc/swagger-ui/pactus.swagger.json +++ b/www/grpc/swagger-ui/pactus.swagger.json @@ -971,7 +971,7 @@ }, { "name": "addressType", - "description": "The type of address to generate.", + "description": "The type of address to generate.\n\n - ADDRESS_TYPE_TREASURY: Treasury address type.\nShould not be used to generate new addresses.\n - ADDRESS_TYPE_VALIDATOR: Validator address type.\n - ADDRESS_TYPE_BLS_ACCOUNT: Account address type with BLS signature scheme.", "in": "query", "required": false, "type": "string", @@ -1328,7 +1328,7 @@ "ADDRESS_TYPE_BLS_ACCOUNT" ], "default": "ADDRESS_TYPE_TREASURY", - "description": "Enum for the address type." + "description": "Enum for the address type.\n\n - ADDRESS_TYPE_TREASURY: Treasury address type.\nShould not be used to generate new addresses.\n - ADDRESS_TYPE_VALIDATOR: Validator address type.\n - ADDRESS_TYPE_BLS_ACCOUNT: Account address type with BLS signature scheme." }, "pactusBlockHeaderInfo": { "type": "object",