UNPKG

@bandprotocol/bandchain.js

Version:

TypeScript library for Cosmos SDK and BandChain

59 lines (58 loc) 2.14 kB
//@ts-nocheck import { setPaginationParams } from "../../../helpers"; export class LCDQueryClient { req; constructor({ requestClient }) { this.req = requestClient; this.vaults = this.vaults.bind(this); this.vault = this.vault.bind(this); this.locks = this.locks.bind(this); this.lock = this.lock.bind(this); this.stake = this.stake.bind(this); this.params = this.params.bind(this); } /* Vaults returns a list of vault. */ async vaults(params = { pagination: undefined }) { const options = { params: {} }; if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `restake/v1beta1/vaults`; return await this.req.get(endpoint, options); } /* Vault returns a vault information. */ async vault(params) { const endpoint = `restake/v1beta1/vaults/${params.key}`; return await this.req.get(endpoint); } /* Locks returns all lock information for a specified address. */ async locks(params) { const options = { params: {} }; if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `restake/v1beta1/stakers/${params.stakerAddress}/locks`; return await this.req.get(endpoint, options); } /* Lock returns a lock information for a specified address and a vault. */ async lock(params) { const endpoint = `restake/v1beta1/stakers/${params.stakerAddress}/locks/${params.key}`; return await this.req.get(endpoint); } /* Stake returns stake information for a specific address. */ async stake(params) { const endpoint = `restake/v1beta1/stakers/${params.stakerAddress}/stake`; return await this.req.get(endpoint); } /* Params returns all parameters of the module. */ async params(_params = {}) { const endpoint = `restake/v1beta1/params`; return await this.req.get(endpoint); } }