"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LCDQueryClient = void 0;
//@ts-nocheck
const helpers_1 = require("../../../../helpers");
class LCDQueryClient {
req;
constructor({ requestClient }) {
this.req = requestClient;
this.incentivizedPackets = this.incentivizedPackets.bind(this);
this.incentivizedPacket = this.incentivizedPacket.bind(this);
this.incentivizedPacketsForChannel = this.incentivizedPacketsForChannel.bind(this);
this.totalRecvFees = this.totalRecvFees.bind(this);
this.totalAckFees = this.totalAckFees.bind(this);
this.totalTimeoutFees = this.totalTimeoutFees.bind(this);
this.payee = this.payee.bind(this);
this.counterpartyPayee = this.counterpartyPayee.bind(this);
this.feeEnabledChannels = this.feeEnabledChannels.bind(this);
this.feeEnabledChannel = this.feeEnabledChannel.bind(this);
}
/* IncentivizedPackets returns all incentivized packets and their associated fees */
async incentivizedPackets(params) {
const options = {
params: {}
};
if (typeof params?.pagination !== "undefined") {
(0, helpers_1.setPaginationParams)(options, params.pagination);
}
if (typeof params?.queryHeight !== "undefined") {
options.params.query_height = params.queryHeight;
}
const endpoint = `ibc/apps/fee/v1/incentivized_packets`;
return await this.req.get(endpoint, options);
}
/* IncentivizedPacket returns all packet fees for a packet given its identifier */
async incentivizedPacket(params) {
const options = {
params: {}
};
if (typeof params?.packetId !== "undefined") {
options.params.packet_id = params.packetId;
}
if (typeof params?.queryHeight !== "undefined") {
options.params.query_height = params.queryHeight;
}
const endpoint = `ibc/apps/fee/v1/channels/${params.packetId.channel_id}/ports/${params.packetId.port_id}/sequences/${params.packetId.sequence}/incentivized_packet`;
return await this.req.get(endpoint, options);
}
/* Gets all incentivized packets for a specific channel */
async incentivizedPacketsForChannel(params) {
const options = {
params: {}
};
if (typeof params?.pagination !== "undefined") {
(0, helpers_1.setPaginationParams)(options, params.pagination);
}
if (typeof params?.queryHeight !== "undefined") {
options.params.query_height = params.queryHeight;
}
const endpoint = `ibc/apps/fee/v1/channels/${params.channelId}/ports/${params.portId}/incentivized_packets`;
return await this.req.get(endpoint, options);
}
/* TotalRecvFees returns the total receive fees for a packet given its identifier */
async totalRecvFees(params) {
const options = {
params: {}
};
if (typeof params?.packetId !== "undefined") {
options.params.packet_id = params.packetId;
}
const endpoint = `ibc/apps/fee/v1/channels/${params.packetId.channel_id}/ports/${params.packetId.port_id}/sequences/${params.packetId.sequence}/total_recv_fees`;
return await this.req.get(endpoint, options);
}
/* TotalAckFees returns the total acknowledgement fees for a packet given its identifier */
async totalAckFees(params) {
const options = {
params: {}
};
if (typeof params?.packetId !== "undefined") {
options.params.packet_id = params.packetId;
}
const endpoint = `ibc/apps/fee/v1/channels/${params.packetId.channel_id}/ports/${params.packetId.port_id}/sequences/${params.packetId.sequence}/total_ack_fees`;
return await this.req.get(endpoint, options);
}
/* TotalTimeoutFees returns the total timeout fees for a packet given its identifier */
async totalTimeoutFees(params) {
const options = {
params: {}
};
if (typeof params?.packetId !== "undefined") {
options.params.packet_id = params.packetId;
}
const endpoint = `ibc/apps/fee/v1/channels/${params.packetId.channel_id}/ports/${params.packetId.port_id}/sequences/${params.packetId.sequence}/total_timeout_fees`;
return await this.req.get(endpoint, options);
}
/* Payee returns the registered payee address for a specific channel given the relayer address */
async payee(params) {
const endpoint = `ibc/apps/fee/v1/channels/${params.channelId}/relayers/${params.relayer}/payee`;
return await this.req.get(endpoint);
}
/* CounterpartyPayee returns the registered counterparty payee for forward relaying */
async counterpartyPayee(params) {
const endpoint = `ibc/apps/fee/v1/channels/${params.channelId}/relayers/${params.relayer}/counterparty_payee`;
return await this.req.get(endpoint);
}
/* FeeEnabledChannels returns a list of all fee enabled channels */
async feeEnabledChannels(params) {
const options = {
params: {}
};
if (typeof params?.pagination !== "undefined") {
(0, helpers_1.setPaginationParams)(options, params.pagination);
}
if (typeof params?.queryHeight !== "undefined") {
options.params.query_height = params.queryHeight;
}
const endpoint = `ibc/apps/fee/v1/fee_enabled`;
return await this.req.get(endpoint, options);
}
/* FeeEnabledChannel returns true if the provided port and channel identifiers belong to a fee enabled channel */
async feeEnabledChannel(params) {
const endpoint = `ibc/apps/fee/v1/channels/${params.channelId}/ports/${params.portId}/fee_enabled`;
return await this.req.get(endpoint);
}
}
exports.LCDQueryClient = LCDQueryClient;