Skip to content

string-to-buff #4

Description

@Rapha-btc

there is no such thing in clarity string-to-buff

You can use to-consensus-buff?
And then remove the type and length bytes at the beginning

(define-read-only (ascii-to-buff (in (string-ascii 100)))
(default-to 0x (match (to-consensus-buff? in) buff (slice? buff u5 (len buff)) none))
)

https://github.com/Rapha-btc/Smart-Wallet/blob/4228dff5512e9d35b5c739b6f1ad7f65649fb226/contracts/passkey-smart-wallet.clar

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions