-
Notifications
You must be signed in to change notification settings - Fork 121
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
docs: clarify interactions of message sending functions and their modes #1634
base: main
Are you sure you want to change the base?
Conversation
Also listed functions with implicit mode, plus made some minor fixes on related pages
|
||
:::note | ||
|
||
To avoid dealing with similar cases and to simplify future [debugging sessions](/book/debug), consider having only one call to one of the [message sending functions](#message-sending-functions) per [receiver function](/book/receive), preferably at the end of the function body. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should suggest a different solution based on nativeReserve
here. @Shvandre can you please help with this part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this specific case (when contract initially has 0 on balance). Such code will work properly
send(SendParameters{
bounce: false,
body: "TEST1".asComment(),
to: sender(), //Actually any address
value: ton("0.5"),
mode: SendDefaultMode,
});
send(SendParameters{
bounce: false,
body: "TEST2".asComment(),
to: myAddress(), //Actually any address
value: 0,
mode: SendRemainingBalance,
});
And nativeReserve
is unnecessary here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@novusnota FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is in bounce: false
and using SendRemainingBalance
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, bounce does not affect anything.
Point is that SendRemainingBalance works correctly, taking previous actions into account,
while SendRemainingValue does not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! super-useful, thanks Andrei
let's add a solution what to do when the balance is not zero
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, and I'll also add info on SendRemainingValue
vs. SendRemainingBalance
to the book/message-mode, under the table in "Base modes" section
Co-authored-by: Anton Trunov <anton@tonstudio.io>
Also listed functions with implicit mode, plus made some minor fixes on related pages
Issue
Closes #1093.
Checklist