Skip to content

Commit

Permalink
feat(cosmic-proto): add icq/v1 proto + codegen for @agoric/orchestration
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed May 2, 2024
1 parent 4638e98 commit 98213dc
Show file tree
Hide file tree
Showing 18 changed files with 1,060 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# interchain accounts
3 changes: 3 additions & 0 deletions packages/cosmic-proto/proto/icq/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# icq (interchain queries)

These protos were sourced from: [cosmos/ibc-apps/async-icq/v1#18248c3](https://github.com/cosmos/ibc-apps/tree/18248c35e913b3ccba99a2756612b1fcb3370a0d/modules/async-icq/proto/icq/v1)
14 changes: 14 additions & 0 deletions packages/cosmic-proto/proto/icq/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";

package icq.v1;

option go_package = "github.com/cosmos/ibc-apps/modules/async-icq/v8/types";

import "gogoproto/gogo.proto";
import "icq/v1/icq.proto";

// GenesisState defines the interchain query genesis state
message GenesisState {
string host_port = 1;
Params params = 4 [(gogoproto.nullable) = false];
}
15 changes: 15 additions & 0 deletions packages/cosmic-proto/proto/icq/v1/icq.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package icq.v1;

option go_package = "github.com/cosmos/ibc-apps/modules/async-icq/v8/types";

import "gogoproto/gogo.proto";

// Params defines the set of on-chain interchain query parameters.
message Params {
// host_enabled enables or disables the host submodule.
bool host_enabled = 2 [(gogoproto.moretags) = "yaml:\"host_enabled\""];
// allow_queries defines a list of query paths allowed to be queried on a host chain.
repeated string allow_queries = 3 [(gogoproto.moretags) = "yaml:\"allow_queries\""];
}
32 changes: 32 additions & 0 deletions packages/cosmic-proto/proto/icq/v1/packet.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";

package icq.v1;

import "gogoproto/gogo.proto";
import "tendermint/abci/types.proto";

option go_package = "github.com/cosmos/ibc-apps/modules/async-icq/v8/types";



// InterchainQueryPacketData is comprised of raw query.
message InterchainQueryPacketData {
bytes data = 1;
// optional memo
string memo = 2;
}

// InterchainQueryPacketAck is comprised of an ABCI query response with non-deterministic fields left empty (e.g. Codespace, Log, Info and ...).
message InterchainQueryPacketAck {
bytes data = 1;
}

// CosmosQuery contains a list of tendermint ABCI query requests. It should be used when sending queries to an SDK host chain.
message CosmosQuery {
repeated tendermint.abci.RequestQuery requests = 1 [(gogoproto.nullable) = false];
}

// CosmosResponse contains a list of tendermint ABCI query responses. It should be used when receiving responses from an SDK host chain.
message CosmosResponse {
repeated tendermint.abci.ResponseQuery responses = 1 [(gogoproto.nullable) = false];
}
25 changes: 25 additions & 0 deletions packages/cosmic-proto/proto/icq/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

package icq.v1;

option go_package = "github.com/cosmos/ibc-apps/modules/async-icq/v8/types";

import "google/api/annotations.proto";
import "icq/v1/icq.proto";

// Query provides defines the gRPC querier service.
service Query {
// Params queries all parameters of the ICQ module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/async-icq/v1/params";
}
}

// 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;
}
41 changes: 41 additions & 0 deletions packages/cosmic-proto/proto/icq/v1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
syntax = "proto3";
package icq.v1;

import "cosmos/msg/v1/msg.proto";
import "icq/v1/icq.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/ibc-apps/modules/async-icq/v8/types";

// Msg defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;

// UpdateParams defines a governance operation for updating the x/async-icq module
// parameters. The authority is hard-coded to the x/gov module account.
//
// Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}

// MsgUpdateParams is the Msg/UpdateParams request type.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";

// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// params defines the x/async-icq parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}
15 changes: 15 additions & 0 deletions packages/cosmic-proto/src/codegen/icq/bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ts-nocheck
import * as _118 from './v1/genesis.js';
import * as _119 from './v1/icq.js';
import * as _120 from './v1/packet.js';
import * as _121 from './v1/query.js';
import * as _122 from './v1/tx.js';
export namespace icq {
export const v1 = {
..._118,
..._119,
..._120,
..._121,
..._122,
};
}
94 changes: 94 additions & 0 deletions packages/cosmic-proto/src/codegen/icq/v1/genesis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
//@ts-nocheck
import { Params, ParamsSDKType } from './icq.js';
import { BinaryReader, BinaryWriter } from '../../binary.js';
import { isSet } from '../../helpers.js';
/** GenesisState defines the interchain query genesis state */
export interface GenesisState {
hostPort: string;
params: Params;
}
export interface GenesisStateProtoMsg {
typeUrl: '/icq.v1.GenesisState';
value: Uint8Array;
}
/** GenesisState defines the interchain query genesis state */
export interface GenesisStateSDKType {
host_port: string;
params: ParamsSDKType;
}
function createBaseGenesisState(): GenesisState {
return {
hostPort: '',
params: Params.fromPartial({}),
};
}
export const GenesisState = {
typeUrl: '/icq.v1.GenesisState',
encode(
message: GenesisState,
writer: BinaryWriter = BinaryWriter.create(),
): BinaryWriter {
if (message.hostPort !== '') {
writer.uint32(10).string(message.hostPort);
}
if (message.params !== undefined) {
Params.encode(message.params, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GenesisState {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenesisState();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.hostPort = reader.string();
break;
case 4:
message.params = Params.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): GenesisState {
return {
hostPort: isSet(object.hostPort) ? String(object.hostPort) : '',
params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
};
},
toJSON(message: GenesisState): unknown {
const obj: any = {};
message.hostPort !== undefined && (obj.hostPort = message.hostPort);
message.params !== undefined &&
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
return obj;
},
fromPartial(object: Partial<GenesisState>): GenesisState {
const message = createBaseGenesisState();
message.hostPort = object.hostPort ?? '';
message.params =
object.params !== undefined && object.params !== null
? Params.fromPartial(object.params)
: undefined;
return message;
},
fromProtoMsg(message: GenesisStateProtoMsg): GenesisState {
return GenesisState.decode(message.value);
},
toProto(message: GenesisState): Uint8Array {
return GenesisState.encode(message).finish();
},
toProtoMsg(message: GenesisState): GenesisStateProtoMsg {
return {
typeUrl: '/icq.v1.GenesisState',
value: GenesisState.encode(message).finish(),
};
},
};
100 changes: 100 additions & 0 deletions packages/cosmic-proto/src/codegen/icq/v1/icq.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
//@ts-nocheck
import { BinaryReader, BinaryWriter } from '../../binary.js';
import { isSet } from '../../helpers.js';
/** Params defines the set of on-chain interchain query parameters. */
export interface Params {
/** host_enabled enables or disables the host submodule. */
hostEnabled: boolean;
/** allow_queries defines a list of query paths allowed to be queried on a host chain. */
allowQueries: string[];
}
export interface ParamsProtoMsg {
typeUrl: '/icq.v1.Params';
value: Uint8Array;
}
/** Params defines the set of on-chain interchain query parameters. */
export interface ParamsSDKType {
host_enabled: boolean;
allow_queries: string[];
}
function createBaseParams(): Params {
return {
hostEnabled: false,
allowQueries: [],
};
}
export const Params = {
typeUrl: '/icq.v1.Params',
encode(
message: Params,
writer: BinaryWriter = BinaryWriter.create(),
): BinaryWriter {
if (message.hostEnabled === true) {
writer.uint32(16).bool(message.hostEnabled);
}
for (const v of message.allowQueries) {
writer.uint32(26).string(v!);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Params {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
message.hostEnabled = reader.bool();
break;
case 3:
message.allowQueries.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Params {
return {
hostEnabled: isSet(object.hostEnabled)
? Boolean(object.hostEnabled)
: false,
allowQueries: Array.isArray(object?.allowQueries)
? object.allowQueries.map((e: any) => String(e))
: [],
};
},
toJSON(message: Params): unknown {
const obj: any = {};
message.hostEnabled !== undefined &&
(obj.hostEnabled = message.hostEnabled);
if (message.allowQueries) {
obj.allowQueries = message.allowQueries.map(e => e);
} else {
obj.allowQueries = [];
}
return obj;
},
fromPartial(object: Partial<Params>): Params {
const message = createBaseParams();
message.hostEnabled = object.hostEnabled ?? false;
message.allowQueries = object.allowQueries?.map(e => e) || [];
return message;
},
fromProtoMsg(message: ParamsProtoMsg): Params {
return Params.decode(message.value);
},
toProto(message: Params): Uint8Array {
return Params.encode(message).finish();
},
toProtoMsg(message: Params): ParamsProtoMsg {
return {
typeUrl: '/icq.v1.Params',
value: Params.encode(message).finish(),
};
},
};
Loading

0 comments on commit 98213dc

Please sign in to comment.