Use getLogsByAddress

Hello.

Is it possible to use array of topics? How I can do it?

For example I have this code:

const options = {
	address: sSwapFactoryContractAddress,
	chain: 'bsc',
	topic0: sPairCreatedAddress,
	topic1: ethers.utils.hexZeroPad(sWBNB, 32),
	topic2: ethers.utils.hexZeroPad(sTokenContractAddress, 32)
};
const oLogs = await Moralis.Web3API.native.getLogsByAddress(options);

and it’s work fine. But I need check for another pairs like BUSD / USDT. So it will be nice to use code like:

const options = {
	address: sSwapFactoryContractAddress,
	chain: 'bsc',
	topic0: sPairCreatedAddress,
	topic1: [ethers.utils.hexZeroPad(sWBNB, 32), ethers.utils.hexZeroPad(sBUSD, 32), ethers.utils.hexZeroPad(sUSDT, 32)],
	topic2: ethers.utils.hexZeroPad(sTokenContractAddress, 32)
};
const oLogs = await Moralis.Web3API.native.getLogsByAddress(options);

instead of:

const options = {
	address: sSwapFactoryContractAddress,
	chain: 'bsc',
	topic0: sPairCreatedAddress,
	topic1: ethers.utils.hexZeroPad(sWBNB, 32),
	topic2: ethers.utils.hexZeroPad(sTokenContractAddress, 32)
};
const oLogs = await Moralis.Web3API.native.getLogsByAddress(options);

const options = {
	address: sSwapFactoryContractAddress,
	chain: 'bsc',
	topic0: sPairCreatedAddress,
	topic1: ethers.utils.hexZeroPad(sBUSD, 32),
	topic2: ethers.utils.hexZeroPad(sTokenContractAddress, 32)
};
const oLogs = await Moralis.Web3API.native.getLogsByAddress(options);

const options = {
	address: sSwapFactoryContractAddress,
	chain: 'bsc',
	topic0: sPairCreatedAddress,
	topic1: ethers.utils.hexZeroPad(sUSDT, 32),
	topic2: ethers.utils.hexZeroPad(sTokenContractAddress, 32)
};
const oLogs = await Moralis.Web3API.native.getLogsByAddress(options);

Thanks.

cryptokid?

Most of the api functions don’t support an array as parameter. You can propose this particular case on roadmap.moralis.io

1 Like

It’s a pity.

Сan I leave the request here: https://roadmap.moralis.io/b/feature-requests/?

Thanks.

It looks like the right place there

1 Like

Already ) Waiting for moderation.