UNPKG

@bandprotocol/bandchain.js

Version:

TypeScript library for Cosmos SDK and BandChain

82 lines (81 loc) 3.29 kB
"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.tunnels = this.tunnels.bind(this); this.tunnel = this.tunnel.bind(this); this.deposits = this.deposits.bind(this); this.deposit = this.deposit.bind(this); this.packets = this.packets.bind(this); this.packet = this.packet.bind(this); this.totalFees = this.totalFees.bind(this); this.params = this.params.bind(this); } /* Tunnels is a RPC method that returns all tunnels. */ async tunnels(params) { const options = { params: {} }; if (typeof params?.statusFilter !== "undefined") { options.params.status_filter = params.statusFilter; } if (typeof params?.pagination !== "undefined") { (0, helpers_1.setPaginationParams)(options, params.pagination); } const endpoint = `tunnel/v1beta1/tunnels`; return await this.req.get(endpoint, options); } /* Tunnel is a RPC method that returns a tunnel by its ID. */ async tunnel(params) { const endpoint = `tunnel/v1beta1/tunnels/${params.tunnelId}`; return await this.req.get(endpoint); } /* Deposits queries all deposits of a single tunnel. */ async deposits(params) { const options = { params: {} }; if (typeof params?.pagination !== "undefined") { (0, helpers_1.setPaginationParams)(options, params.pagination); } const endpoint = `tunnel/v1beta1/tunnels/${params.tunnelId}/deposits`; return await this.req.get(endpoint, options); } /* Deposit queries single deposit information based tunnelID, depositAddr. */ async deposit(params) { const endpoint = `tunnel/v1beta1/tunnels/${params.tunnelId}/deposits/${params.depositor}`; return await this.req.get(endpoint); } /* Packets is a RPC method that returns all packets of a tunnel. */ async packets(params) { const options = { params: {} }; if (typeof params?.pagination !== "undefined") { (0, helpers_1.setPaginationParams)(options, params.pagination); } const endpoint = `tunnel/v1beta1/tunnels/${params.tunnelId}/packets`; return await this.req.get(endpoint, options); } /* Packet is a RPC method that returns a packet by its tunnel ID and sequence. */ async packet(params) { const endpoint = `tunnel/v1beta1/tunnels/${params.tunnelId}/packets/${params.sequence}`; return await this.req.get(endpoint); } /* TotalFees is a RPC method that returns the total fees collected by the tunnel */ async totalFees(_params = {}) { const endpoint = `tunnel/v1beta1/total_fees`; return await this.req.get(endpoint); } /* Params is a RPC method that returns all parameters of the module. */ async params(_params = {}) { const endpoint = `tunnel/v1beta1/params`; return await this.req.get(endpoint); } } exports.LCDQueryClient = LCDQueryClient;