@bandprotocol/bandchain.js
Version:
TypeScript library for Cosmos SDK and BandChain
37 lines (36 loc) • 1.3 kB
JavaScript
export class LCDQueryClient {
req;
constructor({ requestClient }) {
this.req = requestClient;
this.proof = this.proof.bind(this);
this.multiProof = this.multiProof.bind(this);
this.requestCountProof = this.requestCountProof.bind(this);
}
/* Proof queries the proof for given request ID */
async proof(params) {
const options = {
params: {}
};
if (typeof params?.height !== "undefined") {
options.params.height = params.height;
}
const endpoint = `bandchain/v1/oracle/proof/${params.requestId}`;
return await this.req.get(endpoint, options);
}
/* MultiProof queries multiple proofs for given list of request IDs */
async multiProof(params) {
const options = {
params: {}
};
if (typeof params?.requestIds !== "undefined") {
options.params.request_ids = params.requestIds;
}
const endpoint = `bandchain/v1/oracle/multi_proof`;
return await this.req.get(endpoint, options);
}
/* RequestCountProof queries the count proof */
async requestCountProof(_params = {}) {
const endpoint = `bandchain/v1/oracle/requests_count_proof`;
return await this.req.get(endpoint);
}
}