admin管理员组

文章数量:1312927

I am having trouble parsing the boc that I get after a sendTransaction is successful. I have tried using the libraries in python as well as js. I reach up to getting some hex codes but I'm unable to figure out how to extract the data from those. I need help in extraction of the information available in the boc like the sender Address, destination address, time, value etc.

Here's the code snippet for reference

let a = new TonWeb.boc.Cell();
a.bits.writeUint(0, 32);
a.bits.writeString("Hello TON!");
let payload = TonWeb.utils.bytesToBase64(await a.toBoc());

// connector is the ton_connect object
console.log(await connector.sendTransaction({
  validUntil: Math.floor(new Date() / 1000) + 360,
  messages: [
    {
      address: connector.wallet.account.address,
      amount: "200000000",
      payload: payload
    }
  ]
}));

This is an example of the object returned from the above code

{
   boc: "te6ccgEBBAEAygABRYgBuHbhGI31Hjax4/d/GRQVrG+62pQM57RVamnpUGSjDJIMAQGadNzyPfpUYS4DajxVtls/EkwJxArNT2ljbFh2931gDxg5MA/b9vMuTS0wyQAh0mx//qhvM4L7T+lCfsKs4rusAimpoxdnnNoVAAAAAwMCAWhiAG4duEYjfUeNrHj938ZFBWsb7ralAzntFVqaelQZKMMkoF9eEAAAAAAAAAAAAAAAAAABAwA2AAAAAFRPTiBDb25uZWN0IDIgdHV0b3JpYWwh"
}

I need help in extracting the data from this

I am having trouble parsing the boc that I get after a sendTransaction is successful. I have tried using the libraries in python as well as js. I reach up to getting some hex codes but I'm unable to figure out how to extract the data from those. I need help in extraction of the information available in the boc like the sender Address, destination address, time, value etc.

Here's the code snippet for reference

let a = new TonWeb.boc.Cell();
a.bits.writeUint(0, 32);
a.bits.writeString("Hello TON!");
let payload = TonWeb.utils.bytesToBase64(await a.toBoc());

// connector is the ton_connect object
console.log(await connector.sendTransaction({
  validUntil: Math.floor(new Date() / 1000) + 360,
  messages: [
    {
      address: connector.wallet.account.address,
      amount: "200000000",
      payload: payload
    }
  ]
}));

This is an example of the object returned from the above code

{
   boc: "te6ccgEBBAEAygABRYgBuHbhGI31Hjax4/d/GRQVrG+62pQM57RVamnpUGSjDJIMAQGadNzyPfpUYS4DajxVtls/EkwJxArNT2ljbFh2931gDxg5MA/b9vMuTS0wyQAh0mx//qhvM4L7T+lCfsKs4rusAimpoxdnnNoVAAAAAwMCAWhiAG4duEYjfUeNrHj938ZFBWsb7ralAzntFVqaelQZKMMkoF9eEAAAAAAAAAAAAAAAAAABAwA2AAAAAFRPTiBDb25uZWN0IDIgdHV0b3JpYWwh"
}

I need help in extracting the data from this

Share Improve this question edited Feb 1 at 11:56 PatPanda 5,06027 gold badges115 silver badges247 bronze badges asked Feb 1 at 5:07 SamSam 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

After extensive research, I found that it is probably not possible to get the info from the boc.

Instead you can use the boc to find the transaction on the ton network.

More details are found on this website

https://docs.ton./v3/guidelines/dapps/cookbook#how-to-find-transaction-for-a-certain-ton-connect-result

本文标签: blockchainHow to parse the BoC returned from the sendTransaction method in Ton ConnectStack Overflow