-
Notifications
You must be signed in to change notification settings - Fork 409
/
query.proto
355 lines (314 loc) · 13.4 KB
/
query.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
syntax = "proto3";
package cosmwasm.wasm.v1;
import "gogoproto/gogo.proto";
import "cosmwasm/wasm/v1/types.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos/query/v1/query.proto";
import "amino/amino.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/CosmWasm/wasmd/x/wasm/types";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;
// Query provides defines the gRPC querier service
service Query {
// ContractInfo gets the contract meta data
rpc ContractInfo(QueryContractInfoRequest)
returns (QueryContractInfoResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}";
}
// ContractHistory gets the contract code history
rpc ContractHistory(QueryContractHistoryRequest)
returns (QueryContractHistoryResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get =
"/cosmwasm/wasm/v1/contract/{address}/history";
}
// ContractsByCode lists all smart contracts for a code id
rpc ContractsByCode(QueryContractsByCodeRequest)
returns (QueryContractsByCodeResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/code/{code_id}/contracts";
}
// AllContractState gets all raw store data for a single contract
rpc AllContractState(QueryAllContractStateRequest)
returns (QueryAllContractStateResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}/state";
}
// RawContractState gets single key from the raw store data of a contract
rpc RawContractState(QueryRawContractStateRequest)
returns (QueryRawContractStateResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get =
"/cosmwasm/wasm/v1/contract/{address}/raw/{query_data}";
}
// SmartContractState get smart query result from the contract
rpc SmartContractState(QuerySmartContractStateRequest)
returns (QuerySmartContractStateResponse) {
option (google.api.http).get =
"/cosmwasm/wasm/v1/contract/{address}/smart/{query_data}";
}
// Code gets the binary code and metadata for a single wasm code
rpc Code(QueryCodeRequest) returns (QueryCodeResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/code/{code_id}";
}
// Codes gets the metadata for all stored wasm codes
rpc Codes(QueryCodesRequest) returns (QueryCodesResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/code";
}
// CodeInfo gets the metadata for a single wasm code
rpc CodeInfo(QueryCodeInfoRequest) returns (QueryCodeInfoResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/code-info/{code_id}";
}
// PinnedCodes gets the pinned code ids
rpc PinnedCodes(QueryPinnedCodesRequest) returns (QueryPinnedCodesResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/codes/pinned";
}
// Params gets the module params
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/codes/params";
}
// ContractsByCreator gets the contracts by creator
rpc ContractsByCreator(QueryContractsByCreatorRequest)
returns (QueryContractsByCreatorResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get =
"/cosmwasm/wasm/v1/contracts/creator/{creator_address}";
}
// WasmLimitsConfig gets the configured limits for static validation of Wasm
// files, encoded in JSON.
rpc WasmLimitsConfig(QueryWasmLimitsConfigRequest)
returns (QueryWasmLimitsConfigResponse) {
option (google.api.http).get = "/cosmwasm/wasm/v1/wasm-limits-config";
}
// BuildAddress builds a contract address
rpc BuildAddress(QueryBuildAddressRequest)
returns (QueryBuildAddressResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmwasm/wasm/v1/contract/build_address";
}
}
// QueryContractInfoRequest is the request type for the Query/ContractInfo RPC
// method
message QueryContractInfoRequest {
// address is the address of the contract to query
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}
// QueryContractInfoResponse is the response type for the Query/ContractInfo RPC
// method
message QueryContractInfoResponse {
option (gogoproto.equal) = true;
// address is the address of the contract
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
ContractInfo contract_info = 2 [
(gogoproto.embed) = true,
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.jsontag) = ""
];
}
// QueryContractHistoryRequest is the request type for the Query/ContractHistory
// RPC method
message QueryContractHistoryRequest {
// address is the address of the contract to query
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryContractHistoryResponse is the response type for the
// Query/ContractHistory RPC method
message QueryContractHistoryResponse {
repeated ContractCodeHistoryEntry entries = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryContractsByCodeRequest is the request type for the Query/ContractsByCode
// RPC method
message QueryContractsByCodeRequest {
uint64 code_id = 1; // grpc-gateway_out does not support Go style CodeID
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryContractsByCodeResponse is the response type for the
// Query/ContractsByCode RPC method
message QueryContractsByCodeResponse {
// contracts are a set of contract addresses
repeated string contracts = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryAllContractStateRequest is the request type for the
// Query/AllContractState RPC method
message QueryAllContractStateRequest {
// address is the address of the contract
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryAllContractStateResponse is the response type for the
// Query/AllContractState RPC method
message QueryAllContractStateResponse {
repeated Model models = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryRawContractStateRequest is the request type for the
// Query/RawContractState RPC method
message QueryRawContractStateRequest {
// address is the address of the contract
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
bytes query_data = 2;
}
// QueryRawContractStateResponse is the response type for the
// Query/RawContractState RPC method
message QueryRawContractStateResponse {
// Data contains the raw store data
bytes data = 1;
}
// QuerySmartContractStateRequest is the request type for the
// Query/SmartContractState RPC method
message QuerySmartContractStateRequest {
// address is the address of the contract
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// QueryData contains the query data passed to the contract
bytes query_data = 2 [
(gogoproto.casttype) = "RawContractMessage",
(amino.encoding) = "inline_json"
];
}
// QuerySmartContractStateResponse is the response type for the
// Query/SmartContractState RPC method
message QuerySmartContractStateResponse {
// Data contains the json data returned from the smart contract
bytes data = 1 [
(gogoproto.casttype) = "RawContractMessage",
(amino.encoding) = "inline_json"
];
}
// QueryCodeRequest is the request type for the Query/Code RPC method
message QueryCodeRequest {
uint64 code_id = 1; // grpc-gateway_out does not support Go style CodeID
}
// QueryCodeInfoRequest is the request type for the Query/CodeInfo RPC method
message QueryCodeInfoRequest {
uint64 code_id = 1; // grpc-gateway_out does not support Go style CodeID
}
// QueryCodeInfoResponse is the response type for the Query/CodeInfo RPC method
message QueryCodeInfoResponse {
option (gogoproto.equal) = true;
uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ];
string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
bytes checksum = 3 [ (gogoproto.casttype) =
"github.com/cometbft/cometbft/libs/bytes.HexBytes" ];
AccessConfig instantiate_permission = 4
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}
// CodeInfoResponse contains code meta data from CodeInfo
message CodeInfoResponse {
option (gogoproto.equal) = true;
uint64 code_id = 1 [
(gogoproto.customname) = "CodeID",
(gogoproto.jsontag) = "id"
]; // id for legacy support
string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
bytes data_hash = 3
[ (gogoproto.casttype) =
"github.com/cometbft/cometbft/libs/bytes.HexBytes" ];
// Used in v1beta1
reserved 4, 5;
AccessConfig instantiate_permission = 6
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}
// QueryCodeResponse is the response type for the Query/Code RPC method
message QueryCodeResponse {
option (gogoproto.equal) = true;
CodeInfoResponse code_info = 1
[ (gogoproto.embed) = true, (gogoproto.jsontag) = "" ];
bytes data = 2 [ (gogoproto.jsontag) = "data" ];
}
// QueryCodesRequest is the request type for the Query/Codes RPC method
message QueryCodesRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
// QueryCodesResponse is the response type for the Query/Codes RPC method
message QueryCodesResponse {
repeated CodeInfoResponse code_infos = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryPinnedCodesRequest is the request type for the Query/PinnedCodes
// RPC method
message QueryPinnedCodesRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryPinnedCodesResponse is the response type for the
// Query/PinnedCodes RPC method
message QueryPinnedCodesResponse {
repeated uint64 code_ids = 1 [ (gogoproto.customname) = "CodeIDs" ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}
// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}
// QueryContractsByCreatorRequest is the request type for the
// Query/ContractsByCreator RPC method.
message QueryContractsByCreatorRequest {
// CreatorAddress is the address of contract creator
string creator_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryContractsByCreatorResponse is the response type for the
// Query/ContractsByCreator RPC method.
message QueryContractsByCreatorResponse {
// ContractAddresses result set
repeated string contract_addresses = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryWasmLimitsConfigRequest is the request type for the
// Query/WasmLimitsConfig RPC method.
message QueryWasmLimitsConfigRequest {}
// QueryWasmLimitsConfigResponse is the response type for the
// Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for
// static validation of Wasm files.
message QueryWasmLimitsConfigResponse { string config = 1; }
// QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC
// method.
message QueryBuildAddressRequest {
// CodeHash is the hash of the code
string code_hash = 1;
// CreatorAddress is the address of the contract instantiator
string creator_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Salt is a hex encoded salt
string salt = 3;
// InitArgs are optional json encoded init args to be used in contract address
// building if provided
bytes init_args = 4;
}
// QueryBuildAddressResponse is the response type for the Query/BuildAddress RPC
// method.
message QueryBuildAddressResponse {
// Address is the contract address
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}