Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 source pure

Package meta validates launch metadata and addresses, and encodes text safely for JSON and Markdown.

Overview

Package meta validates launch metadata and addresses, and encodes text safely for JSON and Markdown.

Variables 1

var ErrName, ErrTicker, ErrDescription, ErrImage, ErrWebsite, ErrHandle

1var (
2	ErrName        = errors.New("launchpad/meta: name must be 1-32 bytes of printable text without markup characters")
3	ErrTicker      = errors.New("launchpad/meta: ticker must be 1-10 characters A-Z or 0-9")
4	ErrDescription = errors.New("launchpad/meta: description must be at most 280 bytes of printable text without markup characters")
5	ErrImage       = errors.New("launchpad/meta: image must be an ipfs:// or https:// URI of at most 200 bytes")
6	ErrWebsite     = errors.New("launchpad/meta: website must be an https:// URL of at most 200 bytes")
7	ErrHandle      = errors.New("launchpad/meta: handle must be 1-32 characters A-Z, a-z, 0-9 or _")
8)
source

Functions 9

func EscapeMarkdown

1func EscapeMarkdown(s string) string
source

EscapeMarkdown backslash-escapes every Markdown control character.

func JSONString

1func JSONString(s string) string
source

JSONString quotes s as a JSON string. Control bytes become \u00XX so the value survives the frontend's qeval double decode.

func ValidAddress

1func ValidAddress(a address) bool
source

ValidAddress reports whether a is an account or realm address written the one way the chain gives it to a caller: "g1", then 38 lowercase bech32 characters whose checksum is the original bech32 one. It reads the text itself: decoding and re-encoding it costs far more gas.

Imports 4

  • errors stdlib
  • strings stdlib
  • unicode stdlib
  • unicode/utf8 stdlib

Source Files 2