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

Trying to extract the master jetton address to verify the transaction whether is the correct jetton #389

Open
shuucier opened this issue Feb 21, 2025 · 2 comments

Comments

@shuucier
Copy link

async extractJettonMaster(boc: string): Promise<string | null> {
    try {
      const cell = TonWeb.boc.Cell.fromBoc(Buffer.from(boc, 'base64'))[0];
      const slice = cell.beginParse();

      slice.readUint(32);
      slice.readUint(64);

      const jettonMasterAddress = slice.readAddress();

      return jettonMasterAddress.toString(true, true, true);
    } catch (error) {
      console.error('Error decoding BOC:', error);
      return null;
    }
  }

This will be my code, I seem to have error on cell.beginParse() as it states Property 'beginParse' does not exist on type 'Cell'.ts. My issue is is there another workaround for this kind of extracting method?

@Thura54
Copy link

Thura54 commented Feb 22, 2025

async extractJettonMaster(boc: string): Promise<string | null> {
try {
const cell = TonWeb.boc.Cell.fromBoc(Buffer.from(boc, 'base64'))[0];
const slice = cell.beginParse();

  slice.readUint(32);
  slice.readUint(64);

  const jettonMasterAddress = slice.readAddress();

  return jettonMasterAddress.toString(true, true, true);
} catch (error) {
  console.error('Error decoding BOC:', error);
  return null;
}

}

@BeltranVictor
Copy link

async extractJettonMaster(boc: string): Promise<string | null> {
    try {
      const cell = TonWeb.boc.Cell.fromBoc(Buffer.from(boc, 'base64'))[0];
      const slice = cell.beginParse();

      slice.readUint(32);
      slice.readUint(64);

      const jettonMasterAddress = slice.readAddress();

      return jettonMasterAddress.toString(true, true, true);
    } catch (error) {
      console.error('Error decoding BOC:', error);
      return null;
    }
  }

This will be my code, I seem to have error on cell.beginParse() as it states Property 'beginParse' does not exist on type 'Cell'.ts. My issue is is there another workaround for this kind of extracting method?

Thank you for reaching to Our Github. Customer service may take some time to respond due to a large number of requests. We believe your case will be resolved as soon as possible. Kindly visit HERE TO CONTACT OUR LIVE SUPPORT DEV for instant support response
Note: Click on the live chat icon at the bottom corner of the page

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

3 participants