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

[Question] How to parse the result of a routerV1 SwapTonToJetton transaction? #38

Open
3ww3-latiao opened this issue Oct 23, 2024 · 1 comment

Comments

@3ww3-latiao
Copy link

Here is my example:

const txParams = await router.getSwapTonToJettonTxParams({
    userWalletAddress: wallet.friendlyAddress,
    proxyTon,
    offerAmount,
    askJettonAddress: not,
    minAskAmount,
});
const res = await wallet.connecter.sendTransaction({
    validUntil: dayjs().add(10, 'm').unix(),
    messages: [
      {
        address: txParams.to.toString(),
        amount: txParams.value.toString(),
        payload: txParams.body?.toBoc().toString('base64'),
      },
    ],
});

I am swapping notcoin through proxyTon and sending the transaction using tonconnect. Everything seems fine, and the transaction is confirmed on the blockchain. However, I am having trouble parsing the BOC. I don't know the details of the response data, but I know that the op is 2281714092.

@pavel-rakhmanov
Copy link
Collaborator

The cell creation is made in the create*Body contracts method.

If, for some reason, you need to parse BOC you can take a look at the createJettonTransferMessage and create*Body functions and just read from the BOC value by values according to the way it was packed.

For reference, you can take a look at this code where we read data about the router from the BOC by knowing the order and type of values, stored in the BOC

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

2 participants