随笔分类 - ton
telegram的合约
摘要:func (t TonApiServiceImpl) TransferToken(ctx context.Context, tokenContractAddr string, toAddr string, amount big.Int) (string, error) { recipientAddr
阅读全文
摘要:js发起交易代码: async function sendTransaction(item, queryId) { // return false; // console.log('sendTransaction', item, address); const { beginCell, toNano
阅读全文
摘要:tact代码: import "@stdlib/deploy"; import "@stdlib/ownable"; struct RoundInfo { orders: map<Int as uint32, BuyInfo>; sum: Int as uint16; arrLength: Int
阅读全文
摘要:package tonapiservice import ( "fmt" "testing" "github.com/tonkeeper/tongo/boc" "github.com/tonkeeper/tongo/tlb" ) func TestHashmapE(t *testing.T) { /
阅读全文
摘要:receive(msg: BatchSyncOrderMsg) { self.requireOwner(); // Ensure the caller is the contract owner let roundInfo: RoundInfo = self.rounds.get(msg.round
阅读全文
摘要:发现一个问题,tact合约如果代码都没有更改的情况下,不论怎么编译,合约地址都是同一个。 然后发现只要初始化的参数不一样就可以简单的生成不同的合约: contract StudyContract with Deployable { msg: String = "123"; // Constructo
阅读全文
摘要:tact合约是这样: import "@stdlib/deploy"; import "@stdlib/ownable"; contract StudyContract with Deployable { msg: String = "123"; // Constructor init(){ sel
阅读全文
摘要:先把正常的记录下来: // Send Msg let maxCellData = generate1023BitHex() console.log("maxCellData:",maxCellData); let msg = beginCell() .storeBuffer(Buffer.from(
阅读全文
摘要:tact中的map结构: struct RoundInfo { // Purchase records quotient: map<Int as uint32, BuyInfo>; // key is sequence number // Order anti-duplication records
阅读全文
摘要:// Send Msg let msg = beginCell() .storeBuffer(Buffer.from("c5341626", "hex")) // 发送结构体 .storeStringRefTail("2") // storeStringTail 会报错不支持? .endCell()
阅读全文
摘要:如果不设置gasfee,ton就不会处理的: // Send Msg let msg = beginCell() .storeBuffer(Buffer.from("c5341626", "hex")) // 发送结构体 .storeStringTail("1") .endCell() let se
阅读全文
摘要:在开发TON合约时,消息的发送格式非常关键。特别是在使用TypeScript与TON合约交互时,我们会遇到这样的代码片段: async send(provider: ContractProvider, via: Sender, args: { value: bigint, bounce?: bool
阅读全文
摘要:txId, err := w.SendV2(context.TODO(), 0, wallet.SimpleTransfer{ Amount: tlb.Grams(amount.Uint64()), Address: tongo.MustParseAccountID(toAddr), Comment
阅读全文
摘要:在智能合约的开发过程中,消息传递和响应机制是非常关键的部分。在 TON(The Open Network) 的智能合约系统中,为了使合约能够与用户进行互动,一般使用 send 或 reply 等函数。它们用于向外发送消息、事件通知,或反馈操作状态等。而在这其中,reply() 则是一个专门用来将信息
阅读全文
摘要:// User purchase msg message BuyMsg { number: Int as uint32; } message BuyEvent { // Purchase address buy: Address; // Order number, unique, used to p
阅读全文
摘要:在 TON (The Open Network) 智能合约开发中,函数是实现合约逻辑的关键组成部分。开发者通常会使用 fun 函数来编写业务逻辑,但当涉及到与外部消息的交互时,就需要用到 receive 开头的特殊函数。那么,receive 函数和 fun 函数有什么区别?为什么不能用 fun 函数
阅读全文
摘要:在 TON(The Open Network)的智能合约开发中,理解不同类型方法的用途和限制对于编写高效的合约至关重要。本文将聚焦于 get 方法,与其他方法的对比,帮助你更好地在合约中使用这些工具。 什么是 get 方法? get 方法是 TON 智能合约中的一种特殊的只读方法,用于读取数据而不改
阅读全文