帖子
分享您的知识。
1 Luca29
Jan 11, 2025
专家问答
How to query Swap_Event without specifying phantom types?
I'm trying to query all Swap_Event instances without specifying phantom types for the struct like Swap_Event<phantom Ty0, phantom Ty1>
. What are some alternative methods to achieve this? Also, if I upgrade the contract, how does it affect my queries? Additionally, is there a rate limit on public GraphQL queries?
- Move CLI
- Move
3
3
分享
评论
答案
3farshad122
Jan 11 2025, 10:18MoveEventModule
你可以使用带有过滤器的 QueryEvents API,其目标是这样的:
"params": [
{
"MoveEventModule": {
"package": "<PACKAGE_ID>",
"module": "<MODULE_NAME>",
"event": "Swap_Event"
}
}
]
但是,请注意,这适用于模块中的所有事件,而不仅仅是Swap_Event
. 要在未指定幻像类型时筛选特定的事件名称,可以使用 GraphQL 查询,例如:
https://sui-<devnet|testnet|mainnet>.mystenlabs.com/
{
events(
filter: {
eventType: "<PACKAGE_ID>::<MODULE_NAME>::Swap_Event"
}
) {
edges {
node {
timestamp
type {
repr
}
data
json
}
}
}
}
这种方法允许更精细的控制.
2
最佳答案
评论
你知道答案吗?
请登录并分享。
Move is an executable bytecode language used to implement custom transactions and smart contracts.
98帖子158答案