klaytn/caver-js

Caver filters issue

Closed this issue · 1 comments

const fromBlock = caver.utils.toHex('85838460');
caver.rpc.klay.getLogs({
fromBlock: fromBlock,
toBlock: 'latest',
address:'0x87ac99835e67168d4f9a40580f8f5c33550ba88b'
}).then(console.log)
output: [ ]

Note: Always return empty Array however there are multiple transaction on given account within specified range.

Hi,

'getLogs' is for getting log events, not for retrieving normal transactions.

I tested to see whether caver.rpc.klay.getLogs works or not with the below code and saw a normal return value.
Please read documentation and check your parameters.
For topic, you can see this documentation.

    const deployed = await caver.kct.kip7.deploy({
        name: 'TestToken',
        symbol: 'TTK',
        decimals: 18,
        initialSupply: '100000000000000000000'
    }, keyring.address)
    const recepient = caver.wallet.keyring.generate().address
    const receipt = await deployed.transfer(recepient, 1, { from: keyring.address })
    console.log(receipt) // See the `events` part.

    const addr = deployed.options.address // Contract address
    const fromBlock = caver.utils.toHex(2260)
    const logs = await caver.rpc.klay.getLogs({
        fromBlock: fromBlock,
        address: addr,
    })
    console.log(logs)