How to query module event using ts-sdk? #6
-
I looked at ts sdk code and it's calling indexer endpoint to get events, so I went to indexer's hasura, and tried this query query MyQuery {
events(offset: 10, limit: 10, where: {type: {_eq: ""}}) {
type
account_address
creation_number
data
indexed_type
sequence_number
transaction_block_height
event_index
transaction_version
}
} Result looks like this, this is a pyth update price oracle event. But i can't tell if this is a module event or not from the response. Then I looked into pyth contract, and I think pyth still use event-handle event. [
{
"type": "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387::event::PriceFeedUpdate",
"account_address": "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387",
"creation_number": 2,
"indexed_type": "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387::event::PriceFeedUpdate",
"sequence_number": 93035016,
"transaction_block_height": 112163800,
"event_index": 0,
"transaction_version": 325874498
},
] So how can we query module event from indexer (then I can update ts sdk if needed)? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
A couple of things:
|
Beta Was this translation helpful? Give feedback.
-
Added an API to get module event in ts-sdk aptos-labs/aptos-ts-sdk#304 |
Beta Was this translation helpful? Give feedback.
A couple of things:
indexed_type
instead of type. Type field isn't indexed so it'll be less performant.