Skip to content

Commit

Permalink
Fix: Proto Files Mismatch (#174)
Browse files Browse the repository at this point in the history
* Proto Files Update

- Temporary update (downgrade) the proto files to match the proto files in the sei-cosmos-sdk fork to fix broken queries

* Added changeset
  • Loading branch information
codebycarson authored May 15, 2024
1 parent ed0f374 commit a8eb844
Show file tree
Hide file tree
Showing 123 changed files with 6,174 additions and 4,288 deletions.
6 changes: 6 additions & 0 deletions .changeset/cyan-pants-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@sei-js/cosmjs": patch
"@sei-js/proto": patch
---

Temporary update (downgrade) the proto files to match the proto files in the sei-cosmos-sdk fork to fix broken queries
374 changes: 1 addition & 373 deletions packages/cosmjs/src/core/queryClient/queryClient.ts

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions packages/cosmjs/src/staking/apr.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import moment, { Moment } from 'moment';
import { PoolSDKType } from '@sei-js/proto/dist/types/codegen/cosmos/staking/v1beta1/staking';
import { ParamsSDKType, ScheduledTokenReleaseSDKType } from '@sei-js/proto/dist/types/codegen/mint/v1beta1/mint';
import { SeiLCDQueryClient } from '../core';

/**
* Calculates the estimated staking APR based on the upcoming token release schedule and the current number of bonded tokens.
Expand All @@ -10,7 +9,7 @@ import { SeiLCDQueryClient } from '../core';
* @returns The estimated APR percentage.
* @category Staking
*/
export async function estimateStakingAPR(queryClient: SeiLCDQueryClient): Promise<number> {
export async function estimateStakingAPR(queryClient: any): Promise<number> {
// Query number of bonded tokens
const pool = await getPool(queryClient);
const bondedTokens = Number(pool?.bonded_tokens);
Expand All @@ -36,7 +35,7 @@ export async function estimateStakingAPR(queryClient: SeiLCDQueryClient): Promis
* @returns An object with information about the amount of bonded and non-bonded tokens in the staking pool.
* @category Staking
*/
export async function getPool(queryClient: SeiLCDQueryClient): Promise<PoolSDKType | undefined> {
export async function getPool(queryClient: any): Promise<PoolSDKType | undefined> {
try {
const result = await queryClient.cosmos.staking.v1beta1.pool({});
return result.pool;
Expand All @@ -51,7 +50,7 @@ export async function getPool(queryClient: SeiLCDQueryClient): Promise<PoolSDKTy
* @returns An object with information about the mint schedule and token denom.
* @category Staking
*/
export async function getMintParams(queryClient: SeiLCDQueryClient): Promise<ParamsSDKType | undefined> {
export async function getMintParams(queryClient: any): Promise<ParamsSDKType | undefined> {
try {
const result = await queryClient.seiprotocol.seichain.mint.params({});
return result.params;
Expand Down
2 changes: 1 addition & 1 deletion packages/proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TypeScript library for Sei protobufs generated using Telescope
## Installation

```bash
npm install @sei-js/evm
yarn add @sei-js/proto
```

This project was generated using Telescope. For more information, please refer to the [Telescope Documentation](https://github.com/osmosis-labs/telescope).
55 changes: 55 additions & 0 deletions packages/proto/proto/cosmos/accesscontrol/accesscontrol.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
syntax = "proto3";
package cosmos.accesscontrol.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos/accesscontrol/constants.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types/accesscontrol";

message AccessOperation {
AccessType access_type = 1;
ResourceType resource_type = 2;
string identifier_template = 3;
}

message WasmAccessOperation {
AccessOperation operation = 1;
AccessOperationSelectorType selector_type = 2;
string selector = 3;
}

message WasmContractReference {
string contract_address = 1;
WasmMessageSubtype message_type = 2;
string message_name = 3;
string json_translation_template = 4;
}

message WasmContractReferences {
string message_name = 1;
repeated WasmContractReference contract_references = 2;
}

message WasmAccessOperations {
string message_name = 1;
repeated WasmAccessOperation wasm_operations = 2;
}

message MessageDependencyMapping {
string message_key = 1;
repeated AccessOperation access_ops = 2 [
(gogoproto.nullable) = false
];
bool dynamic_enabled = 3;
}

message WasmDependencyMapping {
repeated WasmAccessOperation base_access_ops = 1;
repeated WasmAccessOperations query_access_ops = 2;
repeated WasmAccessOperations execute_access_ops = 3;
repeated WasmContractReference base_contract_references = 4;
repeated WasmContractReferences query_contract_references = 5;
repeated WasmContractReferences execute_contract_references = 6;
string reset_reason = 7;
string contract_address = 8;
}
139 changes: 139 additions & 0 deletions packages/proto/proto/cosmos/accesscontrol/constants.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
syntax = "proto3";
package cosmos.accesscontrol.v1beta1;

option go_package = "github.com/cosmos/cosmos-sdk/types/accesscontrol";

enum AccessType {
UNKNOWN = 0;
READ = 1;
WRITE = 2;
COMMIT = 3;
}

enum AccessOperationSelectorType {
NONE = 0;
JQ = 1;
JQ_BECH32_ADDRESS = 2;
JQ_LENGTH_PREFIXED_ADDRESS = 3;
SENDER_BECH32_ADDRESS = 4;
SENDER_LENGTH_PREFIXED_ADDRESS = 5;
CONTRACT_ADDRESS = 6;
JQ_MESSAGE_CONDITIONAL = 7;
CONSTANT_STRING_TO_HEX = 8;
CONTRACT_REFERENCE = 9;
}

enum ResourceType {
ANY = 0;
KV = 1; // child of ANY
Mem = 2; // child of ANY
DexMem = 3; // child of MEM
KV_BANK = 4; // child of KV
KV_STAKING = 5; // child of KV
KV_WASM = 6; // child of KV
KV_ORACLE = 7; // child of KV
KV_DEX = 8; // child of KV
KV_EPOCH = 9; // child of KV
KV_TOKENFACTORY = 10; // child of KV
KV_ORACLE_VOTE_TARGETS = 11; // child of KV_ORACLE
KV_ORACLE_AGGREGATE_VOTES = 12; // child of KV_ORACLE
KV_ORACLE_FEEDERS = 13; // child of KV_ORACLE
KV_STAKING_DELEGATION = 14; // child of KV_STAKING
KV_STAKING_VALIDATOR = 15; // child of KV_STAKING
KV_AUTH = 16; // child of KV
KV_AUTH_ADDRESS_STORE = 17; // child of KV
KV_BANK_SUPPLY = 18; // child of KV_BANK
KV_BANK_DENOM = 19; // child of KV_BANK
KV_BANK_BALANCES = 20; // child of KV_BANK
KV_TOKENFACTORY_DENOM = 21; // child of KV_TOKENFACTORY
KV_TOKENFACTORY_METADATA = 22; // child of KV_TOKENFACTORY
KV_TOKENFACTORY_ADMIN = 23; // child of KV_TOKENFACTORY
KV_TOKENFACTORY_CREATOR = 24; // child of KV_TOKENFACTORY
KV_ORACLE_EXCHANGE_RATE = 25; // child of KV_ORACLE
KV_ORACLE_VOTE_PENALTY_COUNTER = 26; // child of KV_ORACLE
KV_ORACLE_PRICE_SNAPSHOT = 27; // child of KV_ORACLE

KV_STAKING_VALIDATION_POWER = 28; // child of KV_STAKING
KV_STAKING_TOTAL_POWER = 29; // child of KV_STAKING
KV_STAKING_VALIDATORS_CON_ADDR = 30; // child of KV_STAKING
KV_STAKING_UNBONDING_DELEGATION = 31; // child of KV_STAKING
KV_STAKING_UNBONDING_DELEGATION_VAL = 32; // child of KV_STAKING
KV_STAKING_REDELEGATION = 33; // child of KV_STAKING
KV_STAKING_REDELEGATION_VAL_SRC = 34; // child of KV_STAKING
KV_STAKING_REDELEGATION_VAL_DST = 35; // child of KV_STAKING
KV_STAKING_REDELEGATION_QUEUE = 36; // child of KV_STAKING
KV_STAKING_VALIDATOR_QUEUE = 37; // child of KV_STAKING
KV_STAKING_HISTORICAL_INFO = 38; // child of KV_STAKING
KV_STAKING_UNBONDING = 39; // child of KV_STAKING
KV_STAKING_VALIDATORS_BY_POWER = 41; // child of KV_STAKING

KV_DISTRIBUTION = 40; // child of KV
KV_DISTRIBUTION_FEE_POOL = 42; // child of KV_DISTRIBUTION
KV_DISTRIBUTION_PROPOSER_KEY = 43; // child of KV_DISTRIBUTION
KV_DISTRIBUTION_OUTSTANDING_REWARDS = 44; // child of KV_DISTRIBUTION
KV_DISTRIBUTION_DELEGATOR_WITHDRAW_ADDR = 45; // child of KV_DISTRIBUTION
KV_DISTRIBUTION_DELEGATOR_STARTING_INFO = 46; // child of KV_DISTRIBUTION
KV_DISTRIBUTION_VAL_HISTORICAL_REWARDS = 47; // child of KV_DISTRIBUTION
KV_DISTRIBUTION_VAL_CURRENT_REWARDS = 48; // child of KV_DISTRIBUTION
KV_DISTRIBUTION_VAL_ACCUM_COMMISSION = 49; // child of KV_DISTRIBUTION
KV_DISTRIBUTION_SLASH_EVENT = 50; // child of KV_DISTRIBUTION

KV_DEX_CONTRACT_LONGBOOK = 51; // child of KV_DEX
KV_DEX_CONTRACT_SHORTBOOK = 52; // child of KV_DEX
KV_DEX_SETTLEMENT = 53; // child of KV_DEX
KV_DEX_PAIR_PREFIX = 54; // child of KV_DEX
KV_DEX_TWAP = 55; // child of KV_DEX
KV_DEX_PRICE = 56; // child of KV_DEX
KV_DEX_SETTLEMENT_ENTRY = 57; // child of KV_DEX
KV_DEX_REGISTERED_PAIR = 58; // child of KV_DEX
reserved 59; // KV_DEX_PRICE_TICK_SIZE deprecated // child of KV_DEX
KV_DEX_ORDER = 60; // child of KV_DEX
KV_DEX_CANCEL = 61; // child of KV_DEX
KV_DEX_ACCOUNT_ACTIVE_ORDERS = 62; // child of KV_DEX
reserved 63; // KV_DEX_REGISTERED_PAIR_COUNT deprecated // child of KV_DEX
KV_DEX_ASSET_LIST = 64; // child of KV_DEX
KV_DEX_NEXT_ORDER_ID = 65; // child of KV_DEX
KV_DEX_NEXT_SETTLEMENT_ID = 66; // child of KV_DEX
KV_DEX_MATCH_RESULT = 67; // child of KV_DEX
KV_DEX_SETTLEMENT_ORDER_ID = 68; // child of KV_DEX
KV_DEX_ORDER_BOOK = 69; // child of KV_DEX
reserved 70; // KV_DEX_QUANTITY_TICK_SIZE deprecated // child of KV_DEX

KV_ACCESSCONTROL = 71; // child of KV
KV_ACCESSCONTROL_WASM_DEPENDENCY_MAPPING = 72; // child of KV_ACCESSCONTROL

KV_WASM_CODE = 73; // child of KV_WASM
KV_WASM_CONTRACT_ADDRESS = 74; // child of KV_WASM
KV_WASM_CONTRACT_STORE = 75; // child of KV_WASM
KV_WASM_SEQUENCE_KEY = 76; // child of KV_WASM
KV_WASM_CONTRACT_CODE_HISTORY = 77; // child of KV_WASM
KV_WASM_CONTRACT_BY_CODE_ID = 78; // child of KV_WASM
KV_WASM_PINNED_CODE_INDEX = 79; // child of KV_WASM

KV_AUTH_GLOBAL_ACCOUNT_NUMBER = 80; // child of KV_AUTH

KV_AUTHZ = 81; // child of KV

KV_FEEGRANT = 82; // child of KV
KV_FEEGRANT_ALLOWANCE = 83; // child of KV_FEEGRANT

KV_SLASHING = 84; // child of KV
KV_SLASHING_VAL_SIGNING_INFO = 85; // child of KV_SLASHING
KV_SLASHING_ADDR_PUBKEY_RELATION_KEY = 86; // child of KV_SLASHING

KV_DEX_MEM_ORDER = 87;
KV_DEX_MEM_CANCEL = 88;
KV_DEX_MEM_DEPOSIT = 89;

KV_DEX_CONTRACT = 90; // child of KV_DEX
KV_DEX_LONG_ORDER_COUNT = 91; // child of KV_DEX
KV_DEX_SHORT_ORDER_COUNT = 92; // child of KV_DEX

KV_BANK_DEFERRED = 93; // child of KV
KV_BANK_DEFERRED_MODULE_TX_INDEX = 95; // child of KV_BANK_DEFERRED
}

enum WasmMessageSubtype {
QUERY = 0;
EXECUTE = 1;
}
23 changes: 23 additions & 0 deletions packages/proto/proto/cosmos/accesscontrol/legacy.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";
package cosmos.accesscontrol.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos/accesscontrol/constants.proto";
import "cosmos/accesscontrol/accesscontrol.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types/accesscontrol";

message LegacyAccessOperationWithSelector {
AccessOperation operation = 1;
AccessOperationSelectorType selector_type = 2;
string selector = 3;
}

message LegacyWasmDependencyMapping {
bool enabled = 1;
repeated LegacyAccessOperationWithSelector access_ops = 2 [
(gogoproto.nullable) = false
];
string reset_reason = 3;
string contract_address = 4;
}
27 changes: 27 additions & 0 deletions packages/proto/proto/cosmos/accesscontrol_x/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto3";
package cosmos.accesscontrol_x.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos/accesscontrol/accesscontrol.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/accesscontrol/types";

message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];

// mapping between every message type and its predetermined resource read/write sequence
repeated cosmos.accesscontrol.v1beta1.MessageDependencyMapping message_dependency_mapping = 2 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"message_dependency_mapping\""
];

repeated cosmos.accesscontrol.v1beta1.WasmDependencyMapping wasm_dependency_mappings = 3 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"wasm_dependency_mappings\""
];
}

message Params {
option (gogoproto.goproto_stringer) = false;
}

95 changes: 95 additions & 0 deletions packages/proto/proto/cosmos/accesscontrol_x/gov.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
syntax = "proto3";
package cosmos.accesscontrol.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos/accesscontrol/constants.proto";
import "cosmos/accesscontrol/accesscontrol.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/accesscontrol/types";

message MsgUpdateResourceDependencyMappingProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;

string title = 1 [
(gogoproto.moretags) = "yaml:\"title\"",
(gogoproto.jsontag) = "title"
];
string description = 2 [
(gogoproto.moretags) = "yaml:\"description\"",
(gogoproto.jsontag) = "description"
];
repeated cosmos.accesscontrol.v1beta1.MessageDependencyMapping message_dependency_mapping = 3 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"message_dependency_mapping\""
];
}
message MsgUpdateResourceDependencyMappingProposalJsonFile {
string title = 1 [
(gogoproto.moretags) = "yaml:\"title\"",
(gogoproto.jsontag) = "title"
];
string description = 2 [
(gogoproto.moretags) = "yaml:\"description\"",
(gogoproto.jsontag) = "description"
];
string deposit = 3 [
(gogoproto.moretags) = "yaml:\"deposit\"",
(gogoproto.jsontag) = "deposit"
];
repeated cosmos.accesscontrol.v1beta1.MessageDependencyMapping message_dependency_mapping = 4 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"message_dependency_mapping\""
];
}

message MsgUpdateResourceDependencyMappingProposalResponse {}

message MsgUpdateWasmDependencyMappingProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;

string title = 1 [
(gogoproto.moretags) = "yaml:\"title\"",
(gogoproto.jsontag) = "title"
];
string description = 2 [
(gogoproto.moretags) = "yaml:\"description\"",
(gogoproto.jsontag) = "description"
];
string contract_address = 3 [
(gogoproto.moretags) = "yaml:\"contract_address\"",
(gogoproto.jsontag) = "contract_address"
];
cosmos.accesscontrol.v1beta1.WasmDependencyMapping wasm_dependency_mapping = 4 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"wasm_dependency_mapping\""
];
}

message MsgUpdateWasmDependencyMappingProposalJsonFile {
string title = 1 [
(gogoproto.moretags) = "yaml:\"title\"",
(gogoproto.jsontag) = "title"
];
string description = 2 [
(gogoproto.moretags) = "yaml:\"description\"",
(gogoproto.jsontag) = "description"
];
string deposit = 3 [
(gogoproto.moretags) = "yaml:\"deposit\"",
(gogoproto.jsontag) = "deposit"
];
string contract_address = 4 [
(gogoproto.moretags) = "yaml:\"contract_address\"",
(gogoproto.jsontag) = "contract_address"
];
cosmos.accesscontrol.v1beta1.WasmDependencyMapping wasm_dependency_mapping = 5 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"wasm_dependency_mapping\""
];
}
Loading

0 comments on commit a8eb844

Please sign in to comment.