@cryptokid Please help me. This is an error

@cryptokid
MoralisError [Moralis SDK Core Error]: [C0006] Request failed, Bad Request(400): allAddresses cant be enabled on the same topic in multiple streams.

I want to create each stream for each user.
This is my code.

const ERC20_transfer_ABI = [

  {

    anonymous: false,

    inputs: [

      { indexed: true, name: "from", type: "address" },

      { indexed: true, name: "to", type: "address" },

      { indexed: false, name: "value", type: "uint256" },

    ],

    name: "Transfer",

    type: "event",

  },

]; // valid abi of the event

const filter_ERC20 = {

  eq: ["to", publickey.toLowerCase()],

};

const chains = production

  ? [EvmChain.ETHEREUM, EvmChain.BSC, EvmChain.POLYGON]

  : [EvmChain.GOERLI, EvmChain.BSC_TESTNET, EvmChain.MUMBAI];

const options = {

  chains: chains, // list of blockchains to monitor

  description: `monitor all ERC20 transfers for openbank wallet`, // your description

  tag: "ERC20_transfers", // give it a tag

  abi: ERC20_transfer_ABI,

  includeContractLogs: true,

  topic0: ["Transfer(address,address,uint256)"], // topic of the event

  advancedOptions: {

    topic0: "Transfer(address,address,uint256)",

    filter: filter_ERC20,

  },

  webhookUrl: webhookUrl, // webhook url to receive events,

  includeNativeTxs: true,

};

await Moralis.Streams.add(options);

please help me If someone have solution

You can not create two streams with all addresses setting set on and the same topic0. That is what you want to do?

yes that’s right.
then how can I implement this functionality

Can you do that only with one stream?

how can I do that?
I want to get all erc20 transactions to several addresses.

Listen to all addresses works with any address.

For a stream you can add a list of addresses, tens of thousands of addresses can be added to the same stream easily.

I don’t know which address send erc20 token to several addresses.
so how can I add?

Can you give more info about your use case?
What is that you want to achieve?

so now I am working on custodial wallet.
so I have user’s wallet.
If users deposit crypto to user’s wallet from metamask, I don’t know on my side.
and then I don’t know which metamask address will be used.
so I want to get all transactions from all addresses to our several wallet address.

That should be easy, you create a stream where you add the custodial addresses and that should be all.

really?
If this users send crypto from one address which is not added to moralis to adding account, that transaction will attach to my webhook api?

Yes, if you added the custodial address to the list of addresses on a stream then any transaction to that address will be matched and a webhook request will be sent to you

You don’t need to use listen to all addresses functionality either. You only have to add your custodial addresses to a stream.

OK I see.
I will try and then If any questions, leave message here
Thanks for your help.

2 Likes