import { BinaryReader } from '@agoric/cosmic-proto/codegen/binary.js';
import { QueryClient, createProtobufRpcClient } from '@cosmjs/stargate';
import { QueryCommunityPoolRequest, QueryCommunityPoolResponse, QueryContinuousFundRequest, QueryContinuousFundResponse, QueryContinuousFundsRequest, QueryContinuousFundsResponse, QueryParamsRequest, QueryParamsResponse, } from '@agoric/cosmic-proto/codegen/cosmos/protocolpool/v1/query.js';
export class QueryClientImpl {
    rpc;
    constructor(rpc) {
        this.rpc = rpc;
        this.communityPool = this.communityPool.bind(this);
        this.continuousFund = this.continuousFund.bind(this);
        this.continuousFunds = this.continuousFunds.bind(this);
        this.params = this.params.bind(this);
    }
    communityPool(request = {}) {
        const data = QueryCommunityPoolRequest.encode(request).finish();
        const promise = this.rpc.request('cosmos.protocolpool.v1.Query', 'CommunityPool', data);
        return promise.then(data => QueryCommunityPoolResponse.decode(new BinaryReader(data)));
    }
    continuousFund(request) {
        const data = QueryContinuousFundRequest.encode(request).finish();
        const promise = this.rpc.request('cosmos.protocolpool.v1.Query', 'ContinuousFund', data);
        return promise.then(data => QueryContinuousFundResponse.decode(new BinaryReader(data)));
    }
    continuousFunds(request = {}) {
        const data = QueryContinuousFundsRequest.encode(request).finish();
        const promise = this.rpc.request('cosmos.protocolpool.v1.Query', 'ContinuousFunds', data);
        return promise.then(data => QueryContinuousFundsResponse.decode(new BinaryReader(data)));
    }
    params(request = {}) {
        const data = QueryParamsRequest.encode(request).finish();
        const promise = this.rpc.request('cosmos.protocolpool.v1.Query', 'Params', data);
        return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data)));
    }
}
export const createRpcQueryExtension = (base) => {
    const rpc = createProtobufRpcClient(base);
    const queryService = new QueryClientImpl(rpc);
    return {
        communityPool(request) {
            return queryService.communityPool(request);
        },
        continuousFund(request) {
            return queryService.continuousFund(request);
        },
        continuousFunds(request) {
            return queryService.continuousFunds(request);
        },
        params(request) {
            return queryService.params(request);
        },
    };
};
//# sourceMappingURL=query.rpc.Query.js.map