import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@osmonauts/lcd"; import { QueryAccountRequest, AccountResponseSDKType, QueryAccountsRequest, AccountsResponseSDKType, QueryDisabledListRequest, DisabledListResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ requestClient }: { requestClient: LCDClient; }) { this.req = requestClient; this.account = this.account.bind(this); this.accounts = this.accounts.bind(this); this.disabledList = this.disabledList.bind(this); } /* Account returns account permissions. */ async account(params: QueryAccountRequest): Promise { const endpoint = `cosmos/circuit/v1/accounts/${params.address}`; return await this.req.get(endpoint); } /* Account returns account permissions. */ async accounts(params: QueryAccountsRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `cosmos/circuit/v1/accounts`; return await this.req.get(endpoint, options); } /* DisabledList returns a list of disabled message urls */ async disabledList(_params: QueryDisabledListRequest = {}): Promise { const endpoint = `cosmos/circuit/v1/disable_list`; return await this.req.get(endpoint); } }