cosmjs
cosmjs copied to clipboard
WS method addListener: formatted query string not working
When I hardcode the address, it works
const query = "tm.event='Tx' AND ethereum_tx.recipient='0xfaC60Ac942b8Ac6a2BC2470D81124C34e8719d88'";
const stream = this.tendermintWs.listen({
id: 0,
jsonrpc: '2.0',
method: 'subscribe',
params: { query }
});
stream.addListener({
next: data => this.onEventTendermintData(data),
error: err => console.error(err),
complete: () => console.log('completed'),
});
But not working if the address is formatted in query
const query = `tm.event='Tx' AND ethereum_tx.recipient='${address}'`;
Did you debug the content of query and address? The code looks correct.
Have you tried double quotes for const query = "tm.event='Tx' AND ethereum_tx.recipient='${address}'";