cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

WS method addListener: formatted query string not working

Open Microsxema opened this issue 3 years ago • 2 comments

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}'`;

Microsxema avatar Mar 11 '22 04:03 Microsxema

Did you debug the content of query and address? The code looks correct.

webmaster128 avatar Mar 14 '22 20:03 webmaster128

Have you tried double quotes for const query = "tm.event='Tx' AND ethereum_tx.recipient='${address}'";

SameerFulzele avatar May 30 '22 20:05 SameerFulzele