Add comment on multi request implementation

This commit is contained in:
Simon Warta
2020-02-12 14:14:49 +01:00
parent f27b278014
commit 007b4dd362
+2 -1
View File
@@ -168,9 +168,10 @@ export class CosmWasmClient {
} else if (isSearchByHeightQuery(query)) {
return (await this.restClient.txs(`tx.height=${query.height}`)).txs;
} else if (isSearchBySentFromOrToQuery(query)) {
// We cannot get both in one request (see https://github.com/cosmos/gaia/issues/75)
const sent = (await this.restClient.txs(limited(`message.sender=${query.sentFromOrTo}`))).txs;
const sentHashes = sent.map(t => t.txhash);
const received = (await this.restClient.txs(limited(`transfer.recipient=${query.sentFromOrTo}`))).txs;
const sentHashes = sent.map(t => t.txhash);
return [...sent, ...received.filter(t => !sentHashes.includes(t.txhash))];
} else {
throw new Error("Unknown query type");