diff --git a/README.md b/README.md index 9772794..294363c 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Use with [cosmjs](https://github.com/cosmos/cosmjs) - do `npm run update-protos` - do `npm run build:telescope` - update package.json version +- do `npm install` - commit and open PR - tag a release for publishing on npmjs diff --git a/package-lock.json b/package-lock.json index 8748be1..c51285c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "persistenceonejs", - "version": "2.3.0-rc2", + "version": "2.4.0-rc1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "persistenceonejs", - "version": "2.3.0-rc2", + "version": "2.4.0-rc1", "license": "ASLv2", "devDependencies": { "@cosmjs/amino": "^0.31.1", diff --git a/package.json b/package.json index 8a27549..446acb9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "persistenceonejs", - "version": "2.4.0-rc0", + "version": "2.4.0-rc1", "description": "Client side JS libraries for persistenceSDK transaction generation, signing and broadcasting.", "main": "main/index.js", "module": "module/index.js", diff --git a/proto/pstake/liquidstake/v1beta1/liquidstake.proto b/proto/pstake/liquidstake/v1beta1/liquidstake.proto index aa82f70..1bd663e 100644 --- a/proto/pstake/liquidstake/v1beta1/liquidstake.proto +++ b/proto/pstake/liquidstake/v1beta1/liquidstake.proto @@ -4,8 +4,6 @@ package pstake.liquidstake.v1beta1; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "google/protobuf/timestamp.proto"; option go_package = "github.com/persistenceOne/pstake-native/v2/x/liquidstake/types"; @@ -42,10 +40,35 @@ message Params { (gogoproto.nullable) = false ]; - // cw_locked_pool_address defines the bech32-encoded address of + // CwLockedPoolAddress defines the bech32-encoded address of // a CW smart-contract representing a time locked LP (e.g. Superfluid LP). string cw_locked_pool_address = 6 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // FeeAccountAddress defines the bech32-encoded address of + // a an account responsible for accumulating protocol fees. + string fee_account_address = 7 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // AutocompoundFeeRate specifies the fee rate for auto redelegating the stake + // rewards. The fee is taken in favour of the fee account (see + // FeeAccountAddress). + string autocompound_fee_rate = 8 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // WhitelistAdminAddress the bech32-encoded address of an admin authority + // that is allowed to update whitelisted validators or pause liquidstaking + // module entirely. The key is controlled by an offchain process that is + // selecting validators based on a criteria. Pausing of the module can be + // required during important migrations or failures. + string whitelist_admin_address = 9 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // ModulePaused is a safety toggle that allows to stop main module functions + // such as stake/unstake/stake-to-lp and the BeginBlocker logic. + bool module_paused = 10; } // ValidatorStatus enumerates the status of a liquid validator. @@ -65,8 +88,7 @@ enum ValidatorStatus { // WhitelistedValidator consists of the validator operator address and the // target weight, which is a value for calculating the real weight to be derived -// according to the active status. In the case of inactive, it is calculated as -// zero. +// according to the active status. message WhitelistedValidator { option (gogoproto.goproto_getters) = false; @@ -96,7 +118,6 @@ message LiquidValidator { // encoded in JSON. string operator_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - } // LiquidValidatorState is type LiquidValidator with state added to return to @@ -110,7 +131,6 @@ message LiquidValidatorState { string operator_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // weight specifies the weight for liquid staking, unstaking amount string weight = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", diff --git a/proto/pstake/liquidstake/v1beta1/tx.proto b/proto/pstake/liquidstake/v1beta1/tx.proto index 4ed81dd..9291fb1 100644 --- a/proto/pstake/liquidstake/v1beta1/tx.proto +++ b/proto/pstake/liquidstake/v1beta1/tx.proto @@ -26,6 +26,15 @@ service Msg { // UpdateParams defines a method to update the module params. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // UpdateWhitelistedValidators defines a method to update the whitelisted + // validators list. + rpc UpdateWhitelistedValidators(MsgUpdateWhitelistedValidators) + returns (MsgUpdateWhitelistedValidatorsResponse); + + // SetModulePaused defines a method to update the module's pause status, + // setting value of the safety flag in params. + rpc SetModulePaused(MsgSetModulePaused) returns (MsgSetModulePausedResponse); } // MsgLiquidStake defines a SDK message for performing a liquid stake of coins @@ -54,7 +63,6 @@ message MsgStakeToLP { string delegator_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - string validator_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; @@ -95,9 +103,46 @@ message MsgUpdateParams { // params defines the parameters to update. // - // NOTE: All parameters must be supplied. + // NOTE: denom and whitelisted validators are not updated. + // Params params = 2 [ (gogoproto.nullable) = false ]; } // MsgUpdateParamsResponse defines the response structure for executing a message MsgUpdateParamsResponse {} + +message MsgUpdateWhitelistedValidators { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address that is allowed to update whitelisted validators, + // defined as admin address in params (WhitelistAdminAddress). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // WhitelistedValidators specifies the validators elected to become Active + // Liquid Validators. + repeated WhitelistedValidator whitelisted_validators = 2 + [ (gogoproto.nullable) = false ]; +} + +// MsgUpdateWhitelistedValidatorsResponse defines the response structure for +// executing a +message MsgUpdateWhitelistedValidatorsResponse {} + +message MsgSetModulePaused { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address that is allowed to update module's paused state, + // defined as admin address in params (WhitelistAdminAddress). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // IsPaused represents the target state of the paused flag. + bool is_paused = 2; +} + +// MsgSetModulePausedResponse defines the response structure for +// executing a +message MsgSetModulePausedResponse {} diff --git a/proto/pstake/liquidstakeibc/v1beta1/liquidstakeibc.proto b/proto/pstake/liquidstakeibc/v1beta1/liquidstakeibc.proto index 3f93219..d38fa4b 100644 --- a/proto/pstake/liquidstakeibc/v1beta1/liquidstakeibc.proto +++ b/proto/pstake/liquidstakeibc/v1beta1/liquidstakeibc.proto @@ -60,10 +60,19 @@ message HostChain { ]; // host chain flags HostChainFlags flags = 16; + // non-compoundable chain reward params + RewardParams reward_params = 17; } message HostChainFlags { bool lsm = 1; } +message RewardParams { + // rewards denom on the host chain + string denom = 1; + // entity which will convert rewards to the host denom + string destination = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + message HostChainLSParams { string deposit_fee = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", @@ -107,6 +116,17 @@ message HostChainLSParams { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + string upper_c_value_limit = 10 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // upper limit for the c value of the host chain + + string lower_c_value_limit = 11 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // lower limit for the c value of the host chain } message ICAAccount { diff --git a/proto/pstake/liquidstakeibc/v1beta1/params.proto b/proto/pstake/liquidstakeibc/v1beta1/params.proto index 0dd9604..ae54669 100644 --- a/proto/pstake/liquidstakeibc/v1beta1/params.proto +++ b/proto/pstake/liquidstakeibc/v1beta1/params.proto @@ -18,15 +18,8 @@ message Params { string fee_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // protocol fee address - string upper_c_value_limit = 3 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; // upper limit for the c value of a host chain - - string lower_c_value_limit = 4 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; // lower limit for the c value of a host chain + // fields 3 and 4 were migrated to on-chain params. + // check https://github.com/persistenceOne/pstake-native/pull/732. + reserved 3; // upper_c_value_limit + reserved 4; // lower_c_value_limit } diff --git a/proto/pstake/liquidstakeibc/v1beta1/query.proto b/proto/pstake/liquidstakeibc/v1beta1/query.proto index ce39c76..28bc0a4 100644 --- a/proto/pstake/liquidstakeibc/v1beta1/query.proto +++ b/proto/pstake/liquidstakeibc/v1beta1/query.proto @@ -63,6 +63,13 @@ service Query { "/pstake/liquidstakeibc/v1beta1/user_unbondings/{address}"; } + // Queries all unbondings for a host chain. + rpc HostChainUserUnbondings(QueryHostChainUserUnbondingsRequest) + returns (QueryHostChainUserUnbondingsResponse) { + option (google.api.http).get = + "/pstake/liquidstakeibc/v1beta1/user_unbondings/{chain_id}"; + } + // Queries all validator unbondings for a host chain. rpc ValidatorUnbondings(QueryValidatorUnbondingRequest) returns (QueryValidatorUnbondingResponse) { @@ -84,6 +91,21 @@ service Query { option (google.api.http).get = "/pstake/liquidstakeibc/v1beta1/exchange_rate/{chain_id}"; } + + // Queries for a host chain redelegation entries on the host token delegation + // acct. + rpc Redelegations(QueryRedelegationsRequest) + returns (QueryRedelegationsResponse) { + option (google.api.http).get = + "/pstake/liquidstakeibc/v1beta1/redelegations/{chain_id}"; + } + + // Queries for a host chain redelegation-txs for the host token. + rpc RedelegationTx(QueryRedelegationTxRequest) + returns (QueryRedelegationTxResponse) { + option (google.api.http).get = + "/pstake/liquidstakeibc/v1beta1/redelegation_tx/{chain_id}"; + } } message QueryParamsRequest {} @@ -127,6 +149,16 @@ message QueryUserUnbondingsResponse { repeated UserUnbonding user_unbondings = 1; } +message QueryHostChainUserUnbondingsRequest { + string chain_id = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +message QueryHostChainUserUnbondingsResponse { + repeated UserUnbonding user_unbondings = 1; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + message QueryValidatorUnbondingRequest { string chain_id = 1; } message QueryValidatorUnbondingResponse { @@ -148,3 +180,15 @@ message QueryExchangeRateResponse { (cosmos_proto.scalar) = "cosmos.Dec" ]; } + +message QueryRedelegationsRequest { string chain_id = 1; } + +message QueryRedelegationsResponse { + liquidstakeibc.v1beta1.Redelegations redelegations = 1; +} + +message QueryRedelegationTxRequest { string chain_id = 1; } + +message QueryRedelegationTxResponse { + repeated liquidstakeibc.v1beta1.RedelegateTx redelegation_tx = 1; +} diff --git a/scripts/update-protos.sh b/scripts/update-protos.sh index 177fbf0..6eb12d5 100755 --- a/scripts/update-protos.sh +++ b/scripts/update-protos.sh @@ -13,53 +13,53 @@ ibc_git=https://github.com/persistenceOne/ibc-go.git ibc_tag=v7.2.0-lsm3 pstake_git=https://github.com/persistenceOne/pstake-native.git -pstake_tag=v2.7.1 +pstake_tag=v2.9.2-rc1 persistence_sdk_git=https://github.com/persistenceOne/persistence-sdk.git persistence_sdk_tag=v2.1.0 wasmd_git=https://github.com/persistenceOne/wasmd.git wasmd_tag=v0.40.2-lsm3 -# -#echo "updating amino, cosmos, tendermint from cosmos-sdk" -#git clone $cosmos_git -#cd cosmos-sdk -#git checkout $cosmos_tag -# -#rm -rf ../proto/cosmos -#rm -rf ../proto/amino -#rm -rf ../proto/tendermint -#cp -r proto/amino ../proto/amino -#cp -r proto/cosmos ../proto/cosmos -#cp -r proto/tendermint ../proto/tendermint -# -#cd .. -#rm -rf cosmos-sdk -#echo "remove problematic packages autocli" -#rm -rf proto/cosmos/autocli -# -#echo "updating ics23 from cosmos/ics23" -#git clone $ics23_git -#cd ics23 -#git checkout $ics23_tag -# -#rm -rf ../proto/cosmos/ics23 -#cp -r proto/cosmos/ics23 ../proto/cosmos/ics23 -# -#cd .. -#rm -rf ics23 -# -#echo "updating ibc from ibc-go" -#git clone $ibc_git -#cd ibc-go -#git checkout $ibc_tag -# -#rm -rf ../proto/ibc -#cp -r proto/ibc ../proto/ibc -# -#cd .. -#rm -rf ibc-go -# + +echo "updating amino, cosmos, tendermint from cosmos-sdk" +git clone $cosmos_git +cd cosmos-sdk +git checkout $cosmos_tag + +rm -rf ../proto/cosmos +rm -rf ../proto/amino +rm -rf ../proto/tendermint +cp -r proto/amino ../proto/amino +cp -r proto/cosmos ../proto/cosmos +cp -r proto/tendermint ../proto/tendermint + +cd .. +rm -rf cosmos-sdk +echo "remove problematic packages autocli" +rm -rf proto/cosmos/autocli + +echo "updating ics23 from cosmos/ics23" +git clone $ics23_git +cd ics23 +git checkout $ics23_tag + +rm -rf ../proto/cosmos/ics23 +cp -r proto/cosmos/ics23 ../proto/cosmos/ics23 + +cd .. +rm -rf ics23 + +echo "updating ibc from ibc-go" +git clone $ibc_git +cd ibc-go +git checkout $ibc_tag + +rm -rf ../proto/ibc +cp -r proto/ibc ../proto/ibc + +cd .. +rm -rf ibc-go + echo "updating pstake from pstake-native" git clone $pstake_git cd pstake-native @@ -71,28 +71,28 @@ cp -r proto/pstake ../proto/pstake cd .. rm -rf pstake-native -#echo "updating persistence from persistence-sdk" -#git clone $persistence_sdk_git -#cd persistence-sdk -#git checkout $persistence_sdk_tag -# -#rm -rf ../proto/persistence -#cp -r proto/persistence ../proto/persistence -# -#cd .. -#rm -rf persistence-sdk -# -#echo "remove problematic packages interchainquery and oracle" -#rm -rf proto/persistence/interchainquery -#rm -rf proto/persistence/oracle -# -#echo "updating cosmwasm from wasmd" -#git clone $wasmd_git -#cd wasmd -#git checkout $wasmd_tag -# -#rm -rf ../proto/cosmwasm -#cp -r proto/cosmwasm ../proto/cosmwasm -# -#cd .. -#rm -rf wasmd +echo "updating persistence from persistence-sdk" +git clone $persistence_sdk_git +cd persistence-sdk +git checkout $persistence_sdk_tag + +rm -rf ../proto/persistence +cp -r proto/persistence ../proto/persistence + +cd .. +rm -rf persistence-sdk + +echo "remove problematic packages interchainquery and oracle" +rm -rf proto/persistence/interchainquery +rm -rf proto/persistence/oracle + +echo "updating cosmwasm from wasmd" +git clone $wasmd_git +cd wasmd +git checkout $wasmd_tag + +rm -rf ../proto/cosmwasm +cp -r proto/cosmwasm ../proto/cosmwasm + +cd .. +rm -rf wasmd diff --git a/src/pstake/client.ts b/src/pstake/client.ts index 815a57b..1313da0 100644 --- a/src/pstake/client.ts +++ b/src/pstake/client.ts @@ -5,18 +5,22 @@ import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import * as pstakeLiquidstakeV1beta1TxRegistry from "./liquidstake/v1beta1/tx.registry"; import * as pstakeLiquidstakeibcV1beta1MsgsRegistry from "./liquidstakeibc/v1beta1/msgs.registry"; import * as pstakeLscosmosV1beta1MsgsRegistry from "./lscosmos/v1beta1/msgs.registry"; +import * as pstakeRatesyncV1beta1TxRegistry from "./ratesync/v1beta1/tx.registry"; import * as pstakeLiquidstakeV1beta1TxAmino from "./liquidstake/v1beta1/tx.amino"; import * as pstakeLiquidstakeibcV1beta1MsgsAmino from "./liquidstakeibc/v1beta1/msgs.amino"; import * as pstakeLscosmosV1beta1MsgsAmino from "./lscosmos/v1beta1/msgs.amino"; +import * as pstakeRatesyncV1beta1TxAmino from "./ratesync/v1beta1/tx.amino"; export const pstakeAminoConverters = { ...pstakeLiquidstakeV1beta1TxAmino.AminoConverter, ...pstakeLiquidstakeibcV1beta1MsgsAmino.AminoConverter, ...pstakeLscosmosV1beta1MsgsAmino.AminoConverter, + ...pstakeRatesyncV1beta1TxAmino.AminoConverter, }; export const pstakeProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [ ...pstakeLiquidstakeV1beta1TxRegistry.registry, ...pstakeLiquidstakeibcV1beta1MsgsRegistry.registry, ...pstakeLscosmosV1beta1MsgsRegistry.registry, + ...pstakeRatesyncV1beta1TxRegistry.registry, ]; export const getSigningPstakeClientOptions = (): { registry: Registry; diff --git a/src/pstake/liquidstake/v1beta1/liquidstake.ts b/src/pstake/liquidstake/v1beta1/liquidstake.ts index 2561ad3..78ed099 100644 --- a/src/pstake/liquidstake/v1beta1/liquidstake.ts +++ b/src/pstake/liquidstake/v1beta1/liquidstake.ts @@ -71,16 +71,39 @@ export interface Params { */ minLiquidStakeAmount: string; /** - * cw_locked_pool_address defines the bech32-encoded address of + * CwLockedPoolAddress defines the bech32-encoded address of * a CW smart-contract representing a time locked LP (e.g. Superfluid LP). */ cwLockedPoolAddress: string; + /** + * FeeAccountAddress defines the bech32-encoded address of + * a an account responsible for accumulating protocol fees. + */ + feeAccountAddress: string; + /** + * AutocompoundFeeRate specifies the fee rate for auto redelegating the stake + * rewards. The fee is taken in favour of the fee account (see + * FeeAccountAddress). + */ + autocompoundFeeRate: string; + /** + * WhitelistAdminAddress the bech32-encoded address of an admin authority + * that is allowed to update whitelisted validators or pause liquidstaking + * module entirely. The key is controlled by an offchain process that is + * selecting validators based on a criteria. Pausing of the module can be + * required during important migrations or failures. + */ + whitelistAdminAddress: string; + /** + * ModulePaused is a safety toggle that allows to stop main module functions + * such as stake/unstake/stake-to-lp and the BeginBlocker logic. + */ + modulePaused: boolean; } /** * WhitelistedValidator consists of the validator operator address and the * target weight, which is a value for calculating the real weight to be derived - * according to the active status. In the case of inactive, it is calculated as - * zero. + * according to the active status. */ export interface WhitelistedValidator { /** @@ -172,6 +195,10 @@ function createBaseParams(): Params { lsmDisabled: false, minLiquidStakeAmount: "", cwLockedPoolAddress: "", + feeAccountAddress: "", + autocompoundFeeRate: "", + whitelistAdminAddress: "", + modulePaused: false, }; } export const Params = { @@ -194,6 +221,18 @@ export const Params = { if (message.cwLockedPoolAddress !== "") { writer.uint32(50).string(message.cwLockedPoolAddress); } + if (message.feeAccountAddress !== "") { + writer.uint32(58).string(message.feeAccountAddress); + } + if (message.autocompoundFeeRate !== "") { + writer.uint32(66).string(message.autocompoundFeeRate); + } + if (message.whitelistAdminAddress !== "") { + writer.uint32(74).string(message.whitelistAdminAddress); + } + if (message.modulePaused === true) { + writer.uint32(80).bool(message.modulePaused); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Params { @@ -221,6 +260,18 @@ export const Params = { case 6: message.cwLockedPoolAddress = reader.string(); break; + case 7: + message.feeAccountAddress = reader.string(); + break; + case 8: + message.autocompoundFeeRate = reader.string(); + break; + case 9: + message.whitelistAdminAddress = reader.string(); + break; + case 10: + message.modulePaused = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -239,6 +290,10 @@ export const Params = { if (isSet(object.lsmDisabled)) obj.lsmDisabled = Boolean(object.lsmDisabled); if (isSet(object.minLiquidStakeAmount)) obj.minLiquidStakeAmount = String(object.minLiquidStakeAmount); if (isSet(object.cwLockedPoolAddress)) obj.cwLockedPoolAddress = String(object.cwLockedPoolAddress); + if (isSet(object.feeAccountAddress)) obj.feeAccountAddress = String(object.feeAccountAddress); + if (isSet(object.autocompoundFeeRate)) obj.autocompoundFeeRate = String(object.autocompoundFeeRate); + if (isSet(object.whitelistAdminAddress)) obj.whitelistAdminAddress = String(object.whitelistAdminAddress); + if (isSet(object.modulePaused)) obj.modulePaused = Boolean(object.modulePaused); return obj; }, toJSON(message: Params): unknown { @@ -255,6 +310,11 @@ export const Params = { message.lsmDisabled !== undefined && (obj.lsmDisabled = message.lsmDisabled); message.minLiquidStakeAmount !== undefined && (obj.minLiquidStakeAmount = message.minLiquidStakeAmount); message.cwLockedPoolAddress !== undefined && (obj.cwLockedPoolAddress = message.cwLockedPoolAddress); + message.feeAccountAddress !== undefined && (obj.feeAccountAddress = message.feeAccountAddress); + message.autocompoundFeeRate !== undefined && (obj.autocompoundFeeRate = message.autocompoundFeeRate); + message.whitelistAdminAddress !== undefined && + (obj.whitelistAdminAddress = message.whitelistAdminAddress); + message.modulePaused !== undefined && (obj.modulePaused = message.modulePaused); return obj; }, fromPartial(object: Partial): Params { @@ -266,6 +326,10 @@ export const Params = { message.lsmDisabled = object.lsmDisabled ?? false; message.minLiquidStakeAmount = object.minLiquidStakeAmount ?? ""; message.cwLockedPoolAddress = object.cwLockedPoolAddress ?? ""; + message.feeAccountAddress = object.feeAccountAddress ?? ""; + message.autocompoundFeeRate = object.autocompoundFeeRate ?? ""; + message.whitelistAdminAddress = object.whitelistAdminAddress ?? ""; + message.modulePaused = object.modulePaused ?? false; return message; }, }; diff --git a/src/pstake/liquidstake/v1beta1/tx.amino.ts b/src/pstake/liquidstake/v1beta1/tx.amino.ts index 6f3003e..ad8aa15 100644 --- a/src/pstake/liquidstake/v1beta1/tx.amino.ts +++ b/src/pstake/liquidstake/v1beta1/tx.amino.ts @@ -1,6 +1,13 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; -import { MsgLiquidStake, MsgLiquidUnstake, MsgStakeToLP, MsgUpdateParams } from "./tx"; +import { + MsgLiquidStake, + MsgLiquidUnstake, + MsgStakeToLP, + MsgUpdateParams, + MsgUpdateWhitelistedValidators, + MsgSetModulePaused, +} from "./tx"; export interface MsgLiquidStakeAminoType extends AminoMsg { type: "/pstake.liquidstake.v1beta1.MsgLiquidStake"; value: { @@ -50,9 +57,30 @@ export interface MsgUpdateParamsAminoType extends AminoMsg { lsm_disabled: boolean; min_liquid_stake_amount: string; cw_locked_pool_address: string; + fee_account_address: string; + autocompound_fee_rate: string; + whitelist_admin_address: string; + module_paused: boolean; }; }; } +export interface MsgUpdateWhitelistedValidatorsAminoType extends AminoMsg { + type: "/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators"; + value: { + authority: string; + whitelisted_validators: { + validator_address: string; + target_weight: string; + }[]; + }; +} +export interface MsgSetModulePausedAminoType extends AminoMsg { + type: "/pstake.liquidstake.v1beta1.MsgSetModulePaused"; + value: { + authority: string; + is_paused: boolean; + }; +} export const AminoConverter = { "/pstake.liquidstake.v1beta1.MsgLiquidStake": { aminoType: "/pstake.liquidstake.v1beta1.MsgLiquidStake", @@ -152,6 +180,10 @@ export const AminoConverter = { lsm_disabled: params.lsmDisabled, min_liquid_stake_amount: params.minLiquidStakeAmount, cw_locked_pool_address: params.cwLockedPoolAddress, + fee_account_address: params.feeAccountAddress, + autocompound_fee_rate: params.autocompoundFeeRate, + whitelist_admin_address: params.whitelistAdminAddress, + module_paused: params.modulePaused, }, }; }, @@ -168,8 +200,54 @@ export const AminoConverter = { lsmDisabled: params.lsm_disabled, minLiquidStakeAmount: params.min_liquid_stake_amount, cwLockedPoolAddress: params.cw_locked_pool_address, + feeAccountAddress: params.fee_account_address, + autocompoundFeeRate: params.autocompound_fee_rate, + whitelistAdminAddress: params.whitelist_admin_address, + modulePaused: params.module_paused, }, }; }, }, + "/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators": { + aminoType: "/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators", + toAmino: ({ + authority, + whitelistedValidators, + }: MsgUpdateWhitelistedValidators): MsgUpdateWhitelistedValidatorsAminoType["value"] => { + return { + authority, + whitelisted_validators: whitelistedValidators.map((el0) => ({ + validator_address: el0.validatorAddress, + target_weight: el0.targetWeight, + })), + }; + }, + fromAmino: ({ + authority, + whitelisted_validators, + }: MsgUpdateWhitelistedValidatorsAminoType["value"]): MsgUpdateWhitelistedValidators => { + return { + authority, + whitelistedValidators: whitelisted_validators.map((el0) => ({ + validatorAddress: el0.validator_address, + targetWeight: el0.target_weight, + })), + }; + }, + }, + "/pstake.liquidstake.v1beta1.MsgSetModulePaused": { + aminoType: "/pstake.liquidstake.v1beta1.MsgSetModulePaused", + toAmino: ({ authority, isPaused }: MsgSetModulePaused): MsgSetModulePausedAminoType["value"] => { + return { + authority, + is_paused: isPaused, + }; + }, + fromAmino: ({ authority, is_paused }: MsgSetModulePausedAminoType["value"]): MsgSetModulePaused => { + return { + authority, + isPaused: is_paused, + }; + }, + }, }; diff --git a/src/pstake/liquidstake/v1beta1/tx.registry.ts b/src/pstake/liquidstake/v1beta1/tx.registry.ts index bf0ac37..7327399 100644 --- a/src/pstake/liquidstake/v1beta1/tx.registry.ts +++ b/src/pstake/liquidstake/v1beta1/tx.registry.ts @@ -1,12 +1,21 @@ //@ts-nocheck /* eslint-disable */ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgLiquidStake, MsgLiquidUnstake, MsgStakeToLP, MsgUpdateParams } from "./tx"; +import { + MsgLiquidStake, + MsgLiquidUnstake, + MsgStakeToLP, + MsgUpdateParams, + MsgUpdateWhitelistedValidators, + MsgSetModulePaused, +} from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [ ["/pstake.liquidstake.v1beta1.MsgLiquidStake", MsgLiquidStake], ["/pstake.liquidstake.v1beta1.MsgLiquidUnstake", MsgLiquidUnstake], ["/pstake.liquidstake.v1beta1.MsgStakeToLP", MsgStakeToLP], ["/pstake.liquidstake.v1beta1.MsgUpdateParams", MsgUpdateParams], + ["/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators", MsgUpdateWhitelistedValidators], + ["/pstake.liquidstake.v1beta1.MsgSetModulePaused", MsgSetModulePaused], ]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { @@ -39,6 +48,18 @@ export const MessageComposer = { value: MsgUpdateParams.encode(value).finish(), }; }, + updateWhitelistedValidators(value: MsgUpdateWhitelistedValidators) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators", + value: MsgUpdateWhitelistedValidators.encode(value).finish(), + }; + }, + setModulePaused(value: MsgSetModulePaused) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgSetModulePaused", + value: MsgSetModulePaused.encode(value).finish(), + }; + }, }, withTypeUrl: { liquidStake(value: MsgLiquidStake) { @@ -65,6 +86,18 @@ export const MessageComposer = { value, }; }, + updateWhitelistedValidators(value: MsgUpdateWhitelistedValidators) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators", + value, + }; + }, + setModulePaused(value: MsgSetModulePaused) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgSetModulePaused", + value, + }; + }, }, toJSON: { liquidStake(value: MsgLiquidStake) { @@ -91,6 +124,18 @@ export const MessageComposer = { value: MsgUpdateParams.toJSON(value), }; }, + updateWhitelistedValidators(value: MsgUpdateWhitelistedValidators) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators", + value: MsgUpdateWhitelistedValidators.toJSON(value), + }; + }, + setModulePaused(value: MsgSetModulePaused) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgSetModulePaused", + value: MsgSetModulePaused.toJSON(value), + }; + }, }, fromJSON: { liquidStake(value: any) { @@ -117,6 +162,18 @@ export const MessageComposer = { value: MsgUpdateParams.fromJSON(value), }; }, + updateWhitelistedValidators(value: any) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators", + value: MsgUpdateWhitelistedValidators.fromJSON(value), + }; + }, + setModulePaused(value: any) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgSetModulePaused", + value: MsgSetModulePaused.fromJSON(value), + }; + }, }, fromPartial: { liquidStake(value: MsgLiquidStake) { @@ -143,5 +200,17 @@ export const MessageComposer = { value: MsgUpdateParams.fromPartial(value), }; }, + updateWhitelistedValidators(value: MsgUpdateWhitelistedValidators) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgUpdateWhitelistedValidators", + value: MsgUpdateWhitelistedValidators.fromPartial(value), + }; + }, + setModulePaused(value: MsgSetModulePaused) { + return { + typeUrl: "/pstake.liquidstake.v1beta1.MsgSetModulePaused", + value: MsgSetModulePaused.fromPartial(value), + }; + }, }, }; diff --git a/src/pstake/liquidstake/v1beta1/tx.ts b/src/pstake/liquidstake/v1beta1/tx.ts index b7481cb..1d535d0 100644 --- a/src/pstake/liquidstake/v1beta1/tx.ts +++ b/src/pstake/liquidstake/v1beta1/tx.ts @@ -1,6 +1,6 @@ /* eslint-disable */ import { Coin } from "../../../cosmos/base/v1beta1/coin"; -import { Params } from "./liquidstake"; +import { Params, WhitelistedValidator } from "./liquidstake"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, fromJsonTimestamp, fromTimestamp, Rpc } from "../../../helpers"; @@ -48,12 +48,43 @@ export interface MsgUpdateParams { /** * params defines the parameters to update. * - * NOTE: All parameters must be supplied. + * NOTE: denom and whitelisted validators are not updated. */ params: Params; } /** MsgUpdateParamsResponse defines the response structure for executing a */ export interface MsgUpdateParamsResponse {} +export interface MsgUpdateWhitelistedValidators { + /** + * Authority is the address that is allowed to update whitelisted validators, + * defined as admin address in params (WhitelistAdminAddress). + */ + authority: string; + /** + * WhitelistedValidators specifies the validators elected to become Active + * Liquid Validators. + */ + whitelistedValidators: WhitelistedValidator[]; +} +/** + * MsgUpdateWhitelistedValidatorsResponse defines the response structure for + * executing a + */ +export interface MsgUpdateWhitelistedValidatorsResponse {} +export interface MsgSetModulePaused { + /** + * Authority is the address that is allowed to update module's paused state, + * defined as admin address in params (WhitelistAdminAddress). + */ + authority: string; + /** IsPaused represents the target state of the paused flag. */ + isPaused: boolean; +} +/** + * MsgSetModulePausedResponse defines the response structure for + * executing a + */ +export interface MsgSetModulePausedResponse {} function createBaseMsgLiquidStake(): MsgLiquidStake { return { delegatorAddress: "", @@ -456,6 +487,200 @@ export const MsgUpdateParamsResponse = { return message; }, }; +function createBaseMsgUpdateWhitelistedValidators(): MsgUpdateWhitelistedValidators { + return { + authority: "", + whitelistedValidators: [], + }; +} +export const MsgUpdateWhitelistedValidators = { + encode( + message: MsgUpdateWhitelistedValidators, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.whitelistedValidators) { + WhitelistedValidator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateWhitelistedValidators { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateWhitelistedValidators(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.whitelistedValidators.push(WhitelistedValidator.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateWhitelistedValidators { + const obj = createBaseMsgUpdateWhitelistedValidators(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (Array.isArray(object?.whitelistedValidators)) + obj.whitelistedValidators = object.whitelistedValidators.map((e: any) => + WhitelistedValidator.fromJSON(e), + ); + return obj; + }, + toJSON(message: MsgUpdateWhitelistedValidators): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + if (message.whitelistedValidators) { + obj.whitelistedValidators = message.whitelistedValidators.map((e) => + e ? WhitelistedValidator.toJSON(e) : undefined, + ); + } else { + obj.whitelistedValidators = []; + } + return obj; + }, + fromPartial(object: Partial): MsgUpdateWhitelistedValidators { + const message = createBaseMsgUpdateWhitelistedValidators(); + message.authority = object.authority ?? ""; + message.whitelistedValidators = + object.whitelistedValidators?.map((e) => WhitelistedValidator.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgUpdateWhitelistedValidatorsResponse(): MsgUpdateWhitelistedValidatorsResponse { + return {}; +} +export const MsgUpdateWhitelistedValidatorsResponse = { + encode( + _: MsgUpdateWhitelistedValidatorsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateWhitelistedValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateWhitelistedValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateWhitelistedValidatorsResponse { + const obj = createBaseMsgUpdateWhitelistedValidatorsResponse(); + return obj; + }, + toJSON(_: MsgUpdateWhitelistedValidatorsResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateWhitelistedValidatorsResponse { + const message = createBaseMsgUpdateWhitelistedValidatorsResponse(); + return message; + }, +}; +function createBaseMsgSetModulePaused(): MsgSetModulePaused { + return { + authority: "", + isPaused: false, + }; +} +export const MsgSetModulePaused = { + encode(message: MsgSetModulePaused, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.isPaused === true) { + writer.uint32(16).bool(message.isPaused); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetModulePaused { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetModulePaused(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.isPaused = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSetModulePaused { + const obj = createBaseMsgSetModulePaused(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (isSet(object.isPaused)) obj.isPaused = Boolean(object.isPaused); + return obj; + }, + toJSON(message: MsgSetModulePaused): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.isPaused !== undefined && (obj.isPaused = message.isPaused); + return obj; + }, + fromPartial(object: Partial): MsgSetModulePaused { + const message = createBaseMsgSetModulePaused(); + message.authority = object.authority ?? ""; + message.isPaused = object.isPaused ?? false; + return message; + }, +}; +function createBaseMsgSetModulePausedResponse(): MsgSetModulePausedResponse { + return {}; +} +export const MsgSetModulePausedResponse = { + encode(_: MsgSetModulePausedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetModulePausedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetModulePausedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgSetModulePausedResponse { + const obj = createBaseMsgSetModulePausedResponse(); + return obj; + }, + toJSON(_: MsgSetModulePausedResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgSetModulePausedResponse { + const message = createBaseMsgSetModulePausedResponse(); + return message; + }, +}; /** Msg defines the liquid staking Msg service. */ export interface Msg { /** @@ -475,6 +700,18 @@ export interface Msg { StakeToLP(request: MsgStakeToLP): Promise; /** UpdateParams defines a method to update the module params. */ UpdateParams(request: MsgUpdateParams): Promise; + /** + * UpdateWhitelistedValidators defines a method to update the whitelisted + * validators list. + */ + UpdateWhitelistedValidators( + request: MsgUpdateWhitelistedValidators, + ): Promise; + /** + * SetModulePaused defines a method to update the module's pause status, + * setting value of the safety flag in params. + */ + SetModulePaused(request: MsgSetModulePaused): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -484,6 +721,8 @@ export class MsgClientImpl implements Msg { this.LiquidUnstake = this.LiquidUnstake.bind(this); this.StakeToLP = this.StakeToLP.bind(this); this.UpdateParams = this.UpdateParams.bind(this); + this.UpdateWhitelistedValidators = this.UpdateWhitelistedValidators.bind(this); + this.SetModulePaused = this.SetModulePaused.bind(this); } LiquidStake(request: MsgLiquidStake): Promise { const data = MsgLiquidStake.encode(request).finish(); @@ -505,4 +744,16 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("pstake.liquidstake.v1beta1.Msg", "UpdateParams", data); return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); } + UpdateWhitelistedValidators( + request: MsgUpdateWhitelistedValidators, + ): Promise { + const data = MsgUpdateWhitelistedValidators.encode(request).finish(); + const promise = this.rpc.request("pstake.liquidstake.v1beta1.Msg", "UpdateWhitelistedValidators", data); + return promise.then((data) => MsgUpdateWhitelistedValidatorsResponse.decode(new BinaryReader(data))); + } + SetModulePaused(request: MsgSetModulePaused): Promise { + const data = MsgSetModulePaused.encode(request).finish(); + const promise = this.rpc.request("pstake.liquidstake.v1beta1.Msg", "SetModulePaused", data); + return promise.then((data) => MsgSetModulePausedResponse.decode(new BinaryReader(data))); + } } diff --git a/src/pstake/liquidstakeibc/v1beta1/liquidstakeibc.ts b/src/pstake/liquidstakeibc/v1beta1/liquidstakeibc.ts index 6b8d581..13e053d 100644 --- a/src/pstake/liquidstakeibc/v1beta1/liquidstakeibc.ts +++ b/src/pstake/liquidstakeibc/v1beta1/liquidstakeibc.ts @@ -254,10 +254,18 @@ export interface HostChain { autoCompoundFactor: string; /** host chain flags */ flags: HostChainFlags; + /** non-compoundable chain reward params */ + rewardParams: RewardParams; } export interface HostChainFlags { lsm: boolean; } +export interface RewardParams { + /** rewards denom on the host chain */ + denom: string; + /** entity which will convert rewards to the host denom */ + destination: string; +} export interface HostChainLSParams { depositFee: string; restakeFee: string; @@ -273,6 +281,8 @@ export interface HostChainLSParams { maxEntries: number; /** amount skew that is acceptable before redelegating */ redelegationAcceptableDelta: string; + upperCValueLimit: string; + lowerCValueLimit: string; } export interface ICAAccount { /** address of the ica on the controller chain */ @@ -415,6 +425,7 @@ function createBaseHostChain(): HostChain { active: false, autoCompoundFactor: "", flags: HostChainFlags.fromPartial({}), + rewardParams: RewardParams.fromPartial({}), }; } export const HostChain = { @@ -467,6 +478,9 @@ export const HostChain = { if (message.flags !== undefined) { HostChainFlags.encode(message.flags, writer.uint32(130).fork()).ldelim(); } + if (message.rewardParams !== undefined) { + RewardParams.encode(message.rewardParams, writer.uint32(138).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): HostChain { @@ -524,6 +538,9 @@ export const HostChain = { case 16: message.flags = HostChainFlags.decode(reader, reader.uint32()); break; + case 17: + message.rewardParams = RewardParams.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -551,6 +568,7 @@ export const HostChain = { if (isSet(object.active)) obj.active = Boolean(object.active); if (isSet(object.autoCompoundFactor)) obj.autoCompoundFactor = String(object.autoCompoundFactor); if (isSet(object.flags)) obj.flags = HostChainFlags.fromJSON(object.flags); + if (isSet(object.rewardParams)) obj.rewardParams = RewardParams.fromJSON(object.rewardParams); return obj; }, toJSON(message: HostChain): unknown { @@ -582,6 +600,8 @@ export const HostChain = { message.autoCompoundFactor !== undefined && (obj.autoCompoundFactor = message.autoCompoundFactor); message.flags !== undefined && (obj.flags = message.flags ? HostChainFlags.toJSON(message.flags) : undefined); + message.rewardParams !== undefined && + (obj.rewardParams = message.rewardParams ? RewardParams.toJSON(message.rewardParams) : undefined); return obj; }, fromPartial(object: Partial): HostChain { @@ -612,6 +632,9 @@ export const HostChain = { if (object.flags !== undefined && object.flags !== null) { message.flags = HostChainFlags.fromPartial(object.flags); } + if (object.rewardParams !== undefined && object.rewardParams !== null) { + message.rewardParams = RewardParams.fromPartial(object.rewardParams); + } return message; }, }; @@ -660,6 +683,61 @@ export const HostChainFlags = { return message; }, }; +function createBaseRewardParams(): RewardParams { + return { + denom: "", + destination: "", + }; +} +export const RewardParams = { + encode(message: RewardParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.destination !== "") { + writer.uint32(18).string(message.destination); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RewardParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRewardParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.destination = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): RewardParams { + const obj = createBaseRewardParams(); + if (isSet(object.denom)) obj.denom = String(object.denom); + if (isSet(object.destination)) obj.destination = String(object.destination); + return obj; + }, + toJSON(message: RewardParams): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.destination !== undefined && (obj.destination = message.destination); + return obj; + }, + fromPartial(object: Partial): RewardParams { + const message = createBaseRewardParams(); + message.denom = object.denom ?? ""; + message.destination = object.destination ?? ""; + return message; + }, +}; function createBaseHostChainLSParams(): HostChainLSParams { return { depositFee: "", @@ -670,6 +748,8 @@ function createBaseHostChainLSParams(): HostChainLSParams { lsmBondFactor: "", maxEntries: 0, redelegationAcceptableDelta: "", + upperCValueLimit: "", + lowerCValueLimit: "", }; } export const HostChainLSParams = { @@ -698,6 +778,12 @@ export const HostChainLSParams = { if (message.redelegationAcceptableDelta !== "") { writer.uint32(74).string(message.redelegationAcceptableDelta); } + if (message.upperCValueLimit !== "") { + writer.uint32(82).string(message.upperCValueLimit); + } + if (message.lowerCValueLimit !== "") { + writer.uint32(90).string(message.lowerCValueLimit); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): HostChainLSParams { @@ -731,6 +817,12 @@ export const HostChainLSParams = { case 9: message.redelegationAcceptableDelta = reader.string(); break; + case 10: + message.upperCValueLimit = reader.string(); + break; + case 11: + message.lowerCValueLimit = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -749,6 +841,8 @@ export const HostChainLSParams = { if (isSet(object.maxEntries)) obj.maxEntries = Number(object.maxEntries); if (isSet(object.redelegationAcceptableDelta)) obj.redelegationAcceptableDelta = String(object.redelegationAcceptableDelta); + if (isSet(object.upperCValueLimit)) obj.upperCValueLimit = String(object.upperCValueLimit); + if (isSet(object.lowerCValueLimit)) obj.lowerCValueLimit = String(object.lowerCValueLimit); return obj; }, toJSON(message: HostChainLSParams): unknown { @@ -762,6 +856,8 @@ export const HostChainLSParams = { message.maxEntries !== undefined && (obj.maxEntries = Math.round(message.maxEntries)); message.redelegationAcceptableDelta !== undefined && (obj.redelegationAcceptableDelta = message.redelegationAcceptableDelta); + message.upperCValueLimit !== undefined && (obj.upperCValueLimit = message.upperCValueLimit); + message.lowerCValueLimit !== undefined && (obj.lowerCValueLimit = message.lowerCValueLimit); return obj; }, fromPartial(object: Partial): HostChainLSParams { @@ -774,6 +870,8 @@ export const HostChainLSParams = { message.lsmBondFactor = object.lsmBondFactor ?? ""; message.maxEntries = object.maxEntries ?? 0; message.redelegationAcceptableDelta = object.redelegationAcceptableDelta ?? ""; + message.upperCValueLimit = object.upperCValueLimit ?? ""; + message.lowerCValueLimit = object.lowerCValueLimit ?? ""; return message; }, }; diff --git a/src/pstake/liquidstakeibc/v1beta1/msgs.amino.ts b/src/pstake/liquidstakeibc/v1beta1/msgs.amino.ts index 1bda540..18beb1c 100644 --- a/src/pstake/liquidstakeibc/v1beta1/msgs.amino.ts +++ b/src/pstake/liquidstakeibc/v1beta1/msgs.amino.ts @@ -84,8 +84,6 @@ export interface MsgUpdateParamsAminoType extends AminoMsg { params: { admin_address: string; fee_address: string; - upper_c_value_limit: string; - lower_c_value_limit: string; }; }; } @@ -273,8 +271,6 @@ export const AminoConverter = { params: { admin_address: params.adminAddress, fee_address: params.feeAddress, - upper_c_value_limit: params.upperCValueLimit, - lower_c_value_limit: params.lowerCValueLimit, }, }; }, @@ -284,8 +280,6 @@ export const AminoConverter = { params: { adminAddress: params.admin_address, feeAddress: params.fee_address, - upperCValueLimit: params.upper_c_value_limit, - lowerCValueLimit: params.lower_c_value_limit, }, }; }, diff --git a/src/pstake/liquidstakeibc/v1beta1/params.ts b/src/pstake/liquidstakeibc/v1beta1/params.ts index 1f0ed08..ee023dd 100644 --- a/src/pstake/liquidstakeibc/v1beta1/params.ts +++ b/src/pstake/liquidstakeibc/v1beta1/params.ts @@ -6,15 +6,11 @@ export const protobufPackage = "pstake.liquidstakeibc.v1beta1"; export interface Params { adminAddress: string; feeAddress: string; - upperCValueLimit: string; - lowerCValueLimit: string; } function createBaseParams(): Params { return { adminAddress: "", feeAddress: "", - upperCValueLimit: "", - lowerCValueLimit: "", }; } export const Params = { @@ -25,12 +21,6 @@ export const Params = { if (message.feeAddress !== "") { writer.uint32(18).string(message.feeAddress); } - if (message.upperCValueLimit !== "") { - writer.uint32(26).string(message.upperCValueLimit); - } - if (message.lowerCValueLimit !== "") { - writer.uint32(34).string(message.lowerCValueLimit); - } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Params { @@ -46,12 +36,6 @@ export const Params = { case 2: message.feeAddress = reader.string(); break; - case 3: - message.upperCValueLimit = reader.string(); - break; - case 4: - message.lowerCValueLimit = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -63,24 +47,18 @@ export const Params = { const obj = createBaseParams(); if (isSet(object.adminAddress)) obj.adminAddress = String(object.adminAddress); if (isSet(object.feeAddress)) obj.feeAddress = String(object.feeAddress); - if (isSet(object.upperCValueLimit)) obj.upperCValueLimit = String(object.upperCValueLimit); - if (isSet(object.lowerCValueLimit)) obj.lowerCValueLimit = String(object.lowerCValueLimit); return obj; }, toJSON(message: Params): unknown { const obj: any = {}; message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress); message.feeAddress !== undefined && (obj.feeAddress = message.feeAddress); - message.upperCValueLimit !== undefined && (obj.upperCValueLimit = message.upperCValueLimit); - message.lowerCValueLimit !== undefined && (obj.lowerCValueLimit = message.lowerCValueLimit); return obj; }, fromPartial(object: Partial): Params { const message = createBaseParams(); message.adminAddress = object.adminAddress ?? ""; message.feeAddress = object.feeAddress ?? ""; - message.upperCValueLimit = object.upperCValueLimit ?? ""; - message.lowerCValueLimit = object.lowerCValueLimit ?? ""; return message; }, }; diff --git a/src/pstake/liquidstakeibc/v1beta1/query.ts b/src/pstake/liquidstakeibc/v1beta1/query.ts index 1a10bc3..9e80eb6 100644 --- a/src/pstake/liquidstakeibc/v1beta1/query.ts +++ b/src/pstake/liquidstakeibc/v1beta1/query.ts @@ -1,4 +1,5 @@ /* eslint-disable */ +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; import { Params } from "./params"; import { HostChain, @@ -7,6 +8,8 @@ import { Unbonding, UserUnbonding, ValidatorUnbonding, + Redelegations, + RedelegateTx, } from "./liquidstakeibc"; import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; @@ -57,6 +60,14 @@ export interface QueryUserUnbondingsRequest { export interface QueryUserUnbondingsResponse { userUnbondings: UserUnbonding[]; } +export interface QueryHostChainUserUnbondingsRequest { + chainId: string; + pagination: PageRequest; +} +export interface QueryHostChainUserUnbondingsResponse { + userUnbondings: UserUnbonding[]; + pagination: PageResponse; +} export interface QueryValidatorUnbondingRequest { chainId: string; } @@ -75,6 +86,18 @@ export interface QueryExchangeRateRequest { export interface QueryExchangeRateResponse { rate: string; } +export interface QueryRedelegationsRequest { + chainId: string; +} +export interface QueryRedelegationsResponse { + redelegations: Redelegations; +} +export interface QueryRedelegationTxRequest { + chainId: string; +} +export interface QueryRedelegationTxResponse { + redelegationTx: RedelegateTx[]; +} function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } @@ -817,6 +840,133 @@ export const QueryUserUnbondingsResponse = { return message; }, }; +function createBaseQueryHostChainUserUnbondingsRequest(): QueryHostChainUserUnbondingsRequest { + return { + chainId: "", + pagination: PageRequest.fromPartial({}), + }; +} +export const QueryHostChainUserUnbondingsRequest = { + encode( + message: QueryHostChainUserUnbondingsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.chainId !== "") { + writer.uint32(10).string(message.chainId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryHostChainUserUnbondingsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHostChainUserUnbondingsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chainId = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryHostChainUserUnbondingsRequest { + const obj = createBaseQueryHostChainUserUnbondingsRequest(); + if (isSet(object.chainId)) obj.chainId = String(object.chainId); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; + }, + toJSON(message: QueryHostChainUserUnbondingsRequest): unknown { + const obj: any = {}; + message.chainId !== undefined && (obj.chainId = message.chainId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryHostChainUserUnbondingsRequest { + const message = createBaseQueryHostChainUserUnbondingsRequest(); + message.chainId = object.chainId ?? ""; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } + return message; + }, +}; +function createBaseQueryHostChainUserUnbondingsResponse(): QueryHostChainUserUnbondingsResponse { + return { + userUnbondings: [], + pagination: PageResponse.fromPartial({}), + }; +} +export const QueryHostChainUserUnbondingsResponse = { + encode( + message: QueryHostChainUserUnbondingsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.userUnbondings) { + UserUnbonding.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryHostChainUserUnbondingsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHostChainUserUnbondingsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userUnbondings.push(UserUnbonding.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): QueryHostChainUserUnbondingsResponse { + const obj = createBaseQueryHostChainUserUnbondingsResponse(); + if (Array.isArray(object?.userUnbondings)) + obj.userUnbondings = object.userUnbondings.map((e: any) => UserUnbonding.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; + }, + toJSON(message: QueryHostChainUserUnbondingsResponse): unknown { + const obj: any = {}; + if (message.userUnbondings) { + obj.userUnbondings = message.userUnbondings.map((e) => (e ? UserUnbonding.toJSON(e) : undefined)); + } else { + obj.userUnbondings = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryHostChainUserUnbondingsResponse { + const message = createBaseQueryHostChainUserUnbondingsResponse(); + message.userUnbondings = object.userUnbondings?.map((e) => UserUnbonding.fromPartial(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } + return message; + }, +}; function createBaseQueryValidatorUnbondingRequest(): QueryValidatorUnbondingRequest { return { chainId: "", @@ -1110,6 +1260,194 @@ export const QueryExchangeRateResponse = { return message; }, }; +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { + chainId: "", + }; +} +export const QueryRedelegationsRequest = { + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.chainId !== "") { + writer.uint32(10).string(message.chainId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chainId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryRedelegationsRequest { + const obj = createBaseQueryRedelegationsRequest(); + if (isSet(object.chainId)) obj.chainId = String(object.chainId); + return obj; + }, + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + message.chainId !== undefined && (obj.chainId = message.chainId); + return obj; + }, + fromPartial(object: Partial): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.chainId = object.chainId ?? ""; + return message; + }, +}; +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { + redelegations: Redelegations.fromPartial({}), + }; +} +export const QueryRedelegationsResponse = { + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.redelegations !== undefined) { + Redelegations.encode(message.redelegations, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegations = Redelegations.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryRedelegationsResponse { + const obj = createBaseQueryRedelegationsResponse(); + if (isSet(object.redelegations)) obj.redelegations = Redelegations.fromJSON(object.redelegations); + return obj; + }, + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + message.redelegations !== undefined && + (obj.redelegations = message.redelegations ? Redelegations.toJSON(message.redelegations) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + if (object.redelegations !== undefined && object.redelegations !== null) { + message.redelegations = Redelegations.fromPartial(object.redelegations); + } + return message; + }, +}; +function createBaseQueryRedelegationTxRequest(): QueryRedelegationTxRequest { + return { + chainId: "", + }; +} +export const QueryRedelegationTxRequest = { + encode(message: QueryRedelegationTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.chainId !== "") { + writer.uint32(10).string(message.chainId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chainId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryRedelegationTxRequest { + const obj = createBaseQueryRedelegationTxRequest(); + if (isSet(object.chainId)) obj.chainId = String(object.chainId); + return obj; + }, + toJSON(message: QueryRedelegationTxRequest): unknown { + const obj: any = {}; + message.chainId !== undefined && (obj.chainId = message.chainId); + return obj; + }, + fromPartial(object: Partial): QueryRedelegationTxRequest { + const message = createBaseQueryRedelegationTxRequest(); + message.chainId = object.chainId ?? ""; + return message; + }, +}; +function createBaseQueryRedelegationTxResponse(): QueryRedelegationTxResponse { + return { + redelegationTx: [], + }; +} +export const QueryRedelegationTxResponse = { + encode(message: QueryRedelegationTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.redelegationTx) { + RedelegateTx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegationTx.push(RedelegateTx.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryRedelegationTxResponse { + const obj = createBaseQueryRedelegationTxResponse(); + if (Array.isArray(object?.redelegationTx)) + obj.redelegationTx = object.redelegationTx.map((e: any) => RedelegateTx.fromJSON(e)); + return obj; + }, + toJSON(message: QueryRedelegationTxResponse): unknown { + const obj: any = {}; + if (message.redelegationTx) { + obj.redelegationTx = message.redelegationTx.map((e) => (e ? RedelegateTx.toJSON(e) : undefined)); + } else { + obj.redelegationTx = []; + } + return obj; + }, + fromPartial(object: Partial): QueryRedelegationTxResponse { + const message = createBaseQueryRedelegationTxResponse(); + message.redelegationTx = object.redelegationTx?.map((e) => RedelegateTx.fromPartial(e)) || []; + return message; + }, +}; /** Query defines the gRPC querier service. */ export interface Query { /** Queries the parameters of the module. */ @@ -1128,6 +1466,10 @@ export interface Query { Unbonding(request: QueryUnbondingRequest): Promise; /** Queries all unbondings for a delegator address. */ UserUnbondings(request: QueryUserUnbondingsRequest): Promise; + /** Queries all unbondings for a host chain. */ + HostChainUserUnbondings( + request: QueryHostChainUserUnbondingsRequest, + ): Promise; /** Queries all validator unbondings for a host chain. */ ValidatorUnbondings(request: QueryValidatorUnbondingRequest): Promise; /** Queries for a host chain deposit account balance. */ @@ -1139,6 +1481,13 @@ export interface Query { * token. */ ExchangeRate(request: QueryExchangeRateRequest): Promise; + /** + * Queries for a host chain redelegation entries on the host token delegation + * acct. + */ + Redelegations(request: QueryRedelegationsRequest): Promise; + /** Queries for a host chain redelegation-txs for the host token. */ + RedelegationTx(request: QueryRedelegationTxRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -1152,9 +1501,12 @@ export class QueryClientImpl implements Query { this.Unbondings = this.Unbondings.bind(this); this.Unbonding = this.Unbonding.bind(this); this.UserUnbondings = this.UserUnbondings.bind(this); + this.HostChainUserUnbondings = this.HostChainUserUnbondings.bind(this); this.ValidatorUnbondings = this.ValidatorUnbondings.bind(this); this.DepositAccountBalance = this.DepositAccountBalance.bind(this); this.ExchangeRate = this.ExchangeRate.bind(this); + this.Redelegations = this.Redelegations.bind(this); + this.RedelegationTx = this.RedelegationTx.bind(this); } Params(request: QueryParamsRequest = {}): Promise { const data = QueryParamsRequest.encode(request).finish(); @@ -1196,6 +1548,13 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("pstake.liquidstakeibc.v1beta1.Query", "UserUnbondings", data); return promise.then((data) => QueryUserUnbondingsResponse.decode(new BinaryReader(data))); } + HostChainUserUnbondings( + request: QueryHostChainUserUnbondingsRequest, + ): Promise { + const data = QueryHostChainUserUnbondingsRequest.encode(request).finish(); + const promise = this.rpc.request("pstake.liquidstakeibc.v1beta1.Query", "HostChainUserUnbondings", data); + return promise.then((data) => QueryHostChainUserUnbondingsResponse.decode(new BinaryReader(data))); + } ValidatorUnbondings(request: QueryValidatorUnbondingRequest): Promise { const data = QueryValidatorUnbondingRequest.encode(request).finish(); const promise = this.rpc.request("pstake.liquidstakeibc.v1beta1.Query", "ValidatorUnbondings", data); @@ -1213,4 +1572,14 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("pstake.liquidstakeibc.v1beta1.Query", "ExchangeRate", data); return promise.then((data) => QueryExchangeRateResponse.decode(new BinaryReader(data))); } + Redelegations(request: QueryRedelegationsRequest): Promise { + const data = QueryRedelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("pstake.liquidstakeibc.v1beta1.Query", "Redelegations", data); + return promise.then((data) => QueryRedelegationsResponse.decode(new BinaryReader(data))); + } + RedelegationTx(request: QueryRedelegationTxRequest): Promise { + const data = QueryRedelegationTxRequest.encode(request).finish(); + const promise = this.rpc.request("pstake.liquidstakeibc.v1beta1.Query", "RedelegationTx", data); + return promise.then((data) => QueryRedelegationTxResponse.decode(new BinaryReader(data))); + } }