Hi,
Back when Moralis had servers, I had a project set up with syncs to log contract events to our mongoDB in a specific place. Now that weāre switched over to a self hosted parse server, I am trying to recreate what we once had.
This is in my index.ts:
app.use(
streamsSync(parseServer, {
apiKey: config.MORALIS_API_KEY,
webhookUrl: config.STREAMS_WEBHOOK_URL,
})
);
After I triggered an event āoptionCreatedā on the smart contract, I got one entry in each of the two tables:
- [MumbaiTestnetLogs]
_id
"rTyoUEbOJk"
name
"optionCreated"
logIndex
18
transactionHash
"0xfe9b6c22e1b2e0d80a3ee975aba91243d493b928a8ac358de4808659323a3aa9"
address
"0x0b30be28c6b359ad5e8804ae587b12b46403a7b0"
blockHash
"0xf5c6fe838edd8067dd1995b70f696767bd5a0d3ffe29e9b68eb38bc563b0551a"
blockTimestamp
1689216833
blockNumber
37871316
confirmed
true
chainId
80001
sender
"0xd896aea7e5865d2d12534702b3371e2c5ce5bc8b"
_created_at
2023-07-13T02:53:55.193+00:00
_updated_at
2023-07-13T02:58:11.123+00:00
- [MumbaiTestnetTxs]
_id
"QzKypUg3A4"
hash
"0xfe9b6c22e1b2e0d80a3ee975aba91243d493b928a8ac358de4808659323a3aa9"
chainId
80001
transactionIndex
7
gas
187840
gasPrice
1500000016
nonce
161
fromAddress
"0xd896aea7e5865d2d12534702b3371e2c5ce5bc8b"
toAddress
"0x0b30be28c6b359ad5e8804ae587b12b46403a7b0"
value
"0"
input
"0x15a921a000000000000000000000000000000000000000000000000000000000ee6bā¦"
type
2
receiptStatus
1
receiptGasUsed
187840
receiptCumulativeGasUsed
1705292
blockHash
"0xf5c6fe838edd8067dd1995b70f696767bd5a0d3ffe29e9b68eb38bc563b0551a"
blockTimestamp
1689216833
blockNumber
37871316
confirmed
true
_created_at
2023-07-13T02:53:55.218+00:00
_updated_at
2023-07-13T02:58:11.120+00:00
Hereās the abi for āoptionCreatedā:
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "_optionId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "_price",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint32",
"name": "_quantity",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint128",
"name": "_mintableDate",
"type": "uint128"
},
{
"indexed": false,
"internalType": "string",
"name": "_uri",
"type": "string"
}
],
"name": "optionCreated",
"type": "event"
},
However, there are two main issues: all of the data from the contract event is not there / subsequent transactions are not being logged. Every time i trigger an event now, I get this error in my backend
2023-07-13T03:35:04.165553+00:00 heroku[router]: at=info method=POST path="/streams-webhook" host=lp-backend.herokuapp.com request_id=1e74677a-ee82-4eea-ba84-eeb8144bc744 fwd="44.226.155.103" dyno=web.1 connect=0ms service=4ms status=500 bytes=298 protocol=https
2023-07-13T03:35:04.165427+00:00 app[web.1]: error while inserting logs no matching event (argument="topichash", value="0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", code=INVALID_ARGUMENT, version=abi/5.7.0)
Any advice would be greatly appreciated