sui
sui copied to clipboard
RPC / SDK don't normalize module address when getting events by event struct name
When calling the sui_getEvents method on the rpc with MoveEvent and the address of the event struct's module starts with a 0 (e.g. 0x050b4...), the rpc call will fail to find the events.
E.g. calling the rpc as below will fail to find the events:
{"method":"sui_getEvents","jsonrpc":"2.0","params":[{"MoveEvent":"0x050b4c3a3080d617726c3193d6bc1f25f5df0075::amm::PoolCreationEvent"},null,null,t
rue],"id":"61484e79-2f8c-49de-a2e5-66423381a2df"}
While the following will work (notice that the MoveEvent value now starts with 0x50b... instead of 0x050b...):
{"method":"sui_getEvents","jsonrpc":"2.0","params":[{"MoveEvent":"0x50b4c3a3080d617726c3193d6bc1f25f5df0075::amm::PoolCreationEvent"},null,null,t
rue],"id":"61484e79-2f8c-49de-a2e5-66423381a2df"}
This is also true when doing the call from the sui.js SDK client (it doesn't do the normalization so passing in 0x050b... as the param to getEvents call will fail).
System Information
devnet 0.15.2
mysten/sui.js 0.16.0