feat: Add TON Network full support#192
Open
betaxab wants to merge 1 commit into
Open
Conversation
Owner
|
ton.usdt 再缓缓吧 等稳健点 后面等有空我也看看 |
Contributor
Author
|
到时候你看看吧,综合来看 ton center 是最优解了,ton 不像别的链,真的用 RPC 反而代码超级重。 |
fdbd5d0 to
4489e7f
Compare
4489e7f to
c079b96
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
杜叔叔做慈善,把费率下调了6倍,接近于 0,而且速度变得超级超级快,那赶紧把 TON 链支持加上来吧。。
但我准备开始找 RPC 开始搞的时候,找了一圈也没有找到免费的,从 RPC 开始出发的话成本高到离谱,于是换种实现方式:Ton Center。
免费用户也能用,个人收款倒是也还行,实测不填 KEY 收款也没问题,但建议申请 KEY。
KEY 可以填多个,我做了 KEY 自动轮换,出现 429 频率限制自动临时冻结 KEY,换另一个没有被限制的,可能可以绕开 1分钟1个请求的限制。但我这边没有大规模利用的场景,更高的频率没法测。
我没用 TON API,那种感觉适合做收款回调,纯拿来收款,依赖它的 event 结构体可能不够稳健。
TON 链跟其它链不同的是,它底层链和展示给用户的格式不同,比如说 USDT 的合约地址:
它底层是:
0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe
展示给用户的是一个可回退地址:
EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs
如果是不可回退,那么它是:UQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_p0p
两者实际都是一个地址,所以数据库存储底层必须使用标准的链接格式:
以 0: 开头。
但这样需要在前端引用的时候,还需要将其格式化成用户可理解的地址,依赖 FormatTonAddress 方法。
TON 收 USDT 代币使用的是 jetton/transfers,收原生币使用的是 transactions。