import { BinaryReader } from '@agoric/cosmic-proto/codegen/binary.js';
import { QueryClient, createProtobufRpcClient } from '@cosmjs/stargate';
import { QueryGetCountRequest, QueryGetCountResponse, } from '@agoric/cosmic-proto/codegen/cosmos/counter/v1/query.js';
export class QueryClientImpl {
    rpc;
    constructor(rpc) {
        this.rpc = rpc;
        this.getCount = this.getCount.bind(this);
    }
    getCount(request = {}) {
        const data = QueryGetCountRequest.encode(request).finish();
        const promise = this.rpc.request('cosmos.counter.v1.Query', 'GetCount', data);
        return promise.then(data => QueryGetCountResponse.decode(new BinaryReader(data)));
    }
}
export const createRpcQueryExtension = (base) => {
    const rpc = createProtobufRpcClient(base);
    const queryService = new QueryClientImpl(rpc);
    return {
        getCount(request) {
            return queryService.getCount(request);
        },
    };
};
//# sourceMappingURL=query.rpc.Query.js.map