How can I send an internal message by link from Surf in DeBot?

I follow this instruction to call smart contracts from DeBot using the message argument in the Surf URI:

https://tonlabs.notion.site/For-developers-f347bd4095f74c9d9e2bd313c666905d

It works ok, but it produces external messages. My guess is that the difference is in headers. How should I modify them to send an internal message using the same scheme?

3 answers

  • answered 2022-01-20 09:39 ilyar

    DeBot cannot send internal message.

    enter image description here

    DeBot have 3 special features:

    1. calling — get-methods of target smart contracts;
    2. calling — external functions of target smart contracts onchain;
    3. invoking — other DeBot in a local environment.

    See DeBot Special Features for more details.

  • answered 2022-01-20 17:18 Norton

    Yes, DeBots themselves cannot do it, so people do the following trick:

    1. Pack debot method arguments into payload: https://github.com/tonlabs/debots/blob/d8111db9eb5d8c42a362a0d34a4dea38f6789eec/accman/AccMan.sol#L257

    2. Run sendTransction with the address of the current DeBot (to) and the address of a wallet (from). The wallet aka smart contract must obviously have sendTransction.

    The external message is received by the wallet, and the multisig sends an internal message to the method in payload.

    1. Once the DeBot receives this internal message, it can tunnel them to other smart contracts.

    The step can be simplified, so that sendTransction is sent directly to the smart contract which requires internal message by providing the correct payload parameters (method name and params).

  • answered 2022-01-23 13:52 laugan

    I think previous answers are indeed "best practice", but still incorrect. Of course, you CAN make internal messages without any additional Msig. DeBot is a smart-contract too. You just have to do the call like this:

    address myDebotAddr = address(this);
    IMyDebot(myDebotAddr).myFunction{...}( ... );
    

    DeBot will call his own contract that lies in blockchain. Then in the function myFunction() you should:

    1. have tvm.accept();
    2. do the internal call that you need

    Thus the execution of myFunction() will happen in blockchain, not locally. Still, you will have to add funds to debot balance. So, it's not a "best practice" for widely used DeBots.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum