如何通过FA Store获取Aptos测试网的存提币事件?
如何通过FA Store追踪Aptos原生Coin的存提事件
核心差异说明
Aptos 1.29版本发布后,新账户的原生Aptos Coin余额存储从Object Store切换至FA(Flexible Asset)Store,事件的存储与查询路径也同步变更:
- Object Store的存提事件绑定到账户的
0x1::coin::CoinStore对象 - FA Store的存提事件则绑定到账户的
0x1::flexible_asset::Store<0x1::aptos_coin::AptosCoin>资源
具体查询步骤
1. 获取FA Store资源的事件标识
先通过账户地址查询对应的FA Store资源,调用API:
GET /v1/accounts/{account_address}/resources/0x1::flexible_asset::Store<0x1::aptos_coin::AptosCoin>
返回结果中,deposit_events和withdraw_events字段下的guid.creation_number是查询事件流的关键参数。
2. 查询存款/取款事件
使用上一步获取的creation_number,结合账户地址调用事件查询API:
- 存款事件查询:
GET /v1/accounts/{account_address}/events/0x1::flexible_asset::Store<0x1::aptos_coin::AptosCoin>/deposit_events?start={start_version}&limit={limit}
- 取款事件查询:
GET /v1/accounts/{account_address}/events/0x1::flexible_asset::Store<0x1::aptos_coin::AptosCoin>/withdraw_events?start={start_version}&limit={limit}
3. 常见失败原因排查
- 若返回404:
- 确认目标账户是1.29版本发布后创建的新账户(老账户仍沿用Object Store)
- 检查资源路径拼写,确保泛型参数
0x1::aptos_coin::AptosCoin格式正确 - 验证测试网节点已同步至1.29版本,可通过
GET /v1接口查询节点版本
- 若事件为空:
- 确认目标交易确实触发了存提动作(比如转账到账属于存款事件,需确保交易已完成上链)
示例事件结构
存款事件的典型响应格式:
{ "key": "0x1::flexible_asset::Store<0x1::aptos_coin::AptosCoin>::deposit_events", "sequence_number": "1", "type": "0x1::flexible_asset::DepositEvent", "data": { "amount": "100000000", "from": "0xabc..." } }
内容的提问来源于stack exchange,提问作者DimaA6_ABC
相关产品推荐
相关产品推荐

