Skip to content

Commit

Permalink
services
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed Oct 14, 2022
1 parent 75a15fe commit 2842408
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 42 deletions.
74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"protobufjs": "~6.11.2"
},
"devDependencies": {
"@osmonauts/telescope": "^0.67.1",
"@osmonauts/telescope": "^0.69.0",
"@types/long": "^4.0.1",
"@types/node": "^15.6.2",
"prettier": "^2.7.1",
Expand Down
9 changes: 8 additions & 1 deletion scripts/codegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ telescope({
enabled: true,
inline: true,
extensions: false,
camelCase: false
camelCase: false,
enabledServices: [
'Msg',
'Query',
'Service',
'ReflectionService',
'ABCIApplication'
]
},
aminoEncoding: {
enabled: false
Expand Down
46 changes: 45 additions & 1 deletion src/cosmos/base/reflection/v1beta1/reflection.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
import * as _m0 from "protobufjs/minimal";
import { isSet } from "../../../../helpers";
import { isSet, Rpc } from "../../../../helpers";
export const protobufPackage = "cosmos.base.reflection.v1beta1";
/** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */

Expand Down Expand Up @@ -254,3 +254,47 @@ export const ListImplementationsResponse = {
return message;
},
};
/** ReflectionService defines a service for interface reflection. */

export interface ReflectionService {
/**
* ListAllInterfaces lists all the interfaces registered in the interface
* registry.
*/
ListAllInterfaces(request?: ListAllInterfacesRequest): Promise<ListAllInterfacesResponse>;
/**
* ListImplementations list all the concrete types that implement a given
* interface.
*/

ListImplementations(request: ListImplementationsRequest): Promise<ListImplementationsResponse>;
}
export class ReflectionServiceClientImpl implements ReflectionService {
private readonly rpc: Rpc;

constructor(rpc: Rpc) {
this.rpc = rpc;
this.ListAllInterfaces = this.ListAllInterfaces.bind(this);
this.ListImplementations = this.ListImplementations.bind(this);
}

ListAllInterfaces(request: ListAllInterfacesRequest = {}): Promise<ListAllInterfacesResponse> {
const data = ListAllInterfacesRequest.encode(request).finish();
const promise = this.rpc.request(
"cosmos.base.reflection.v1beta1.ReflectionService",
"ListAllInterfaces",
data,
);
return promise.then((data) => ListAllInterfacesResponse.decode(new _m0.Reader(data)));
}

ListImplementations(request: ListImplementationsRequest): Promise<ListImplementationsResponse> {
const data = ListImplementationsRequest.encode(request).finish();
const promise = this.rpc.request(
"cosmos.base.reflection.v1beta1.ReflectionService",
"ListImplementations",
data,
);
return promise.then((data) => ListImplementationsResponse.decode(new _m0.Reader(data)));
}
}
4 changes: 2 additions & 2 deletions src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-disable */
/**
* This file and any referenced files were automatically generated by @osmonauts/telescope@0.67.1
* This file and any referenced files were automatically generated by @osmonauts/telescope@0.69.0
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or yarn proto command to regenerate this bundle.
*/

import * as _m0 from "protobufjs/minimal";
import * as Long from "long";
import Long from "long";

// @ts-ignore
if (_m0.util.Long !== Long) {
Expand Down
130 changes: 130 additions & 0 deletions src/tendermint/abci/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
bytesFromBase64,
fromTimestamp,
base64FromBytes,
Rpc,
} from "../../helpers";
export const protobufPackage = "tendermint.abci";
export enum CheckTxType {
Expand Down Expand Up @@ -4644,3 +4645,132 @@ export const Snapshot = {
return message;
},
};
export interface ABCIApplication {
Echo(request: RequestEcho): Promise<ResponseEcho>;
Flush(request?: RequestFlush): Promise<ResponseFlush>;
Info(request: RequestInfo): Promise<ResponseInfo>;
SetOption(request: RequestSetOption): Promise<ResponseSetOption>;
DeliverTx(request: RequestDeliverTx): Promise<ResponseDeliverTx>;
CheckTx(request: RequestCheckTx): Promise<ResponseCheckTx>;
Query(request: RequestQuery): Promise<ResponseQuery>;
Commit(request?: RequestCommit): Promise<ResponseCommit>;
InitChain(request: RequestInitChain): Promise<ResponseInitChain>;
BeginBlock(request: RequestBeginBlock): Promise<ResponseBeginBlock>;
EndBlock(request: RequestEndBlock): Promise<ResponseEndBlock>;
ListSnapshots(request?: RequestListSnapshots): Promise<ResponseListSnapshots>;
OfferSnapshot(request: RequestOfferSnapshot): Promise<ResponseOfferSnapshot>;
LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise<ResponseLoadSnapshotChunk>;
ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise<ResponseApplySnapshotChunk>;
}
export class ABCIApplicationClientImpl implements ABCIApplication {
private readonly rpc: Rpc;

constructor(rpc: Rpc) {
this.rpc = rpc;
this.Echo = this.Echo.bind(this);
this.Flush = this.Flush.bind(this);
this.Info = this.Info.bind(this);
this.SetOption = this.SetOption.bind(this);
this.DeliverTx = this.DeliverTx.bind(this);
this.CheckTx = this.CheckTx.bind(this);
this.Query = this.Query.bind(this);
this.Commit = this.Commit.bind(this);
this.InitChain = this.InitChain.bind(this);
this.BeginBlock = this.BeginBlock.bind(this);
this.EndBlock = this.EndBlock.bind(this);
this.ListSnapshots = this.ListSnapshots.bind(this);
this.OfferSnapshot = this.OfferSnapshot.bind(this);
this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this);
this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this);
}

Echo(request: RequestEcho): Promise<ResponseEcho> {
const data = RequestEcho.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Echo", data);
return promise.then((data) => ResponseEcho.decode(new _m0.Reader(data)));
}

Flush(request: RequestFlush = {}): Promise<ResponseFlush> {
const data = RequestFlush.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Flush", data);
return promise.then((data) => ResponseFlush.decode(new _m0.Reader(data)));
}

Info(request: RequestInfo): Promise<ResponseInfo> {
const data = RequestInfo.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Info", data);
return promise.then((data) => ResponseInfo.decode(new _m0.Reader(data)));
}

SetOption(request: RequestSetOption): Promise<ResponseSetOption> {
const data = RequestSetOption.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "SetOption", data);
return promise.then((data) => ResponseSetOption.decode(new _m0.Reader(data)));
}

DeliverTx(request: RequestDeliverTx): Promise<ResponseDeliverTx> {
const data = RequestDeliverTx.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "DeliverTx", data);
return promise.then((data) => ResponseDeliverTx.decode(new _m0.Reader(data)));
}

CheckTx(request: RequestCheckTx): Promise<ResponseCheckTx> {
const data = RequestCheckTx.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "CheckTx", data);
return promise.then((data) => ResponseCheckTx.decode(new _m0.Reader(data)));
}

Query(request: RequestQuery): Promise<ResponseQuery> {
const data = RequestQuery.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Query", data);
return promise.then((data) => ResponseQuery.decode(new _m0.Reader(data)));
}

Commit(request: RequestCommit = {}): Promise<ResponseCommit> {
const data = RequestCommit.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Commit", data);
return promise.then((data) => ResponseCommit.decode(new _m0.Reader(data)));
}

InitChain(request: RequestInitChain): Promise<ResponseInitChain> {
const data = RequestInitChain.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "InitChain", data);
return promise.then((data) => ResponseInitChain.decode(new _m0.Reader(data)));
}

BeginBlock(request: RequestBeginBlock): Promise<ResponseBeginBlock> {
const data = RequestBeginBlock.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "BeginBlock", data);
return promise.then((data) => ResponseBeginBlock.decode(new _m0.Reader(data)));
}

EndBlock(request: RequestEndBlock): Promise<ResponseEndBlock> {
const data = RequestEndBlock.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "EndBlock", data);
return promise.then((data) => ResponseEndBlock.decode(new _m0.Reader(data)));
}

ListSnapshots(request: RequestListSnapshots = {}): Promise<ResponseListSnapshots> {
const data = RequestListSnapshots.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "ListSnapshots", data);
return promise.then((data) => ResponseListSnapshots.decode(new _m0.Reader(data)));
}

OfferSnapshot(request: RequestOfferSnapshot): Promise<ResponseOfferSnapshot> {
const data = RequestOfferSnapshot.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "OfferSnapshot", data);
return promise.then((data) => ResponseOfferSnapshot.decode(new _m0.Reader(data)));
}

LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise<ResponseLoadSnapshotChunk> {
const data = RequestLoadSnapshotChunk.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "LoadSnapshotChunk", data);
return promise.then((data) => ResponseLoadSnapshotChunk.decode(new _m0.Reader(data)));
}

ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise<ResponseApplySnapshotChunk> {
const data = RequestApplySnapshotChunk.encode(request).finish();
const promise = this.rpc.request("tendermint.abci.ABCIApplication", "ApplySnapshotChunk", data);
return promise.then((data) => ResponseApplySnapshotChunk.decode(new _m0.Reader(data)));
}
}

0 comments on commit 2842408

Please sign in to comment.