我需要通过 boc(Bag of Cells)在 TON 区块链中查找交易的帮助。
文档https://docs.ton.org/develop/dapps/ton-connect/transactions说这是可能的,但找不到如何做到这一点的方法。
我可以在java中解析boc,但这对我没有帮助我无法通过boc的哈希值找到交易或消息
Cell.fromBocBase64("te6cckEBAwEA4QAC44gBZUPZ6qi8Dtmm1cot1P175lXUARlUVwlfMM19lkERK1oCUB3RqDxAFnPpeo191X/jiimn9Bwnq3zwcU/MMjHRNN5sC5tyymBV3SJ1rjyyscAjrDDFAIV/iE+WBySEPP9wCU1NGLsfcvVgAAACSAAYHAECAGhCAFlQ9nqqLwO2abVyi3U/XvmVdQBGVRXCV8wzX2WQRErWoAmJaAAAAAAAAAAAAAAAAAAAAGZCAFlQ9nqqLwO2abVyi3U/XvmVdQBGVRXCV8wzX2WQRErWnMS0AAAAAAAAAAAAAAAAAAADkk4U")
谢谢
import TonWeb from "tonweb";
const msg = {
boc: "te6cckEBAwEA4QAC44gBZUPZ6qi8Dtmm1cot1P175lXUARlUVwlfMM19lkERK1oCUB3RqDxAFnPpeo191X/jiimn9Bwnq3zwcU/MMjHRNN5sC5tyymBV3SJ1rjyyscAjrDDFAIV/iE+WBySEPP9wCU1NGLsfcvVgAAACSAAYHAECAGhCAFlQ9nqqLwO2abVyi3U/XvmVdQBGVRXCV8wzX2WQRErWoAmJaAAAAAAAAAAAAAAAAAAAAGZCAFlQ9nqqLwO2abVyi3U/XvmVdQBGVRXCV8wzX2WQRErWnMS0AAAAAAAAAAAAAAAAAAADkk4U"
};
const msgBody = TonWeb.utils.base64ToBytes(msg.boc);
const cell:any = TonWeb.boc.Cell.oneFromBoc(msgBody);
const slice =cell.beginParse();
// Start parsing with something like const op = slice.loadUint(32);
if (!op.eq(new TonWeb.utils.BN(0x7362d09c))) continue; // op == transfer_notification
您可以使用 Tonscan 检查 Jetton 的操作码,例如对于 usdt,https://tonscan.org/address/EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs#source ,检查 op-codes.fc,您将看到以下内容
;; common
const op::transfer = 0xf8a7ea5;
const op::transfer_notification = 0x7362d09c;
const op::internal_transfer = 0x178d4519;
const op::excesses = 0xd53276db;
const op::burn = 0x595f07bc;
const op::burn_notification = 0x7bdd97de;
const op::provide_wallet_address = 0x2c76b973;
const op::take_wallet_address = 0xd1735400;
const op::top_up = 0xd372158c;
const error::invalid_op = 72;
const error::wrong_op = 0xffff;
const error::not_owner = 73;
const error::not_valid_wallet = 74;
const error::wrong_workchain = 333;
;; jetton-minter
const op::mint = 0x642b7d07;
const op::change_admin = 0x6501f354;
const op::claim_admin = 0xfb88e119;
const op::upgrade = 0x2508d66a;
const op::call_to = 0x235caf52;
const op::change_metadata_uri = 0xcb862902;
;; jetton-wallet
const op::set_status = 0xeed236d3;
const error::contract_locked = 45;
const error::balance_error = 47;
const error::not_enough_gas = 48;
const error::invalid_message = 49;
不是专家,只是分享一些对我有用的东西