Hello,
I am with a problem. I am following this page with the tutorial to parse smart contract events that I receive in the webhooks. I am getting the following exception
MoralisError [Moralis Stream Error]: [S0001] Cannot decode the logs. No logs found in the webhook, or invalid webhook provided.
at parseLog (/home/rute/Documents/projects/parse-server-migration/node_modules/@moralisweb3/streams/lib/methods/logParser.js:13:15)
at MoralisStreams._this.parsedLogs (/home/rute/Documents/projects/parse-server-migration/node_modules/@moralisweb3/streams/lib/MoralisStreams.js:56:81)
at /home/rute/Documents/projects/parse-server-migration/build/index.js:36:71
at Layer.handle [as handle_request] (/home/rute/Documents/projects/parse-server-migration/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/rute/Documents/projects/parse-server-migration/node_modules/express/lib/router/index.js:328:13)
at /home/rute/Documents/projects/parse-server-migration/node_modules/express/lib/router/index.js:286:9
at Function.process_params (/home/rute/Documents/projects/parse-server-migration/node_modules/express/lib/router/index.js:346:12)
at next (/home/rute/Documents/projects/parse-server-migration/node_modules/express/lib/router/index.js:280:10)
at cors (/home/rute/Documents/projects/parse-server-migration/node_modules/cors/lib/index.js:188:7)
at /home/rute/Documents/projects/parse-server-migration/node_modules/cors/lib/index.js:224:17 {
isMoralisError: true,
code: 'S0001',
details: undefined
}
My code looks like this:
export default interface MarketplaceItem {
id:BigNumber;
tokenId:BigNumber;
tokenAddress:string;
askingPrice:BigNumber;
sellerAddress:string;
}
const webhookData: any = req.body;
console.log(webhookData);
const marketplaceItem: MarketplaceItem[] = Moralis.Streams.parsedLogs<MarketplaceItem>(webhookData);
and the solidity event looks like this:
event itemAdded(uint256 id, uint256 tokenId, address tokenAddress, uint256 askingPrice, address sellerAddress);
And the object looks like this:
{"confirmed":true,"chainId":"0x13881","abi":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"askingPrice","type":"uint256"},{"indexed":false,"internalType":"address","name":"sellerAddress","type":"address"}],"name":"itemAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"itemRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"askingPrice","type":"uint256"}],"name":"itemSold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"askingPrice","type":"uint256"}],"name":"updatedAskingPrice","type":"event"}],"streamId":"84a07e19-e2f0-4be8-a549-d2ea06447215","tag":"NewItemMarketplace","retries":0,"block":{"number":"30429799","hash":"0x0243585c2f4e846f54445ea56470e9755f9d64cdd83893bfff3bb93f7f5a7dc7","timestamp":"1672610364"},"logs":[{"logIndex":"16","transactionHash":"0xee4c241e5c61aedc10e8d9812e3fdcde0720f3536b553cf192e4d5ea4fdf68ab","address":"0xcd116c9c037f0c3e270fe2d7eff0c7549a45aa91","data":"0x000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000150000000000000000000000009f8ab1677e8461e0b91b653a37bea3bc8933f614000000000000000000000000000000000000000000000000000009184e72a000000000000000000000000000229b4dbbac15f306651c55aa61305612a4fc789b","topic0":"0x42982e457d0a397b075db754e4e099e3a77a371779574db03bc33b78173c7ff4","topic1":null,"topic2":null,"topic3":null}],"txs":[],"txsInternal":[],"erc20Transfers":[],"erc20Approvals":[],"nftTokenApprovals":[],"nftApprovals":{"ERC721":[],"ERC1155":[]},"nftTransfers":[],"nativeBalances":[]}
What can be the problem?
Thanks and Happy New Year,
Pedro