帖子
分享您的知识。
elfDani227
Feb 17, 2025
专家问答
How to monitor Sui transactions in a wallet app?
I'm adding Sui support to an existing wallet app and need to track blockchain transactions for wallet accounts to detect deposits and update balances. Is there a straightforward method to achieve this without implementing a complex indexer? Is there an event I can monitor using the Sui SDK?
- Sui
- Architecture
0
2
分享
评论
答案
2Feb 17 2025, 15:38
您可以根据您的特定要求重新获取查询. 例如,使用时useSuiClientQuery
,您可以查询交易区块,同时根据特定条件(例如账户地址或特定模块函数)进行筛选:
const { data, isPending, error, refetch, isFetched } = useSuiClientQuery(
"queryTransactionBlocks",
{
order: "descending",
options: QUERY_OPTIONS,
filter: QUERY_FILTER({
FromAddress: account?.address || "",
MoveFunction: {
function: "your_package_function",
module: "your_module",
package: process.env.NEXT_PUBLIC_PACKAGE_ID!,
},
}),
},
);
1
评论
Feb 17 2025, 15:38
您可以使用诸如或使用 SUI getEvents``getTransactionBlocks
SDK 之类的方法按事件或按交易查询任何 SUI 包. 这种方法允许您按参数(如FromAddress``SenderAddress
、或)筛选事件MoveFunction
.
0
评论
你知道答案吗?
请登录并分享。
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.
109帖子177答案