-
Notifications
You must be signed in to change notification settings - Fork 340
Open
Labels
Description
Describe the bug
Event topic could be undefined, which is not considered in the code:
ERROR TypeError: Cannot read properties of undefined (reading 'map')
at /app/node_modules/.pnpm/@[email protected]/node_modules/@stellar/stellar-sdk/lib/rpc/parsers.js:95:26
at Array.map (<anonymous>)
at parseRawEvents (/app/node_modules/.pnpm/@[email protected]/node_modules/@stellar/stellar-sdk/lib/rpc/parsers.js:89:99)
What version are you on?
14.3.0
To Reproduce
execute parseRawEvents for block 1263568 on testnet
Expected behavior
topic is considered to possibly be undefined: (evt.topic ?? []).map instead of topic.map
Additional context
The event causing problem:
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 8675309,
"method": "getEvents",
"params": {
"startLedger": 1263568,
"endLedger": 1263569,
"pagination": {
"limit": 20
}
}
}' \
https://soroban-rpc.testnet.stellar.gateway.fm | jq
{
"jsonrpc": "2.0",
"id": 8675309,
"result": {
"events": [
...,
{
"type": "contract",
"ledger": 1263568,
"ledgerClosedAt": "2025-10-26T22:19:10Z",
"contractId": "CC5E2AZW4DRFDYZHI7M25QKCSMFPUD7C3425BUOW54RU3TQRKUPA64W5",
"id": "0005426983236280320-0000000000",
"operationIndex": 0,
"transactionIndex": 2,
"txHash": "8735d2c7e31b1f10037f41d723072fbfacd0bbf74ed48f71f8e4211132017123",
"inSuccessfulContractCall": true,
"value": "AAAAEAAAAAEAAAACAAAAEgAAAAAAAAAA6l77q0ZD1wnLxQyCbBiGOcbm8+2jMoki9jMGwk+zZ+0AAAAJAAAAAAAAAAAAAAkYTnKgAA=="
},
...,
],
"cursor": "0005426987531239423-4294967295",
"latestLedger": 1291637,
"oldestLedger": 1170678,
"latestLedgerCloseTime": "1761657666",
"oldestLedgerCloseTime": "1761052138"
}
}