import { BinaryReader } from '@agoric/cosmic-proto/codegen/binary.js';
import { QueryClient, createProtobufRpcClient } from '@cosmjs/stargate';
import { QueryNextSequenceSendRequest, QueryNextSequenceSendResponse, QueryPacketCommitmentRequest, QueryPacketCommitmentResponse, QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponse, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponse, QueryPacketReceiptRequest, QueryPacketReceiptResponse, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponse, QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponse, } from '@agoric/cosmic-proto/codegen/ibc/core/channel/v2/query.js';
export class QueryClientImpl {
    rpc;
    constructor(rpc) {
        this.rpc = rpc;
        this.nextSequenceSend = this.nextSequenceSend.bind(this);
        this.packetCommitment = this.packetCommitment.bind(this);
        this.packetCommitments = this.packetCommitments.bind(this);
        this.packetAcknowledgement = this.packetAcknowledgement.bind(this);
        this.packetAcknowledgements = this.packetAcknowledgements.bind(this);
        this.packetReceipt = this.packetReceipt.bind(this);
        this.unreceivedPackets = this.unreceivedPackets.bind(this);
        this.unreceivedAcks = this.unreceivedAcks.bind(this);
    }
    nextSequenceSend(request) {
        const data = QueryNextSequenceSendRequest.encode(request).finish();
        const promise = this.rpc.request('ibc.core.channel.v2.Query', 'NextSequenceSend', data);
        return promise.then(data => QueryNextSequenceSendResponse.decode(new BinaryReader(data)));
    }
    packetCommitment(request) {
        const data = QueryPacketCommitmentRequest.encode(request).finish();
        const promise = this.rpc.request('ibc.core.channel.v2.Query', 'PacketCommitment', data);
        return promise.then(data => QueryPacketCommitmentResponse.decode(new BinaryReader(data)));
    }
    packetCommitments(request) {
        const data = QueryPacketCommitmentsRequest.encode(request).finish();
        const promise = this.rpc.request('ibc.core.channel.v2.Query', 'PacketCommitments', data);
        return promise.then(data => QueryPacketCommitmentsResponse.decode(new BinaryReader(data)));
    }
    packetAcknowledgement(request) {
        const data = QueryPacketAcknowledgementRequest.encode(request).finish();
        const promise = this.rpc.request('ibc.core.channel.v2.Query', 'PacketAcknowledgement', data);
        return promise.then(data => QueryPacketAcknowledgementResponse.decode(new BinaryReader(data)));
    }
    packetAcknowledgements(request) {
        const data = QueryPacketAcknowledgementsRequest.encode(request).finish();
        const promise = this.rpc.request('ibc.core.channel.v2.Query', 'PacketAcknowledgements', data);
        return promise.then(data => QueryPacketAcknowledgementsResponse.decode(new BinaryReader(data)));
    }
    packetReceipt(request) {
        const data = QueryPacketReceiptRequest.encode(request).finish();
        const promise = this.rpc.request('ibc.core.channel.v2.Query', 'PacketReceipt', data);
        return promise.then(data => QueryPacketReceiptResponse.decode(new BinaryReader(data)));
    }
    unreceivedPackets(request) {
        const data = QueryUnreceivedPacketsRequest.encode(request).finish();
        const promise = this.rpc.request('ibc.core.channel.v2.Query', 'UnreceivedPackets', data);
        return promise.then(data => QueryUnreceivedPacketsResponse.decode(new BinaryReader(data)));
    }
    unreceivedAcks(request) {
        const data = QueryUnreceivedAcksRequest.encode(request).finish();
        const promise = this.rpc.request('ibc.core.channel.v2.Query', 'UnreceivedAcks', data);
        return promise.then(data => QueryUnreceivedAcksResponse.decode(new BinaryReader(data)));
    }
}
export const createRpcQueryExtension = (base) => {
    const rpc = createProtobufRpcClient(base);
    const queryService = new QueryClientImpl(rpc);
    return {
        nextSequenceSend(request) {
            return queryService.nextSequenceSend(request);
        },
        packetCommitment(request) {
            return queryService.packetCommitment(request);
        },
        packetCommitments(request) {
            return queryService.packetCommitments(request);
        },
        packetAcknowledgement(request) {
            return queryService.packetAcknowledgement(request);
        },
        packetAcknowledgements(request) {
            return queryService.packetAcknowledgements(request);
        },
        packetReceipt(request) {
            return queryService.packetReceipt(request);
        },
        unreceivedPackets(request) {
            return queryService.unreceivedPackets(request);
        },
        unreceivedAcks(request) {
            return queryService.unreceivedAcks(request);
        },
    };
};
//# sourceMappingURL=query.rpc.Query.js.map