add reverse

This commit is contained in:
liangping 2023-06-21 09:47:38 +08:00
parent 965bb883f5
commit a8c1bb7939

View File

@ -252,16 +252,18 @@ export class CosmosRestClient extends BaseRestClient<RequestRegistry> {
return this.request(this.registry.base_tendermint_validatorsets_latest, {}, query); return this.request(this.registry.base_tendermint_validatorsets_latest, {}, query);
} }
// tx // tx
async getTxsBySender(sender: string) { async getTxsBySender(sender: string, page?: PageRequest) {
const query = `?pagination.reverse=true&events=message.sender='${sender}'`; if(!page) page = new PageRequest()
const query = `?order_by=ORDER_BY_DESC&events=message.sender='${sender}'`;
return this.request(this.registry.tx_txs, {}, query); return this.request(this.registry.tx_txs, {}, query);
} }
// query ibc sending msgs // query ibc sending msgs
// ?&pagination.reverse=true&events=send_packet.packet_src_channel='${channel}'&events=send_packet.packet_src_port='${port}' // ?&pagination.reverse=true&events=send_packet.packet_src_channel='${channel}'&events=send_packet.packet_src_port='${port}'
// query ibc receiving msgs // query ibc receiving msgs
// ?&pagination.reverse=true&events=recv_packet.packet_dst_channel='${channel}'&events=recv_packet.packet_dst_port='${port}' // ?&pagination.reverse=true&events=recv_packet.packet_dst_channel='${channel}'&events=recv_packet.packet_dst_port='${port}'
async getTxs(query: string, params: any) { async getTxs(query: string, params: any, page?: PageRequest) {
return this.request(this.registry.tx_txs, params, query); if(!page) page = new PageRequest()
return this.request(this.registry.tx_txs, params, `${query}&${page.toQueryString()}`);
} }
async getTxsAt(height: string | number) { async getTxsAt(height: string | number) {
return this.request(this.registry.tx_txs_block, { height }); return this.request(this.registry.tx_txs_block, { height });