From 816c695e059003554d3946e3ee94b6dc95794c20 Mon Sep 17 00:00:00 2001 From: Snobbish Bee <125891987+snobbee@users.noreply.github.com> Date: Sat, 9 Dec 2023 12:48:59 +0100 Subject: [PATCH] Build/update proto (#852) build: update core proto files --- core/package.json | 2 +- core/proto/sifnode/clp/v1/genesis.proto | 2 + core/proto/sifnode/clp/v1/params.proto | 3 + core/proto/sifnode/clp/v1/querier.proto | 30 +- .../proto/sifnode/clp/v1/rewards_bucket.proto | 17 + core/proto/sifnode/clp/v1/tx.proto | 12 + core/proto/sifnode/clp/v1/types.proto | 13 + core/proto/sifnode/epochs/v1/genesis.proto | 40 + core/proto/sifnode/epochs/v1/query.proto | 51 ++ .../proto/google/protobuf/descriptor.ts | 682 +++++++++++++++++- .../proto/google/protobuf/duration.ts | 187 +++++ .../proto/google/protobuf/timestamp.ts | 218 ++++++ .../generated/proto/sifnode/clp/v1/genesis.ts | 23 + .../generated/proto/sifnode/clp/v1/params.ts | 51 ++ .../generated/proto/sifnode/clp/v1/querier.ts | 317 ++++++++ .../proto/sifnode/clp/v1/rewards_bucket.ts | 110 +++ core/src/generated/proto/sifnode/clp/v1/tx.ts | 197 +++++ .../generated/proto/sifnode/clp/v1/types.ts | 57 ++ .../proto/sifnode/epochs/v1/genesis.ts | 317 ++++++++ .../proto/sifnode/epochs/v1/query.ts | 409 +++++++++++ package.json | 2 +- 21 files changed, 2708 insertions(+), 32 deletions(-) create mode 100644 core/proto/sifnode/clp/v1/rewards_bucket.proto create mode 100644 core/proto/sifnode/epochs/v1/genesis.proto create mode 100644 core/proto/sifnode/epochs/v1/query.proto create mode 100644 core/src/generated/proto/google/protobuf/duration.ts create mode 100644 core/src/generated/proto/google/protobuf/timestamp.ts create mode 100644 core/src/generated/proto/sifnode/clp/v1/rewards_bucket.ts create mode 100644 core/src/generated/proto/sifnode/epochs/v1/genesis.ts create mode 100644 core/src/generated/proto/sifnode/epochs/v1/query.ts diff --git a/core/package.json b/core/package.json index f411e07b7..0b7d7e340 100644 --- a/core/package.json +++ b/core/package.json @@ -14,7 +14,7 @@ "integration": "./scripts/integration.sh", "test": "yarn jest --passWithNoTests --collect-coverage --projects jest-unit.config.js", "test:integration": "yarn jest --projects --collect-coverage jest-integration.config.js", - "syncProto": "rm -rf proto && degit Sifchain/sifnode/proto/sifnode#${TAG:-'develop'} proto/sifnode && degit Sifchain/sifnode/third_party/proto#${TAG:-'develop'} proto/third_party", + "syncProto": "rm -rf proto && degit Sifchain/sifnode/proto/sifnode#${TAG:-'master'} proto/sifnode && degit Sifchain/sifnode/third_party/proto#${TAG:-'master'} proto/third_party", "codegen": "protoc -I=proto -I=proto/third_party proto/sifnode/**/**/*.proto --plugin=../node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=src/generated/proto --ts_proto_opt='esModuleInterop=true,forceLong=long,useOptionals=messages'" }, "files": [ diff --git a/core/proto/sifnode/clp/v1/genesis.proto b/core/proto/sifnode/clp/v1/genesis.proto index 57fea2a46..e06d5b6b4 100644 --- a/core/proto/sifnode/clp/v1/genesis.proto +++ b/core/proto/sifnode/clp/v1/genesis.proto @@ -7,6 +7,7 @@ option go_package = "github.com/Sifchain/sifnode/x/clp/types"; import "sifnode/clp/v1/params.proto"; import "sifnode/clp/v1/types.proto"; +import "sifnode/clp/v1/rewards_bucket.proto"; // GenesisState - all clp state that must be provided at genesis // TODO: Add parameters to Genesis state ,such as minimum liquidity required to @@ -16,4 +17,5 @@ message GenesisState { repeated string address_whitelist = 2; repeated sifnode.clp.v1.Pool pool_list = 3; repeated sifnode.clp.v1.LiquidityProvider liquidity_providers = 4; + repeated RewardsBucket rewards_bucket_list = 5 [(gogoproto.nullable) = false]; } diff --git a/core/proto/sifnode/clp/v1/params.proto b/core/proto/sifnode/clp/v1/params.proto index c52bb210c..d79e21a9f 100644 --- a/core/proto/sifnode/clp/v1/params.proto +++ b/core/proto/sifnode/clp/v1/params.proto @@ -17,6 +17,9 @@ message RewardParams { repeated RewardPeriod reward_periods = 4; string reward_period_start_time = 5; // start time of the current (or last) reward period + uint64 rewards_lock_period = 6; // in blocks + string rewards_epoch_identifier = 7; // week, day, hour, etc + bool rewards_distribute = 8; // true if reward bucket should be distributed } // These params are non-governable and are calculated on chain diff --git a/core/proto/sifnode/clp/v1/querier.proto b/core/proto/sifnode/clp/v1/querier.proto index c15539dcb..dce3ae87b 100644 --- a/core/proto/sifnode/clp/v1/querier.proto +++ b/core/proto/sifnode/clp/v1/querier.proto @@ -6,6 +6,7 @@ import "sifnode/clp/v1/types.proto"; import "sifnode/clp/v1/params.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; +import "sifnode/clp/v1/rewards_bucket.proto"; option go_package = "github.com/Sifchain/sifnode/x/clp/types"; @@ -59,6 +60,15 @@ service Query { rpc GetPoolShareEstimate(PoolShareEstimateReq) returns (PoolShareEstimateRes) { option (google.api.http).get = "/sifchain/clp/v1/pool_share_estimate"; }; + // Queries a list of RewardsBucket items. + rpc GetRewardsBucket (RewardsBucketReq) returns (RewardsBucketRes) { + option (google.api.http).get = "/sifchain/clp/v1/rewards_bucket/{denom}"; + + } + rpc GetRewardsBucketAll (AllRewardsBucketReq) returns (AllRewardsBucketRes) { + option (google.api.http).get = "/sifchain/clp/v1/clp/rewards_bucket"; + + } } message PoolReq { @@ -262,4 +272,22 @@ message SwapInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", (gogoproto.nullable) = false ]; -} \ No newline at end of file +} + +message RewardsBucketReq { + string denom = 1; +} + +message RewardsBucketRes { + RewardsBucket rewards_bucket = 1 [(gogoproto.nullable) = false]; +} + +message AllRewardsBucketReq { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message AllRewardsBucketRes { + repeated RewardsBucket rewards_bucket = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/core/proto/sifnode/clp/v1/rewards_bucket.proto b/core/proto/sifnode/clp/v1/rewards_bucket.proto new file mode 100644 index 000000000..a40857577 --- /dev/null +++ b/core/proto/sifnode/clp/v1/rewards_bucket.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package sifnode.clp.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Sifchain/sifnode/x/clp/types"; + +message RewardsBucket { + string denom = 1; + string amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"amount\"" + ]; + +} + diff --git a/core/proto/sifnode/clp/v1/tx.proto b/core/proto/sifnode/clp/v1/tx.proto index 4f6c47bf0..96e144816 100644 --- a/core/proto/sifnode/clp/v1/tx.proto +++ b/core/proto/sifnode/clp/v1/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sifnode.clp.v1; import "gogoproto/gogo.proto"; +import "cosmos/base/coin.proto"; import "sifnode/clp/v1/types.proto"; import "sifnode/clp/v1/params.proto"; @@ -34,6 +35,7 @@ service Msg { rpc ModifyLiquidityProtectionRates(MsgModifyLiquidityProtectionRates) returns (MsgModifyLiquidityProtectionRatesResponse); rpc AddProviderDistributionPeriod(MsgAddProviderDistributionPeriodRequest) returns (MsgAddProviderDistributionPeriodResponse); rpc UpdateSwapFeeParams(MsgUpdateSwapFeeParamsRequest) returns (MsgUpdateSwapFeeParamsResponse); + rpc AddLiquidityToRewardsBucket (MsgAddLiquidityToRewardsBucketRequest) returns (MsgAddLiquidityToRewardsBucketResponse); } // message MsgUpdateStakingRewardParams{ @@ -198,6 +200,9 @@ message MsgUpdateRewardsParamsRequest { string signer = 1 [ (gogoproto.moretags) = "yaml:\"signer\"" ]; uint64 liquidity_removal_lock_period = 2; // in blocks uint64 liquidity_removal_cancel_period = 3; // in blocks + uint64 rewards_lock_period = 4; // in blocks + string rewards_epoch_identifier = 5; // week, day, hour, etc + bool rewards_distribute = 6; // true or false } message MsgUpdateRewardsParamsResponse {} @@ -281,3 +286,10 @@ message MsgUpdateSwapFeeParamsRequest { } message MsgUpdateSwapFeeParamsResponse {} + +message MsgAddLiquidityToRewardsBucketRequest { + string signer = 1; +repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; +} + +message MsgAddLiquidityToRewardsBucketResponse {} diff --git a/core/proto/sifnode/clp/v1/types.proto b/core/proto/sifnode/clp/v1/types.proto index 8bbad35e0..a46cad6b4 100644 --- a/core/proto/sifnode/clp/v1/types.proto +++ b/core/proto/sifnode/clp/v1/types.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package sifnode.clp.v1; import "gogoproto/gogo.proto"; +import "cosmos/base/coin.proto"; option go_package = "github.com/Sifchain/sifnode/x/clp/types"; @@ -79,6 +80,12 @@ message Pool { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", (gogoproto.nullable) = false ]; + // the amount of external asset rewards distributed to liquidity providers from reward buckets + string reward_amount_external = 19 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"reward_amount_external\"" + ]; } message LiquidityProvider { @@ -90,6 +97,12 @@ message LiquidityProvider { ]; string liquidity_provider_address = 3; repeated LiquidityUnlock unlocks = 4; + int64 last_updated_block = 5; // contains the block height of the last update + // distributed or added to liquidity provider shares rewards + repeated cosmos.base.v1beta1.Coin reward_amount = 6 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } message LiquidityUnlock { diff --git a/core/proto/sifnode/epochs/v1/genesis.proto b/core/proto/sifnode/epochs/v1/genesis.proto new file mode 100644 index 000000000..88e2a25fc --- /dev/null +++ b/core/proto/sifnode/epochs/v1/genesis.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package sifnode.epochs.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/Sifchain/sifnode/x/epochs/types"; + +// EpochInfo defines the message interface containing the relevant informations about +// an epoch. +message EpochInfo { + // identifier of the epoch + string identifier = 1; + // start_time of the epoch + google.protobuf.Timestamp start_time = 2 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // duration of the epoch + google.protobuf.Duration duration = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true + ]; + // current_epoch is the integer identifier of the epoch + int64 current_epoch = 4; + // current_epoch_start_time defines the timestamp of the start of the epoch + google.protobuf.Timestamp current_epoch_start_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false + ]; + // epoch_counting_started reflects if the counting for the epoch has started + bool epoch_counting_started = 6; + // current_epoch_start_height of the epoch + int64 current_epoch_start_height = 7; +} + +// GenesisState defines the epochs module's genesis state. +message GenesisState { + // epochs is a slice of EpochInfo that defines the epochs in the genesis state + repeated EpochInfo epochs = 1 [(gogoproto.nullable) = false]; +} diff --git a/core/proto/sifnode/epochs/v1/query.proto b/core/proto/sifnode/epochs/v1/query.proto new file mode 100644 index 000000000..1f63c7a42 --- /dev/null +++ b/core/proto/sifnode/epochs/v1/query.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; +package sifnode.epochs.v1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "sifnode/epochs/v1/genesis.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/Sifchain/sifnode/x/epochs/types"; + +// Query defines the gRPC querier service. +service Query { + // EpochInfos provide running epochInfos + rpc EpochInfos(QueryEpochsInfoRequest) returns (QueryEpochsInfoResponse) { + option (google.api.http).get = "/Sifchain/sifnode/epochs/v1/epochs"; + } + // CurrentEpoch provide current epoch of specified identifier + rpc CurrentEpoch(QueryCurrentEpochRequest) returns (QueryCurrentEpochResponse) { + option (google.api.http).get = "/Sifchain/sifnode/epochs/v1/current_epoch"; + } +} + +// QueryEpochsInfoRequest is the request type for the Query/EpochInfos RPC +// method. +message QueryEpochsInfoRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryEpochsInfoResponse is the response type for the Query/EpochInfos RPC +// method. +message QueryEpochsInfoResponse { + // epochs is a slice of all EpochInfos + repeated EpochInfo epochs = 1 [(gogoproto.nullable) = false]; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryCurrentEpochRequest is the request type for the Query/EpochInfos RPC +// method. +message QueryCurrentEpochRequest { + // identifier of the current epoch + string identifier = 1; +} + +// QueryCurrentEpochResponse is the response type for the Query/EpochInfos RPC +// method. +message QueryCurrentEpochResponse { + // current_epoch is the number of the current epoch + int64 current_epoch = 1; +} \ No newline at end of file diff --git a/core/src/generated/proto/google/protobuf/descriptor.ts b/core/src/generated/proto/google/protobuf/descriptor.ts index 578e982ce..29ccc2cd9 100644 --- a/core/src/generated/proto/google/protobuf/descriptor.ts +++ b/core/src/generated/proto/google/protobuf/descriptor.ts @@ -42,9 +42,13 @@ export interface FileDescriptorProto { sourceCodeInfo?: SourceCodeInfo; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ syntax: string; + /** The edition of the proto file, which is an opaque string. */ + edition: string; } /** Describes a message type. */ @@ -88,6 +92,91 @@ export interface DescriptorProto_ReservedRange { export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * go/protobuf-stripping-extension-declarations + * Like Metadata, but we use a repeated field to hold all extension + * declarations. This should avoid the size increases of transforming a large + * extension range into small ranges in generated binaries. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** + * The verification state of the range. + * TODO(b/278783756): flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification: ExtensionRangeOptions_VerificationState; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON( + object: any, +): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON( + object: ExtensionRangeOptions_VerificationState, +): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number: number; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName: string; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type: string; + /** + * Deprecated. Please use "repeated". + * + * @deprecated + */ + isRepeated: boolean; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved: boolean; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated: boolean; } /** Describes a field within a message. */ @@ -118,7 +207,6 @@ export interface FieldDescriptorProto { * For booleans, "true" or "false". * For strings, contains the default text contents (not escaped in any way). * For bytes, contains the C escaped value. All bytes >= 128 are escaped. - * TODO(kenton): Base-64 encode? */ defaultValue: string; /** @@ -437,18 +525,18 @@ export interface FileOptions { */ javaPackage: string; /** - * If set, all the classes from the .proto file are wrapped in a single - * outer class with the given name. This applies to both Proto1 - * (equivalent to the old "--one_java_file" option) and Proto2 (where - * a .proto always translates to a single class, but you may want to - * explicitly choose the class name). + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. */ javaOuterClassname: string; /** - * If set true, then the Java code generator will generate a separate .java + * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto - * file. Thus, these types will *not* be nested inside the outer class - * named by java_outer_classname. However, the outer class will still be + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ @@ -632,6 +720,10 @@ export interface MessageOptions { */ deprecated: boolean; /** + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + * * Whether the message is an automatically generated map entry type for the * maps field. * @@ -649,12 +741,23 @@ export interface MessageOptions { * use a native map in the target language to hold the keys and values. * The reflection APIs in such implementations still need to work as * if the field is a repeated message field. - * - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. */ mapEntry: boolean; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO(b/261750190) This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts: boolean; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -663,8 +766,10 @@ export interface FieldOptions { /** * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! */ ctype: FieldOptions_CType; /** @@ -707,7 +812,6 @@ export interface FieldOptions { * call from multiple threads concurrently, while non-const methods continue * to require exclusive access. * - * * Note that implementations may choose not to check required fields within * a lazy sub-message. That is, calling IsInitialized() on the outer message * may return true even if the inner message has missing required fields. @@ -718,8 +822,17 @@ export interface FieldOptions { * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. + * + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. */ lazy: boolean; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverifiedLazy: boolean; /** * Is this field deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -729,6 +842,15 @@ export interface FieldOptions { deprecated: boolean; /** For Google-internal migration only. Do not use. */ weak: boolean; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact: boolean; + retention: FieldOptions_OptionRetention; + /** @deprecated */ + target: FieldOptions_OptionTargetType; + targets: FieldOptions_OptionTargetType[]; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -736,6 +858,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -815,6 +945,145 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON( + object: any, +): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON( + object: FieldOptions_OptionRetention, +): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON( + object: any, +): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON( + object: FieldOptions_OptionTargetType, +): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + export interface OneofOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; @@ -833,6 +1102,17 @@ export interface EnumOptions { * is a formalization for deprecating enums. */ deprecated: boolean; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO(b/261750190) Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts: boolean; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -950,8 +1230,8 @@ export interface UninterpretedOption { * The name of the uninterpreted option. Each string represents a segment in * a dot-separated name. is_extension is true iff a segment represents an * extension (denoted with parentheses in options specs in .proto files). - * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - * "foo.(bar.baz).qux". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -1017,8 +1297,8 @@ export interface SourceCodeInfo_Location { * location. * * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition. For - * example, this path: + * the root FileDescriptorProto to the place where the definition occurs. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1074,13 +1354,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1128,10 +1408,61 @@ export interface GeneratedCodeInfo_Annotation { begin: number; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ end: number; + semantic: GeneratedCodeInfo_Annotation_Semantic; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON( + object: any, +): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON( + object: GeneratedCodeInfo_Annotation_Semantic, +): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { @@ -1213,6 +1544,7 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: "", }; } @@ -1264,6 +1596,9 @@ export const FileDescriptorProto = { if (message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== "") { + writer.uint32(106).string(message.edition); + } return writer; }, @@ -1335,6 +1670,9 @@ export const FileDescriptorProto = { case 12: message.syntax = reader.string(); break; + case 13: + message.edition = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -1375,6 +1713,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, syntax: isSet(object.syntax) ? String(object.syntax) : "", + edition: isSet(object.edition) ? String(object.edition) : "", }; }, @@ -1434,6 +1773,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.toJSON(message.sourceCodeInfo) : undefined); message.syntax !== undefined && (obj.syntax = message.syntax); + message.edition !== undefined && (obj.edition = message.edition); return obj; }, @@ -1463,6 +1803,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? ""; return message; }, }; @@ -1874,7 +2215,7 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], verification: 0 }; } export const ExtensionRangeOptions = { @@ -1885,6 +2226,15 @@ export const ExtensionRangeOptions = { for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode( + v!, + writer.uint32(18).fork(), + ).ldelim(); + } + if (message.verification !== 0) { + writer.uint32(24).int32(message.verification); + } return writer; }, @@ -1903,6 +2253,14 @@ export const ExtensionRangeOptions = { UninterpretedOption.decode(reader, reader.uint32()), ); break; + case 2: + message.declaration.push( + ExtensionRangeOptions_Declaration.decode(reader, reader.uint32()), + ); + break; + case 3: + message.verification = reader.int32() as any; + break; default: reader.skipType(tag & 7); break; @@ -1918,6 +2276,14 @@ export const ExtensionRangeOptions = { UninterpretedOption.fromJSON(e), ) : [], + declaration: Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => + ExtensionRangeOptions_Declaration.fromJSON(e), + ) + : [], + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 0, }; }, @@ -1930,6 +2296,17 @@ export const ExtensionRangeOptions = { } else { obj.uninterpretedOption = []; } + if (message.declaration) { + obj.declaration = message.declaration.map((e) => + e ? ExtensionRangeOptions_Declaration.toJSON(e) : undefined, + ); + } else { + obj.declaration = []; + } + message.verification !== undefined && + (obj.verification = extensionRangeOptions_VerificationStateToJSON( + message.verification, + )); return obj; }, @@ -1941,6 +2318,120 @@ export const ExtensionRangeOptions = { object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e), ) || []; + message.declaration = + object.declaration?.map((e) => + ExtensionRangeOptions_Declaration.fromPartial(e), + ) || []; + message.verification = object.verification ?? 0; + return message; + }, +}; + +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { + number: 0, + fullName: "", + type: "", + isRepeated: false, + reserved: false, + repeated: false, + }; +} + +export const ExtensionRangeOptions_Declaration = { + encode( + message: ExtensionRangeOptions_Declaration, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.isRepeated === true) { + writer.uint32(32).bool(message.isRepeated); + } + if (message.reserved === true) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated === true) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): ExtensionRangeOptions_Declaration { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.number = reader.int32(); + break; + case 2: + message.fullName = reader.string(); + break; + case 3: + message.type = reader.string(); + break; + case 4: + message.isRepeated = reader.bool(); + break; + case 5: + message.reserved = reader.bool(); + break; + case 6: + message.repeated = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? Number(object.number) : 0, + fullName: isSet(object.fullName) ? String(object.fullName) : "", + type: isSet(object.type) ? String(object.type) : "", + isRepeated: isSet(object.isRepeated) ? Boolean(object.isRepeated) : false, + reserved: isSet(object.reserved) ? Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + message.number !== undefined && (obj.number = Math.round(message.number)); + message.fullName !== undefined && (obj.fullName = message.fullName); + message.type !== undefined && (obj.type = message.type); + message.isRepeated !== undefined && (obj.isRepeated = message.isRepeated); + message.reserved !== undefined && (obj.reserved = message.reserved); + message.repeated !== undefined && (obj.repeated = message.repeated); + return obj; + }, + + fromPartial< + I extends Exact, I>, + >(object: I): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.isRepeated = object.isRepeated ?? false; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; return message; }, }; @@ -3036,6 +3527,7 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, uninterpretedOption: [], }; } @@ -3057,6 +3549,9 @@ export const MessageOptions = { if (message.mapEntry === true) { writer.uint32(56).bool(message.mapEntry); } + if (message.deprecatedLegacyJsonFieldConflicts === true) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3082,6 +3577,9 @@ export const MessageOptions = { case 7: message.mapEntry = reader.bool(); break; + case 11: + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; case 999: message.uninterpretedOption.push( UninterpretedOption.decode(reader, reader.uint32()), @@ -3105,6 +3603,11 @@ export const MessageOptions = { : false, deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet( + object.deprecatedLegacyJsonFieldConflicts, + ) + ? Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e), @@ -3121,6 +3624,9 @@ export const MessageOptions = { (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.mapEntry !== undefined && (obj.mapEntry = message.mapEntry); + message.deprecatedLegacyJsonFieldConflicts !== undefined && + (obj.deprecatedLegacyJsonFieldConflicts = + message.deprecatedLegacyJsonFieldConflicts); if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined, @@ -3140,6 +3646,8 @@ export const MessageOptions = { object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = + object.deprecatedLegacyJsonFieldConflicts ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e), @@ -3154,8 +3662,13 @@ function createBaseFieldOptions(): FieldOptions { packed: false, jstype: 0, lazy: false, + unverifiedLazy: false, deprecated: false, weak: false, + debugRedact: false, + retention: 0, + target: 0, + targets: [], uninterpretedOption: [], }; } @@ -3177,12 +3690,29 @@ export const FieldOptions = { if (message.lazy === true) { writer.uint32(40).bool(message.lazy); } + if (message.unverifiedLazy === true) { + writer.uint32(120).bool(message.unverifiedLazy); + } if (message.deprecated === true) { writer.uint32(24).bool(message.deprecated); } if (message.weak === true) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact === true) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + if (message.target !== 0) { + writer.uint32(144).int32(message.target); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.ldelim(); for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3208,12 +3738,34 @@ export const FieldOptions = { case 5: message.lazy = reader.bool(); break; + case 15: + message.unverifiedLazy = reader.bool(); + break; case 3: message.deprecated = reader.bool(); break; case 10: message.weak = reader.bool(); break; + case 16: + message.debugRedact = reader.bool(); + break; + case 17: + message.retention = reader.int32() as any; + break; + case 18: + message.target = reader.int32() as any; + break; + case 19: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + } else { + message.targets.push(reader.int32() as any); + } + break; case 999: message.uninterpretedOption.push( UninterpretedOption.decode(reader, reader.uint32()), @@ -3235,8 +3787,25 @@ export const FieldOptions = { ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) + ? Boolean(object.unverifiedLazy) + : false, deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, weak: isSet(object.weak) ? Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) + ? Boolean(object.debugRedact) + : false, + retention: isSet(object.retention) + ? fieldOptions_OptionRetentionFromJSON(object.retention) + : 0, + target: isSet(object.target) + ? fieldOptions_OptionTargetTypeFromJSON(object.target) + : 0, + targets: Array.isArray(object?.targets) + ? object.targets.map((e: any) => + fieldOptions_OptionTargetTypeFromJSON(e), + ) + : [], uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e), @@ -3253,8 +3822,23 @@ export const FieldOptions = { message.jstype !== undefined && (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); message.lazy !== undefined && (obj.lazy = message.lazy); + message.unverifiedLazy !== undefined && + (obj.unverifiedLazy = message.unverifiedLazy); message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.weak !== undefined && (obj.weak = message.weak); + message.debugRedact !== undefined && + (obj.debugRedact = message.debugRedact); + message.retention !== undefined && + (obj.retention = fieldOptions_OptionRetentionToJSON(message.retention)); + message.target !== undefined && + (obj.target = fieldOptions_OptionTargetTypeToJSON(message.target)); + if (message.targets) { + obj.targets = message.targets.map((e) => + fieldOptions_OptionTargetTypeToJSON(e), + ); + } else { + obj.targets = []; + } if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined, @@ -3273,8 +3857,13 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.target = object.target ?? 0; + message.targets = object.targets?.map((e) => e) || []; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e), @@ -3353,7 +3942,12 @@ export const OneofOptions = { }; function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + uninterpretedOption: [], + }; } export const EnumOptions = { @@ -3367,6 +3961,9 @@ export const EnumOptions = { if (message.deprecated === true) { writer.uint32(24).bool(message.deprecated); } + if (message.deprecatedLegacyJsonFieldConflicts === true) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3386,6 +3983,9 @@ export const EnumOptions = { case 3: message.deprecated = reader.bool(); break; + case 6: + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; case 999: message.uninterpretedOption.push( UninterpretedOption.decode(reader, reader.uint32()), @@ -3403,6 +4003,11 @@ export const EnumOptions = { return { allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet( + object.deprecatedLegacyJsonFieldConflicts, + ) + ? Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e), @@ -3415,6 +4020,9 @@ export const EnumOptions = { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.deprecatedLegacyJsonFieldConflicts !== undefined && + (obj.deprecatedLegacyJsonFieldConflicts = + message.deprecatedLegacyJsonFieldConflicts); if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined, @@ -3431,6 +4039,8 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = + object.deprecatedLegacyJsonFieldConflicts ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e), @@ -4199,7 +4809,7 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } export const GeneratedCodeInfo_Annotation = { @@ -4221,6 +4831,9 @@ export const GeneratedCodeInfo_Annotation = { if (message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, @@ -4253,6 +4866,9 @@ export const GeneratedCodeInfo_Annotation = { case 4: message.end = reader.int32(); break; + case 5: + message.semantic = reader.int32() as any; + break; default: reader.skipType(tag & 7); break; @@ -4269,6 +4885,9 @@ export const GeneratedCodeInfo_Annotation = { sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", begin: isSet(object.begin) ? Number(object.begin) : 0, end: isSet(object.end) ? Number(object.end) : 0, + semantic: isSet(object.semantic) + ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) + : 0, }; }, @@ -4282,6 +4901,10 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile !== undefined && (obj.sourceFile = message.sourceFile); message.begin !== undefined && (obj.begin = Math.round(message.begin)); message.end !== undefined && (obj.end = Math.round(message.end)); + message.semantic !== undefined && + (obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON( + message.semantic, + )); return obj; }, @@ -4293,6 +4916,7 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; diff --git a/core/src/generated/proto/google/protobuf/duration.ts b/core/src/generated/proto/google/protobuf/duration.ts new file mode 100644 index 000000000..dd1967a61 --- /dev/null +++ b/core/src/generated/proto/google/protobuf/duration.ts @@ -0,0 +1,187 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: Long; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: Long.ZERO, nanos: 0 }; +} + +export const Duration = { + encode( + message: Duration, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Duration { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64() as Long; + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) + ? Long.fromValue(object.seconds) + : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + message.seconds !== undefined && + (obj.seconds = (message.seconds || Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + fromPartial, I>>(object: I): Duration { + const message = createBaseDuration(); + message.seconds = + object.seconds !== undefined && object.seconds !== null + ? Long.fromValue(object.seconds) + : Long.ZERO; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/core/src/generated/proto/google/protobuf/timestamp.ts b/core/src/generated/proto/google/protobuf/timestamp.ts new file mode 100644 index 000000000..d98152cd5 --- /dev/null +++ b/core/src/generated/proto/google/protobuf/timestamp.ts @@ -0,0 +1,218 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: Long; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: Long.ZERO, nanos: 0 }; +} + +export const Timestamp = { + encode( + message: Timestamp, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64() as Long; + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) + ? Long.fromValue(object.seconds) + : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + message.seconds !== undefined && + (obj.seconds = (message.seconds || Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): Timestamp { + const message = createBaseTimestamp(); + message.seconds = + object.seconds !== undefined && object.seconds !== null + ? Long.fromValue(object.seconds) + : Long.ZERO; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/core/src/generated/proto/sifnode/clp/v1/genesis.ts b/core/src/generated/proto/sifnode/clp/v1/genesis.ts index 1ed44739a..d2eb5cc2a 100644 --- a/core/src/generated/proto/sifnode/clp/v1/genesis.ts +++ b/core/src/generated/proto/sifnode/clp/v1/genesis.ts @@ -2,6 +2,7 @@ import { Params } from "./params"; import Long from "long"; import { Pool, LiquidityProvider } from "./types"; +import { RewardsBucket } from "./rewards_bucket"; import _m0 from "protobufjs/minimal"; export const protobufPackage = "sifnode.clp.v1"; @@ -16,6 +17,7 @@ export interface GenesisState { addressWhitelist: string[]; poolList: Pool[]; liquidityProviders: LiquidityProvider[]; + rewardsBucketList: RewardsBucket[]; } function createBaseGenesisState(): GenesisState { @@ -24,6 +26,7 @@ function createBaseGenesisState(): GenesisState { addressWhitelist: [], poolList: [], liquidityProviders: [], + rewardsBucketList: [], }; } @@ -44,6 +47,9 @@ export const GenesisState = { for (const v of message.liquidityProviders) { LiquidityProvider.encode(v!, writer.uint32(34).fork()).ldelim(); } + for (const v of message.rewardsBucketList) { + RewardsBucket.encode(v!, writer.uint32(42).fork()).ldelim(); + } return writer; }, @@ -68,6 +74,11 @@ export const GenesisState = { LiquidityProvider.decode(reader, reader.uint32()), ); break; + case 5: + message.rewardsBucketList.push( + RewardsBucket.decode(reader, reader.uint32()), + ); + break; default: reader.skipType(tag & 7); break; @@ -90,6 +101,9 @@ export const GenesisState = { LiquidityProvider.fromJSON(e), ) : [], + rewardsBucketList: Array.isArray(object?.rewardsBucketList) + ? object.rewardsBucketList.map((e: any) => RewardsBucket.fromJSON(e)) + : [], }; }, @@ -116,6 +130,13 @@ export const GenesisState = { } else { obj.liquidityProviders = []; } + if (message.rewardsBucketList) { + obj.rewardsBucketList = message.rewardsBucketList.map((e) => + e ? RewardsBucket.toJSON(e) : undefined, + ); + } else { + obj.rewardsBucketList = []; + } return obj; }, @@ -132,6 +153,8 @@ export const GenesisState = { message.liquidityProviders = object.liquidityProviders?.map((e) => LiquidityProvider.fromPartial(e)) || []; + message.rewardsBucketList = + object.rewardsBucketList?.map((e) => RewardsBucket.fromPartial(e)) || []; return message; }, }; diff --git a/core/src/generated/proto/sifnode/clp/v1/params.ts b/core/src/generated/proto/sifnode/clp/v1/params.ts index af6e7b9fe..2634ab181 100644 --- a/core/src/generated/proto/sifnode/clp/v1/params.ts +++ b/core/src/generated/proto/sifnode/clp/v1/params.ts @@ -18,6 +18,12 @@ export interface RewardParams { rewardPeriods: RewardPeriod[]; /** start time of the current (or last) reward period */ rewardPeriodStartTime: string; + /** in blocks */ + rewardsLockPeriod: Long; + /** week, day, hour, etc */ + rewardsEpochIdentifier: string; + /** true if reward bucket should be distributed */ + rewardsDistribute: boolean; } /** These params are non-governable and are calculated on chain */ @@ -161,6 +167,9 @@ function createBaseRewardParams(): RewardParams { liquidityRemovalCancelPeriod: Long.UZERO, rewardPeriods: [], rewardPeriodStartTime: "", + rewardsLockPeriod: Long.UZERO, + rewardsEpochIdentifier: "", + rewardsDistribute: false, }; } @@ -181,6 +190,15 @@ export const RewardParams = { if (message.rewardPeriodStartTime !== "") { writer.uint32(42).string(message.rewardPeriodStartTime); } + if (!message.rewardsLockPeriod.isZero()) { + writer.uint32(48).uint64(message.rewardsLockPeriod); + } + if (message.rewardsEpochIdentifier !== "") { + writer.uint32(58).string(message.rewardsEpochIdentifier); + } + if (message.rewardsDistribute === true) { + writer.uint32(64).bool(message.rewardsDistribute); + } return writer; }, @@ -205,6 +223,15 @@ export const RewardParams = { case 5: message.rewardPeriodStartTime = reader.string(); break; + case 6: + message.rewardsLockPeriod = reader.uint64() as Long; + break; + case 7: + message.rewardsEpochIdentifier = reader.string(); + break; + case 8: + message.rewardsDistribute = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -227,6 +254,15 @@ export const RewardParams = { rewardPeriodStartTime: isSet(object.rewardPeriodStartTime) ? String(object.rewardPeriodStartTime) : "", + rewardsLockPeriod: isSet(object.rewardsLockPeriod) + ? Long.fromValue(object.rewardsLockPeriod) + : Long.UZERO, + rewardsEpochIdentifier: isSet(object.rewardsEpochIdentifier) + ? String(object.rewardsEpochIdentifier) + : "", + rewardsDistribute: isSet(object.rewardsDistribute) + ? Boolean(object.rewardsDistribute) + : false, }; }, @@ -249,6 +285,14 @@ export const RewardParams = { } message.rewardPeriodStartTime !== undefined && (obj.rewardPeriodStartTime = message.rewardPeriodStartTime); + message.rewardsLockPeriod !== undefined && + (obj.rewardsLockPeriod = ( + message.rewardsLockPeriod || Long.UZERO + ).toString()); + message.rewardsEpochIdentifier !== undefined && + (obj.rewardsEpochIdentifier = message.rewardsEpochIdentifier); + message.rewardsDistribute !== undefined && + (obj.rewardsDistribute = message.rewardsDistribute); return obj; }, @@ -269,6 +313,13 @@ export const RewardParams = { message.rewardPeriods = object.rewardPeriods?.map((e) => RewardPeriod.fromPartial(e)) || []; message.rewardPeriodStartTime = object.rewardPeriodStartTime ?? ""; + message.rewardsLockPeriod = + object.rewardsLockPeriod !== undefined && + object.rewardsLockPeriod !== null + ? Long.fromValue(object.rewardsLockPeriod) + : Long.UZERO; + message.rewardsEpochIdentifier = object.rewardsEpochIdentifier ?? ""; + message.rewardsDistribute = object.rewardsDistribute ?? false; return message; }, }; diff --git a/core/src/generated/proto/sifnode/clp/v1/querier.ts b/core/src/generated/proto/sifnode/clp/v1/querier.ts index 000cdc750..cb1bccbb7 100644 --- a/core/src/generated/proto/sifnode/clp/v1/querier.ts +++ b/core/src/generated/proto/sifnode/clp/v1/querier.ts @@ -20,6 +20,7 @@ import { ProviderDistributionParams, SwapFeeTokenParams, } from "./params"; +import { RewardsBucket } from "./rewards_bucket"; import Long from "long"; import _m0 from "protobufjs/minimal"; @@ -213,6 +214,23 @@ export interface SwapInfo { result: string; } +export interface RewardsBucketReq { + denom: string; +} + +export interface RewardsBucketRes { + rewardsBucket?: RewardsBucket; +} + +export interface AllRewardsBucketReq { + pagination?: PageRequest; +} + +export interface AllRewardsBucketRes { + rewardsBucket: RewardsBucket[]; + pagination?: PageResponse; +} + function createBasePoolReq(): PoolReq { return { symbol: "" }; } @@ -2458,6 +2476,272 @@ export const SwapInfo = { }, }; +function createBaseRewardsBucketReq(): RewardsBucketReq { + return { denom: "" }; +} + +export const RewardsBucketReq = { + encode( + message: RewardsBucketReq, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RewardsBucketReq { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRewardsBucketReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RewardsBucketReq { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + }; + }, + + toJSON(message: RewardsBucketReq): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + + fromPartial, I>>( + object: I, + ): RewardsBucketReq { + const message = createBaseRewardsBucketReq(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseRewardsBucketRes(): RewardsBucketRes { + return { rewardsBucket: undefined }; +} + +export const RewardsBucketRes = { + encode( + message: RewardsBucketRes, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.rewardsBucket !== undefined) { + RewardsBucket.encode( + message.rewardsBucket, + writer.uint32(10).fork(), + ).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RewardsBucketRes { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRewardsBucketRes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewardsBucket = RewardsBucket.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RewardsBucketRes { + return { + rewardsBucket: isSet(object.rewardsBucket) + ? RewardsBucket.fromJSON(object.rewardsBucket) + : undefined, + }; + }, + + toJSON(message: RewardsBucketRes): unknown { + const obj: any = {}; + message.rewardsBucket !== undefined && + (obj.rewardsBucket = message.rewardsBucket + ? RewardsBucket.toJSON(message.rewardsBucket) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): RewardsBucketRes { + const message = createBaseRewardsBucketRes(); + message.rewardsBucket = + object.rewardsBucket !== undefined && object.rewardsBucket !== null + ? RewardsBucket.fromPartial(object.rewardsBucket) + : undefined; + return message; + }, +}; + +function createBaseAllRewardsBucketReq(): AllRewardsBucketReq { + return { pagination: undefined }; +} + +export const AllRewardsBucketReq = { + encode( + message: AllRewardsBucketReq, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AllRewardsBucketReq { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllRewardsBucketReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AllRewardsBucketReq { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: AllRewardsBucketReq): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): AllRewardsBucketReq { + const message = createBaseAllRewardsBucketReq(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseAllRewardsBucketRes(): AllRewardsBucketRes { + return { rewardsBucket: [], pagination: undefined }; +} + +export const AllRewardsBucketRes = { + encode( + message: AllRewardsBucketRes, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + for (const v of message.rewardsBucket) { + RewardsBucket.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork(), + ).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AllRewardsBucketRes { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllRewardsBucketRes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewardsBucket.push( + RewardsBucket.decode(reader, reader.uint32()), + ); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AllRewardsBucketRes { + return { + rewardsBucket: Array.isArray(object?.rewardsBucket) + ? object.rewardsBucket.map((e: any) => RewardsBucket.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: AllRewardsBucketRes): unknown { + const obj: any = {}; + if (message.rewardsBucket) { + obj.rewardsBucket = message.rewardsBucket.map((e) => + e ? RewardsBucket.toJSON(e) : undefined, + ); + } else { + obj.rewardsBucket = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): AllRewardsBucketRes { + const message = createBaseAllRewardsBucketRes(); + message.rewardsBucket = + object.rewardsBucket?.map((e) => RewardsBucket.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + export interface Query { GetPool(request: PoolReq): Promise; GetPools(request: PoolsReq): Promise; @@ -2487,6 +2771,11 @@ export interface Query { GetPoolShareEstimate( request: PoolShareEstimateReq, ): Promise; + /** Queries a list of RewardsBucket items. */ + GetRewardsBucket(request: RewardsBucketReq): Promise; + GetRewardsBucketAll( + request: AllRewardsBucketReq, + ): Promise; } export class QueryClientImpl implements Query { @@ -2509,6 +2798,8 @@ export class QueryClientImpl implements Query { this.GetProviderDistributionParams.bind(this); this.GetSwapFeeParams = this.GetSwapFeeParams.bind(this); this.GetPoolShareEstimate = this.GetPoolShareEstimate.bind(this); + this.GetRewardsBucket = this.GetRewardsBucket.bind(this); + this.GetRewardsBucketAll = this.GetRewardsBucketAll.bind(this); } GetPool(request: PoolReq): Promise { const data = PoolReq.encode(request).finish(); @@ -2667,6 +2958,32 @@ export class QueryClientImpl implements Query { PoolShareEstimateRes.decode(new _m0.Reader(data)), ); } + + GetRewardsBucket(request: RewardsBucketReq): Promise { + const data = RewardsBucketReq.encode(request).finish(); + const promise = this.rpc.request( + "sifnode.clp.v1.Query", + "GetRewardsBucket", + data, + ); + return promise.then((data) => + RewardsBucketRes.decode(new _m0.Reader(data)), + ); + } + + GetRewardsBucketAll( + request: AllRewardsBucketReq, + ): Promise { + const data = AllRewardsBucketReq.encode(request).finish(); + const promise = this.rpc.request( + "sifnode.clp.v1.Query", + "GetRewardsBucketAll", + data, + ); + return promise.then((data) => + AllRewardsBucketRes.decode(new _m0.Reader(data)), + ); + } } interface Rpc { diff --git a/core/src/generated/proto/sifnode/clp/v1/rewards_bucket.ts b/core/src/generated/proto/sifnode/clp/v1/rewards_bucket.ts new file mode 100644 index 000000000..346f3c174 --- /dev/null +++ b/core/src/generated/proto/sifnode/clp/v1/rewards_bucket.ts @@ -0,0 +1,110 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "sifnode.clp.v1"; + +export interface RewardsBucket { + denom: string; + amount: string; +} + +function createBaseRewardsBucket(): RewardsBucket { + return { denom: "", amount: "" }; +} + +export const RewardsBucket = { + encode( + message: RewardsBucket, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RewardsBucket { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRewardsBucket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RewardsBucket { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: RewardsBucket): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>( + object: I, + ): RewardsBucket { + const message = createBaseRewardsBucket(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/core/src/generated/proto/sifnode/clp/v1/tx.ts b/core/src/generated/proto/sifnode/clp/v1/tx.ts index 1a291c59a..5a4d289c7 100644 --- a/core/src/generated/proto/sifnode/clp/v1/tx.ts +++ b/core/src/generated/proto/sifnode/clp/v1/tx.ts @@ -6,6 +6,7 @@ import { ProviderDistributionPeriod, SwapFeeTokenParams, } from "./params"; +import { Coin } from "../../../cosmos/base/coin"; import _m0 from "protobufjs/minimal"; export const protobufPackage = "sifnode.clp.v1"; @@ -103,6 +104,12 @@ export interface MsgUpdateRewardsParamsRequest { liquidityRemovalLockPeriod: Long; /** in blocks */ liquidityRemovalCancelPeriod: Long; + /** in blocks */ + rewardsLockPeriod: Long; + /** week, day, hour, etc */ + rewardsEpochIdentifier: string; + /** true or false */ + rewardsDistribute: boolean; } export interface MsgUpdateRewardsParamsResponse {} @@ -168,6 +175,13 @@ export interface MsgUpdateSwapFeeParamsRequest { export interface MsgUpdateSwapFeeParamsResponse {} +export interface MsgAddLiquidityToRewardsBucketRequest { + signer: string; + amount: Coin[]; +} + +export interface MsgAddLiquidityToRewardsBucketResponse {} + function createBaseMsgUpdateStakingRewardParams(): MsgUpdateStakingRewardParams { return { signer: "", minter: "", params: "" }; } @@ -1565,6 +1579,9 @@ function createBaseMsgUpdateRewardsParamsRequest(): MsgUpdateRewardsParamsReques signer: "", liquidityRemovalLockPeriod: Long.UZERO, liquidityRemovalCancelPeriod: Long.UZERO, + rewardsLockPeriod: Long.UZERO, + rewardsEpochIdentifier: "", + rewardsDistribute: false, }; } @@ -1582,6 +1599,15 @@ export const MsgUpdateRewardsParamsRequest = { if (!message.liquidityRemovalCancelPeriod.isZero()) { writer.uint32(24).uint64(message.liquidityRemovalCancelPeriod); } + if (!message.rewardsLockPeriod.isZero()) { + writer.uint32(32).uint64(message.rewardsLockPeriod); + } + if (message.rewardsEpochIdentifier !== "") { + writer.uint32(42).string(message.rewardsEpochIdentifier); + } + if (message.rewardsDistribute === true) { + writer.uint32(48).bool(message.rewardsDistribute); + } return writer; }, @@ -1604,6 +1630,15 @@ export const MsgUpdateRewardsParamsRequest = { case 3: message.liquidityRemovalCancelPeriod = reader.uint64() as Long; break; + case 4: + message.rewardsLockPeriod = reader.uint64() as Long; + break; + case 5: + message.rewardsEpochIdentifier = reader.string(); + break; + case 6: + message.rewardsDistribute = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -1621,6 +1656,15 @@ export const MsgUpdateRewardsParamsRequest = { liquidityRemovalCancelPeriod: isSet(object.liquidityRemovalCancelPeriod) ? Long.fromValue(object.liquidityRemovalCancelPeriod) : Long.UZERO, + rewardsLockPeriod: isSet(object.rewardsLockPeriod) + ? Long.fromValue(object.rewardsLockPeriod) + : Long.UZERO, + rewardsEpochIdentifier: isSet(object.rewardsEpochIdentifier) + ? String(object.rewardsEpochIdentifier) + : "", + rewardsDistribute: isSet(object.rewardsDistribute) + ? Boolean(object.rewardsDistribute) + : false, }; }, @@ -1635,6 +1679,14 @@ export const MsgUpdateRewardsParamsRequest = { (obj.liquidityRemovalCancelPeriod = ( message.liquidityRemovalCancelPeriod || Long.UZERO ).toString()); + message.rewardsLockPeriod !== undefined && + (obj.rewardsLockPeriod = ( + message.rewardsLockPeriod || Long.UZERO + ).toString()); + message.rewardsEpochIdentifier !== undefined && + (obj.rewardsEpochIdentifier = message.rewardsEpochIdentifier); + message.rewardsDistribute !== undefined && + (obj.rewardsDistribute = message.rewardsDistribute); return obj; }, @@ -1653,6 +1705,13 @@ export const MsgUpdateRewardsParamsRequest = { object.liquidityRemovalCancelPeriod !== null ? Long.fromValue(object.liquidityRemovalCancelPeriod) : Long.UZERO; + message.rewardsLockPeriod = + object.rewardsLockPeriod !== undefined && + object.rewardsLockPeriod !== null + ? Long.fromValue(object.rewardsLockPeriod) + : Long.UZERO; + message.rewardsEpochIdentifier = object.rewardsEpochIdentifier ?? ""; + message.rewardsDistribute = object.rewardsDistribute ?? false; return message; }, }; @@ -2707,6 +2766,125 @@ export const MsgUpdateSwapFeeParamsResponse = { }, }; +function createBaseMsgAddLiquidityToRewardsBucketRequest(): MsgAddLiquidityToRewardsBucketRequest { + return { signer: "", amount: [] }; +} + +export const MsgAddLiquidityToRewardsBucketRequest = { + encode( + message: MsgAddLiquidityToRewardsBucketRequest, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): MsgAddLiquidityToRewardsBucketRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddLiquidityToRewardsBucketRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgAddLiquidityToRewardsBucketRequest { + return { + signer: isSet(object.signer) ? String(object.signer) : "", + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgAddLiquidityToRewardsBucketRequest): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial< + I extends Exact, I>, + >(object: I): MsgAddLiquidityToRewardsBucketRequest { + const message = createBaseMsgAddLiquidityToRewardsBucketRequest(); + message.signer = object.signer ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgAddLiquidityToRewardsBucketResponse(): MsgAddLiquidityToRewardsBucketResponse { + return {}; +} + +export const MsgAddLiquidityToRewardsBucketResponse = { + encode( + _: MsgAddLiquidityToRewardsBucketResponse, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): MsgAddLiquidityToRewardsBucketResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddLiquidityToRewardsBucketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgAddLiquidityToRewardsBucketResponse { + return {}; + }, + + toJSON(_: MsgAddLiquidityToRewardsBucketResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial< + I extends Exact, I>, + >(_: I): MsgAddLiquidityToRewardsBucketResponse { + const message = createBaseMsgAddLiquidityToRewardsBucketResponse(); + return message; + }, +}; + export interface Msg { RemoveLiquidity( request: MsgRemoveLiquidity, @@ -2756,6 +2934,9 @@ export interface Msg { UpdateSwapFeeParams( request: MsgUpdateSwapFeeParamsRequest, ): Promise; + AddLiquidityToRewardsBucket( + request: MsgAddLiquidityToRewardsBucketRequest, + ): Promise; } export class MsgClientImpl implements Msg { @@ -2783,6 +2964,8 @@ export class MsgClientImpl implements Msg { this.AddProviderDistributionPeriod = this.AddProviderDistributionPeriod.bind(this); this.UpdateSwapFeeParams = this.UpdateSwapFeeParams.bind(this); + this.AddLiquidityToRewardsBucket = + this.AddLiquidityToRewardsBucket.bind(this); } RemoveLiquidity( request: MsgRemoveLiquidity, @@ -3020,6 +3203,20 @@ export class MsgClientImpl implements Msg { MsgUpdateSwapFeeParamsResponse.decode(new _m0.Reader(data)), ); } + + AddLiquidityToRewardsBucket( + request: MsgAddLiquidityToRewardsBucketRequest, + ): Promise { + const data = MsgAddLiquidityToRewardsBucketRequest.encode(request).finish(); + const promise = this.rpc.request( + "sifnode.clp.v1.Msg", + "AddLiquidityToRewardsBucket", + data, + ); + return promise.then((data) => + MsgAddLiquidityToRewardsBucketResponse.decode(new _m0.Reader(data)), + ); + } } interface Rpc { diff --git a/core/src/generated/proto/sifnode/clp/v1/types.ts b/core/src/generated/proto/sifnode/clp/v1/types.ts index 58110615a..ce8848ec0 100644 --- a/core/src/generated/proto/sifnode/clp/v1/types.ts +++ b/core/src/generated/proto/sifnode/clp/v1/types.ts @@ -1,5 +1,6 @@ /* eslint-disable */ import Long from "long"; +import { Coin } from "../../../cosmos/base/coin"; import _m0 from "protobufjs/minimal"; export const protobufPackage = "sifnode.clp.v1"; @@ -27,6 +28,8 @@ export interface Pool { unsettledNativeLiabilities: string; blockInterestNative: string; blockInterestExternal: string; + /** the amount of external asset rewards distributed to liquidity providers from reward buckets */ + rewardAmountExternal: string; } export interface LiquidityProvider { @@ -34,6 +37,10 @@ export interface LiquidityProvider { liquidityProviderUnits: string; liquidityProviderAddress: string; unlocks: LiquidityUnlock[]; + /** contains the block height of the last update */ + lastUpdatedBlock: Long; + /** distributed or added to liquidity provider shares rewards */ + rewardAmount: Coin[]; } export interface LiquidityUnlock { @@ -138,6 +145,7 @@ function createBasePool(): Pool { unsettledNativeLiabilities: "", blockInterestNative: "", blockInterestExternal: "", + rewardAmountExternal: "", }; } @@ -197,6 +205,9 @@ export const Pool = { if (message.blockInterestExternal !== "") { writer.uint32(146).string(message.blockInterestExternal); } + if (message.rewardAmountExternal !== "") { + writer.uint32(154).string(message.rewardAmountExternal); + } return writer; }, @@ -261,6 +272,9 @@ export const Pool = { case 18: message.blockInterestExternal = reader.string(); break; + case 19: + message.rewardAmountExternal = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -323,6 +337,9 @@ export const Pool = { blockInterestExternal: isSet(object.blockInterestExternal) ? String(object.blockInterestExternal) : "", + rewardAmountExternal: isSet(object.rewardAmountExternal) + ? String(object.rewardAmountExternal) + : "", }; }, @@ -367,6 +384,8 @@ export const Pool = { (obj.blockInterestNative = message.blockInterestNative); message.blockInterestExternal !== undefined && (obj.blockInterestExternal = message.blockInterestExternal); + message.rewardAmountExternal !== undefined && + (obj.rewardAmountExternal = message.rewardAmountExternal); return obj; }, @@ -400,6 +419,7 @@ export const Pool = { object.unsettledNativeLiabilities ?? ""; message.blockInterestNative = object.blockInterestNative ?? ""; message.blockInterestExternal = object.blockInterestExternal ?? ""; + message.rewardAmountExternal = object.rewardAmountExternal ?? ""; return message; }, }; @@ -410,6 +430,8 @@ function createBaseLiquidityProvider(): LiquidityProvider { liquidityProviderUnits: "", liquidityProviderAddress: "", unlocks: [], + lastUpdatedBlock: Long.ZERO, + rewardAmount: [], }; } @@ -430,6 +452,12 @@ export const LiquidityProvider = { for (const v of message.unlocks) { LiquidityUnlock.encode(v!, writer.uint32(34).fork()).ldelim(); } + if (!message.lastUpdatedBlock.isZero()) { + writer.uint32(40).int64(message.lastUpdatedBlock); + } + for (const v of message.rewardAmount) { + Coin.encode(v!, writer.uint32(50).fork()).ldelim(); + } return writer; }, @@ -452,6 +480,12 @@ export const LiquidityProvider = { case 4: message.unlocks.push(LiquidityUnlock.decode(reader, reader.uint32())); break; + case 5: + message.lastUpdatedBlock = reader.int64() as Long; + break; + case 6: + message.rewardAmount.push(Coin.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -472,6 +506,12 @@ export const LiquidityProvider = { unlocks: Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => LiquidityUnlock.fromJSON(e)) : [], + lastUpdatedBlock: isSet(object.lastUpdatedBlock) + ? Long.fromValue(object.lastUpdatedBlock) + : Long.ZERO, + rewardAmount: Array.isArray(object?.rewardAmount) + ? object.rewardAmount.map((e: any) => Coin.fromJSON(e)) + : [], }; }, @@ -490,6 +530,17 @@ export const LiquidityProvider = { } else { obj.unlocks = []; } + message.lastUpdatedBlock !== undefined && + (obj.lastUpdatedBlock = ( + message.lastUpdatedBlock || Long.ZERO + ).toString()); + if (message.rewardAmount) { + obj.rewardAmount = message.rewardAmount.map((e) => + e ? Coin.toJSON(e) : undefined, + ); + } else { + obj.rewardAmount = []; + } return obj; }, @@ -505,6 +556,12 @@ export const LiquidityProvider = { message.liquidityProviderAddress = object.liquidityProviderAddress ?? ""; message.unlocks = object.unlocks?.map((e) => LiquidityUnlock.fromPartial(e)) || []; + message.lastUpdatedBlock = + object.lastUpdatedBlock !== undefined && object.lastUpdatedBlock !== null + ? Long.fromValue(object.lastUpdatedBlock) + : Long.ZERO; + message.rewardAmount = + object.rewardAmount?.map((e) => Coin.fromPartial(e)) || []; return message; }, }; diff --git a/core/src/generated/proto/sifnode/epochs/v1/genesis.ts b/core/src/generated/proto/sifnode/epochs/v1/genesis.ts new file mode 100644 index 000000000..3c4f97df1 --- /dev/null +++ b/core/src/generated/proto/sifnode/epochs/v1/genesis.ts @@ -0,0 +1,317 @@ +/* eslint-disable */ +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "sifnode.epochs.v1"; + +/** + * EpochInfo defines the message interface containing the relevant informations about + * an epoch. + */ +export interface EpochInfo { + /** identifier of the epoch */ + identifier: string; + /** start_time of the epoch */ + startTime?: Date; + /** duration of the epoch */ + duration?: Duration; + /** current_epoch is the integer identifier of the epoch */ + currentEpoch: Long; + /** current_epoch_start_time defines the timestamp of the start of the epoch */ + currentEpochStartTime?: Date; + /** epoch_counting_started reflects if the counting for the epoch has started */ + epochCountingStarted: boolean; + /** current_epoch_start_height of the epoch */ + currentEpochStartHeight: Long; +} + +/** GenesisState defines the epochs module's genesis state. */ +export interface GenesisState { + /** epochs is a slice of EpochInfo that defines the epochs in the genesis state */ + epochs: EpochInfo[]; +} + +function createBaseEpochInfo(): EpochInfo { + return { + identifier: "", + startTime: undefined, + duration: undefined, + currentEpoch: Long.ZERO, + currentEpochStartTime: undefined, + epochCountingStarted: false, + currentEpochStartHeight: Long.ZERO, + }; +} + +export const EpochInfo = { + encode( + message: EpochInfo, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + if (message.startTime !== undefined) { + Timestamp.encode( + toTimestamp(message.startTime), + writer.uint32(18).fork(), + ).ldelim(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(26).fork()).ldelim(); + } + if (!message.currentEpoch.isZero()) { + writer.uint32(32).int64(message.currentEpoch); + } + if (message.currentEpochStartTime !== undefined) { + Timestamp.encode( + toTimestamp(message.currentEpochStartTime), + writer.uint32(42).fork(), + ).ldelim(); + } + if (message.epochCountingStarted === true) { + writer.uint32(48).bool(message.epochCountingStarted); + } + if (!message.currentEpochStartHeight.isZero()) { + writer.uint32(56).int64(message.currentEpochStartHeight); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EpochInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEpochInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + case 2: + message.startTime = fromTimestamp( + Timestamp.decode(reader, reader.uint32()), + ); + break; + case 3: + message.duration = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.currentEpoch = reader.int64() as Long; + break; + case 5: + message.currentEpochStartTime = fromTimestamp( + Timestamp.decode(reader, reader.uint32()), + ); + break; + case 6: + message.epochCountingStarted = reader.bool(); + break; + case 7: + message.currentEpochStartHeight = reader.int64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EpochInfo { + return { + identifier: isSet(object.identifier) ? String(object.identifier) : "", + startTime: isSet(object.startTime) + ? fromJsonTimestamp(object.startTime) + : undefined, + duration: isSet(object.duration) + ? Duration.fromJSON(object.duration) + : undefined, + currentEpoch: isSet(object.currentEpoch) + ? Long.fromValue(object.currentEpoch) + : Long.ZERO, + currentEpochStartTime: isSet(object.currentEpochStartTime) + ? fromJsonTimestamp(object.currentEpochStartTime) + : undefined, + epochCountingStarted: isSet(object.epochCountingStarted) + ? Boolean(object.epochCountingStarted) + : false, + currentEpochStartHeight: isSet(object.currentEpochStartHeight) + ? Long.fromValue(object.currentEpochStartHeight) + : Long.ZERO, + }; + }, + + toJSON(message: EpochInfo): unknown { + const obj: any = {}; + message.identifier !== undefined && (obj.identifier = message.identifier); + message.startTime !== undefined && + (obj.startTime = message.startTime.toISOString()); + message.duration !== undefined && + (obj.duration = message.duration + ? Duration.toJSON(message.duration) + : undefined); + message.currentEpoch !== undefined && + (obj.currentEpoch = (message.currentEpoch || Long.ZERO).toString()); + message.currentEpochStartTime !== undefined && + (obj.currentEpochStartTime = message.currentEpochStartTime.toISOString()); + message.epochCountingStarted !== undefined && + (obj.epochCountingStarted = message.epochCountingStarted); + message.currentEpochStartHeight !== undefined && + (obj.currentEpochStartHeight = ( + message.currentEpochStartHeight || Long.ZERO + ).toString()); + return obj; + }, + + fromPartial, I>>( + object: I, + ): EpochInfo { + const message = createBaseEpochInfo(); + message.identifier = object.identifier ?? ""; + message.startTime = object.startTime ?? undefined; + message.duration = + object.duration !== undefined && object.duration !== null + ? Duration.fromPartial(object.duration) + : undefined; + message.currentEpoch = + object.currentEpoch !== undefined && object.currentEpoch !== null + ? Long.fromValue(object.currentEpoch) + : Long.ZERO; + message.currentEpochStartTime = object.currentEpochStartTime ?? undefined; + message.epochCountingStarted = object.epochCountingStarted ?? false; + message.currentEpochStartHeight = + object.currentEpochStartHeight !== undefined && + object.currentEpochStartHeight !== null + ? Long.fromValue(object.currentEpochStartHeight) + : Long.ZERO; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { epochs: [] }; +} + +export const GenesisState = { + encode( + message: GenesisState, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + for (const v of message.epochs) { + EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.epochs.push(EpochInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + epochs: Array.isArray(object?.epochs) + ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.epochs) { + obj.epochs = message.epochs.map((e) => + e ? EpochInfo.toJSON(e) : undefined, + ); + } else { + obj.epochs = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): GenesisState { + const message = createBaseGenesisState(); + message.epochs = object.epochs?.map((e) => EpochInfo.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = t.seconds.toNumber() * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function numberToLong(number: number) { + return Long.fromNumber(number); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/core/src/generated/proto/sifnode/epochs/v1/query.ts b/core/src/generated/proto/sifnode/epochs/v1/query.ts new file mode 100644 index 000000000..4102244cf --- /dev/null +++ b/core/src/generated/proto/sifnode/epochs/v1/query.ts @@ -0,0 +1,409 @@ +/* eslint-disable */ +import { + PageRequest, + PageResponse, +} from "../../../cosmos/base/query/v1beta1/pagination"; +import Long from "long"; +import { EpochInfo } from "./genesis"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "sifnode.epochs.v1"; + +/** + * QueryEpochsInfoRequest is the request type for the Query/EpochInfos RPC + * method. + */ +export interface QueryEpochsInfoRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryEpochsInfoResponse is the response type for the Query/EpochInfos RPC + * method. + */ +export interface QueryEpochsInfoResponse { + /** epochs is a slice of all EpochInfos */ + epochs: EpochInfo[]; + /** pagination defines an optional pagination for the request. */ + pagination?: PageResponse; +} + +/** + * QueryCurrentEpochRequest is the request type for the Query/EpochInfos RPC + * method. + */ +export interface QueryCurrentEpochRequest { + /** identifier of the current epoch */ + identifier: string; +} + +/** + * QueryCurrentEpochResponse is the response type for the Query/EpochInfos RPC + * method. + */ +export interface QueryCurrentEpochResponse { + /** current_epoch is the number of the current epoch */ + currentEpoch: Long; +} + +function createBaseQueryEpochsInfoRequest(): QueryEpochsInfoRequest { + return { pagination: undefined }; +} + +export const QueryEpochsInfoRequest = { + encode( + message: QueryEpochsInfoRequest, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): QueryEpochsInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochsInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryEpochsInfoRequest { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryEpochsInfoRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryEpochsInfoRequest { + const message = createBaseQueryEpochsInfoRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { + return { epochs: [], pagination: undefined }; +} + +export const QueryEpochsInfoResponse = { + encode( + message: QueryEpochsInfoResponse, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + for (const v of message.epochs) { + EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork(), + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): QueryEpochsInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochsInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.epochs.push(EpochInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryEpochsInfoResponse { + return { + epochs: Array.isArray(object?.epochs) + ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryEpochsInfoResponse): unknown { + const obj: any = {}; + if (message.epochs) { + obj.epochs = message.epochs.map((e) => + e ? EpochInfo.toJSON(e) : undefined, + ); + } else { + obj.epochs = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryEpochsInfoResponse { + const message = createBaseQueryEpochsInfoResponse(); + message.epochs = object.epochs?.map((e) => EpochInfo.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { + return { identifier: "" }; +} + +export const QueryCurrentEpochRequest = { + encode( + message: QueryCurrentEpochRequest, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): QueryCurrentEpochRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentEpochRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCurrentEpochRequest { + return { + identifier: isSet(object.identifier) ? String(object.identifier) : "", + }; + }, + + toJSON(message: QueryCurrentEpochRequest): unknown { + const obj: any = {}; + message.identifier !== undefined && (obj.identifier = message.identifier); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryCurrentEpochRequest { + const message = createBaseQueryCurrentEpochRequest(); + message.identifier = object.identifier ?? ""; + return message; + }, +}; + +function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { + return { currentEpoch: Long.ZERO }; +} + +export const QueryCurrentEpochResponse = { + encode( + message: QueryCurrentEpochResponse, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (!message.currentEpoch.isZero()) { + writer.uint32(8).int64(message.currentEpoch); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): QueryCurrentEpochResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentEpochResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currentEpoch = reader.int64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCurrentEpochResponse { + return { + currentEpoch: isSet(object.currentEpoch) + ? Long.fromValue(object.currentEpoch) + : Long.ZERO, + }; + }, + + toJSON(message: QueryCurrentEpochResponse): unknown { + const obj: any = {}; + message.currentEpoch !== undefined && + (obj.currentEpoch = (message.currentEpoch || Long.ZERO).toString()); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryCurrentEpochResponse { + const message = createBaseQueryCurrentEpochResponse(); + message.currentEpoch = + object.currentEpoch !== undefined && object.currentEpoch !== null + ? Long.fromValue(object.currentEpoch) + : Long.ZERO; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** EpochInfos provide running epochInfos */ + EpochInfos(request: QueryEpochsInfoRequest): Promise; + /** CurrentEpoch provide current epoch of specified identifier */ + CurrentEpoch( + request: QueryCurrentEpochRequest, + ): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.EpochInfos = this.EpochInfos.bind(this); + this.CurrentEpoch = this.CurrentEpoch.bind(this); + } + EpochInfos( + request: QueryEpochsInfoRequest, + ): Promise { + const data = QueryEpochsInfoRequest.encode(request).finish(); + const promise = this.rpc.request( + "sifnode.epochs.v1.Query", + "EpochInfos", + data, + ); + return promise.then((data) => + QueryEpochsInfoResponse.decode(new _m0.Reader(data)), + ); + } + + CurrentEpoch( + request: QueryCurrentEpochRequest, + ): Promise { + const data = QueryCurrentEpochRequest.encode(request).finish(); + const promise = this.rpc.request( + "sifnode.epochs.v1.Query", + "CurrentEpoch", + data, + ); + return promise.then((data) => + QueryCurrentEpochResponse.decode(new _m0.Reader(data)), + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array, + ): Promise; +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/package.json b/package.json index 240abd5ff..1cd223458 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sifchain-ui", - "version": "2.14.14", + "version": "2.14.15", "private": true, "license": "UNLICENSED", "packageManager": "yarn@3.2.0",