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

receive(msg: Slice) is not available for users to call #182

Open
anton-trunov opened this issue Dec 20, 2024 · 4 comments
Open

receive(msg: Slice) is not available for users to call #182

anton-trunov opened this issue Dec 20, 2024 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@anton-trunov
Copy link
Member

This contract

import "@stdlib/deploy";

contract MyContract with Deployable {
    receive("foo") { dump("1") }
    receive(msg: String) { dump("2") }
    receive(msg: Slice) { dump("3") }
}

results in the following receivers:

image

Related Tact docs page: https://docs.tact-lang.org/book/receive/#receive-internal-messages

@anton-trunov anton-trunov added the bug Something isn't working label Dec 20, 2024
@anton-trunov anton-trunov added this to the 2024 Q4 milestone Dec 20, 2024
@rahulyadav-57
Copy link
Member

For the Slice type, I am currently receiving message.kind: any. Should I prompt the user to select a cell file as input in this scenario?

Regarding the String type, it currently appears blank, as shown in the attached screenshot. Instead of leaving it empty, we can display "string" or "text" when message.kind = "text" and the text property is not provided.

"message": {
    "kind": "text"
}

@anton-trunov
Copy link
Member Author

Should I prompt the user to select a cell file as input in this scenario?

Or we could ask them to provide a constant slice expression, like emptySlice(), rawSlice("4a_") or slice("te6cckEBAQEADgAAGEhlbGxvIHdvcmxkIXgtxbw="), see https://docs.tact-lang.org/ref/core-comptime.

Tagging @novusnota for more ideas

@novusnota
Copy link
Member

novusnota commented Dec 24, 2024

Agree with @rahulyadav-57 and @anton-trunov. Adding anything extra would not be beneficial to the end-user, who is probably someone advanced and have their own workflow of composing cells/slices/etc., so we just need a simple way to accept those.

Thus, to re-iterate:

  1. In case of String, instead of the current "": the user should probably see String: and then be allowed to type the String with or without the surrounding double-quotes "".

  2. In case of Slice, the user will see Comptime Slice expression: and the hint saying For example, rawSlice("4a_").

To implement the latter, import the parseAndEvalExpression() function from src/interpreter.ts, and only provide the string as the first argument.

@rahulyadav-57
Copy link
Member

Thanks for the inputs. We can go with the approach.

@anton-trunov anton-trunov modified the milestones: 2024 Q4, 2025 Q1 Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants