Documentation
¶
Index ¶
- Constants
- Variables
- func CreateTxMgrByKeyFile(privateKey *ecdsa.PrivateKey, rpcClient eth.Client, chainID *big.Int, ...) (txmgr.TxManager, error)
- func DecodeJSONFromFile(filepath string, data any) error
- func LogSubError(lg log.Logger, err error)
- func TypedErr(e interface{}) error
- func WrapError(mainErr interface{}, subErr interface{}) error
- func WriteJSONToFile(filepath string, data any) error
Constants ¶
View Source
const ( PngMimeType = "image/png" TextRegex = `^[a-zA-Z0-9 +.,;:?!'’"\-_/()\[\]~&#$—%]+$` )
Variables ¶
View Source
var ( ErrInvalidURL = errors.New("invalid url") ErrInvalidGithubRawURL = errors.New("invalid github raw url") ErrInvalidText = fmt.Errorf("invalid text format, doesn't conform to regex %s", TextRegex) ErrTextTooLong = errors.New("text should be less than 500 characters") ErrEmptyText = errors.New("text is empty") ErrInvalidImageExtension = errors.New( "invalid image extension. only " + strings.Join(ImageExtensions, ",") + " is supported", ) ErrInvalidImageMimeType = errors.New("invalid image mime-type. only png is supported") ErrInvalidURLLength = errors.New("url length should be no larger than 1024 character") ErrURLPointingToLocalServer = errors.New("url should not point to local server") ErrEmptyURL = errors.New("url is empty") ErrInvalidTwitterURLRegex = errors.New( "invalid twitter url, it should be of the format https://twitter.com/<username> or https://x.com/<username>", ) ErrResponseTooLarge = errors.New("response too large, allowed size is 1 MB") )
View Source
var ( // ImageExtensions List of common image file extensions // Only support PNG for now to reduce surface area of image validation // We do NOT want to support formats like SVG since they can be used for javascript injection // If we get pushback on only supporting png, we can support jpg, jpeg, gif, etc. later ImageExtensions = []string{".png"} )
Functions ¶
func CreateTxMgrByKeyFile ¶
func DecodeJSONFromFile ¶
func LogSubError ¶
func WriteJSONToFile ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.