How do we use topics in events?

我们两清 提交于 2021-02-11 14:56:31

问题


I am trying to use deposit_event_indexed method when depositing an event with a specific topic so that I can use something like the polkadot.js' api.query.system.eventTopics to fetched indexed events.

However, I get the following error

63  | |  Self::deposit_event_indexed(&eventHashArray, RawEvent::TestIndexedEvent());
    | |        ^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `Module<T>`

I am also quite new to rust, so from my understanding, according to the doc, this method is part of the Module's trait. Please help!


回答1:


Assuming you are calling deposit_event_indexed from your custom pallet, you simply need to target the function which is located in the frame_system pallet.

frame_system::Module::<T>::deposit_event_indexed(...)

Unlike the more commonly used deposit_event feature, we do not automatically import this into your pallet, which is why you see this error.



来源:https://stackoverflow.com/questions/60720925/how-do-we-use-topics-in-events

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!