Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TON有类似Solidity的emit的事件吗?如果有的话,这事件是怎么实现和订阅? #4

Open
sansx opened this issue Jun 24, 2024 · 1 comment

Comments

@sansx
Copy link
Contributor

sansx commented Jun 24, 2024

> 怎么拿到txid的
> ton异步的 交易了txid还没生成
> 难道循环去查自己的历史交易吗

@sansx
Copy link
Contributor Author

sansx commented Jun 24, 2024

在Solidity里面,emit event在合约中定义的本质是对log数据的序列化,而在使用时是在获取区块或交易时有transaction recipiets里面有专门的logs数据,这部分逻辑是offchain的,而在TON上是没有这个功能的目前,需要自己去做msg解析来实现类似的功能

原生支持这个emit的正确设计思路是从语言设计上加入这个部分,还要在TON节点实现上支持;但从实际开发来说,这个功能属于锦上添花,并不影响你开发dapp

> 那tact emit 是不是就是send msg,然后自己去解析msg body?
不建议,因为在Solidity里emit event是无状态的行为,但TON上每一个send_raw_msg都有side effect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant