Sui.

帖子

分享您的知识。

elfDani.
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
1
2
分享
评论
.

答案

2
McMMoKing.
Feb 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!,
        },
      }),
    },
  );
2
最佳答案
评论
.
kryptoschain.
Feb 17 2025, 15:38

您可以使用诸如或使用 SUI getEvents``getTransactionBlocksSDK 之类的方法按事件或按交易查询任何 SUI 包. 这种方法允许您按参数(如FromAddress``SenderAddress、或)筛选事件MoveFunction.

1
评论
.

你知道答案吗?

请登录并分享。

Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.

610帖子1335答案
Sui.X.Peera.

赚取你的 1000 Sui 份额

获取声誉积分,并因帮助 Sui 社区成长而获得奖励。

奖励活动七月