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

Add an extension function asAddress(self: Slice) to the stdlib #1736

Open
Shvandre opened this issue Feb 7, 2025 · 2 comments
Open

Add an extension function asAddress(self: Slice) to the stdlib #1736

Shvandre opened this issue Feb 7, 2025 · 2 comments
Labels
scope: stdlib The Tact standard library (src/stdlib)

Comments

@Shvandre
Copy link
Contributor

Shvandre commented Feb 7, 2025

Idk, maybe slice should be checked if it is a valid address
Or it may be just "NOP"

@novusnota novusnota changed the title Add "extends fun asAddress(self: Slice)" Add an extension function asAddress(self: Slice) to the stdlib Feb 7, 2025
@novusnota novusnota added the scope: stdlib The Tact standard library (src/stdlib) label Feb 7, 2025
@novusnota
Copy link
Member

Perhaps, we should add two: with and without a check. Like, .asAddress() won't check, but .asValidAddress() (or something) will. That's because we've previously removed lots of Address checks, but having some that user can tap in if they want seems beneficial to me.

Ideas of names for the latter:

  • .asAddressCheck()
  • .asAddressAssert() (akin to !! in name and spirit) — or even .assertAddress()
  • .asAddressSafe()

@Shvandre
Copy link
Contributor Author

Shvandre commented Feb 7, 2025

Great idea!
Maybe it's better to make .asAddress safe version, and .asAddressUnsafe - without any checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: stdlib The Tact standard library (src/stdlib)
Projects
None yet
Development

No branches or pull requests

2 participants