github.com/InjectiveLabs/sdk-go@v1.53.0/proto/injective/exchange/v1beta1/query.proto (about)

     1  syntax = "proto3";
     2  package injective.exchange.v1beta1;
     3  
     4  import "google/api/annotations.proto";
     5  import "injective/exchange/v1beta1/exchange.proto";
     6  import "injective/exchange/v1beta1/genesis.proto";
     7  import "injective/oracle/v1beta1/oracle.proto";
     8  import "gogoproto/gogo.proto";
     9  
    10  option go_package = "github.com/InjectiveLabs/injective-core/injective-chain/modules/exchange/types";
    11  
    12  // Query defines the gRPC querier service.
    13  service Query {
    14  
    15    // Retrieves exchange params
    16    rpc QueryExchangeParams(QueryExchangeParamsRequest)
    17        returns (QueryExchangeParamsResponse) {
    18      option (google.api.http).get = "/injective/exchange/v1beta1/exchangeParams";
    19    }
    20  
    21    // Retrieves a Subaccount's Deposits
    22    rpc SubaccountDeposits(QuerySubaccountDepositsRequest)
    23        returns (QuerySubaccountDepositsResponse) {
    24      option (google.api.http).get =
    25          "/injective/exchange/v1beta1/exchange/subaccountDeposits";
    26    }
    27  
    28    // Retrieves a Subaccount's Deposits
    29    rpc SubaccountDeposit(QuerySubaccountDepositRequest)
    30        returns (QuerySubaccountDepositResponse) {
    31      option (google.api.http).get =
    32          "/injective/exchange/v1beta1/exchange/subaccountDeposit";
    33    }
    34  
    35    // Retrieves all of the balances of all users on the exchange.
    36    rpc ExchangeBalances(QueryExchangeBalancesRequest)
    37        returns (QueryExchangeBalancesResponse) {
    38      option (google.api.http).get =
    39          "/injective/exchange/v1beta1/exchange/exchangeBalances";
    40    }
    41  
    42    // Retrieves the aggregate volumes for the specified account or subaccount
    43    rpc AggregateVolume(QueryAggregateVolumeRequest)
    44        returns (QueryAggregateVolumeResponse) {
    45      option (google.api.http).get =
    46          "/injective/exchange/v1beta1/exchange/aggregateVolume/{account}";
    47    }
    48  
    49    // Retrieves the aggregate volumes for specified accounts
    50    rpc AggregateVolumes(QueryAggregateVolumesRequest)
    51        returns (QueryAggregateVolumesResponse) {
    52      option (google.api.http).get =
    53          "/injective/exchange/v1beta1/exchange/aggregateVolumes";
    54    }
    55  
    56    // Retrieves the aggregate volume for the specified market
    57    rpc AggregateMarketVolume(QueryAggregateMarketVolumeRequest)
    58        returns (QueryAggregateMarketVolumeResponse) {
    59      option (google.api.http).get = "/injective/exchange/v1beta1/exchange/"
    60                                     "aggregateMarketVolume/{market_id}";
    61    }
    62  
    63    // Retrieves the aggregate market volumes for specified markets
    64    rpc AggregateMarketVolumes(QueryAggregateMarketVolumesRequest)
    65        returns (QueryAggregateMarketVolumesResponse) {
    66      option (google.api.http).get =
    67          "/injective/exchange/v1beta1/exchange/aggregateMarketVolumes";
    68    }
    69  
    70    // Retrieves the denom decimals for a denom.
    71    rpc DenomDecimal(QueryDenomDecimalRequest)
    72        returns (QueryDenomDecimalResponse) {
    73      option (google.api.http).get =
    74          "/injective/exchange/v1beta1/exchange/denom_decimal/{denom}";
    75    }
    76  
    77    // Retrieves the denom decimals for multiple denoms. Returns all denom
    78    // decimals if unspecified.
    79    rpc DenomDecimals(QueryDenomDecimalsRequest)
    80        returns (QueryDenomDecimalsResponse) {
    81      option (google.api.http).get =
    82          "/injective/exchange/v1beta1/exchange/denom_decimals";
    83    }
    84  
    85    // Retrieves a list of spot markets.
    86    rpc SpotMarkets(QuerySpotMarketsRequest) returns (QuerySpotMarketsResponse) {
    87      option (google.api.http).get = "/injective/exchange/v1beta1/spot/markets";
    88    }
    89  
    90    // Retrieves a spot market by ticker
    91    rpc SpotMarket(QuerySpotMarketRequest) returns (QuerySpotMarketResponse) {
    92      option (google.api.http).get =
    93          "/injective/exchange/v1beta1/spot/markets/{market_id}";
    94    }
    95  
    96    // Retrieves a list of spot markets with extra information.
    97    rpc FullSpotMarkets(QueryFullSpotMarketsRequest)
    98        returns (QueryFullSpotMarketsResponse) {
    99      option (google.api.http).get =
   100          "/injective/exchange/v1beta1/spot/full_markets";
   101    }
   102  
   103    // Retrieves a spot market with extra information.
   104    rpc FullSpotMarket(QueryFullSpotMarketRequest)
   105        returns (QueryFullSpotMarketResponse) {
   106      option (google.api.http).get =
   107          "/injective/exchange/v1beta1/spot/full_market/{market_id}";
   108    }
   109  
   110    // Retrieves a spot market's orderbook by marketID
   111    rpc SpotOrderbook(QuerySpotOrderbookRequest)
   112        returns (QuerySpotOrderbookResponse) {
   113      option (google.api.http).get =
   114          "/injective/exchange/v1beta1/spot/orderbook/{market_id}";
   115    }
   116  
   117    // Retrieves a trader's spot orders
   118    rpc TraderSpotOrders(QueryTraderSpotOrdersRequest)
   119        returns (QueryTraderSpotOrdersResponse) {
   120      option (google.api.http).get =
   121          "/injective/exchange/v1beta1/spot/orders/{market_id}/{subaccount_id}";
   122    }
   123  
   124    // Retrieves all account address spot orders
   125    rpc AccountAddressSpotOrders(QueryAccountAddressSpotOrdersRequest)
   126        returns (QueryAccountAddressSpotOrdersResponse) {
   127      option (google.api.http).get = "/injective/exchange/v1beta1/spot/orders/"
   128                                     "{market_id}/account/{account_address}";
   129    }
   130  
   131    // Retrieves spot orders corresponding to specified order hashes for a given
   132    // subaccountID and marketID
   133    rpc SpotOrdersByHashes(QuerySpotOrdersByHashesRequest)
   134        returns (QuerySpotOrdersByHashesResponse) {
   135      option (google.api.http).get =
   136          "/injective/exchange/v1beta1/spot/orders_by_hashes/{market_id}/"
   137          "{subaccount_id}";
   138    }
   139  
   140    // Retrieves subaccount's orders
   141    rpc SubaccountOrders(QuerySubaccountOrdersRequest)
   142        returns (QuerySubaccountOrdersResponse) {
   143      option (google.api.http).get =
   144          "/injective/exchange/v1beta1/orders/{subaccount_id}";
   145    }
   146  
   147    // Retrieves a trader's transient spot orders
   148    rpc TraderSpotTransientOrders(QueryTraderSpotOrdersRequest)
   149        returns (QueryTraderSpotOrdersResponse) {
   150      option (google.api.http).get =
   151          "/injective/exchange/v1beta1/spot/transient_orders/{market_id}/"
   152          "{subaccount_id}";
   153    }
   154  
   155    // Retrieves a spot market's mid-price
   156    rpc SpotMidPriceAndTOB(QuerySpotMidPriceAndTOBRequest)
   157        returns (QuerySpotMidPriceAndTOBResponse) {
   158      option (google.api.http).get =
   159          "/injective/exchange/v1beta1/spot/mid_price_and_tob/{market_id}";
   160    }
   161  
   162    // Retrieves a derivative market's mid-price
   163    rpc DerivativeMidPriceAndTOB(QueryDerivativeMidPriceAndTOBRequest)
   164        returns (QueryDerivativeMidPriceAndTOBResponse) {
   165      option (google.api.http).get =
   166          "/injective/exchange/v1beta1/derivative/mid_price_and_tob/{market_id}";
   167    }
   168  
   169    // Retrieves a derivative market's orderbook by marketID
   170    rpc DerivativeOrderbook(QueryDerivativeOrderbookRequest)
   171        returns (QueryDerivativeOrderbookResponse) {
   172      option (google.api.http).get =
   173          "/injective/exchange/v1beta1/derivative/orderbook/{market_id}";
   174    }
   175  
   176    // Retrieves a trader's derivative orders
   177    rpc TraderDerivativeOrders(QueryTraderDerivativeOrdersRequest)
   178        returns (QueryTraderDerivativeOrdersResponse) {
   179      option (google.api.http).get = "/injective/exchange/v1beta1/derivative/"
   180                                     "orders/{market_id}/{subaccount_id}";
   181    }
   182  
   183    // Retrieves all account address derivative orders
   184    rpc AccountAddressDerivativeOrders(QueryAccountAddressDerivativeOrdersRequest)
   185        returns (QueryAccountAddressDerivativeOrdersResponse) {
   186      option (google.api.http).get =
   187          "/injective/exchange/v1beta1/derivative/orders/{market_id}/account/"
   188          "{account_address}";
   189    }
   190  
   191    // Retrieves a trader's derivative orders
   192    rpc DerivativeOrdersByHashes(QueryDerivativeOrdersByHashesRequest)
   193        returns (QueryDerivativeOrdersByHashesResponse) {
   194      option (google.api.http).get =
   195          "/injective/exchange/v1beta1/derivative/orders_by_hashes/{market_id}/"
   196          "{subaccount_id}";
   197    }
   198  
   199    // Retrieves a trader's transient derivative orders
   200    rpc TraderDerivativeTransientOrders(QueryTraderDerivativeOrdersRequest)
   201        returns (QueryTraderDerivativeOrdersResponse) {
   202      option (google.api.http).get =
   203          "/injective/exchange/v1beta1/derivative/transient_orders/{market_id}/"
   204          "{subaccount_id}";
   205    }
   206  
   207    // Retrieves a list of derivative markets.
   208    rpc DerivativeMarkets(QueryDerivativeMarketsRequest)
   209        returns (QueryDerivativeMarketsResponse) {
   210      option (google.api.http).get =
   211          "/injective/exchange/v1beta1/derivative/markets";
   212    }
   213  
   214    // Retrieves a derivative market by ticker
   215    rpc DerivativeMarket(QueryDerivativeMarketRequest)
   216        returns (QueryDerivativeMarketResponse) {
   217      option (google.api.http).get =
   218          "/injective/exchange/v1beta1/derivative/markets/{market_id}";
   219    }
   220  
   221    // Retrieves a derivative market's corresponding address for fees that
   222    // contribute to the market's insurance fund
   223    rpc DerivativeMarketAddress(QueryDerivativeMarketAddressRequest)
   224        returns (QueryDerivativeMarketAddressResponse) {
   225      option (google.api.http).get =
   226          "/injective/exchange/v1beta1/derivative/market_address/{market_id}";
   227    }
   228  
   229    // Retrieves a subaccount's trade nonce
   230    rpc SubaccountTradeNonce(QuerySubaccountTradeNonceRequest)
   231        returns (QuerySubaccountTradeNonceResponse) {
   232      option (google.api.http).get =
   233          "/injective/exchange/v1beta1/exchange/{subaccount_id}";
   234    }
   235  
   236    // Retrieves the entire exchange module's state
   237    rpc ExchangeModuleState(QueryModuleStateRequest)
   238        returns (QueryModuleStateResponse) {
   239      option (google.api.http).get = "/injective/exchange/v1beta1/module_state";
   240    }
   241  
   242    // Retrieves the entire exchange module's positions
   243    rpc Positions(QueryPositionsRequest) returns (QueryPositionsResponse) {
   244      option (google.api.http).get = "/injective/exchange/v1beta1/positions";
   245    }
   246  
   247    // Retrieves subaccount's positions
   248    rpc SubaccountPositions(QuerySubaccountPositionsRequest)
   249        returns (QuerySubaccountPositionsResponse) {
   250      option (google.api.http).get =
   251          "/injective/exchange/v1beta1/positions/{subaccount_id}";
   252    }
   253  
   254    // Retrieves subaccount's position in market
   255    rpc SubaccountPositionInMarket(QuerySubaccountPositionInMarketRequest)
   256        returns (QuerySubaccountPositionInMarketResponse) {
   257      option (google.api.http).get =
   258          "/injective/exchange/v1beta1/positions/{subaccount_id}/{market_id}";
   259    }
   260  
   261    // Retrieves subaccount's position in market
   262    rpc SubaccountEffectivePositionInMarket(
   263        QuerySubaccountEffectivePositionInMarketRequest)
   264        returns (QuerySubaccountEffectivePositionInMarketResponse) {
   265      option (google.api.http).get =
   266          "/injective/exchange/v1beta1/effective_positions/{subaccount_id}/"
   267          "{market_id}";
   268    }
   269  
   270    // Retrieves perpetual market info
   271    rpc PerpetualMarketInfo(QueryPerpetualMarketInfoRequest)
   272        returns (QueryPerpetualMarketInfoResponse) {
   273      option (google.api.http).get =
   274          "/injective/exchange/v1beta1/perpetual_market_info/{market_id}";
   275    }
   276  
   277    // Retrieves expiry market info
   278    rpc ExpiryFuturesMarketInfo(QueryExpiryFuturesMarketInfoRequest)
   279        returns (QueryExpiryFuturesMarketInfoResponse) {
   280      option (google.api.http).get =
   281          "/injective/exchange/v1beta1/expiry_market_info/{market_id}";
   282    }
   283  
   284    // Retrieves perpetual market funding
   285    rpc PerpetualMarketFunding(QueryPerpetualMarketFundingRequest)
   286        returns (QueryPerpetualMarketFundingResponse) {
   287      option (google.api.http).get =
   288          "/injective/exchange/v1beta1/perpetual_market_funding/{market_id}";
   289    }
   290  
   291    // Retrieves subaccount's order metadata
   292    rpc SubaccountOrderMetadata(QuerySubaccountOrderMetadataRequest)
   293        returns (QuerySubaccountOrderMetadataResponse) {
   294      option (google.api.http).get =
   295          "/injective/exchange/v1beta1/order_metadata/{subaccount_id}";
   296    }
   297  
   298    // Retrieves the account and total trade rewards points
   299    rpc TradeRewardPoints(QueryTradeRewardPointsRequest)
   300        returns (QueryTradeRewardPointsResponse) {
   301      option (google.api.http).get =
   302          "/injective/exchange/v1beta1/trade_reward_points";
   303    }
   304  
   305    // Retrieves the pending account and total trade rewards points
   306    rpc PendingTradeRewardPoints(QueryTradeRewardPointsRequest)
   307        returns (QueryTradeRewardPointsResponse) {
   308      option (google.api.http).get =
   309          "/injective/exchange/v1beta1/pending_trade_reward_points";
   310    }
   311  
   312    // Retrieves the trade reward campaign
   313    rpc TradeRewardCampaign(QueryTradeRewardCampaignRequest)
   314        returns (QueryTradeRewardCampaignResponse) {
   315      option (google.api.http).get =
   316          "/injective/exchange/v1beta1/trade_reward_campaign";
   317    }
   318  
   319    // Retrieves the account's fee discount info
   320    rpc FeeDiscountAccountInfo(QueryFeeDiscountAccountInfoRequest)
   321        returns (QueryFeeDiscountAccountInfoResponse) {
   322      option (google.api.http).get =
   323          "/injective/exchange/v1beta1/fee_discount_account_info/{account}";
   324    }
   325  
   326    // Retrieves the fee discount schedule
   327    rpc FeeDiscountSchedule(QueryFeeDiscountScheduleRequest)
   328        returns (QueryFeeDiscountScheduleResponse) {
   329      option (google.api.http).get =
   330          "/injective/exchange/v1beta1/fee_discount_schedule";
   331    }
   332  
   333    // Retrieves mismatches between available vs. total balance
   334    rpc BalanceMismatches(QueryBalanceMismatchesRequest)
   335        returns (QueryBalanceMismatchesResponse) {
   336      option (google.api.http).get =
   337          "/injective/exchange/v1beta1/balance_mismatches/{dust_factor}";
   338    }
   339  
   340    // Retrieves available and total balances with balance holds
   341    rpc BalanceWithBalanceHolds(QueryBalanceWithBalanceHoldsRequest)
   342        returns (QueryBalanceWithBalanceHoldsResponse) {
   343      option (google.api.http).get =
   344          "/injective/exchange/v1beta1/balances_with_balance_holds";
   345    }
   346  
   347    // Retrieves fee discount tier stats
   348    rpc FeeDiscountTierStatistics(QueryFeeDiscountTierStatisticsRequest)
   349        returns (QueryFeeDiscountTierStatisticsResponse) {
   350      option (google.api.http).get =
   351          "/injective/exchange/v1beta1/fee_discount_tier_stats";
   352    }
   353  
   354    // Retrieves market making pool info
   355    rpc MitoVaultInfos(MitoVaultInfosRequest) returns (MitoVaultInfosResponse) {
   356      option (google.api.http).get =
   357          "/injective/exchange/v1beta1/mito_vault_infos";
   358    }
   359  
   360    // QueryMarketIDFromVault returns the market ID for a given vault subaccount
   361    // ID
   362    rpc QueryMarketIDFromVault(QueryMarketIDFromVaultRequest)
   363        returns (QueryMarketIDFromVaultResponse) {
   364      option (google.api.http).get =
   365          "/injective/exchange/v1beta1/vault_market_id/{vault_address}";
   366    }
   367  
   368    // Retrieves historical trade records for a given market ID
   369    rpc HistoricalTradeRecords(QueryHistoricalTradeRecordsRequest)
   370        returns (QueryHistoricalTradeRecordsResponse) {
   371      option (google.api.http).get =
   372          "/injective/exchange/v1beta1/historical_trade_records";
   373    }
   374  
   375    // Retrieves if the account is opted out of rewards
   376    rpc IsOptedOutOfRewards(QueryIsOptedOutOfRewardsRequest)
   377        returns (QueryIsOptedOutOfRewardsResponse) {
   378      option (google.api.http).get =
   379          "/injective/exchange/v1beta1/is_opted_out_of_rewards/{account}";
   380    }
   381  
   382    // Retrieves all accounts opted out of rewards
   383    rpc OptedOutOfRewardsAccounts(QueryOptedOutOfRewardsAccountsRequest)
   384        returns (QueryOptedOutOfRewardsAccountsResponse) {
   385      option (google.api.http).get =
   386          "/injective/exchange/v1beta1/opted_out_of_rewards_accounts";
   387    }
   388  
   389    // MarketVolatility computes the volatility for spot and derivative markets
   390    // trading history.
   391    rpc MarketVolatility(QueryMarketVolatilityRequest)
   392        returns (QueryMarketVolatilityResponse) {
   393      option (google.api.http).get =
   394          "/injective/exchange/v1beta1/market_volatility/{market_id}";
   395    }
   396  
   397    // Retrieves a spot market's orderbook by marketID
   398    rpc BinaryOptionsMarkets(QueryBinaryMarketsRequest)
   399        returns (QueryBinaryMarketsResponse) {
   400      option (google.api.http).get =
   401          "/injective/exchange/v1beta1/binary_options/markets";
   402    }
   403  
   404    // Retrieves a trader's derivative conditional orders
   405    rpc TraderDerivativeConditionalOrders(
   406        QueryTraderDerivativeConditionalOrdersRequest)
   407        returns (QueryTraderDerivativeConditionalOrdersResponse) {
   408      option (google.api.http).get =
   409          "/injective/exchange/v1beta1/derivative/orders/conditional/{market_id}/"
   410          "{subaccount_id}";
   411    }
   412  
   413    rpc MarketAtomicExecutionFeeMultiplier(
   414        QueryMarketAtomicExecutionFeeMultiplierRequest)
   415        returns (QueryMarketAtomicExecutionFeeMultiplierResponse) {
   416      option (google.api.http).get =
   417          "/injective/exchange/v1beta1/atomic_order_fee_multiplier";
   418    }
   419  
   420    // Retrieves the active stake grant for a grantee
   421    rpc ActiveStakeGrant(QueryActiveStakeGrantRequest)
   422        returns (QueryActiveStakeGrantResponse) {
   423      option (google.api.http).get =
   424          "/injective/exchange/v1beta1/active_stake_grant/{grantee}";
   425    }
   426  
   427    // Retrieves the grant authorization amount for a granter and grantee
   428    rpc GrantAuthorization(QueryGrantAuthorizationRequest)
   429        returns (QueryGrantAuthorizationResponse) {
   430      option (google.api.http).get =
   431          "/injective/exchange/v1beta1/grant_authorization/{granter}/{grantee}";
   432    }
   433  
   434    // Retrieves the grant authorization amount for a granter and grantee
   435    rpc GrantAuthorizations(QueryGrantAuthorizationsRequest)
   436        returns (QueryGrantAuthorizationsResponse) {
   437      option (google.api.http).get =
   438          "/injective/exchange/v1beta1/grant_authorizations/{granter}";
   439    }
   440  }
   441  
   442  message Subaccount {
   443    string trader = 1;
   444    uint32 subaccount_nonce = 2;
   445  }
   446  
   447  message QuerySubaccountOrdersRequest {
   448    string subaccount_id = 1;
   449    string market_id = 2;
   450  }
   451  
   452  message QuerySubaccountOrdersResponse {
   453    repeated SubaccountOrderData buy_orders = 1;
   454    repeated SubaccountOrderData sell_orders = 2;
   455  }
   456  
   457  message SubaccountOrderbookMetadataWithMarket {
   458    SubaccountOrderbookMetadata metadata = 1;
   459    string market_id = 2;
   460    bool isBuy = 3;
   461  }
   462  
   463  // QueryExchangeParamsRequest is the request type for the Query/ExchangeParams
   464  // RPC method.
   465  message QueryExchangeParamsRequest {}
   466  
   467  // QueryExchangeParamsRequest is the response type for the Query/ExchangeParams
   468  // RPC method.
   469  message QueryExchangeParamsResponse {
   470    Params params = 1 [ (gogoproto.nullable) = false ];
   471  }
   472  
   473  // QuerySubaccountDepositsRequest is the request type for the
   474  // Query/SubaccountDeposits RPC method.
   475  message QuerySubaccountDepositsRequest {
   476    string subaccount_id = 1;
   477    Subaccount subaccount = 2 [ (gogoproto.nullable) = true ];
   478  }
   479  
   480  // QuerySubaccountDepositsResponse is the response type for the
   481  // Query/SubaccountDeposits RPC method.
   482  message QuerySubaccountDepositsResponse { map<string, Deposit> deposits = 1; }
   483  
   484  // QueryExchangeBalancesRequest is the request type for the
   485  // Query/ExchangeBalances RPC method.
   486  message QueryExchangeBalancesRequest {}
   487  
   488  // QuerySubaccountDepositsResponse is the response type for the
   489  // Query/SubaccountDeposits RPC method.
   490  message QueryExchangeBalancesResponse {
   491    repeated Balance balances = 1 [ (gogoproto.nullable) = false ];
   492  }
   493  
   494  // QueryAggregateVolumeRequest is the request type for the Query/AggregateVolume
   495  // RPC method.
   496  message QueryAggregateVolumeRequest {
   497    // can either be an address or a subaccount
   498    string account = 1;
   499  }
   500  
   501  // QueryAggregateVolumeResponse is the response type for the
   502  // Query/AggregateVolume RPC method.
   503  message QueryAggregateVolumeResponse {
   504    // if an address is specified, then the aggregate_volumes will aggregate the
   505    // volumes across all subaccounts for the address
   506    repeated MarketVolume aggregate_volumes = 1;
   507  }
   508  
   509  // QueryAggregateVolumesRequest is the request type for the
   510  // Query/AggregateVolumes RPC method.
   511  message QueryAggregateVolumesRequest {
   512    repeated string accounts = 1;
   513    repeated string market_ids = 2;
   514  }
   515  
   516  // QueryAggregateVolumesResponse is the response type for the
   517  // Query/AggregateVolumes RPC method.
   518  message QueryAggregateVolumesResponse {
   519    // the aggregate volume records for the accounts specified
   520    repeated AggregateAccountVolumeRecord aggregate_account_volumes = 1;
   521    // the aggregate volumes for the markets specified
   522    repeated MarketVolume aggregate_market_volumes = 2;
   523  }
   524  
   525  // QueryAggregateMarketVolumeRequest is the request type for the
   526  // Query/AggregateMarketVolume RPC method.
   527  message QueryAggregateMarketVolumeRequest { string market_id = 1; }
   528  
   529  // QueryAggregateMarketVolumeResponse is the response type for the
   530  // Query/AggregateMarketVolume RPC method.
   531  message QueryAggregateMarketVolumeResponse {
   532    VolumeRecord volume = 1 [ (gogoproto.nullable) = false ];
   533  }
   534  
   535  // QueryDenomDecimalRequest is the request type for the Query/DenomDecimal RPC
   536  // method.
   537  message QueryDenomDecimalRequest { string denom = 1; }
   538  
   539  // QueryDenomDecimalResponse is the response type for the Query/DenomDecimal RPC
   540  // method.
   541  message QueryDenomDecimalResponse { uint64 decimal = 1; }
   542  
   543  // QueryDenomDecimalsRequest is the request type for the Query/DenomDecimals RPC
   544  // method.
   545  message QueryDenomDecimalsRequest {
   546    // denoms can be empty to query all denom decimals
   547    repeated string denoms = 1;
   548  }
   549  
   550  // QueryDenomDecimalsRequest is the response type for the Query/DenomDecimals
   551  // RPC method.
   552  message QueryDenomDecimalsResponse {
   553    repeated DenomDecimals denom_decimals = 1 [ (gogoproto.nullable) = false ];
   554  }
   555  
   556  // QueryAggregateMarketVolumesRequest is the request type for the
   557  // Query/AggregateMarketVolumes RPC method.
   558  message QueryAggregateMarketVolumesRequest { repeated string market_ids = 1; }
   559  
   560  // QueryAggregateMarketVolumesResponse is the response type for the
   561  // Query/AggregateMarketVolumes RPC method.
   562  message QueryAggregateMarketVolumesResponse {
   563    // the aggregate volumes for the entire market
   564    repeated MarketVolume volumes = 1;
   565  }
   566  
   567  // QuerySubaccountDepositsRequest is the request type for the
   568  // Query/SubaccountDeposits RPC method.
   569  message QuerySubaccountDepositRequest {
   570    string subaccount_id = 1;
   571    string denom = 2;
   572  }
   573  
   574  // QuerySubaccountDepositsResponse is the response type for the
   575  // Query/SubaccountDeposits RPC method.
   576  message QuerySubaccountDepositResponse { Deposit deposits = 1; }
   577  
   578  // QuerySpotMarketsRequest is the request type for the Query/SpotMarkets RPC
   579  // method.
   580  message QuerySpotMarketsRequest {
   581    // Status of the market, for convenience it is set to string - not enum
   582    string status = 1;
   583  
   584    // Filter by market IDs
   585    repeated string market_ids = 2;
   586  }
   587  
   588  // QuerySpotMarketsResponse is the response type for the Query/SpotMarkets RPC
   589  // method.
   590  message QuerySpotMarketsResponse { repeated SpotMarket markets = 1; }
   591  
   592  // QuerySpotMarketRequest is the request type for the Query/SpotMarket RPC
   593  // method.
   594  message QuerySpotMarketRequest {
   595    // Market ID for the market
   596    string market_id = 1;
   597  }
   598  
   599  // QuerySpotMarketResponse is the response type for the Query/SpotMarket RPC
   600  // method.
   601  message QuerySpotMarketResponse { SpotMarket market = 1; }
   602  
   603  enum OrderSide {
   604    // will return both
   605    Side_Unspecified = 0;
   606    Buy = 1;
   607    Sell = 2;
   608  }
   609  
   610  // QuerySpotOrderbookRequest is the request type for the Query/SpotOrderbook RPC
   611  // method.
   612  message QuerySpotOrderbookRequest {
   613    // Market ID for the market
   614    string market_id = 1;
   615    uint64 limit = 2;
   616    OrderSide order_side = 3;
   617    string limit_cumulative_notional = 4 [
   618      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   619      (gogoproto.nullable) = true
   620    ];
   621    string limit_cumulative_quantity = 5 [
   622      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   623      (gogoproto.nullable) = true
   624    ];
   625  }
   626  
   627  // QuerySpotOrderbookResponse is the response type for the Query/SpotOrderbook
   628  // RPC method.
   629  message QuerySpotOrderbookResponse {
   630    repeated Level buys_price_level = 1;
   631    repeated Level sells_price_level = 2;
   632  }
   633  
   634  message FullSpotMarket {
   635    SpotMarket market = 1;
   636    // mid_price_and_tob defines the mid price for this market and the best ask
   637    // and bid orders
   638    MidPriceAndTOB mid_price_and_tob = 2 [ (gogoproto.nullable) = true ];
   639  }
   640  
   641  // QueryFullSpotMarketsRequest is the request type for the Query/FullSpotMarkets
   642  // RPC method.
   643  message QueryFullSpotMarketsRequest {
   644    // Status of the market, for convenience it is set to string - not enum
   645    string status = 1;
   646  
   647    // Filter by market IDs
   648    repeated string market_ids = 2;
   649  
   650    // Flag to return the markets mid price and top of the book buy and sell
   651    // orders.
   652    bool with_mid_price_and_tob = 3;
   653  }
   654  
   655  // QueryFullSpotMarketsResponse is the response type for the
   656  // Query/FullSpotMarkets RPC method.
   657  message QueryFullSpotMarketsResponse { repeated FullSpotMarket markets = 1; }
   658  
   659  // QuerySpotMarketRequest is the request type for the Query/SpotMarket RPC
   660  // method.
   661  message QueryFullSpotMarketRequest {
   662    // Market ID for the market
   663    string market_id = 1;
   664    // Flag to return the markets mid price and top of the book buy and sell
   665    // orders.
   666    bool with_mid_price_and_tob = 2;
   667  }
   668  
   669  // QuerySpotMarketResponse is the response type for the Query/SpotMarket RPC
   670  // method.
   671  message QueryFullSpotMarketResponse { FullSpotMarket market = 1; }
   672  
   673  // QuerySpotOrdersByHashesRequest is the request type for the
   674  // Query/SpotOrdersByHashes RPC method.
   675  message QuerySpotOrdersByHashesRequest {
   676    // Market ID for the market
   677    string market_id = 1;
   678    // SubaccountID of the trader
   679    string subaccount_id = 2;
   680    // the order hashes
   681    repeated string order_hashes = 3;
   682  }
   683  
   684  // QuerySpotOrdersByHashesResponse is the response type for the
   685  // Query/SpotOrdersByHashes RPC method.
   686  message QuerySpotOrdersByHashesResponse {
   687    repeated TrimmedSpotLimitOrder orders = 1;
   688  }
   689  
   690  // QueryTraderSpotOrdersRequest is the request type for the
   691  // Query/TraderSpotOrders RPC method.
   692  message QueryTraderSpotOrdersRequest {
   693    // Market ID for the market
   694    string market_id = 1;
   695    // SubaccountID of the trader
   696    string subaccount_id = 2;
   697  }
   698  
   699  // QueryAccountAddressSpotOrdersRequest is the request type for the
   700  // Query/AccountAddressSpotOrders RPC method.
   701  message QueryAccountAddressSpotOrdersRequest {
   702    // Market ID for the market
   703    string market_id = 1;
   704    // Account address of the trader
   705    string account_address = 2;
   706  }
   707  
   708  message TrimmedSpotLimitOrder {
   709    // price of the order
   710    string price = 1 [
   711      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   712      (gogoproto.nullable) = false
   713    ];
   714    // quantity of the order
   715    string quantity = 2 [
   716      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   717      (gogoproto.nullable) = false
   718    ];
   719    // the amount of the quantity remaining fillable
   720    string fillable = 3 [
   721      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   722      (gogoproto.nullable) = false
   723    ];
   724    // true if the order is a buy
   725    bool isBuy = 4;
   726    string order_hash = 5;
   727    string cid = 6;
   728  }
   729  
   730  // QueryTraderSpotOrdersResponse is the response type for the
   731  // Query/TraderSpotOrders RPC method.
   732  message QueryTraderSpotOrdersResponse {
   733    repeated TrimmedSpotLimitOrder orders = 1;
   734  }
   735  
   736  // QueryAccountAddressSpotOrdersResponse is the response type for the
   737  // Query/AccountAddressSpotOrders RPC method.
   738  message QueryAccountAddressSpotOrdersResponse {
   739    repeated TrimmedSpotLimitOrder orders = 1;
   740  }
   741  
   742  // QuerySpotMidPriceAndTOBRequest is the request type for the
   743  // Query/SpotMidPriceAndTOB RPC method.
   744  message QuerySpotMidPriceAndTOBRequest {
   745    // Market ID for the market
   746    string market_id = 1;
   747  }
   748  
   749  // QuerySpotMidPriceAndTOBResponse is the response type for the
   750  // Query/SpotMidPriceAndTOB RPC method.
   751  message QuerySpotMidPriceAndTOBResponse {
   752    // mid price of the market
   753    string mid_price = 1 [
   754      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   755      (gogoproto.nullable) = true
   756    ];
   757    // best buy price of the market
   758    string best_buy_price = 2 [
   759      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   760      (gogoproto.nullable) = true
   761    ];
   762    // best sell price of the market
   763    string best_sell_price = 3 [
   764      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   765      (gogoproto.nullable) = true
   766    ];
   767  }
   768  
   769  // QueryDerivativeMidPriceAndTOBRequest is the request type for the
   770  // Query/GetDerivativeMidPriceAndTOB RPC method.
   771  message QueryDerivativeMidPriceAndTOBRequest {
   772    // Market ID for the market
   773    string market_id = 1;
   774  }
   775  
   776  // QueryDerivativeMidPriceAndTOBResponse is the response type for the
   777  // Query/GetDerivativeMidPriceAndTOB RPC method.
   778  message QueryDerivativeMidPriceAndTOBResponse {
   779    // mid price of the market
   780    string mid_price = 1 [
   781      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   782      (gogoproto.nullable) = true
   783    ];
   784    // best buy price of the market
   785    string best_buy_price = 2 [
   786      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   787      (gogoproto.nullable) = true
   788    ];
   789    // best sell price of the market
   790    string best_sell_price = 3 [
   791      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   792      (gogoproto.nullable) = true
   793    ];
   794  }
   795  
   796  // QueryDerivativeOrderbookRequest is the request type for the
   797  // Query/DerivativeOrderbook RPC method.
   798  message QueryDerivativeOrderbookRequest {
   799    // Market ID for the market
   800    string market_id = 1;
   801    uint64 limit = 2;
   802    string limit_cumulative_notional = 3 [
   803      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   804      (gogoproto.nullable) = true
   805    ];
   806  }
   807  
   808  // QueryDerivativeOrderbookResponse is the response type for the
   809  // Query/DerivativeOrderbook RPC method.
   810  message QueryDerivativeOrderbookResponse {
   811    repeated Level buys_price_level = 1;
   812    repeated Level sells_price_level = 2;
   813  }
   814  
   815  // CancellationStrategy is the list of cancellation strategies.
   816  enum CancellationStrategy {
   817    // just cancelling in random order in most efficient way
   818    UnspecifiedOrder = 0;
   819    // e.g. for buy orders from lowest to highest price
   820    FromWorstToBest = 1;
   821    // e.g. for buy orders from higest to lowest price
   822    FromBestToWorst = 2;
   823  
   824    // more strategies could be imagined like cancel buy first or cancel sell
   825    // first
   826  }
   827  
   828  // QueryTraderSpotOrdersToCancelUpToAmountRequest is the request type for the
   829  // Query/TraderSpotOrdersToCancelUpToAmountRequest RPC method.
   830  message QueryTraderSpotOrdersToCancelUpToAmountRequest {
   831    // Market ID for the market
   832    string market_id = 1;
   833    // SubaccountID of the trader
   834    string subaccount_id = 2;
   835    // the base amount to cancel (free up)
   836    string base_amount = 3 [
   837      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   838      (gogoproto.nullable) = false
   839    ];
   840    // the quote amount to cancel (free up)
   841    string quote_amount = 4 [
   842      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   843      (gogoproto.nullable) = false
   844    ];
   845    // The cancellation strategy
   846    CancellationStrategy strategy = 5;
   847    // The reference price for the cancellation strategy, e.g. mid price or mark
   848    // price
   849    string reference_price = 6 [
   850      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   851      (gogoproto.nullable) = true
   852    ];
   853  }
   854  
   855  // QueryTraderDerivativeOrdersToCancelUpToAmountRequest is the request type for
   856  // the Query/TraderDerivativeOrdersToCancelUpToAmountRequest RPC method.
   857  message QueryTraderDerivativeOrdersToCancelUpToAmountRequest {
   858    // Market ID for the market
   859    string market_id = 1;
   860    // SubaccountID of the trader
   861    string subaccount_id = 2;
   862    // the quote amount to cancel (free up)
   863    string quote_amount = 3 [
   864      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   865      (gogoproto.nullable) = false
   866    ];
   867    // The cancellation strategy
   868    CancellationStrategy strategy = 4;
   869    // The reference price for the cancellation strategy, e.g. mid price or mark
   870    // price
   871    string reference_price = 5 [
   872      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   873      (gogoproto.nullable) = true
   874    ];
   875  }
   876  
   877  // QueryTraderDerivativeOrdersRequest is the request type for the
   878  // Query/TraderDerivativeOrders RPC method.
   879  message QueryTraderDerivativeOrdersRequest {
   880    // Market ID for the market
   881    string market_id = 1;
   882    // SubaccountID of the trader
   883    string subaccount_id = 2;
   884  }
   885  
   886  // QueryAccountAddressSpotOrdersRequest is the request type for the
   887  // Query/AccountAddressDerivativeOrders RPC method.
   888  message QueryAccountAddressDerivativeOrdersRequest {
   889    // Market ID for the market
   890    string market_id = 1;
   891    // Account address of the trader
   892    string account_address = 2;
   893  }
   894  
   895  message TrimmedDerivativeLimitOrder {
   896    // price of the order
   897    string price = 1 [
   898      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   899      (gogoproto.nullable) = false
   900    ];
   901    // quantity of the order
   902    string quantity = 2 [
   903      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   904      (gogoproto.nullable) = false
   905    ];
   906    // margin of the order
   907    string margin = 3 [
   908      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   909      (gogoproto.nullable) = false
   910    ];
   911    // the amount of the quantity remaining fillable
   912    string fillable = 4 [
   913      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   914      (gogoproto.nullable) = false
   915    ];
   916    // true if the order is a buy
   917    bool isBuy = 5
   918        [ (gogoproto.jsontag) = "isBuy" ]; // ensure omitempty is not in jsontag
   919    string order_hash = 6;
   920    string cid = 7;
   921  }
   922  
   923  // QueryTraderDerivativeOrdersResponse is the response type for the
   924  // Query/TraderDerivativeOrders RPC method.
   925  message QueryTraderDerivativeOrdersResponse {
   926    repeated TrimmedDerivativeLimitOrder orders = 1;
   927  }
   928  
   929  // QueryAccountAddressDerivativeOrdersResponse is the response type for the
   930  // Query/AccountAddressDerivativeOrders RPC method.
   931  message QueryAccountAddressDerivativeOrdersResponse {
   932    repeated TrimmedDerivativeLimitOrder orders = 1;
   933  }
   934  
   935  // QueryTraderDerivativeOrdersRequest is the request type for the
   936  // Query/TraderDerivativeOrders RPC method.
   937  message QueryDerivativeOrdersByHashesRequest {
   938    // Market ID for the market
   939    string market_id = 1;
   940    // SubaccountID of the trader
   941    string subaccount_id = 2;
   942    // the order hashes
   943    repeated string order_hashes = 3;
   944  }
   945  
   946  // QueryDerivativeOrdersByHashesResponse is the response type for the
   947  // Query/DerivativeOrdersByHashes RPC method.
   948  message QueryDerivativeOrdersByHashesResponse {
   949    repeated TrimmedDerivativeLimitOrder orders = 1;
   950  }
   951  
   952  // QueryDerivativeMarketsRequest is the request type for the
   953  // Query/DerivativeMarkets RPC method.
   954  message QueryDerivativeMarketsRequest {
   955    // Status of the market, for convenience it is set to string - not enum
   956    string status = 1;
   957  
   958    // Filter by market IDs
   959    repeated string market_ids = 2;
   960  
   961    // Flag to return the markets mid price and top of the book buy and sell
   962    // orders.
   963    bool with_mid_price_and_tob = 3;
   964  }
   965  
   966  message PriceLevel {
   967    string price = 1 [
   968      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   969      (gogoproto.nullable) = false
   970    ];
   971    // quantity
   972    string quantity = 2 [
   973      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   974      (gogoproto.nullable) = false
   975    ];
   976  }
   977  
   978  message PerpetualMarketState {
   979    PerpetualMarketInfo market_info = 1;
   980    PerpetualMarketFunding funding_info = 2;
   981  }
   982  
   983  message FullDerivativeMarket {
   984    DerivativeMarket market = 1;
   985    oneof info {
   986      PerpetualMarketState perpetual_info = 2;
   987      ExpiryFuturesMarketInfo futures_info = 3;
   988    }
   989    string mark_price = 4 [
   990      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
   991      (gogoproto.nullable) = false
   992    ];
   993  
   994    // mid_price_and_tob defines the mid price for this market and the best ask
   995    // and bid orders
   996    MidPriceAndTOB mid_price_and_tob = 5 [ (gogoproto.nullable) = true ];
   997  }
   998  
   999  // QueryDerivativeMarketsResponse is the response type for the
  1000  // Query/DerivativeMarkets RPC method.
  1001  message QueryDerivativeMarketsResponse {
  1002    repeated FullDerivativeMarket markets = 1;
  1003  }
  1004  
  1005  // QueryDerivativeMarketRequest is the request type for the
  1006  // Query/DerivativeMarket RPC method.
  1007  message QueryDerivativeMarketRequest {
  1008    // Market ID for the market
  1009    string market_id = 1;
  1010  }
  1011  
  1012  // QueryDerivativeMarketResponse is the response type for the
  1013  // Query/DerivativeMarket RPC method.
  1014  message QueryDerivativeMarketResponse { FullDerivativeMarket market = 1; }
  1015  
  1016  // QueryDerivativeMarketAddressRequest is the request type for the
  1017  // Query/DerivativeMarketAddress RPC method.
  1018  message QueryDerivativeMarketAddressRequest {
  1019    // Market ID for the market
  1020    string market_id = 1;
  1021  }
  1022  
  1023  // QueryDerivativeMarketAddressResponse is the response type for the
  1024  // Query/DerivativeMarketAddress RPC method.
  1025  message QueryDerivativeMarketAddressResponse {
  1026    // address for the market
  1027    string address = 1;
  1028    // subaccountID for the market
  1029    string subaccount_id = 2;
  1030  }
  1031  
  1032  // QuerySubaccountTradeNonceRequest is the request type for the
  1033  // Query/SubaccountTradeNonce RPC method.
  1034  message QuerySubaccountTradeNonceRequest { string subaccount_id = 1; }
  1035  
  1036  // QuerySubaccountPositionsRequest is the request type for the
  1037  // Query/SubaccountPositions RPC method.
  1038  message QuerySubaccountPositionsRequest { string subaccount_id = 1; }
  1039  
  1040  // QuerySubaccountPositionInMarketRequest is the request type for the
  1041  // Query/SubaccountPositionInMarket RPC method.
  1042  message QuerySubaccountPositionInMarketRequest {
  1043    string subaccount_id = 1;
  1044    string market_id = 2;
  1045  }
  1046  
  1047  // QuerySubaccountEffectivePositionInMarketRequest is the request type for the
  1048  // Query/SubaccountEffectivePositionInMarket RPC method.
  1049  message QuerySubaccountEffectivePositionInMarketRequest {
  1050    string subaccount_id = 1;
  1051    string market_id = 2;
  1052  }
  1053  
  1054  // QuerySubaccountOrderMetadataRequest is the request type for the
  1055  // Query/SubaccountOrderMetadata RPC method.
  1056  message QuerySubaccountOrderMetadataRequest { string subaccount_id = 1; }
  1057  
  1058  // QuerySubaccountPositionsResponse is the response type for the
  1059  // Query/SubaccountPositions RPC method.
  1060  message QuerySubaccountPositionsResponse {
  1061    repeated DerivativePosition state = 1 [ (gogoproto.nullable) = false ];
  1062  }
  1063  
  1064  // QuerySubaccountPositionInMarketResponse is the response type for the
  1065  // Query/SubaccountPositionInMarket RPC method.
  1066  message QuerySubaccountPositionInMarketResponse {
  1067    Position state = 1 [ (gogoproto.nullable) = true ];
  1068  }
  1069  
  1070  message EffectivePosition {
  1071    bool is_long = 1;
  1072    string quantity = 2 [
  1073      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1074      (gogoproto.nullable) = false
  1075    ];
  1076    string entry_price = 3 [
  1077      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1078      (gogoproto.nullable) = false
  1079    ];
  1080    string effective_margin = 4 [
  1081      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1082      (gogoproto.nullable) = false
  1083    ];
  1084  }
  1085  
  1086  // QuerySubaccountEffectivePositionInMarketResponse is the response type for the
  1087  // Query/SubaccountEffectivePositionInMarket RPC method.
  1088  message QuerySubaccountEffectivePositionInMarketResponse {
  1089    EffectivePosition state = 1 [ (gogoproto.nullable) = true ];
  1090  }
  1091  
  1092  // QueryPerpetualMarketInfoRequest is the request type for the
  1093  // Query/PerpetualMarketInfo RPC method.
  1094  message QueryPerpetualMarketInfoRequest { string market_id = 1; }
  1095  
  1096  // QueryPerpetualMarketInfoResponse is the response type for the
  1097  // Query/PerpetualMarketInfo RPC method.
  1098  message QueryPerpetualMarketInfoResponse {
  1099    PerpetualMarketInfo info = 1 [ (gogoproto.nullable) = false ];
  1100  }
  1101  
  1102  // QueryExpiryFuturesMarketInfoRequest is the request type for the Query/
  1103  // ExpiryFuturesMarketInfo RPC method.
  1104  message QueryExpiryFuturesMarketInfoRequest { string market_id = 1; }
  1105  
  1106  // QueryExpiryFuturesMarketInfoResponse is the response type for the Query/
  1107  // ExpiryFuturesMarketInfo RPC method.
  1108  message QueryExpiryFuturesMarketInfoResponse {
  1109    ExpiryFuturesMarketInfo info = 1 [ (gogoproto.nullable) = false ];
  1110  }
  1111  
  1112  // QueryPerpetualMarketFundingRequest is the request type for the
  1113  // Query/PerpetualMarketFunding RPC method.
  1114  message QueryPerpetualMarketFundingRequest { string market_id = 1; }
  1115  
  1116  // QueryPerpetualMarketFundingResponse is the response type for the
  1117  // Query/PerpetualMarketFunding RPC method.
  1118  message QueryPerpetualMarketFundingResponse {
  1119    PerpetualMarketFunding state = 1 [ (gogoproto.nullable) = false ];
  1120  }
  1121  
  1122  // QuerySubaccountOrderMetadataResponse is the response type for the
  1123  // Query/SubaccountOrderMetadata RPC method.
  1124  message QuerySubaccountOrderMetadataResponse {
  1125    repeated SubaccountOrderbookMetadataWithMarket metadata = 1
  1126        [ (gogoproto.nullable) = false ];
  1127  }
  1128  
  1129  // QuerySubaccountTradeNonceResponse is the response type for the
  1130  // Query/SubaccountTradeNonce RPC method.
  1131  message QuerySubaccountTradeNonceResponse { uint32 nonce = 1; }
  1132  
  1133  // QueryModuleStateRequest is the request type for the Query/ExchangeModuleState
  1134  // RPC method.
  1135  message QueryModuleStateRequest {}
  1136  
  1137  // QueryModuleStateResponse is the response type for the
  1138  // Query/ExchangeModuleState RPC method.
  1139  message QueryModuleStateResponse { GenesisState state = 1; }
  1140  
  1141  // QueryPositionsRequest is the request type for the Query/Positions RPC method.
  1142  message QueryPositionsRequest {}
  1143  
  1144  // QueryPositionsResponse is the response type for the Query/Positions RPC
  1145  // method.
  1146  message QueryPositionsResponse {
  1147    repeated DerivativePosition state = 1 [ (gogoproto.nullable) = false ];
  1148  }
  1149  
  1150  // QueryTradeRewardPointsRequest is the request type for the
  1151  // Query/TradeRewardPoints RPC method.
  1152  message QueryTradeRewardPointsRequest {
  1153    repeated string accounts = 1;
  1154    int64 pending_pool_timestamp = 2;
  1155  }
  1156  
  1157  // QueryTradeRewardPointsResponse is the response type for the
  1158  // Query/TradeRewardPoints RPC method.
  1159  message QueryTradeRewardPointsResponse {
  1160    repeated string account_trade_reward_points = 1 [
  1161      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1162      (gogoproto.nullable) = false
  1163    ];
  1164  }
  1165  
  1166  // QueryTradeRewardCampaignRequest is the request type for the
  1167  // Query/TradeRewardCampaign RPC method.
  1168  message QueryTradeRewardCampaignRequest {}
  1169  
  1170  // QueryTradeRewardCampaignResponse is the response type for the
  1171  // Query/TradeRewardCampaign RPC method.
  1172  message QueryTradeRewardCampaignResponse {
  1173    TradingRewardCampaignInfo trading_reward_campaign_info = 1;
  1174    repeated CampaignRewardPool trading_reward_pool_campaign_schedule = 2;
  1175    string total_trade_reward_points = 3 [
  1176      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1177      (gogoproto.nullable) = false
  1178    ];
  1179    repeated CampaignRewardPool pending_trading_reward_pool_campaign_schedule = 4;
  1180    repeated string pending_total_trade_reward_points = 5 [
  1181      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1182      (gogoproto.nullable) = false
  1183    ];
  1184  }
  1185  
  1186  // QueryIsRegisteredDMMRequest is the request type for the Query/IsRegisteredDMM
  1187  // RPC method.
  1188  message QueryIsOptedOutOfRewardsRequest { string account = 1; }
  1189  
  1190  // QueryIsRegisteredDMMResponse is the response type for the
  1191  // Query/IsRegisteredDMM RPC method.
  1192  message QueryIsOptedOutOfRewardsResponse { bool is_opted_out = 1; }
  1193  
  1194  // QueryRegisteredDMMsRequest is the request type for the Query/RegisteredDMMs
  1195  // RPC method.
  1196  message QueryOptedOutOfRewardsAccountsRequest {}
  1197  
  1198  // QueryRegisteredDMMsResponse is the response type for the Query/RegisteredDMMs
  1199  // RPC method.
  1200  message QueryOptedOutOfRewardsAccountsResponse { repeated string accounts = 1; }
  1201  
  1202  // QueryFeeDiscountAccountInfoRequest is the request type for the
  1203  // Query/FeeDiscountAccountInfo RPC method.
  1204  message QueryFeeDiscountAccountInfoRequest { string account = 1; }
  1205  
  1206  // QueryFeeDiscountAccountInfoResponse is the response type for the
  1207  // Query/FeeDiscountAccountInfo RPC method.
  1208  message QueryFeeDiscountAccountInfoResponse {
  1209    uint64 tier_level = 1;
  1210    FeeDiscountTierInfo account_info = 2;
  1211    FeeDiscountTierTTL account_ttl = 3;
  1212  }
  1213  
  1214  // QueryFeeDiscountScheduleRequest is the request type for the
  1215  // Query/FeeDiscountSchedule RPC method.
  1216  message QueryFeeDiscountScheduleRequest {}
  1217  
  1218  // QueryFeeDiscountScheduleResponse is the response type for the
  1219  // Query/FeeDiscountSchedule RPC method.
  1220  message QueryFeeDiscountScheduleResponse {
  1221    FeeDiscountSchedule fee_discount_schedule = 1;
  1222  }
  1223  
  1224  // QueryBalanceMismatchesRequest is the request type for the
  1225  // Query/QueryBalanceMismatches RPC method.
  1226  message QueryBalanceMismatchesRequest { int64 dust_factor = 1; }
  1227  
  1228  message BalanceMismatch {
  1229    string subaccountId = 1;
  1230    string denom = 2;
  1231    string available = 3 [
  1232      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1233      (gogoproto.nullable) = false
  1234    ];
  1235    string total = 4 [
  1236      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1237      (gogoproto.nullable) = false
  1238    ];
  1239    string balance_hold = 5 [
  1240      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1241      (gogoproto.nullable) = false
  1242    ];
  1243    string expected_total = 6 [
  1244      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1245      (gogoproto.nullable) = false
  1246    ];
  1247    string difference = 7 [
  1248      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1249      (gogoproto.nullable) = false
  1250    ];
  1251  }
  1252  
  1253  // QueryBalanceMismatchesResponse is the response type for the
  1254  // Query/QueryBalanceMismatches RPC method.
  1255  message QueryBalanceMismatchesResponse {
  1256    repeated BalanceMismatch balance_mismatches = 1;
  1257  }
  1258  
  1259  // QueryBalanceWithBalanceHoldsRequest is the request type for the
  1260  // Query/QueryBalanceWithBalanceHolds RPC method.
  1261  message QueryBalanceWithBalanceHoldsRequest {}
  1262  
  1263  message BalanceWithMarginHold {
  1264    string subaccountId = 1;
  1265    string denom = 2;
  1266    string available = 3 [
  1267      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1268      (gogoproto.nullable) = false
  1269    ];
  1270    string total = 4 [
  1271      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1272      (gogoproto.nullable) = false
  1273    ];
  1274    string balance_hold = 5 [
  1275      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1276      (gogoproto.nullable) = false
  1277    ];
  1278  }
  1279  
  1280  // QueryBalanceWithBalanceHoldsResponse is the response type for the
  1281  // Query/QueryBalanceWithBalanceHolds RPC method.
  1282  message QueryBalanceWithBalanceHoldsResponse {
  1283    repeated BalanceWithMarginHold balance_with_balance_holds = 1;
  1284  }
  1285  
  1286  // QueryFeeDiscountTierStatisticsRequest is the request type for the
  1287  // Query/QueryFeeDiscountTierStatistics RPC method.
  1288  message QueryFeeDiscountTierStatisticsRequest {}
  1289  
  1290  message TierStatistic {
  1291    uint64 tier = 1;
  1292    uint64 count = 2;
  1293  }
  1294  
  1295  // QueryFeeDiscountTierStatisticsResponse is the response type for the
  1296  // Query/QueryFeeDiscountTierStatistics RPC method.
  1297  message QueryFeeDiscountTierStatisticsResponse {
  1298    repeated TierStatistic statistics = 1;
  1299  }
  1300  
  1301  // MitoVaultInfosRequest is the request type for the Query/MitoVaultInfos RPC
  1302  // method.
  1303  message MitoVaultInfosRequest {}
  1304  
  1305  // MitoVaultInfosResponse is the response type for the Query/MitoVaultInfos RPC
  1306  // method.
  1307  message MitoVaultInfosResponse {
  1308    repeated string master_addresses = 1;
  1309    repeated string derivative_addresses = 2;
  1310    repeated string spot_addresses = 3;
  1311    repeated string cw20_addresses = 4;
  1312  }
  1313  
  1314  // QueryMarketIDFromVaultRequest is the request type for the
  1315  // Query/QueryMarketIDFromVault RPC method.
  1316  message QueryMarketIDFromVaultRequest { string vault_address = 1; }
  1317  
  1318  // QueryMarketIDFromVaultResponse is the response type for the
  1319  // Query/QueryMarketIDFromVault RPC method.
  1320  message QueryMarketIDFromVaultResponse { string market_id = 1; }
  1321  
  1322  message QueryHistoricalTradeRecordsRequest { string market_id = 1; }
  1323  
  1324  message QueryHistoricalTradeRecordsResponse {
  1325    repeated TradeRecords trade_records = 1;
  1326  }
  1327  
  1328  // TradeHistoryOptions are the optional params for Query/MarketVolatility RPC
  1329  // method.
  1330  message TradeHistoryOptions {
  1331    // TradeGroupingSec of 0 means use the chain's default grouping
  1332    uint64 trade_grouping_sec = 1;
  1333    // MaxAge restricts the trade records oldest age in seconds from the current
  1334    // block time to consider. A value of 0 means use all the records present on
  1335    // the chain.
  1336    uint64 max_age = 2;
  1337    // If IncludeRawHistory is true, the raw underlying data used for the
  1338    // computation is included in the response
  1339    bool include_raw_history = 4;
  1340    // If IncludeMetadata is true, metadata on the computation is included in the
  1341    // response
  1342    bool include_metadata = 5;
  1343  }
  1344  
  1345  // QueryMarketVolatilityRequest are the request params for the
  1346  // Query/MarketVolatility RPC method.
  1347  message QueryMarketVolatilityRequest {
  1348    string market_id = 1;
  1349    TradeHistoryOptions trade_history_options = 2;
  1350  }
  1351  
  1352  // QueryMarketVolatilityResponse is the response type for the
  1353  // Query/MarketVolatility RPC method.
  1354  message QueryMarketVolatilityResponse {
  1355    string volatility = 1
  1356        [ (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec" ];
  1357    injective.oracle.v1beta1.MetadataStatistics history_metadata = 2;
  1358    repeated TradeRecord raw_history = 3;
  1359  }
  1360  
  1361  // QuerBinaryMarketsRequest is the request type for the Query/BinaryMarkets RPC
  1362  // method.
  1363  message QueryBinaryMarketsRequest {
  1364    // Status of the market, for convenience it is set to string - not enum
  1365    string status = 1;
  1366  }
  1367  
  1368  // QueryBinaryMarketsResponse is the response type for the Query/BinaryMarkets
  1369  // RPC method.
  1370  message QueryBinaryMarketsResponse { repeated BinaryOptionsMarket markets = 1; }
  1371  
  1372  // QueryConditionalOrdersRequest is the request type for the
  1373  // Query/ConditionalOrders RPC method.
  1374  message QueryTraderDerivativeConditionalOrdersRequest {
  1375    string subaccount_id = 1;
  1376    string market_id = 2;
  1377  }
  1378  
  1379  message TrimmedDerivativeConditionalOrder {
  1380    // price of the order
  1381    string price = 1 [
  1382      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1383      (gogoproto.nullable) = false
  1384    ];
  1385    // quantity of the order
  1386    string quantity = 2 [
  1387      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1388      (gogoproto.nullable) = false
  1389    ];
  1390    // margin of the order
  1391    string margin = 3 [
  1392      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1393      (gogoproto.nullable) = false
  1394    ];
  1395    // price to trigger the order
  1396    string triggerPrice = 4 [
  1397      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1398      (gogoproto.nullable) = false
  1399    ];
  1400    // true if the order is a buy
  1401    bool isBuy = 5
  1402        [ (gogoproto.jsontag) = "isBuy" ]; // ensure omitempty is not in jsontag
  1403    bool isLimit = 6 [ (gogoproto.jsontag) = "isLimit" ];
  1404    string order_hash = 7;
  1405    string cid = 8;
  1406  }
  1407  
  1408  // QueryTraderDerivativeOrdersResponse is the response type for the
  1409  // Query/TraderDerivativeOrders RPC method.
  1410  message QueryTraderDerivativeConditionalOrdersResponse {
  1411    repeated TrimmedDerivativeConditionalOrder orders = 1;
  1412  }
  1413  
  1414  message QueryMarketAtomicExecutionFeeMultiplierRequest { string market_id = 1; }
  1415  
  1416  message QueryMarketAtomicExecutionFeeMultiplierResponse {
  1417    string multiplier = 1 [
  1418      (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
  1419      (gogoproto.nullable) = false
  1420    ];
  1421  }
  1422  
  1423  message QueryActiveStakeGrantRequest { string grantee = 1; }
  1424  
  1425  message QueryActiveStakeGrantResponse {
  1426    ActiveGrant grant = 1;
  1427    EffectiveGrant effective_grant = 2;
  1428  }
  1429  
  1430  message QueryGrantAuthorizationRequest {
  1431    string granter = 1;
  1432    string grantee = 2;
  1433  }
  1434  
  1435  message QueryGrantAuthorizationResponse {
  1436    string amount = 1 [
  1437      (gogoproto.customtype) = "cosmossdk.io/math.Int",
  1438      (gogoproto.nullable) = false
  1439    ];
  1440  }
  1441  
  1442  message QueryGrantAuthorizationsRequest { string granter = 1; }
  1443  
  1444  message QueryGrantAuthorizationsResponse {
  1445    string total_grant_amount = 1 [
  1446      (gogoproto.customtype) = "cosmossdk.io/math.Int",
  1447      (gogoproto.nullable) = false
  1448    ];
  1449    repeated GrantAuthorization grants = 2;
  1450  }